| 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 UI_VIEWS_EVENTS_EVENT_H_ | 5 #ifndef UI_VIEWS_EVENTS_EVENT_H_ |
| 6 #define UI_VIEWS_EVENTS_EVENT_H_ | 6 #define UI_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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // | 55 // |
| 56 //////////////////////////////////////////////////////////////////////////////// | 56 //////////////////////////////////////////////////////////////////////////////// |
| 57 class VIEWS_EXPORT Event { | 57 class VIEWS_EXPORT Event { |
| 58 public: | 58 public: |
| 59 const NativeEvent& native_event() const { return native_event_; } | 59 const NativeEvent& native_event() const { return native_event_; } |
| 60 #if defined(TOOLKIT_USES_GTK) | 60 #if defined(TOOLKIT_USES_GTK) |
| 61 GdkEvent* gdk_event() const { return gdk_event_; } | 61 GdkEvent* gdk_event() const { return gdk_event_; } |
| 62 #endif | 62 #endif |
| 63 ui::EventType type() const { return type_; } | 63 ui::EventType type() const { return type_; } |
| 64 const base::Time& time_stamp() const { return time_stamp_; } | 64 const base::Time& time_stamp() const { return time_stamp_; } |
| 65 |
| 66 // Required for Gesture testing purposes. |
| 67 void set_time_stamp(base::Time time_stamp) { time_stamp_ = time_stamp; } |
| 68 |
| 65 int flags() const { return flags_; } | 69 int flags() const { return flags_; } |
| 66 void set_flags(int flags) { flags_ = flags; } | 70 void set_flags(int flags) { flags_ = flags; } |
| 67 | 71 |
| 68 // The following methods return true if the respective keys were pressed at | 72 // The following methods return true if the respective keys were pressed at |
| 69 // the time the event was created. | 73 // the time the event was created. |
| 70 bool IsShiftDown() const { return (flags_ & ui::EF_SHIFT_DOWN) != 0; } | 74 bool IsShiftDown() const { return (flags_ & ui::EF_SHIFT_DOWN) != 0; } |
| 71 bool IsControlDown() const { return (flags_ & ui::EF_CONTROL_DOWN) != 0; } | 75 bool IsControlDown() const { return (flags_ & ui::EF_CONTROL_DOWN) != 0; } |
| 72 bool IsCapsLockDown() const { return (flags_ & ui::EF_CAPS_LOCK_DOWN) != 0; } | 76 bool IsCapsLockDown() const { return (flags_ & ui::EF_CAPS_LOCK_DOWN) != 0; } |
| 73 bool IsAltDown() const { return (flags_ & ui::EF_ALT_DOWN) != 0; } | 77 bool IsAltDown() const { return (flags_ & ui::EF_ALT_DOWN) != 0; } |
| 74 | 78 |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 float x_offset() const { return x_offset_; } | 416 float x_offset() const { return x_offset_; } |
| 413 float y_offset() const { return y_offset_; } | 417 float y_offset() const { return y_offset_; } |
| 414 | 418 |
| 415 private: | 419 private: |
| 416 float x_offset_; | 420 float x_offset_; |
| 417 float y_offset_; | 421 float y_offset_; |
| 418 | 422 |
| 419 DISALLOW_COPY_AND_ASSIGN(ScrollEvent); | 423 DISALLOW_COPY_AND_ASSIGN(ScrollEvent); |
| 420 }; | 424 }; |
| 421 | 425 |
| 426 //////////////////////////////////////////////////////////////////////////////// |
| 427 // GestureEvent class |
| 428 // |
| 429 //////////////////////////////////////////////////////////////////////////////// |
| 430 class VIEWS_EXPORT GestureEvent : public LocatedEvent { |
| 431 public: |
| 432 GestureEvent(ui::EventType type, |
| 433 int x, |
| 434 int y, |
| 435 int flags, |
| 436 base::Time time_stamp, |
| 437 float delta_x, |
| 438 float delta_y); |
| 439 |
| 440 // Create a new GestureEvent which is identical to the provided model. |
| 441 // If source / target views are provided, the model location will be converted |
| 442 // from |source| coordinate system to |target| coordinate system. |
| 443 GestureEvent(const GestureEvent& model, View* source, View* target); |
| 444 |
| 445 float delta_x() const { return delta_x_; } |
| 446 float delta_y() const { return delta_y_; } |
| 447 |
| 448 private: |
| 449 friend class internal::RootView; |
| 450 |
| 451 GestureEvent(const GestureEvent& model, View* root); |
| 452 |
| 453 float delta_x_; |
| 454 float delta_y_; |
| 455 |
| 456 DISALLOW_COPY_AND_ASSIGN(GestureEvent); |
| 457 }; |
| 458 |
| 422 } // namespace views | 459 } // namespace views |
| 423 | 460 |
| 424 #endif // UI_VIEWS_EVENTS_EVENT_H_ | 461 #endif // UI_VIEWS_EVENTS_EVENT_H_ |
| OLD | NEW |