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 Thu Mar 28 10:51:06 2013. */ | 6 /* From ppb_input_event.idl modified Tue Jul 23 19:23:51 2013. */ |
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" |
(...skipping 11 matching lines...) Expand all Loading... |
28 #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" |
29 #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 |
30 | 30 |
31 #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" |
32 #define PPB_KEYBOARD_INPUT_EVENT_INTERFACE \ | 32 #define PPB_KEYBOARD_INPUT_EVENT_INTERFACE \ |
33 PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_0 | 33 PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_0 |
34 | 34 |
35 #define PPB_TOUCH_INPUT_EVENT_INTERFACE_1_0 "PPB_TouchInputEvent;1.0" | 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 | 36 #define PPB_TOUCH_INPUT_EVENT_INTERFACE PPB_TOUCH_INPUT_EVENT_INTERFACE_1_0 |
37 | 37 |
| 38 #define PPB_IME_INPUT_EVENT_INTERFACE_1_0 "PPB_IMEInputEvent;1.0" |
| 39 #define PPB_IME_INPUT_EVENT_INTERFACE PPB_IME_INPUT_EVENT_INTERFACE_1_0 |
| 40 |
38 /** | 41 /** |
39 * @file | 42 * @file |
40 * This file defines the Input Event interfaces. | 43 * This file defines the Input Event interfaces. |
41 */ | 44 */ |
42 | 45 |
43 | 46 |
44 /** | 47 /** |
45 * @addtogroup Enums | 48 * @addtogroup Enums |
46 * @{ | 49 * @{ |
47 */ | 50 */ |
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
882 * @param[in] touch_id The id of the touch-point. | 885 * @param[in] touch_id The id of the touch-point. |
883 * | 886 * |
884 * @return A <code>PP_TouchPoint</code> representing the touch-point. | 887 * @return A <code>PP_TouchPoint</code> representing the touch-point. |
885 */ | 888 */ |
886 struct PP_TouchPoint (*GetTouchById)(PP_Resource resource, | 889 struct PP_TouchPoint (*GetTouchById)(PP_Resource resource, |
887 PP_TouchListType list, | 890 PP_TouchListType list, |
888 uint32_t touch_id); | 891 uint32_t touch_id); |
889 }; | 892 }; |
890 | 893 |
891 typedef struct PPB_TouchInputEvent_1_0 PPB_TouchInputEvent; | 894 typedef struct PPB_TouchInputEvent_1_0 PPB_TouchInputEvent; |
| 895 |
| 896 struct PPB_IMEInputEvent_1_0 { |
| 897 /** |
| 898 * Create() creates an IME input event with the given parameters. Normally |
| 899 * you will get an IME event passed through the <code>HandleInputEvent</code> |
| 900 * and will not need to create them, but some applications may want to create |
| 901 * their own for internal use. |
| 902 * |
| 903 * @param[in] instance The instance for which this event occurred. |
| 904 * |
| 905 * @param[in] type A <code>PP_InputEvent_Type</code> identifying the type of |
| 906 * input event. The type must be one of the IME event types. |
| 907 * |
| 908 * @param[in] time_stamp A <code>PP_TimeTicks</code> indicating the time |
| 909 * when the event occurred. |
| 910 * |
| 911 * @param[in] text The string returned by <code>GetText</code>. |
| 912 * |
| 913 * @param[in] segment_number The number returned by |
| 914 * <code>GetSegmentNumber</code>. |
| 915 * |
| 916 * @param[in] segment_offsets The array of numbers returned by |
| 917 * <code>GetSegmentOffset</code>. If <code>segment_number</code> is zero, |
| 918 * the number of elements of the array should be zero. If |
| 919 * <code>segment_number</code> is non-zero, the length of the array must be |
| 920 * <code>segment_number</code> + 1. |
| 921 * |
| 922 * @param[in] target_segment The number returned by |
| 923 * <code>GetTargetSegment</code>. |
| 924 * |
| 925 * @param[in] selection_start The start index returned by |
| 926 * <code>GetSelection</code>. |
| 927 * |
| 928 * @param[in] selection_end The end index returned by |
| 929 * <code>GetSelection</code>. |
| 930 * |
| 931 * @return A <code>PP_Resource</code> containing the new IME input event. |
| 932 */ |
| 933 PP_Resource (*Create)(PP_Instance instance, |
| 934 PP_InputEvent_Type type, |
| 935 PP_TimeTicks time_stamp, |
| 936 struct PP_Var text, |
| 937 uint32_t segment_number, |
| 938 const uint32_t segment_offsets[], |
| 939 int32_t target_segment, |
| 940 uint32_t selection_start, |
| 941 uint32_t selection_end); |
| 942 /** |
| 943 * IsIMEInputEvent() determines if a resource is an IME event. |
| 944 * |
| 945 * @param[in] resource A <code>PP_Resource</code> corresponding to an event. |
| 946 * |
| 947 * @return <code>PP_TRUE</code> if the given resource is a valid input event. |
| 948 */ |
| 949 PP_Bool (*IsIMEInputEvent)(PP_Resource resource); |
| 950 /** |
| 951 * GetText() returns the composition text as a UTF-8 string for the given IME |
| 952 * event. |
| 953 * |
| 954 * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME |
| 955 * event. |
| 956 * |
| 957 * @return A string var representing the composition text. For non-IME input |
| 958 * events the return value will be an undefined var. |
| 959 */ |
| 960 struct PP_Var (*GetText)(PP_Resource ime_event); |
| 961 /** |
| 962 * GetSegmentNumber() returns the number of segments in the composition text. |
| 963 * |
| 964 * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME |
| 965 * event. |
| 966 * |
| 967 * @return The number of segments. For events other than COMPOSITION_UPDATE, |
| 968 * returns 0. |
| 969 */ |
| 970 uint32_t (*GetSegmentNumber)(PP_Resource ime_event); |
| 971 /** |
| 972 * GetSegmentOffset() returns the position of the index-th segmentation point |
| 973 * in the composition text. The position is given by a byte-offset (not a |
| 974 * character-offset) of the string returned by GetText(). It always satisfies |
| 975 * 0=GetSegmentOffset(0) < ... < GetSegmentOffset(i) < GetSegmentOffset(i+1) |
| 976 * < ... < GetSegmentOffset(GetSegmentNumber())=(byte-length of GetText()). |
| 977 * Note that [GetSegmentOffset(i), GetSegmentOffset(i+1)) represents the range |
| 978 * of the i-th segment, and hence GetSegmentNumber() can be a valid argument |
| 979 * to this function instead of an off-by-1 error. |
| 980 * |
| 981 * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME |
| 982 * event. |
| 983 * |
| 984 * @param[in] index An integer indicating a segment. |
| 985 * |
| 986 * @return The byte-offset of the segmentation point. If the event is not |
| 987 * COMPOSITION_UPDATE or index is out of range, returns 0. |
| 988 */ |
| 989 uint32_t (*GetSegmentOffset)(PP_Resource ime_event, uint32_t index); |
| 990 /** |
| 991 * GetTargetSegment() returns the index of the current target segment of |
| 992 * composition. |
| 993 * |
| 994 * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME |
| 995 * event. |
| 996 * |
| 997 * @return An integer indicating the index of the target segment. When there |
| 998 * is no active target segment, or the event is not COMPOSITION_UPDATE, |
| 999 * returns -1. |
| 1000 */ |
| 1001 int32_t (*GetTargetSegment)(PP_Resource ime_event); |
| 1002 /** |
| 1003 * GetSelection() returns the range selected by caret in the composition text. |
| 1004 * |
| 1005 * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME |
| 1006 * event. |
| 1007 * |
| 1008 * @param[out] start The start position of the current selection. |
| 1009 * |
| 1010 * @param[out] end The end position of the current selection. |
| 1011 */ |
| 1012 void (*GetSelection)(PP_Resource ime_event, uint32_t* start, uint32_t* end); |
| 1013 }; |
| 1014 |
| 1015 typedef struct PPB_IMEInputEvent_1_0 PPB_IMEInputEvent; |
892 /** | 1016 /** |
893 * @} | 1017 * @} |
894 */ | 1018 */ |
895 | 1019 |
896 #endif /* PPAPI_C_PPB_INPUT_EVENT_H_ */ | 1020 #endif /* PPAPI_C_PPB_INPUT_EVENT_H_ */ |
897 | 1021 |
OLD | NEW |