Index: ui/base/event.h |
=================================================================== |
--- ui/base/event.h (revision 151481) |
+++ ui/base/event.h (working copy) |
@@ -45,7 +45,7 @@ |
}; |
const base::NativeEvent& native_event() const { return native_event_; } |
- const ui::NativeEvent& ui_native_event() const { return ui_native_event_; } |
+ const NativeEvent& ui_native_event() const { return ui_native_event_; } |
EventType type() const { return type_; } |
// time_stamp represents time since machine was booted. |
const base::TimeDelta& time_stamp() const { return time_stamp_; } |
@@ -63,32 +63,32 @@ |
bool IsAltDown() const { return (flags_ & EF_ALT_DOWN) != 0; } |
bool IsMouseEvent() const { |
- return type_ == ui::ET_MOUSE_PRESSED || |
- type_ == ui::ET_MOUSE_DRAGGED || |
- type_ == ui::ET_MOUSE_RELEASED || |
- type_ == ui::ET_MOUSE_MOVED || |
- type_ == ui::ET_MOUSE_ENTERED || |
- type_ == ui::ET_MOUSE_EXITED || |
- type_ == ui::ET_MOUSEWHEEL; |
+ return type_ == ET_MOUSE_PRESSED || |
+ type_ == ET_MOUSE_DRAGGED || |
+ type_ == ET_MOUSE_RELEASED || |
+ type_ == ET_MOUSE_MOVED || |
+ type_ == ET_MOUSE_ENTERED || |
+ type_ == ET_MOUSE_EXITED || |
+ type_ == ET_MOUSEWHEEL; |
} |
bool IsTouchEvent() const { |
- return type_ == ui::ET_TOUCH_RELEASED || |
- type_ == ui::ET_TOUCH_PRESSED || |
- type_ == ui::ET_TOUCH_MOVED || |
- type_ == ui::ET_TOUCH_STATIONARY || |
- type_ == ui::ET_TOUCH_CANCELLED; |
+ return type_ == ET_TOUCH_RELEASED || |
+ type_ == ET_TOUCH_PRESSED || |
+ type_ == ET_TOUCH_MOVED || |
+ type_ == ET_TOUCH_STATIONARY || |
+ type_ == ET_TOUCH_CANCELLED; |
} |
bool IsScrollGestureEvent() const { |
- return type_ == ui::ET_GESTURE_SCROLL_BEGIN || |
- type_ == ui::ET_GESTURE_SCROLL_UPDATE || |
- type_ == ui::ET_GESTURE_SCROLL_END; |
+ return type_ == ET_GESTURE_SCROLL_BEGIN || |
+ type_ == ET_GESTURE_SCROLL_UPDATE || |
+ type_ == ET_GESTURE_SCROLL_END; |
} |
bool IsFlingScrollEvent() const { |
- return type_ == ui::ET_SCROLL_FLING_CANCEL || |
- type_ == ui::ET_SCROLL_FLING_START; |
+ return type_ == ET_SCROLL_FLING_CANCEL || |
+ type_ == ET_SCROLL_FLING_START; |
} |
// Returns true if the event has a valid |native_event_|. |
@@ -113,7 +113,7 @@ |
base::NativeEvent native_event_; |
// TODO(beng): check to see if this is necessary. |
- ui::NativeEvent ui_native_event_; |
+ NativeEvent ui_native_event_; |
EventType type_; |
base::TimeDelta time_stamp_; |
int flags_; |
@@ -209,30 +209,30 @@ |
// Conveniences to quickly test what button is down |
bool IsOnlyLeftMouseButton() const { |
- return (flags() & ui::EF_LEFT_MOUSE_BUTTON) && |
- !(flags() & (ui::EF_MIDDLE_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON)); |
+ return (flags() & EF_LEFT_MOUSE_BUTTON) && |
+ !(flags() & (EF_MIDDLE_MOUSE_BUTTON | EF_RIGHT_MOUSE_BUTTON)); |
} |
bool IsLeftMouseButton() const { |
- return (flags() & ui::EF_LEFT_MOUSE_BUTTON) != 0; |
+ return (flags() & EF_LEFT_MOUSE_BUTTON) != 0; |
} |
bool IsOnlyMiddleMouseButton() const { |
- return (flags() & ui::EF_MIDDLE_MOUSE_BUTTON) && |
- !(flags() & (ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON)); |
+ return (flags() & EF_MIDDLE_MOUSE_BUTTON) && |
+ !(flags() & (EF_LEFT_MOUSE_BUTTON | EF_RIGHT_MOUSE_BUTTON)); |
} |
bool IsMiddleMouseButton() const { |
- return (flags() & ui::EF_MIDDLE_MOUSE_BUTTON) != 0; |
+ return (flags() & EF_MIDDLE_MOUSE_BUTTON) != 0; |
} |
bool IsOnlyRightMouseButton() const { |
- return (flags() & ui::EF_RIGHT_MOUSE_BUTTON) && |
- !(flags() & (ui::EF_LEFT_MOUSE_BUTTON | ui::EF_MIDDLE_MOUSE_BUTTON)); |
+ return (flags() & EF_RIGHT_MOUSE_BUTTON) && |
+ !(flags() & (EF_LEFT_MOUSE_BUTTON | EF_MIDDLE_MOUSE_BUTTON)); |
} |
bool IsRightMouseButton() const { |
- return (flags() & ui::EF_RIGHT_MOUSE_BUTTON) != 0; |
+ return (flags() & EF_RIGHT_MOUSE_BUTTON) != 0; |
} |
// Compares two mouse down events and returns true if the second one should |
@@ -259,6 +259,26 @@ |
static int GetRepeatCount(const MouseEvent& click_event); |
}; |
+class ScrollEvent; |
+ |
+class UI_EXPORT MouseWheelEvent : public MouseEvent { |
+ public: |
+ // See |offset| for details. |
+ static const int kWheelDelta; |
+ |
+ explicit MouseWheelEvent(const NativeEvent& native_event); |
+ explicit MouseWheelEvent(const ScrollEvent& scroll_event); |
+ |
+ // The amount to scroll. This is in multiples of kWheelDelta. |
+ // Note: offset() > 0 means scroll up / left. |
+ int offset() const { return offset_; } |
+ |
+ private: |
+ int offset_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(MouseWheelEvent); |
+}; |
+ |
class UI_EXPORT TouchEvent : public LocatedEvent { |
public: |
explicit TouchEvent(const base::NativeEvent& native_event); |
@@ -328,6 +348,22 @@ |
DISALLOW_COPY_AND_ASSIGN(TouchEvent); |
}; |
+class UI_EXPORT TestTouchEvent : public TouchEvent { |
+ public: |
+ // Create a new touch event. |
+ TestTouchEvent(EventType type, |
+ int x, |
+ int y, |
+ int flags, |
+ int touch_id, |
+ float radius_x, |
+ float radius_y, |
+ float angle, |
+ float force); |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(TestTouchEvent); |
+}; |
+ |
class UI_EXPORT KeyEvent : public Event { |
public: |
KeyEvent(const base::NativeEvent& native_event, bool is_char); |