| 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 | 5 |
| 6 /* From ppb_input_event.idl modified Wed Aug 24 09:43:38 2011. */ | 6 /* From ppb_input_event.idl modified Tue Sep 13 18:18:57 2011. */ |
| 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_var.h" | 18 #include "ppapi/c/pp_var.h" |
| 19 | 19 |
| 20 #define PPB_INPUT_EVENT_INTERFACE_1_0 "PPB_InputEvent;1.0" | 20 #define PPB_INPUT_EVENT_INTERFACE_1_0 "PPB_InputEvent;1.0" |
| 21 #define PPB_INPUT_EVENT_INTERFACE PPB_INPUT_EVENT_INTERFACE_1_0 | 21 #define PPB_INPUT_EVENT_INTERFACE PPB_INPUT_EVENT_INTERFACE_1_0 |
| 22 | 22 |
| 23 #define PPB_MOUSE_INPUT_EVENT_INTERFACE_1_0 "PPB_MouseInputEvent;1.0" | 23 #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" | 24 #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 | 25 #define PPB_MOUSE_INPUT_EVENT_INTERFACE PPB_MOUSE_INPUT_EVENT_INTERFACE_1_1 |
| 26 | 26 |
| 27 #define PPB_WHEEL_INPUT_EVENT_INTERFACE_1_0 "PPB_WheelInputEvent;1.0" | 27 #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 | 28 #define PPB_WHEEL_INPUT_EVENT_INTERFACE PPB_WHEEL_INPUT_EVENT_INTERFACE_1_0 |
| 29 | 29 |
| 30 #define PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_0 "PPB_KeyboardInputEvent;1.0" | 30 #define PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_0 "PPB_KeyboardInputEvent;1.0" |
| 31 #define PPB_KEYBOARD_INPUT_EVENT_INTERFACE \ | 31 #define PPB_KEYBOARD_INPUT_EVENT_INTERFACE \ |
| 32 PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_0 | 32 PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_0 |
| 33 | 33 |
| 34 #define PPB_COMPOSITION_INPUT_EVENT_INTERFACE_1_0 \ |
| 35 "PPB_CompositionInputEvent;1.0" |
| 36 #define PPB_COMPOSITION_INPUT_EVENT_INTERFACE_1_2 \ |
| 37 "PPB_CompositionInputEvent;1.2" |
| 38 #define PPB_COMPOSITION_INPUT_EVENT_INTERFACE \ |
| 39 PPB_COMPOSITION_INPUT_EVENT_INTERFACE_1_2 |
| 40 |
| 34 /** | 41 /** |
| 35 * @file | 42 * @file |
| 36 * This file defines the Input Event interfaces. | 43 * This file defines the Input Event interfaces. |
| 37 */ | 44 */ |
| 38 | 45 |
| 39 | 46 |
| 40 /** | 47 /** |
| 41 * @addtogroup Enums | 48 * @addtogroup Enums |
| 42 * @{ | 49 * @{ |
| 43 */ | 50 */ |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 * on the key, locale, and operating system. | 117 * on the key, locale, and operating system. |
| 111 * | 118 * |
| 112 * Register for this event using the PP_INPUTEVENT_CLASS_KEYBOARD class. | 119 * Register for this event using the PP_INPUTEVENT_CLASS_KEYBOARD class. |
| 113 */ | 120 */ |
| 114 PP_INPUTEVENT_TYPE_CHAR = 9, | 121 PP_INPUTEVENT_TYPE_CHAR = 9, |
| 115 /** | 122 /** |
| 116 * TODO(brettw) when is this used? | 123 * TODO(brettw) when is this used? |
| 117 * | 124 * |
| 118 * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class. | 125 * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class. |
| 119 */ | 126 */ |
| 120 PP_INPUTEVENT_TYPE_CONTEXTMENU = 10 | 127 PP_INPUTEVENT_TYPE_CONTEXTMENU = 10, |
| 128 /** |
| 129 * Notification that an input method composition process has just started. |
| 130 * |
| 131 * Register for this event using the PP_INPUTEVENT_CLASS_COMPOSITION class. |
| 132 */ |
| 133 PP_INPUTEVENT_TYPE_COMPOSITION_START = 11, |
| 134 /** |
| 135 * Notification that the input method composition string is updated. |
| 136 * |
| 137 * Register for this event using the PP_INPUTEVENT_CLASS_COMPOSITION class. |
| 138 */ |
| 139 PP_INPUTEVENT_TYPE_COMPOSITION_UPDATE = 12, |
| 140 /** |
| 141 * Notification that an input method composition process has completed. |
| 142 * |
| 143 * Register for this event using the PP_INPUTEVENT_CLASS_COMPOSITION class. |
| 144 */ |
| 145 PP_INPUTEVENT_TYPE_COMPOSITION_END = 13, |
| 146 /** |
| 147 * Notification that an input method committed a string. |
| 148 * |
| 149 * Register for this event using the PP_INPUTEVENT_CLASS_COMPOSITION class. |
| 150 */ |
| 151 PP_INPUTEVENT_TYPE_IME_TEXT = 14 |
| 121 } PP_InputEvent_Type; | 152 } PP_InputEvent_Type; |
| 122 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_InputEvent_Type, 4); | 153 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_InputEvent_Type, 4); |
| 123 | 154 |
| 124 /** | 155 /** |
| 125 * This enumeration contains event modifier constants. Each modifier is one | 156 * This enumeration contains event modifier constants. Each modifier is one |
| 126 * bit. Retrieve the modifiers from an input event using the GetEventModifiers | 157 * bit. Retrieve the modifiers from an input event using the GetEventModifiers |
| 127 * function on PPB_InputEvent. | 158 * function on PPB_InputEvent. |
| 128 */ | 159 */ |
| 129 typedef enum { | 160 typedef enum { |
| 130 PP_INPUTEVENT_MODIFIER_SHIFTKEY = 1 << 0, | 161 PP_INPUTEVENT_MODIFIER_SHIFTKEY = 1 << 0, |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 PP_INPUTEVENT_CLASS_WHEEL = 1 << 2, | 229 PP_INPUTEVENT_CLASS_WHEEL = 1 << 2, |
| 199 /** | 230 /** |
| 200 * Identifies touch input events. | 231 * Identifies touch input events. |
| 201 * | 232 * |
| 202 * Request touch events only if you intend to handle them. If the browser | 233 * Request touch events only if you intend to handle them. If the browser |
| 203 * knows you do not need to handle touch events, it can handle them at a | 234 * knows you do not need to handle touch events, it can handle them at a |
| 204 * higher level and achieve higher performance. | 235 * higher level and achieve higher performance. |
| 205 */ | 236 */ |
| 206 PP_INPUTEVENT_CLASS_TOUCH = 1 << 3, | 237 PP_INPUTEVENT_CLASS_TOUCH = 1 << 3, |
| 207 /** | 238 /** |
| 208 * Identifies IME composition input events. | 239 * Identifies composition input events. |
| 209 * | 240 * |
| 210 * Request this input event class if you allow on-the-spot IME input. | 241 * Request this input event class if you allow on-the-spot composition. |
| 211 */ | 242 */ |
| 212 PP_INPUTEVENT_CLASS_IME = 1 << 4 | 243 PP_INPUTEVENT_CLASS_COMPOSITION = 1 << 4 |
| 213 } PP_InputEvent_Class; | 244 } PP_InputEvent_Class; |
| 214 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_InputEvent_Class, 4); | 245 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_InputEvent_Class, 4); |
| 215 /** | 246 /** |
| 216 * @} | 247 * @} |
| 217 */ | 248 */ |
| 218 | 249 |
| 219 /** | 250 /** |
| 220 * @addtogroup Interfaces | 251 * @addtogroup Interfaces |
| 221 * @{ | 252 * @{ |
| 222 */ | 253 */ |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 * | 698 * |
| 668 * @param[in] character_event A <code>PP_Resource</code> corresponding to a | 699 * @param[in] character_event A <code>PP_Resource</code> corresponding to a |
| 669 * keyboard event. | 700 * keyboard event. |
| 670 * | 701 * |
| 671 * @return A string var representing a single typed character for character | 702 * @return A string var representing a single typed character for character |
| 672 * input events. For non-character input events the return value will be an | 703 * input events. For non-character input events the return value will be an |
| 673 * undefined var. | 704 * undefined var. |
| 674 */ | 705 */ |
| 675 struct PP_Var (*GetCharacterText)(PP_Resource character_event); | 706 struct PP_Var (*GetCharacterText)(PP_Resource character_event); |
| 676 }; | 707 }; |
| 708 |
| 709 /** |
| 710 * The <code>PPB_CompositionInputEvent</code> interface contains pointers to |
| 711 * several functions related to composition input events. |
| 712 */ |
| 713 struct PPB_CompositionInputEvent { |
| 714 /** |
| 715 * IsCompositionInputEvent() determines if a resource is a composition event. |
| 716 * |
| 717 * @param[in] resource A <code>PP_Resource</code> corresponding to an event. |
| 718 * |
| 719 * @return <code>PP_TRUE</code> if the given resource is a valid input event. |
| 720 */ |
| 721 PP_Bool (*IsCompositionInputEvent)(PP_Resource resource); |
| 722 /** |
| 723 * GetText() returns the composition text as a UTF-8 string for the given |
| 724 * composition event. |
| 725 * |
| 726 * @param[in] composition_event A <code>PP_Resource</code> corresponding to a |
| 727 * composition event. |
| 728 * |
| 729 * @return A string var representing the composition text. For non-composition |
| 730 * input events the return value will be an undefined var. |
| 731 */ |
| 732 struct PP_Var (*GetText)(PP_Resource composition_event); |
| 733 /** |
| 734 * GetSegmentNumber() returns the number of segments in the composition text. |
| 735 * |
| 736 * @param[in] composition_event A <code>PP_Resource</code> corresponding to a |
| 737 * composition event. |
| 738 * |
| 739 * @return The number of segments. For events other than COMPOSITION_UPDATE, |
| 740 * returns 0. |
| 741 */ |
| 742 uint32_t (*GetSegmentNumber)(PP_Resource composition_event); |
| 743 /** |
| 744 * GetSegmentAt() returns the start and the end position of the index-th |
| 745 * segment in the composition text. The positions are given by byte-indices of |
| 746 * the string GetText(). They always satisfy 0 <= start < end <= (Length of |
| 747 * GetText()) and start[index] < start[index+1]. When the event is not |
| 748 * COMPOSITION_UPDATE or index >= GetSegmentNumber(), nothing happens. |
| 749 * |
| 750 * @param[in] composition_event A <code>PP_Resource</code> corresponding to a |
| 751 * composition event. |
| 752 * |
| 753 * @param[in] index An integer indicating a segment. |
| 754 * |
| 755 * @param[out] start The start position of the index-th segment. |
| 756 * |
| 757 * @param[out] end The end position of the index-th segment. |
| 758 */ |
| 759 void (*GetSegmentAt)(PP_Resource composition_event, |
| 760 uint32_t index, |
| 761 uint32_t* start, |
| 762 uint32_t* end); |
| 763 /** |
| 764 * GetTargetSegment() returns the index of the current target segment of |
| 765 * composition. |
| 766 * |
| 767 * @param[in] composition_event A <code>PP_Resource</code> corresponding to a |
| 768 * composition event. |
| 769 * |
| 770 * @return An integer indicating the index of the target segment. When there |
| 771 * is no active target segment, or the event is not COMPOSITION_UPDATE, |
| 772 * returns -1. |
| 773 */ |
| 774 int32_t (*GetTargetSegment)(PP_Resource composition_event); |
| 775 /** |
| 776 * GetSelection() returns the range selected by caret in the composition text. |
| 777 * |
| 778 * @param[in] composition_event A <code>PP_Resource</code> corresponding to a |
| 779 * composition event. |
| 780 * |
| 781 * @param[out] start The start position of the current selection. |
| 782 * |
| 783 * @param[out] end The end position of the current selection. |
| 784 */ |
| 785 void (*GetSelection)(PP_Resource composition_event, |
| 786 uint32_t* start, |
| 787 uint32_t* end); |
| 788 }; |
| 789 |
| 790 struct PPB_CompositionInputEvent_1_0 { |
| 791 |
| 792 }; |
| 677 /** | 793 /** |
| 678 * @} | 794 * @} |
| 679 */ | 795 */ |
| 680 | 796 |
| 681 #endif /* PPAPI_C_PPB_INPUT_EVENT_H_ */ | 797 #endif /* PPAPI_C_PPB_INPUT_EVENT_H_ */ |
| 682 | 798 |
| OLD | NEW |