OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_EVENTS_EVENT_H_ | 5 #ifndef UI_EVENTS_EVENT_H_ |
6 #define UI_EVENTS_EVENT_H_ | 6 #define UI_EVENTS_EVENT_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/event_types.h" | 10 #include "base/event_types.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "ui/events/event_constants.h" | 13 #include "ui/events/event_constants.h" |
14 #include "ui/events/gesture_event_details.h" | 14 #include "ui/events/gesture_event_details.h" |
15 #include "ui/events/gestures/gesture_types.h" | 15 #include "ui/events/gestures/gesture_types.h" |
16 #include "ui/events/keycodes/keyboard_codes.h" | 16 #include "ui/events/keycodes/keyboard_codes.h" |
17 #include "ui/events/latency_info.h" | 17 #include "ui/events/latency_info.h" |
18 #include "ui/gfx/native_widget_types.h" | |
18 #include "ui/gfx/point.h" | 19 #include "ui/gfx/point.h" |
19 #include "ui/gfx/point_conversions.h" | 20 #include "ui/gfx/point_conversions.h" |
20 | 21 |
21 namespace gfx { | 22 namespace gfx { |
22 class Transform; | 23 class Transform; |
23 } | 24 } |
24 | 25 |
25 namespace ui { | 26 namespace ui { |
26 class EventTarget; | 27 class EventTarget; |
27 | 28 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 LatencyInfo* latency() { return &latency_; } | 68 LatencyInfo* latency() { return &latency_; } |
68 const LatencyInfo* latency() const { return &latency_; } | 69 const LatencyInfo* latency() const { return &latency_; } |
69 void set_latency(const LatencyInfo& latency) { latency_ = latency; } | 70 void set_latency(const LatencyInfo& latency) { latency_ = latency; } |
70 | 71 |
71 // By default, events are "cancelable", this means any default processing that | 72 // By default, events are "cancelable", this means any default processing that |
72 // the containing abstraction layer may perform can be prevented by calling | 73 // the containing abstraction layer may perform can be prevented by calling |
73 // SetHandled(). SetHandled() or StopPropagation() must not be called for | 74 // SetHandled(). SetHandled() or StopPropagation() must not be called for |
74 // events that are not cancelable. | 75 // events that are not cancelable. |
75 bool cancelable() const { return cancelable_; } | 76 bool cancelable() const { return cancelable_; } |
76 | 77 |
78 #if defined(USE_OZONE) | |
79 gfx::AcceleratedWidget window() const { return window_; } | |
dnicoara
2014/05/05 17:37:19
I'm also wondering if this could be moved into one
| |
80 void set_window(gfx::AcceleratedWidget w) { window_ = w; } | |
81 #endif | |
82 | |
77 // The following methods return true if the respective keys were pressed at | 83 // The following methods return true if the respective keys were pressed at |
78 // the time the event was created. | 84 // the time the event was created. |
79 bool IsShiftDown() const { return (flags_ & EF_SHIFT_DOWN) != 0; } | 85 bool IsShiftDown() const { return (flags_ & EF_SHIFT_DOWN) != 0; } |
80 bool IsControlDown() const { return (flags_ & EF_CONTROL_DOWN) != 0; } | 86 bool IsControlDown() const { return (flags_ & EF_CONTROL_DOWN) != 0; } |
81 bool IsCapsLockDown() const { return (flags_ & EF_CAPS_LOCK_DOWN) != 0; } | 87 bool IsCapsLockDown() const { return (flags_ & EF_CAPS_LOCK_DOWN) != 0; } |
82 bool IsAltDown() const { return (flags_ & EF_ALT_DOWN) != 0; } | 88 bool IsAltDown() const { return (flags_ & EF_ALT_DOWN) != 0; } |
83 bool IsAltGrDown() const { return (flags_ & EF_ALTGR_DOWN) != 0; } | 89 bool IsAltGrDown() const { return (flags_ & EF_ALTGR_DOWN) != 0; } |
84 | 90 |
85 bool IsKeyEvent() const { | 91 bool IsKeyEvent() const { |
86 return type_ == ET_KEY_PRESSED || | 92 return type_ == ET_KEY_PRESSED || |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
222 std::string name_; | 228 std::string name_; |
223 base::TimeDelta time_stamp_; | 229 base::TimeDelta time_stamp_; |
224 LatencyInfo latency_; | 230 LatencyInfo latency_; |
225 int flags_; | 231 int flags_; |
226 base::NativeEvent native_event_; | 232 base::NativeEvent native_event_; |
227 bool delete_native_event_; | 233 bool delete_native_event_; |
228 bool cancelable_; | 234 bool cancelable_; |
229 EventTarget* target_; | 235 EventTarget* target_; |
230 EventPhase phase_; | 236 EventPhase phase_; |
231 EventResult result_; | 237 EventResult result_; |
238 #if defined(USE_OZONE) | |
239 gfx::AcceleratedWidget window_; | |
240 #endif | |
232 }; | 241 }; |
233 | 242 |
234 class EVENTS_EXPORT CancelModeEvent : public Event { | 243 class EVENTS_EXPORT CancelModeEvent : public Event { |
235 public: | 244 public: |
236 CancelModeEvent(); | 245 CancelModeEvent(); |
237 virtual ~CancelModeEvent(); | 246 virtual ~CancelModeEvent(); |
238 }; | 247 }; |
239 | 248 |
240 class EVENTS_EXPORT LocatedEvent : public Event { | 249 class EVENTS_EXPORT LocatedEvent : public Event { |
241 public: | 250 public: |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
687 // The set of indices of ones in the binary representation of | 696 // The set of indices of ones in the binary representation of |
688 // touch_ids_bitfield_ is the set of touch_ids associate with this gesture. | 697 // touch_ids_bitfield_ is the set of touch_ids associate with this gesture. |
689 // This value is stored as a bitfield because the number of touch ids varies, | 698 // This value is stored as a bitfield because the number of touch ids varies, |
690 // but we currently don't need more than 32 touches at a time. | 699 // but we currently don't need more than 32 touches at a time. |
691 const unsigned int touch_ids_bitfield_; | 700 const unsigned int touch_ids_bitfield_; |
692 }; | 701 }; |
693 | 702 |
694 } // namespace ui | 703 } // namespace ui |
695 | 704 |
696 #endif // UI_EVENTS_EVENT_H_ | 705 #endif // UI_EVENTS_EVENT_H_ |
OLD | NEW |