Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: views/events/event.h

Issue 8364039: Initial views touchui GestureRecognizer support (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Added switch support in place of map::find() Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef VIEWS_EVENTS_EVENT_H_ 5 #ifndef VIEWS_EVENTS_EVENT_H_
6 #define VIEWS_EVENTS_EVENT_H_ 6 #define VIEWS_EVENTS_EVENT_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 // 56 //
57 //////////////////////////////////////////////////////////////////////////////// 57 ////////////////////////////////////////////////////////////////////////////////
58 class VIEWS_EXPORT Event { 58 class VIEWS_EXPORT Event {
59 public: 59 public:
60 const NativeEvent& native_event() const { return native_event_; } 60 const NativeEvent& native_event() const { return native_event_; }
61 #if defined(TOOLKIT_USES_GTK) 61 #if defined(TOOLKIT_USES_GTK)
62 GdkEvent* gdk_event() const { return gdk_event_; } 62 GdkEvent* gdk_event() const { return gdk_event_; }
63 #endif 63 #endif
64 ui::EventType type() const { return type_; } 64 ui::EventType type() const { return type_; }
65 const base::Time& time_stamp() const { return time_stamp_; } 65 const base::Time& time_stamp() const { return time_stamp_; }
66
67 // Required for Gesture testing purpose.
68 void set_time_stamp(base::Time time_stamp) { time_stamp_ = time_stamp; }
69
66 int flags() const { return flags_; } 70 int flags() const { return flags_; }
67 void set_flags(int flags) { flags_ = flags; } 71 void set_flags(int flags) { flags_ = flags; }
68 72
69 // The following methods return true if the respective keys were pressed at 73 // The following methods return true if the respective keys were pressed at
70 // the time the event was created. 74 // the time the event was created.
71 bool IsShiftDown() const { return (flags_ & ui::EF_SHIFT_DOWN) != 0; } 75 bool IsShiftDown() const { return (flags_ & ui::EF_SHIFT_DOWN) != 0; }
72 bool IsControlDown() const { return (flags_ & ui::EF_CONTROL_DOWN) != 0; } 76 bool IsControlDown() const { return (flags_ & ui::EF_CONTROL_DOWN) != 0; }
73 bool IsCapsLockDown() const { return (flags_ & ui::EF_CAPS_LOCK_DOWN) != 0; } 77 bool IsCapsLockDown() const { return (flags_ & ui::EF_CAPS_LOCK_DOWN) != 0; }
74 bool IsAltDown() const { return (flags_ & ui::EF_ALT_DOWN) != 0; } 78 bool IsAltDown() const { return (flags_ & ui::EF_ALT_DOWN) != 0; }
75 79
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 private: 431 private:
428 // Data associated with the drag/drop session. 432 // Data associated with the drag/drop session.
429 const ui::OSExchangeData& data_; 433 const ui::OSExchangeData& data_;
430 434
431 // Bitmask of supported ui::DragDropTypes::DragOperation by the source. 435 // Bitmask of supported ui::DragDropTypes::DragOperation by the source.
432 int source_operations_; 436 int source_operations_;
433 437
434 DISALLOW_COPY_AND_ASSIGN(DropTargetEvent); 438 DISALLOW_COPY_AND_ASSIGN(DropTargetEvent);
435 }; 439 };
436 440
441 ////////////////////////////////////////////////////////////////////////////////
442 // GestureEvent class
443 //
444 ////////////////////////////////////////////////////////////////////////////////
445 class VIEWS_EXPORT GestureEvent : public LocatedEvent {
446 public:
447 GestureEvent(ui::EventType type,
448 int x,
449 int y,
450 int flags,
451 base::Time time_stamp,
452 float delta_x,
453 float delta_y);
454
455 // Create a new GestureEvent which is identical to the provided model.
456 // If source / target views are provided, the model location will be converted
457 // from |source| coordinate system to |target| coordinate system.
458 GestureEvent(const GestureEvent& model, View* source, View* target);
459
460 float delta_x() const { return delta_x_; }
461 float delta_y() const { return delta_y_; }
462
463 private:
464 friend class internal::RootView;
465
466 GestureEvent(const GestureEvent& model, View* root);
467
468 float delta_x_;
469 float delta_y_;
470
471 DISALLOW_COPY_AND_ASSIGN(GestureEvent);
472 };
473
437 } // namespace views 474 } // namespace views
438 475
439 #endif // VIEWS_EVENTS_EVENT_H_ 476 #endif // VIEWS_EVENTS_EVENT_H_
OLDNEW
« no previous file with comments | « ui/base/events.h ('k') | views/events/event.cc » ('j') | views/touchui/gesture_recognizer.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698