| 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 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 /// This constructor constructs a mouse input event object from the provided | 96 /// This constructor constructs a mouse input event object from the provided |
| 97 /// generic input event. If the given event is itself is_null() or is not | 97 /// generic input event. If the given event is itself is_null() or is not |
| 98 /// a mouse input event, the mouse object will be is_null(). | 98 /// a mouse input event, the mouse object will be is_null(). |
| 99 /// | 99 /// |
| 100 /// @param event An <code>InputEvent</code>. | 100 /// @param event An <code>InputEvent</code>. |
| 101 explicit MouseInputEvent(const InputEvent& event); | 101 explicit MouseInputEvent(const InputEvent& event); |
| 102 | 102 |
| 103 /// This constructor manually constructs a mouse event from the provided | 103 /// This constructor manually constructs a mouse event from the provided |
| 104 /// parameters. | 104 /// parameters. |
| 105 /// | 105 /// |
| 106 /// @param[in] instance The instance for which this event occured. | 106 /// @param[in] instance The instance for which this event occurred. |
| 107 /// | 107 /// |
| 108 /// @param[in] type A <code>PP_InputEvent_Type</code> identifying the type of | 108 /// @param[in] type A <code>PP_InputEvent_Type</code> identifying the type of |
| 109 /// input event. | 109 /// input event. |
| 110 /// | 110 /// |
| 111 /// @param[in] time_stamp A <code>PP_TimeTicks</code> indicating the time | 111 /// @param[in] time_stamp A <code>PP_TimeTicks</code> indicating the time |
| 112 /// when the event occured. | 112 /// when the event occurred. |
| 113 /// | 113 /// |
| 114 /// @param[in] modifiers A bit field combination of the | 114 /// @param[in] modifiers A bit field combination of the |
| 115 /// <code>PP_InputEvent_Modifier</code> flags. | 115 /// <code>PP_InputEvent_Modifier</code> flags. |
| 116 /// | 116 /// |
| 117 /// @param[in] mouse_button The button that changed for mouse down or up | 117 /// @param[in] mouse_button The button that changed for mouse down or up |
| 118 /// events. This value will be <code>PP_EVENT_MOUSEBUTTON_NONE</code> for | 118 /// events. This value will be <code>PP_EVENT_MOUSEBUTTON_NONE</code> for |
| 119 /// mouse move, enter, and leave events. | 119 /// mouse move, enter, and leave events. |
| 120 /// | 120 /// |
| 121 /// @param[in] mouse_position A <code>Point</code> containing the x and y | 121 /// @param[in] mouse_position A <code>Point</code> containing the x and y |
| 122 /// position of the mouse when the eent occurred. | 122 /// position of the mouse when the event occurred. |
| 123 /// | 123 /// |
| 124 /// @param[in] click_count | 124 /// @param[in] click_count |
| 125 // TODO(brettw) figure out exactly what this means. | 125 // TODO(brettw) figure out exactly what this means. |
| 126 /// | 126 /// |
| 127 /// @param[in] mouse_movement The change in position of the mouse. | 127 /// @param[in] mouse_movement The change in position of the mouse. |
| 128 MouseInputEvent(const InstanceHandle& instance, | 128 MouseInputEvent(const InstanceHandle& instance, |
| 129 PP_InputEvent_Type type, | 129 PP_InputEvent_Type type, |
| 130 PP_TimeTicks time_stamp, | 130 PP_TimeTicks time_stamp, |
| 131 uint32_t modifiers, | 131 uint32_t modifiers, |
| 132 PP_InputEvent_MouseButton mouse_button, | 132 PP_InputEvent_MouseButton mouse_button, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 /// This constructor constructs a wheel input event object from the | 171 /// This constructor constructs a wheel input event object from the |
| 172 /// provided generic input event. If the given event is itself | 172 /// provided generic input event. If the given event is itself |
| 173 /// is_null() or is not a wheel input event, the wheel object will be | 173 /// is_null() or is not a wheel input event, the wheel object will be |
| 174 /// is_null(). | 174 /// is_null(). |
| 175 /// | 175 /// |
| 176 /// @param[in] event A generic input event. | 176 /// @param[in] event A generic input event. |
| 177 explicit WheelInputEvent(const InputEvent& event); | 177 explicit WheelInputEvent(const InputEvent& event); |
| 178 | 178 |
| 179 /// Constructs a wheel input even from the given parameters. | 179 /// Constructs a wheel input even from the given parameters. |
| 180 /// | 180 /// |
| 181 /// @param[in] instance The instance for which this event occured. | 181 /// @param[in] instance The instance for which this event occurred. |
| 182 /// | 182 /// |
| 183 /// @param[in] time_stamp A <code>PP_TimeTicks</code> indicating the time | 183 /// @param[in] time_stamp A <code>PP_TimeTicks</code> indicating the time |
| 184 /// when the event occured. | 184 /// when the event occurred. |
| 185 /// | 185 /// |
| 186 /// @param[in] modifiers A bit field combination of the | 186 /// @param[in] modifiers A bit field combination of the |
| 187 /// <code>PP_InputEvent_Modifier</code> flags. | 187 /// <code>PP_InputEvent_Modifier</code> flags. |
| 188 /// | 188 /// |
| 189 /// @param[in] wheel_delta The scroll wheel's horizontal and vertical scroll | 189 /// @param[in] wheel_delta The scroll wheel's horizontal and vertical scroll |
| 190 /// amounts. | 190 /// amounts. |
| 191 /// | 191 /// |
| 192 /// @param[in] wheel_ticks The number of "clicks" of the scroll wheel that | 192 /// @param[in] wheel_ticks The number of "clicks" of the scroll wheel that |
| 193 /// have produced the event. | 193 /// have produced the event. |
| 194 /// | 194 /// |
| (...skipping 14 matching lines...) Expand all Loading... |
| 209 /// | 209 /// |
| 210 /// This amount is system dependent and will take into account the user's | 210 /// This amount is system dependent and will take into account the user's |
| 211 /// preferred scroll sensitivity and potentially also nonlinear acceleration | 211 /// preferred scroll sensitivity and potentially also nonlinear acceleration |
| 212 /// based on the speed of the scrolling. | 212 /// based on the speed of the scrolling. |
| 213 /// | 213 /// |
| 214 /// Devices will be of varying resolution. Some mice with large detents will | 214 /// Devices will be of varying resolution. Some mice with large detents will |
| 215 /// only generate integer scroll amounts. But fractional values are also | 215 /// only generate integer scroll amounts. But fractional values are also |
| 216 /// possible, for example, on some trackpads and newer mice that don't have | 216 /// possible, for example, on some trackpads and newer mice that don't have |
| 217 /// "clicks". | 217 /// "clicks". |
| 218 /// | 218 /// |
| 219 /// @return The vertial and horizontal scroll values. The units are either in | 219 /// @return The vertical and horizontal scroll values. The units are either in |
| 220 /// pixels (when scroll_by_page is false) or pages (when scroll_by_page is | 220 /// pixels (when scroll_by_page is false) or pages (when scroll_by_page is |
| 221 /// true). For example, y = -3 means scroll up 3 pixels when scroll_by_page | 221 /// true). For example, y = -3 means scroll up 3 pixels when scroll_by_page |
| 222 /// is false, and scroll up 3 pages when scroll_by_page is true. | 222 /// is false, and scroll up 3 pages when scroll_by_page is true. |
| 223 FloatPoint GetDelta() const; | 223 FloatPoint GetDelta() const; |
| 224 | 224 |
| 225 /// GetTicks() returns the number of "clicks" of the scroll wheel | 225 /// GetTicks() returns the number of "clicks" of the scroll wheel |
| 226 /// that have produced the event. The value may have system-specific | 226 /// that have produced the event. The value may have system-specific |
| 227 /// acceleration applied to it, depending on the device. The positive and | 227 /// acceleration applied to it, depending on the device. The positive and |
| 228 /// negative meanings are the same as for GetDelta(). | 228 /// negative meanings are the same as for GetDelta(). |
| 229 /// | 229 /// |
| (...skipping 26 matching lines...) Expand all Loading... |
| 256 | 256 |
| 257 /// Constructs a keyboard input event object from the provided generic input | 257 /// Constructs a keyboard input event object from the provided generic input |
| 258 /// event. If the given event is itself is_null() or is not a keyboard input | 258 /// event. If the given event is itself is_null() or is not a keyboard input |
| 259 /// event, the keybaord object will be is_null(). | 259 /// event, the keybaord object will be is_null(). |
| 260 /// | 260 /// |
| 261 /// @param[in] event A generic input event. | 261 /// @param[in] event A generic input event. |
| 262 explicit KeyboardInputEvent(const InputEvent& event); | 262 explicit KeyboardInputEvent(const InputEvent& event); |
| 263 | 263 |
| 264 /// Constructs a keyboard input even from the given parameters. | 264 /// Constructs a keyboard input even from the given parameters. |
| 265 /// | 265 /// |
| 266 /// @param[in] instance The instance for which this event occured. | 266 /// @param[in] instance The instance for which this event occurred. |
| 267 /// | 267 /// |
| 268 /// @param[in] type A <code>PP_InputEvent_Type</code> identifying the type of | 268 /// @param[in] type A <code>PP_InputEvent_Type</code> identifying the type of |
| 269 /// input event. | 269 /// input event. |
| 270 /// | 270 /// |
| 271 /// @param[in] time_stamp A <code>PP_TimeTicks</code> indicating the time | 271 /// @param[in] time_stamp A <code>PP_TimeTicks</code> indicating the time |
| 272 /// when the event occured. | 272 /// when the event occurred. |
| 273 /// | 273 /// |
| 274 /// @param[in] modifiers A bit field combination of the | 274 /// @param[in] modifiers A bit field combination of the |
| 275 /// <code>PP_InputEvent_Modifier</code> flags. | 275 /// <code>PP_InputEvent_Modifier</code> flags. |
| 276 /// | 276 /// |
| 277 /// @param[in] key_code This value reflects the DOM KeyboardEvent | 277 /// @param[in] key_code This value reflects the DOM KeyboardEvent |
| 278 /// <code>keyCode</code> field. Chrome populates this with the Windows-style | 278 /// <code>keyCode</code> field. Chrome populates this with the Windows-style |
| 279 /// Virtual Key code of the key. | 279 /// Virtual Key code of the key. |
| 280 /// | 280 /// |
| 281 /// @param[in] character_text This value represents the typed character as a | 281 /// @param[in] character_text This value represents the typed character as a |
| 282 /// UTF-8 string. | 282 /// UTF-8 string. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 304 /// Constructs an is_null() touch input event object. | 304 /// Constructs an is_null() touch input event object. |
| 305 TouchInputEvent(); | 305 TouchInputEvent(); |
| 306 | 306 |
| 307 /// Constructs a touch input event object from the given generic input event. | 307 /// Constructs a touch input event object from the given generic input event. |
| 308 /// If the given event is itself is_null() or is not a touch input event, the | 308 /// If the given event is itself is_null() or is not a touch input event, the |
| 309 /// touch object will be is_null(). | 309 /// touch object will be is_null(). |
| 310 explicit TouchInputEvent(const InputEvent& event); | 310 explicit TouchInputEvent(const InputEvent& event); |
| 311 | 311 |
| 312 /// Constructs a touch input even from the given parameters. | 312 /// Constructs a touch input even from the given parameters. |
| 313 /// | 313 /// |
| 314 /// @param[in] instance The instance for which this event occured. | 314 /// @param[in] instance The instance for which this event occurred. |
| 315 /// | 315 /// |
| 316 /// @param[in] type A <code>PP_InputEvent_Type</code> identifying the type of | 316 /// @param[in] type A <code>PP_InputEvent_Type</code> identifying the type of |
| 317 /// input event. | 317 /// input event. |
| 318 /// | 318 /// |
| 319 /// @param[in] time_stamp A <code>PP_TimeTicks</code> indicating the time | 319 /// @param[in] time_stamp A <code>PP_TimeTicks</code> indicating the time |
| 320 /// when the event occured. | 320 /// when the event occurred. |
| 321 /// | 321 /// |
| 322 /// @param[in] modifiers A bit field combination of the | 322 /// @param[in] modifiers A bit field combination of the |
| 323 /// <code>PP_InputEvent_Modifier</code> flags. | 323 /// <code>PP_InputEvent_Modifier</code> flags. |
| 324 TouchInputEvent(const InstanceHandle& instance, | 324 TouchInputEvent(const InstanceHandle& instance, |
| 325 PP_InputEvent_Type type, | 325 PP_InputEvent_Type type, |
| 326 PP_TimeTicks time_stamp, | 326 PP_TimeTicks time_stamp, |
| 327 uint32_t modifiers); | 327 uint32_t modifiers); |
| 328 | 328 |
| 329 /// Adds the touch-point to the specified TouchList. | 329 /// Adds the touch-point to the specified TouchList. |
| 330 void AddTouchPoint(PP_TouchListType list, PP_TouchPoint point); | 330 void AddTouchPoint(PP_TouchListType list, PP_TouchPoint point); |
| 331 | 331 |
| 332 /// @return The number of TouchPoints in this TouchList. | 332 /// @return The number of TouchPoints in this TouchList. |
| 333 uint32_t GetTouchCount(PP_TouchListType list) const; | 333 uint32_t GetTouchCount(PP_TouchListType list) const; |
| 334 | 334 |
| 335 /// @return The TouchPoint at the given index of the given list, or an empty | 335 /// @return The TouchPoint at the given index of the given list, or an empty |
| 336 /// TouchPoint if the index is out of range. | 336 /// TouchPoint if the index is out of range. |
| 337 TouchPoint GetTouchByIndex(PP_TouchListType list, uint32_t index) const; | 337 TouchPoint GetTouchByIndex(PP_TouchListType list, uint32_t index) const; |
| 338 | 338 |
| 339 /// @return The TouchPoint in the given list with the given identifier, or an | 339 /// @return The TouchPoint in the given list with the given identifier, or an |
| 340 /// empty TouchPoint if the list does not contain a TouchPoint with that | 340 /// empty TouchPoint if the list does not contain a TouchPoint with that |
| 341 /// identifier. | 341 /// identifier. |
| 342 TouchPoint GetTouchById(PP_TouchListType list, uint32_t id) const; | 342 TouchPoint GetTouchById(PP_TouchListType list, uint32_t id) const; |
| 343 }; | 343 }; |
| 344 | 344 |
| 345 | 345 |
| 346 } // namespace pp | 346 } // namespace pp |
| 347 | 347 |
| 348 #endif // PPAPI_CPP_INPUT_EVENT_H_ | 348 #endif // PPAPI_CPP_INPUT_EVENT_H_ |
| OLD | NEW |