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_BASE_EVENTS_EVENT_H_ | 5 #ifndef UI_BASE_EVENTS_EVENT_H_ |
6 #define UI_BASE_EVENTS_EVENT_H_ | 6 #define UI_BASE_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" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 } | 154 } |
155 | 155 |
156 bool IsFlingScrollEvent() const { | 156 bool IsFlingScrollEvent() const { |
157 return type_ == ET_SCROLL_FLING_CANCEL || | 157 return type_ == ET_SCROLL_FLING_CANCEL || |
158 type_ == ET_SCROLL_FLING_START; | 158 type_ == ET_SCROLL_FLING_START; |
159 } | 159 } |
160 | 160 |
161 // Returns true if the event has a valid |native_event_|. | 161 // Returns true if the event has a valid |native_event_|. |
162 bool HasNativeEvent() const; | 162 bool HasNativeEvent() const; |
163 | 163 |
| 164 // Immediately stops the propagation of the event. This must be called only |
| 165 // from an EventHandler during an event-dispatch. Any event handler that may |
| 166 // be in the list will not receive the event after this is called. |
| 167 void StopPropagation(); |
| 168 bool stopped_propagation() const { return !!(result_ & ui::ER_CONSUMED); } |
| 169 |
| 170 void SetHandled(); |
| 171 bool handled() const { return result_ != ui::ER_UNHANDLED; } |
| 172 |
164 protected: | 173 protected: |
165 Event(EventType type, base::TimeDelta time_stamp, int flags); | 174 Event(EventType type, base::TimeDelta time_stamp, int flags); |
166 Event(const base::NativeEvent& native_event, EventType type, int flags); | 175 Event(const base::NativeEvent& native_event, EventType type, int flags); |
167 Event(const Event& copy); | 176 Event(const Event& copy); |
168 void set_type(EventType type) { type_ = type; } | 177 void set_type(EventType type) { type_ = type; } |
169 void set_delete_native_event(bool delete_native_event) { | 178 void set_delete_native_event(bool delete_native_event) { |
170 delete_native_event_ = delete_native_event; | 179 delete_native_event_ = delete_native_event; |
171 } | 180 } |
172 void set_time_stamp(base::TimeDelta time_stamp) { time_stamp_ = time_stamp; } | 181 void set_time_stamp(base::TimeDelta time_stamp) { time_stamp_ = time_stamp; } |
173 | 182 |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 // This value is stored as a bitfield because the number of touch ids varies, | 656 // This value is stored as a bitfield because the number of touch ids varies, |
648 // but we currently don't need more than 32 touches at a time. | 657 // but we currently don't need more than 32 touches at a time. |
649 const unsigned int touch_ids_bitfield_; | 658 const unsigned int touch_ids_bitfield_; |
650 | 659 |
651 DISALLOW_COPY_AND_ASSIGN(GestureEvent); | 660 DISALLOW_COPY_AND_ASSIGN(GestureEvent); |
652 }; | 661 }; |
653 | 662 |
654 } // namespace ui | 663 } // namespace ui |
655 | 664 |
656 #endif // UI_BASE_EVENTS_EVENT_H_ | 665 #endif // UI_BASE_EVENTS_EVENT_H_ |
OLD | NEW |