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 /** | 6 /** |
7 * This file defines the Input Event interfaces. | 7 * This file defines the Input Event interfaces. |
8 */ | 8 */ |
9 | 9 |
10 label Chrome { | 10 label Chrome { |
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 * @param[in] list The list. | 898 * @param[in] list The list. |
899 * | 899 * |
900 * @param[in] touch_id The id of the touch-point. | 900 * @param[in] touch_id The id of the touch-point. |
901 * | 901 * |
902 * @return A <code>PP_TouchPoint</code> representing the touch-point. | 902 * @return A <code>PP_TouchPoint</code> representing the touch-point. |
903 */ | 903 */ |
904 PP_TouchPoint GetTouchById([in] PP_Resource resource, | 904 PP_TouchPoint GetTouchById([in] PP_Resource resource, |
905 [in] PP_TouchListType list, | 905 [in] PP_TouchListType list, |
906 [in] uint32_t touch_id); | 906 [in] uint32_t touch_id); |
907 }; | 907 }; |
| 908 |
| 909 [macro="PPB_IME_INPUT_EVENT_INTERFACE"] |
| 910 interface PPB_IMEInputEvent { |
| 911 /** |
| 912 * Create() creates an IME input event with the given parameters. Normally |
| 913 * you will get an IME event passed through the <code>HandleInputEvent</code> |
| 914 * and will not need to create them, but some applications may want to create |
| 915 * their own for internal use. |
| 916 * |
| 917 * @param[in] instance The instance for which this event occurred. |
| 918 * |
| 919 * @param[in] type A <code>PP_InputEvent_Type</code> identifying the type of |
| 920 * input event. The type must be one of the IME event types. |
| 921 * |
| 922 * @param[in] time_stamp A <code>PP_TimeTicks</code> indicating the time |
| 923 * when the event occurred. |
| 924 * |
| 925 * @param[in] text The string returned by <code>GetText</code>. |
| 926 * |
| 927 * @param[in] segment_number The number returned by |
| 928 * <code>GetSegmentNumber</code>. |
| 929 * |
| 930 * @param[in] segment_offsets The array of numbers returned by |
| 931 * <code>GetSegmentOffset</code>. If <code>segment_number</code> is zero, |
| 932 * the number of elements of the array should be zero. If |
| 933 * <code>segment_number</code> is non-zero, the length of the array must be |
| 934 * <code>segment_number</code> + 1. |
| 935 * |
| 936 * @param[in] target_segment The number returned by |
| 937 * <code>GetTargetSegment</code>. |
| 938 * |
| 939 * @param[in] selection_start The start index returned by |
| 940 * <code>GetSelection</code>. |
| 941 * |
| 942 * @param[in] selection_end The end index returned by |
| 943 * <code>GetSelection</code>. |
| 944 * |
| 945 * @return A <code>PP_Resource</code> containing the new IME input event. |
| 946 */ |
| 947 PP_Resource Create([in] PP_Instance instance, |
| 948 [in] PP_InputEvent_Type type, |
| 949 [in] PP_TimeTicks time_stamp, |
| 950 [in] PP_Var text, |
| 951 [in] uint32_t segment_number, |
| 952 [in] uint32_t[] segment_offsets, |
| 953 [in] int32_t target_segment, |
| 954 [in] uint32_t selection_start, |
| 955 [in] uint32_t selection_end); |
| 956 |
| 957 /** |
| 958 * IsIMEInputEvent() determines if a resource is an IME event. |
| 959 * |
| 960 * @param[in] resource A <code>PP_Resource</code> corresponding to an event. |
| 961 * |
| 962 * @return <code>PP_TRUE</code> if the given resource is a valid input event. |
| 963 */ |
| 964 PP_Bool IsIMEInputEvent([in] PP_Resource resource); |
| 965 |
| 966 /** |
| 967 * GetText() returns the composition text as a UTF-8 string for the given IME |
| 968 * event. |
| 969 * |
| 970 * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME |
| 971 * event. |
| 972 * |
| 973 * @return A string var representing the composition text. For non-IME input |
| 974 * events the return value will be an undefined var. |
| 975 */ |
| 976 PP_Var GetText([in] PP_Resource ime_event); |
| 977 |
| 978 /** |
| 979 * GetSegmentNumber() returns the number of segments in the composition text. |
| 980 * |
| 981 * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME |
| 982 * event. |
| 983 * |
| 984 * @return The number of segments. For events other than COMPOSITION_UPDATE, |
| 985 * returns 0. |
| 986 */ |
| 987 uint32_t GetSegmentNumber([in] PP_Resource ime_event); |
| 988 |
| 989 /** |
| 990 * GetSegmentOffset() returns the position of the index-th segmentation point |
| 991 * in the composition text. The position is given by a byte-offset (not a |
| 992 * character-offset) of the string returned by GetText(). It always satisfies |
| 993 * 0=GetSegmentOffset(0) < ... < GetSegmentOffset(i) < GetSegmentOffset(i+1) |
| 994 * < ... < GetSegmentOffset(GetSegmentNumber())=(byte-length of GetText()). |
| 995 * Note that [GetSegmentOffset(i), GetSegmentOffset(i+1)) represents the range |
| 996 * of the i-th segment, and hence GetSegmentNumber() can be a valid argument |
| 997 * to this function instead of an off-by-1 error. |
| 998 * |
| 999 * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME |
| 1000 * event. |
| 1001 * |
| 1002 * @param[in] index An integer indicating a segment. |
| 1003 * |
| 1004 * @return The byte-offset of the segmentation point. If the event is not |
| 1005 * COMPOSITION_UPDATE or index is out of range, returns 0. |
| 1006 */ |
| 1007 uint32_t GetSegmentOffset([in] PP_Resource ime_event, |
| 1008 [in] uint32_t index); |
| 1009 |
| 1010 /** |
| 1011 * GetTargetSegment() returns the index of the current target segment of |
| 1012 * composition. |
| 1013 * |
| 1014 * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME |
| 1015 * event. |
| 1016 * |
| 1017 * @return An integer indicating the index of the target segment. When there |
| 1018 * is no active target segment, or the event is not COMPOSITION_UPDATE, |
| 1019 * returns -1. |
| 1020 */ |
| 1021 int32_t GetTargetSegment([in] PP_Resource ime_event); |
| 1022 |
| 1023 /** |
| 1024 * GetSelection() returns the range selected by caret in the composition text. |
| 1025 * |
| 1026 * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME |
| 1027 * event. |
| 1028 * |
| 1029 * @param[out] start The start position of the current selection. |
| 1030 * |
| 1031 * @param[out] end The end position of the current selection. |
| 1032 */ |
| 1033 void GetSelection([in] PP_Resource ime_event, |
| 1034 [out] uint32_t start, |
| 1035 [out] uint32_t end); |
| 1036 }; |
OLD | NEW |