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 #include "ppapi/cpp/touch_point.h" |
12 | 13 |
13 /// @file | 14 /// @file |
14 /// This file defines the API used to handle mouse and keyboard input events. | 15 /// This file defines the API used to handle mouse and keyboard input events. |
15 | 16 |
16 namespace pp { | 17 namespace pp { |
17 | 18 |
18 class FloatPoint; | 19 class FloatPoint; |
19 class InstanceHandle; | 20 class InstanceHandle; |
20 class Point; | 21 class Point; |
21 class Var; | 22 class Var; |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 uint32_t GetKeyCode() const; | 292 uint32_t GetKeyCode() const; |
292 | 293 |
293 /// Returns the typed character for the given character event. | 294 /// Returns the typed character for the given character event. |
294 /// | 295 /// |
295 /// @return A string var representing a single typed character for character | 296 /// @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 | 297 /// input events. For non-character input events the return value will be an |
297 /// undefined var. | 298 /// undefined var. |
298 Var GetCharacterText() const; | 299 Var GetCharacterText() const; |
299 }; | 300 }; |
300 | 301 |
| 302 class TouchInputEvent : public InputEvent { |
| 303 public: |
| 304 /// Constructs an is_null() touch input event object. |
| 305 TouchInputEvent(); |
| 306 |
| 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 |
| 309 /// touch object will be is_null(). |
| 310 explicit TouchInputEvent(const InputEvent& event); |
| 311 |
| 312 /// Constructs a touch input even from the given parameters. |
| 313 /// |
| 314 /// @param[in] instance The instance for which this event occured. |
| 315 /// |
| 316 /// @param[in] type A <code>PP_InputEvent_Type</code> identifying the type of |
| 317 /// input event. |
| 318 /// |
| 319 /// @param[in] time_stamp A <code>PP_TimeTicks</code> indicating the time |
| 320 /// when the event occured. |
| 321 /// |
| 322 /// @param[in] modifiers A bit field combination of the |
| 323 /// <code>PP_InputEvent_Modifier</code> flags. |
| 324 TouchInputEvent(const InstanceHandle& instance, |
| 325 PP_InputEvent_Type type, |
| 326 PP_TimeTicks time_stamp, |
| 327 uint32_t modifiers); |
| 328 |
| 329 /// Adds the touch-point to the specified TouchList. |
| 330 void AddTouchPoint(PP_TouchListType list, PP_TouchPoint point); |
| 331 |
| 332 /// @return The number of TouchPoints in this TouchList. |
| 333 uint32_t GetTouchCount(PP_TouchListType list) const; |
| 334 |
| 335 /// @return The TouchPoint at the given index of the given list, or an empty |
| 336 /// TouchPoint if the index is out of range. |
| 337 TouchPoint GetTouchByIndex(PP_TouchListType list, uint32_t index) const; |
| 338 |
| 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 |
| 341 /// identifier. |
| 342 TouchPoint GetTouchById(PP_TouchListType list, uint32_t id) const; |
| 343 }; |
| 344 |
| 345 |
301 } // namespace pp | 346 } // namespace pp |
302 | 347 |
303 #endif // PPAPI_CPP_INPUT_EVENT_H_ | 348 #endif // PPAPI_CPP_INPUT_EVENT_H_ |
OLD | NEW |