| 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" |
| 11 #include "ppapi/cpp/resource.h" | 11 #include "ppapi/cpp/resource.h" |
| 12 | 12 |
| 13 /// @file | 13 /// @file |
| 14 /// This file defines the API used to handle mouse and keyboard input events. | 14 /// This file defines the API used to handle mouse and keyboard input events. |
| 15 | 15 |
| 16 namespace pp { | 16 namespace pp { |
| 17 | 17 |
| 18 class FloatPoint; | 18 class FloatPoint; |
| 19 class Instance; | 19 class InstanceHandle; |
| 20 class Point; | 20 class Point; |
| 21 class Var; | 21 class Var; |
| 22 | 22 |
| 23 /// This class represents an input event resource. Normally you will get passed | 23 /// This class represents an input event resource. Normally you will get passed |
| 24 /// this object through the HandleInputEvent() function on the | 24 /// this object through the HandleInputEvent() function on the |
| 25 /// <code>Instance</code> object. | 25 /// <code>Instance</code> object. |
| 26 /// | 26 /// |
| 27 /// Typically you would check the type of the event and then create the | 27 /// Typically you would check the type of the event and then create the |
| 28 /// appropriate event-specific object to query the properties. | 28 /// appropriate event-specific object to query the properties. |
| 29 /// | 29 /// |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 /// @param[in] mouse_movement The change in position of the mouse. |
| 127 MouseInputEvent(Instance* instance, | 127 MouseInputEvent(const InstanceHandle& instance, |
| 128 PP_InputEvent_Type type, | 128 PP_InputEvent_Type type, |
| 129 PP_TimeTicks time_stamp, | 129 PP_TimeTicks time_stamp, |
| 130 uint32_t modifiers, | 130 uint32_t modifiers, |
| 131 PP_InputEvent_MouseButton mouse_button, | 131 PP_InputEvent_MouseButton mouse_button, |
| 132 const Point& mouse_position, | 132 const Point& mouse_position, |
| 133 int32_t click_count, | 133 int32_t click_count, |
| 134 const Point& mouse_movement); | 134 const Point& mouse_movement); |
| 135 | 135 |
| 136 /// GetButton() returns the mouse position for a mouse input event. | 136 /// GetButton() returns the mouse position for a mouse input event. |
| 137 /// | 137 /// |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 /// <code>PP_InputEvent_Modifier</code> flags. | 186 /// <code>PP_InputEvent_Modifier</code> flags. |
| 187 /// | 187 /// |
| 188 /// @param[in] wheel_delta The scroll wheel's horizontal and vertical scroll | 188 /// @param[in] wheel_delta The scroll wheel's horizontal and vertical scroll |
| 189 /// amounts. | 189 /// amounts. |
| 190 /// | 190 /// |
| 191 /// @param[in] wheel_ticks The number of "clicks" of the scroll wheel that | 191 /// @param[in] wheel_ticks The number of "clicks" of the scroll wheel that |
| 192 /// have produced the event. | 192 /// have produced the event. |
| 193 /// | 193 /// |
| 194 /// @param[in] scroll_by_page When true, the user is requesting to scroll | 194 /// @param[in] scroll_by_page When true, the user is requesting to scroll |
| 195 /// by pages. When false, the user is requesting to scroll by lines. | 195 /// by pages. When false, the user is requesting to scroll by lines. |
| 196 WheelInputEvent(Instance* instance, | 196 WheelInputEvent(const InstanceHandle& instance, |
| 197 PP_TimeTicks time_stamp, | 197 PP_TimeTicks time_stamp, |
| 198 uint32_t modifiers, | 198 uint32_t modifiers, |
| 199 const FloatPoint& wheel_delta, | 199 const FloatPoint& wheel_delta, |
| 200 const FloatPoint& wheel_ticks, | 200 const FloatPoint& wheel_ticks, |
| 201 bool scroll_by_page); | 201 bool scroll_by_page); |
| 202 | 202 |
| 203 /// GetDelta() returns the amount vertically and horizontally the user has | 203 /// GetDelta() returns the amount vertically and horizontally the user has |
| 204 /// requested to scroll by with their mouse wheel. A scroll down or to the | 204 /// requested to scroll by with their mouse wheel. A scroll down or to the |
| 205 /// right (where the content moves up or left) is represented as positive | 205 /// right (where the content moves up or left) is represented as positive |
| 206 /// values, and a scroll up or to the left (where the content moves down or | 206 /// values, and a scroll up or to the left (where the content moves down or |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 /// | 272 /// |
| 273 /// @param[in] modifiers A bit field combination of the | 273 /// @param[in] modifiers A bit field combination of the |
| 274 /// <code>PP_InputEvent_Modifier</code> flags. | 274 /// <code>PP_InputEvent_Modifier</code> flags. |
| 275 /// | 275 /// |
| 276 /// @param[in] key_code This value reflects the DOM KeyboardEvent | 276 /// @param[in] key_code This value reflects the DOM KeyboardEvent |
| 277 /// <code>keyCode</code> field. Chrome populates this with the Windows-style | 277 /// <code>keyCode</code> field. Chrome populates this with the Windows-style |
| 278 /// Virtual Key code of the key. | 278 /// Virtual Key code of the key. |
| 279 /// | 279 /// |
| 280 /// @param[in] character_text This value represents the typed character as a | 280 /// @param[in] character_text This value represents the typed character as a |
| 281 /// UTF-8 string. | 281 /// UTF-8 string. |
| 282 KeyboardInputEvent(Instance* instance, | 282 KeyboardInputEvent(const InstanceHandle& instance, |
| 283 PP_InputEvent_Type type, | 283 PP_InputEvent_Type type, |
| 284 PP_TimeTicks time_stamp, | 284 PP_TimeTicks time_stamp, |
| 285 uint32_t modifiers, | 285 uint32_t modifiers, |
| 286 uint32_t key_code, | 286 uint32_t key_code, |
| 287 const Var& character_text); | 287 const Var& character_text); |
| 288 | 288 |
| 289 /// Returns the DOM keyCode field for the keyboard event. | 289 /// Returns the DOM keyCode field for the keyboard event. |
| 290 /// Chrome populates this with the Windows-style Virtual Key code of the key. | 290 /// Chrome populates this with the Windows-style Virtual Key code of the key. |
| 291 uint32_t GetKeyCode() const; | 291 uint32_t GetKeyCode() const; |
| 292 | 292 |
| 293 /// Returns the typed character for the given character event. | 293 /// Returns the typed character for the given character event. |
| 294 /// | 294 /// |
| 295 /// @return A string var representing a single typed character for character | 295 /// @return A string var representing a single typed character for character |
| 296 /// input events. For non-character input events the return value will be an | 296 /// input events. For non-character input events the return value will be an |
| 297 /// undefined var. | 297 /// undefined var. |
| 298 Var GetCharacterText() const; | 298 Var GetCharacterText() const; |
| 299 }; | 299 }; |
| 300 | 300 |
| 301 } // namespace pp | 301 } // namespace pp |
| 302 | 302 |
| 303 #endif // PPAPI_CPP_INPUT_EVENT_H_ | 303 #endif // PPAPI_CPP_INPUT_EVENT_H_ |
| OLD | NEW |