Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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, int x, int y, int flags, | |
|
sky
2011/11/15 16:54:44
When you wrap, each param goes on its own line.
Gajen
2011/11/16 15:08:41
Done.
| |
| 448 base::Time time_stamp, float delta_x, float delta_y); | |
| 449 | |
| 450 // Create a new GestureEvent which is identical to the provided model. | |
| 451 // If source / target views are provided, the model location will be converted | |
| 452 // from |source| coordinate system to |target| coordinate system. | |
| 453 GestureEvent(const GestureEvent& model, View* source, View* target); | |
| 454 | |
| 455 float delta_x() const { return delta_x_; } | |
| 456 float delta_y() const { return delta_y_; } | |
| 457 | |
| 458 private: | |
| 459 friend class internal::RootView; | |
| 460 | |
| 461 GestureEvent(const GestureEvent& model, View* root); | |
| 462 | |
| 463 float delta_x_; | |
| 464 float delta_y_; | |
| 465 | |
| 466 DISALLOW_COPY_AND_ASSIGN(GestureEvent); | |
| 467 }; | |
| 468 | |
| 437 } // namespace views | 469 } // namespace views |
| 438 | 470 |
| 439 #endif // VIEWS_EVENTS_EVENT_H_ | 471 #endif // VIEWS_EVENTS_EVENT_H_ |
| OLD | NEW |