| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 PPAPI_CPP_INPUT_EVENT_H_ | 5 #ifndef PPAPI_CPP_INPUT_EVENT_H_ |
| 6 #define PPAPI_CPP_INPUT_EVENT_H_ | 6 #define PPAPI_CPP_INPUT_EVENT_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "ppapi/c/ppb_input_event.h" | 10 #include "ppapi/c/ppb_input_event.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 /// @param[in] mouse_button The button that changed for mouse down or up | 116 /// @param[in] mouse_button The button that changed for mouse down or up |
| 117 /// events. This value will be <code>PP_EVENT_MOUSEBUTTON_NONE</code> for | 117 /// events. This value will be <code>PP_EVENT_MOUSEBUTTON_NONE</code> for |
| 118 /// mouse move, enter, and leave events. | 118 /// mouse move, enter, and leave events. |
| 119 /// | 119 /// |
| 120 /// @param[in] mouse_position A <code>Point</code> containing the x and y | 120 /// @param[in] mouse_position A <code>Point</code> containing the x and y |
| 121 /// position of the mouse when the eent occurred. | 121 /// position of the mouse when the eent occurred. |
| 122 /// | 122 /// |
| 123 /// @param[in] click_count | 123 /// @param[in] click_count |
| 124 /// TODO(brettw) figure out exactly what this means. | 124 /// TODO(brettw) figure out exactly what this means. |
| 125 /// | 125 /// |
| 126 /// @param[in] mouse_movement The change in position of the mouse. |
| 126 MouseInputEvent(Instance* instance, | 127 MouseInputEvent(Instance* instance, |
| 127 PP_InputEvent_Type type, | 128 PP_InputEvent_Type type, |
| 128 PP_TimeTicks time_stamp, | 129 PP_TimeTicks time_stamp, |
| 129 uint32_t modifiers, | 130 uint32_t modifiers, |
| 130 PP_InputEvent_MouseButton mouse_button, | 131 PP_InputEvent_MouseButton mouse_button, |
| 131 const Point& mouse_position, | 132 const Point& mouse_position, |
| 132 int32_t click_count); | 133 int32_t click_count, |
| 134 const Point& mouse_movement); |
| 133 | 135 |
| 134 /// GetButton() returns the mouse position for a mouse input event. | 136 /// GetButton() returns the mouse position for a mouse input event. |
| 135 /// | 137 /// |
| 136 /// @return The mouse button associated with mouse down and up events. This | 138 /// @return The mouse button associated with mouse down and up events. This |
| 137 /// value will be PP_EVENT_MOUSEBUTTON_NONE for mouse move, enter, and leave | 139 /// value will be PP_EVENT_MOUSEBUTTON_NONE for mouse move, enter, and leave |
| 138 /// events, and for all non-mouse events. | 140 /// events, and for all non-mouse events. |
| 139 PP_InputEvent_MouseButton GetButton() const; | 141 PP_InputEvent_MouseButton GetButton() const; |
| 140 | 142 |
| 141 /// GetPostion() returns the pixel location of a mouse input event. This | 143 /// GetPostion() returns the pixel location of a mouse input event. This |
| 142 /// value is in floating-point units to support high-resolution input events. | 144 /// value is in floating-point units to support high-resolution input events. |
| 143 /// | 145 /// |
| 144 /// @return The point associated with the mouse event, relative to the upper- | 146 /// @return The point associated with the mouse event, relative to the upper- |
| 145 /// left of the instance receiving the event. These values can be negative for | 147 /// left of the instance receiving the event. These values can be negative for |
| 146 /// mouse drags. The return value will be (0, 0) for non-mouse events. | 148 /// mouse drags. The return value will be (0, 0) for non-mouse events. |
| 147 Point GetPosition() const; | 149 Point GetPosition() const; |
| 148 | 150 |
| 149 // TODO(brettw) figure out exactly what this means. | 151 // TODO(brettw) figure out exactly what this means. |
| 150 int32_t GetClickCount() const; | 152 int32_t GetClickCount() const; |
| 153 |
| 154 /// Returns the change in position of the mouse. When the cursor lock is |
| 155 /// enabled, although the mouse position doesn't actually change, this |
| 156 /// function continues to provide movement information as when the cursor is |
| 157 /// unlocked. |
| 158 /// |
| 159 /// @return The change in position of the mouse, relative to the previous |
| 160 /// position. |
| 161 Point GetMovement() const; |
| 151 }; | 162 }; |
| 152 | 163 |
| 153 class WheelInputEvent : public InputEvent { | 164 class WheelInputEvent : public InputEvent { |
| 154 public: | 165 public: |
| 155 /// Constructs an is_null() wheel input event object. | 166 /// Constructs an is_null() wheel input event object. |
| 156 WheelInputEvent(); | 167 WheelInputEvent(); |
| 157 | 168 |
| 158 /// This constructor constructs a wheel input event object from the | 169 /// This constructor constructs a wheel input event object from the |
| 159 /// provided generic input event. If the given event is itself | 170 /// provided generic input event. If the given event is itself |
| 160 /// is_null() or is not a wheel input event, the wheel object will be | 171 /// is_null() or is not a wheel input event, the wheel object will be |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 /// | 293 /// |
| 283 /// @return A string var representing a single typed character for character | 294 /// @return A string var representing a single typed character for character |
| 284 /// input events. For non-character input events the return value will be an | 295 /// input events. For non-character input events the return value will be an |
| 285 /// undefined var. | 296 /// undefined var. |
| 286 Var GetCharacterText() const; | 297 Var GetCharacterText() const; |
| 287 }; | 298 }; |
| 288 | 299 |
| 289 } // namespace pp | 300 } // namespace pp |
| 290 | 301 |
| 291 #endif // PPAPI_CPP_INPUT_EVENT_H_ | 302 #endif // PPAPI_CPP_INPUT_EVENT_H_ |
| OLD | NEW |