| 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 | 177 |
| 178 bool IsFlingScrollEvent() const { | 178 bool IsFlingScrollEvent() const { |
| 179 return type_ == ET_SCROLL_FLING_CANCEL || | 179 return type_ == ET_SCROLL_FLING_CANCEL || |
| 180 type_ == ET_SCROLL_FLING_START; | 180 type_ == ET_SCROLL_FLING_START; |
| 181 } | 181 } |
| 182 | 182 |
| 183 bool IsMouseWheelEvent() const { | 183 bool IsMouseWheelEvent() const { |
| 184 return type_ == ET_MOUSEWHEEL; | 184 return type_ == ET_MOUSEWHEEL; |
| 185 } | 185 } |
| 186 | 186 |
| 187 // Convenience methods to cast |this| to a GestureEvent. IsGestureEvent() |
| 188 // must be true as a precondition to calling these methods. |
| 189 GestureEvent* AsGestureEvent(); |
| 190 const GestureEvent* AsGestureEvent() const; |
| 191 |
| 187 // Returns true if the event has a valid |native_event_|. | 192 // Returns true if the event has a valid |native_event_|. |
| 188 bool HasNativeEvent() const; | 193 bool HasNativeEvent() const; |
| 189 | 194 |
| 190 // Immediately stops the propagation of the event. This must be called only | 195 // Immediately stops the propagation of the event. This must be called only |
| 191 // from an EventHandler during an event-dispatch. Any event handler that may | 196 // from an EventHandler during an event-dispatch. Any event handler that may |
| 192 // be in the list will not receive the event after this is called. | 197 // be in the list will not receive the event after this is called. |
| 193 // Note that StopPropagation() can be called only for cancelable events. | 198 // Note that StopPropagation() can be called only for cancelable events. |
| 194 void StopPropagation(); | 199 void StopPropagation(); |
| 195 bool stopped_propagation() const { return !!(result_ & ER_CONSUMED); } | 200 bool stopped_propagation() const { return !!(result_ & ER_CONSUMED); } |
| 196 | 201 |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 | 683 |
| 679 const GestureEventDetails& details() const { return details_; } | 684 const GestureEventDetails& details() const { return details_; } |
| 680 | 685 |
| 681 private: | 686 private: |
| 682 GestureEventDetails details_; | 687 GestureEventDetails details_; |
| 683 }; | 688 }; |
| 684 | 689 |
| 685 } // namespace ui | 690 } // namespace ui |
| 686 | 691 |
| 687 #endif // UI_EVENTS_EVENT_H_ | 692 #endif // UI_EVENTS_EVENT_H_ |
| OLD | NEW |