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 | 5 |
6 /* From ppb_input_event.idl modified Mon Mar 5 10:11:05 2012. */ | 6 /* From ppb_input_event.idl modified Thu Jun 21 17:17:39 2012. */ |
7 | 7 |
8 #ifndef PPAPI_C_PPB_INPUT_EVENT_H_ | 8 #ifndef PPAPI_C_PPB_INPUT_EVENT_H_ |
9 #define PPAPI_C_PPB_INPUT_EVENT_H_ | 9 #define PPAPI_C_PPB_INPUT_EVENT_H_ |
10 | 10 |
11 #include "ppapi/c/pp_bool.h" | 11 #include "ppapi/c/pp_bool.h" |
12 #include "ppapi/c/pp_instance.h" | 12 #include "ppapi/c/pp_instance.h" |
13 #include "ppapi/c/pp_macros.h" | 13 #include "ppapi/c/pp_macros.h" |
14 #include "ppapi/c/pp_point.h" | 14 #include "ppapi/c/pp_point.h" |
15 #include "ppapi/c/pp_resource.h" | 15 #include "ppapi/c/pp_resource.h" |
16 #include "ppapi/c/pp_stdint.h" | 16 #include "ppapi/c/pp_stdint.h" |
17 #include "ppapi/c/pp_time.h" | 17 #include "ppapi/c/pp_time.h" |
| 18 #include "ppapi/c/pp_touch_point.h" |
18 #include "ppapi/c/pp_var.h" | 19 #include "ppapi/c/pp_var.h" |
19 | 20 |
20 #define PPB_INPUT_EVENT_INTERFACE_1_0 "PPB_InputEvent;1.0" | 21 #define PPB_INPUT_EVENT_INTERFACE_1_0 "PPB_InputEvent;1.0" |
21 #define PPB_INPUT_EVENT_INTERFACE PPB_INPUT_EVENT_INTERFACE_1_0 | 22 #define PPB_INPUT_EVENT_INTERFACE PPB_INPUT_EVENT_INTERFACE_1_0 |
22 | 23 |
23 #define PPB_MOUSE_INPUT_EVENT_INTERFACE_1_0 "PPB_MouseInputEvent;1.0" | 24 #define PPB_MOUSE_INPUT_EVENT_INTERFACE_1_0 "PPB_MouseInputEvent;1.0" |
24 #define PPB_MOUSE_INPUT_EVENT_INTERFACE_1_1 "PPB_MouseInputEvent;1.1" | 25 #define PPB_MOUSE_INPUT_EVENT_INTERFACE_1_1 "PPB_MouseInputEvent;1.1" |
25 #define PPB_MOUSE_INPUT_EVENT_INTERFACE PPB_MOUSE_INPUT_EVENT_INTERFACE_1_1 | 26 #define PPB_MOUSE_INPUT_EVENT_INTERFACE PPB_MOUSE_INPUT_EVENT_INTERFACE_1_1 |
26 | 27 |
27 #define PPB_WHEEL_INPUT_EVENT_INTERFACE_1_0 "PPB_WheelInputEvent;1.0" | 28 #define PPB_WHEEL_INPUT_EVENT_INTERFACE_1_0 "PPB_WheelInputEvent;1.0" |
28 #define PPB_WHEEL_INPUT_EVENT_INTERFACE PPB_WHEEL_INPUT_EVENT_INTERFACE_1_0 | 29 #define PPB_WHEEL_INPUT_EVENT_INTERFACE PPB_WHEEL_INPUT_EVENT_INTERFACE_1_0 |
29 | 30 |
30 #define PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_0 "PPB_KeyboardInputEvent;1.0" | 31 #define PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_0 "PPB_KeyboardInputEvent;1.0" |
31 #define PPB_KEYBOARD_INPUT_EVENT_INTERFACE \ | 32 #define PPB_KEYBOARD_INPUT_EVENT_INTERFACE \ |
32 PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_0 | 33 PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_0 |
33 | 34 |
| 35 #define PPB_TOUCH_INPUT_EVENT_INTERFACE_1_0 "PPB_TouchInputEvent;1.0" |
| 36 #define PPB_TOUCH_INPUT_EVENT_INTERFACE PPB_TOUCH_INPUT_EVENT_INTERFACE_1_0 |
| 37 |
34 /** | 38 /** |
35 * @file | 39 * @file |
36 * This file defines the Input Event interfaces. | 40 * This file defines the Input Event interfaces. |
37 */ | 41 */ |
38 | 42 |
39 | 43 |
40 /** | 44 /** |
41 * @addtogroup Enums | 45 * @addtogroup Enums |
42 * @{ | 46 * @{ |
43 */ | 47 */ |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 * Notification that an input method composition process has completed. | 141 * Notification that an input method composition process has completed. |
138 * | 142 * |
139 * Register for this event using the PP_INPUTEVENT_CLASS_IME class. | 143 * Register for this event using the PP_INPUTEVENT_CLASS_IME class. |
140 */ | 144 */ |
141 PP_INPUTEVENT_TYPE_IME_COMPOSITION_END = 13, | 145 PP_INPUTEVENT_TYPE_IME_COMPOSITION_END = 13, |
142 /** | 146 /** |
143 * Notification that an input method committed a string. | 147 * Notification that an input method committed a string. |
144 * | 148 * |
145 * Register for this event using the PP_INPUTEVENT_CLASS_IME class. | 149 * Register for this event using the PP_INPUTEVENT_CLASS_IME class. |
146 */ | 150 */ |
147 PP_INPUTEVENT_TYPE_IME_TEXT = 14 | 151 PP_INPUTEVENT_TYPE_IME_TEXT = 14, |
| 152 /** |
| 153 * Notification that a finger was placed on a touch-enabled device. |
| 154 * |
| 155 * Register for this event using the PP_INPUTEVENT_CLASS_TOUCH class. |
| 156 */ |
| 157 PP_INPUTEVENT_TYPE_TOUCHSTART = 15, |
| 158 /** |
| 159 * Notification that a finger was moved on a touch-enabled device. |
| 160 * |
| 161 * Register for this event using the PP_INPUTEVENT_CLASS_TOUCH class. |
| 162 */ |
| 163 PP_INPUTEVENT_TYPE_TOUCHMOVE = 16, |
| 164 /** |
| 165 * Notification that a finger was released on a touch-enabled device. |
| 166 * |
| 167 * Register for this event using the PP_INPUTEVENT_CLASS_TOUCH class. |
| 168 */ |
| 169 PP_INPUTEVENT_TYPE_TOUCHEND = 17, |
| 170 /** |
| 171 * Notification that a touch event was canceled. |
| 172 * |
| 173 * Register for this event using the PP_INPUTEVENT_CLASS_TOUCH class. |
| 174 */ |
| 175 PP_INPUTEVENT_TYPE_TOUCHCANCEL = 18 |
148 } PP_InputEvent_Type; | 176 } PP_InputEvent_Type; |
149 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_InputEvent_Type, 4); | 177 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_InputEvent_Type, 4); |
150 | 178 |
151 /** | 179 /** |
152 * This enumeration contains event modifier constants. Each modifier is one | 180 * This enumeration contains event modifier constants. Each modifier is one |
153 * bit. Retrieve the modifiers from an input event using the GetEventModifiers | 181 * bit. Retrieve the modifiers from an input event using the GetEventModifiers |
154 * function on PPB_InputEvent. | 182 * function on PPB_InputEvent. |
155 */ | 183 */ |
156 typedef enum { | 184 typedef enum { |
157 PP_INPUTEVENT_MODIFIER_SHIFTKEY = 1 << 0, | 185 PP_INPUTEVENT_MODIFIER_SHIFTKEY = 1 << 0, |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 * undefined var. | 730 * undefined var. |
703 */ | 731 */ |
704 struct PP_Var (*GetCharacterText)(PP_Resource character_event); | 732 struct PP_Var (*GetCharacterText)(PP_Resource character_event); |
705 }; | 733 }; |
706 | 734 |
707 typedef struct PPB_KeyboardInputEvent_1_0 PPB_KeyboardInputEvent; | 735 typedef struct PPB_KeyboardInputEvent_1_0 PPB_KeyboardInputEvent; |
708 /** | 736 /** |
709 * @} | 737 * @} |
710 */ | 738 */ |
711 | 739 |
| 740 /** |
| 741 * @addtogroup Enums |
| 742 * @{ |
| 743 */ |
| 744 typedef enum { |
| 745 /** |
| 746 * The list of all TouchPoints which are currently down. |
| 747 */ |
| 748 PP_TOUCHLIST_TYPE_TOUCHES = 0, |
| 749 /** |
| 750 * The list of all TouchPoints whose state has changed since the last |
| 751 * TouchInputEvent. |
| 752 */ |
| 753 PP_TOUCHLIST_TYPE_CHANGEDTOUCHES = 1, |
| 754 /** |
| 755 * The list of all TouchPoints which are targeting this plugin. This is a |
| 756 * subset of Touches. |
| 757 */ |
| 758 PP_TOUCHLIST_TYPE_TARGETTOUCHES = 2 |
| 759 } PP_TouchListType; |
| 760 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TouchListType, 4); |
| 761 /** |
| 762 * @} |
| 763 */ |
| 764 |
| 765 /** |
| 766 * @addtogroup Interfaces |
| 767 * @{ |
| 768 */ |
| 769 /** |
| 770 * The <code>PPB_TouchInputEvent</code> interface contains pointers to several |
| 771 * functions related to touch events. |
| 772 */ |
| 773 struct PPB_TouchInputEvent_1_0 { |
| 774 /** |
| 775 * Creates a touch input event with the given parameters. Normally you |
| 776 * will get a touch event passed through the HandleInputEvent and will not |
| 777 * need to create them, but some applications may want to create their own |
| 778 * for internal use. The type must be one of the touch event types. |
| 779 * This newly created touch input event does not have any touch point in any |
| 780 * of the touch-point lists. <code>AddTouchPoint</code> should be called to |
| 781 * add the touch-points. |
| 782 * |
| 783 * @param[in] instance The instance for which this event occurred. |
| 784 * |
| 785 * @param[in] type A <code>PP_InputEvent_Type</code> identifying the type of |
| 786 * input event. |
| 787 * |
| 788 * @param[in] time_stamp A <code>PP_TimeTicks</code> indicating the time |
| 789 * when the event occurred. |
| 790 * |
| 791 * @param[in] modifiers A bit field combination of the |
| 792 * <code>PP_InputEvent_Modifier</code> flags. |
| 793 * |
| 794 * @return A <code>PP_Resource</code> containing the new touch input event. |
| 795 */ |
| 796 PP_Resource (*Create)(PP_Instance instance, |
| 797 PP_InputEvent_Type type, |
| 798 PP_TimeTicks time_stamp, |
| 799 uint32_t modifiers); |
| 800 /** |
| 801 * Adds a touch point to the touch event in the specified touch-list. |
| 802 * |
| 803 * @param[in] touch_event A <code>PP_Resource</code> corresponding to a touch |
| 804 * event. |
| 805 * |
| 806 * @param[in] list The list to add the touch point to. |
| 807 * |
| 808 * @param[in] point The point to add to the list. |
| 809 */ |
| 810 void (*AddTouchPoint)(PP_Resource touch_event, |
| 811 PP_TouchListType list, |
| 812 const struct PP_TouchPoint* point); |
| 813 /** |
| 814 * IsTouchInputEvent() determines if a resource is a touch event. |
| 815 * |
| 816 * @param[in] resource A <code>PP_Resource</code> corresponding to an event. |
| 817 * |
| 818 * @return <code>PP_TRUE</code> if the given resource is a valid touch input |
| 819 * event, otherwise <code>PP_FALSE</code>. |
| 820 */ |
| 821 PP_Bool (*IsTouchInputEvent)(PP_Resource resource); |
| 822 /** |
| 823 * Returns the number of touch-points in the specified list. |
| 824 * |
| 825 * @param[in] resource A <code>PP_Resource</code> corresponding to a touch |
| 826 * event. |
| 827 * |
| 828 * @param[in] list The list. |
| 829 * |
| 830 * @return The number of touch-points in the specified list. |
| 831 */ |
| 832 uint32_t (*GetTouchCount)(PP_Resource resource, PP_TouchListType list); |
| 833 /** |
| 834 * Returns the touch-point at the specified index from the specified list. |
| 835 * |
| 836 * @param[in] resource A <code>PP_Resource</code> corresponding to a touch |
| 837 * event. |
| 838 * |
| 839 * @param[in] list The list. |
| 840 * |
| 841 * @param[in] index The index. |
| 842 * |
| 843 * @return A <code>PP_TouchPoint</code> representing the touch-point. |
| 844 */ |
| 845 struct PP_TouchPoint (*GetTouchByIndex)(PP_Resource resource, |
| 846 PP_TouchListType list, |
| 847 uint32_t index); |
| 848 /** |
| 849 * Returns the touch-point with the spcified touch-id in the specified list. |
| 850 * |
| 851 * @param[in] resource A <code>PP_Resource</code> corresponding to a touch |
| 852 * event. |
| 853 * |
| 854 * @param[in] list The list. |
| 855 * |
| 856 * @param[in] touch_id The id of the touch-point. |
| 857 * |
| 858 * @return A <code>PP_TouchPoint</code> representing the touch-point. |
| 859 */ |
| 860 struct PP_TouchPoint (*GetTouchById)(PP_Resource resource, |
| 861 PP_TouchListType list, |
| 862 uint32_t touch_id); |
| 863 }; |
| 864 |
| 865 typedef struct PPB_TouchInputEvent_1_0 PPB_TouchInputEvent; |
| 866 /** |
| 867 * @} |
| 868 */ |
| 869 |
712 #endif /* PPAPI_C_PPB_INPUT_EVENT_H_ */ | 870 #endif /* PPAPI_C_PPB_INPUT_EVENT_H_ */ |
713 | 871 |
OLD | NEW |