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" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 | 180 |
181 bool IsFlingScrollEvent() const { | 181 bool IsFlingScrollEvent() const { |
182 return type_ == ET_SCROLL_FLING_CANCEL || | 182 return type_ == ET_SCROLL_FLING_CANCEL || |
183 type_ == ET_SCROLL_FLING_START; | 183 type_ == ET_SCROLL_FLING_START; |
184 } | 184 } |
185 | 185 |
186 bool IsMouseWheelEvent() const { | 186 bool IsMouseWheelEvent() const { |
187 return type_ == ET_MOUSEWHEEL; | 187 return type_ == ET_MOUSEWHEEL; |
188 } | 188 } |
189 | 189 |
| 190 bool IsLocatedEvent() const { |
| 191 return IsMouseEvent() || IsScrollEvent() || IsTouchEvent() || |
| 192 IsGestureEvent(); |
| 193 } |
| 194 |
190 // Convenience methods to cast |this| to a GestureEvent. IsGestureEvent() | 195 // Convenience methods to cast |this| to a GestureEvent. IsGestureEvent() |
191 // must be true as a precondition to calling these methods. | 196 // must be true as a precondition to calling these methods. |
192 GestureEvent* AsGestureEvent(); | 197 GestureEvent* AsGestureEvent(); |
193 const GestureEvent* AsGestureEvent() const; | 198 const GestureEvent* AsGestureEvent() const; |
194 | 199 |
195 // Returns true if the event has a valid |native_event_|. | 200 // Returns true if the event has a valid |native_event_|. |
196 bool HasNativeEvent() const; | 201 bool HasNativeEvent() const; |
197 | 202 |
198 // Immediately stops the propagation of the event. This must be called only | 203 // Immediately stops the propagation of the event. This must be called only |
199 // from an EventHandler during an event-dispatch. Any event handler that may | 204 // from an EventHandler during an event-dispatch. Any event handler that may |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 | 775 |
771 const GestureEventDetails& details() const { return details_; } | 776 const GestureEventDetails& details() const { return details_; } |
772 | 777 |
773 private: | 778 private: |
774 GestureEventDetails details_; | 779 GestureEventDetails details_; |
775 }; | 780 }; |
776 | 781 |
777 } // namespace ui | 782 } // namespace ui |
778 | 783 |
779 #endif // UI_EVENTS_EVENT_H_ | 784 #endif // UI_EVENTS_EVENT_H_ |
OLD | NEW |