Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(431)

Side by Side Diff: ppapi/c/dev/ppb_ime_input_event_dev.h

Issue 7882004: Declarations for Pepper IME API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clarified the specification of GetSegmentAt(). Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 * found in the LICENSE file.
4 */
5
6 /* From dev/ppb_ime_input_event_dev.idl modified Thu Sep 15 17:06:09 2011. */
7
8 #ifndef PPAPI_C_DEV_PPB_IME_INPUT_EVENT_DEV_H_
9 #define PPAPI_C_DEV_PPB_IME_INPUT_EVENT_DEV_H_
10
11 #include "ppapi/c/pp_bool.h"
12 #include "ppapi/c/pp_macros.h"
13 #include "ppapi/c/pp_resource.h"
14 #include "ppapi/c/pp_stdint.h"
15 #include "ppapi/c/pp_var.h"
16
17 #define PPB_IME_INPUT_EVENT_DEV_INTERFACE_0_1 "PPB_IMEInputEvent(Dev);0.1"
18 #define PPB_IME_INPUT_EVENT_DEV_INTERFACE PPB_IME_INPUT_EVENT_DEV_INTERFACE_0_1
19
20 /**
21 * @file
22 * This file defines the <code>PPB_IMEInputEvent_Dev</code> interface.
23 */
24
25
26 /**
27 * @addtogroup Interfaces
28 * @{
29 */
30 struct PPB_IMEInputEvent_Dev {
31 /**
32 * IsIMEInputEvent() determines if a resource is an IME event.
33 *
34 * @param[in] resource A <code>PP_Resource</code> corresponding to an event.
35 *
36 * @return <code>PP_TRUE</code> if the given resource is a valid input event.
37 */
38 PP_Bool (*IsIMEInputEvent)(PP_Resource resource);
39 /**
40 * GetText() returns the composition text as a UTF-8 string for the given IME
41 * event.
42 *
43 * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME
44 * event.
45 *
46 * @return A string var representing the composition text. For non-IME input
47 * events the return value will be an undefined var.
48 */
49 struct PP_Var (*GetText)(PP_Resource ime_event);
50 /**
51 * GetSegmentNumber() returns the number of segments in the composition text.
52 *
53 * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME
54 * event.
55 *
56 * @return The number of segments. For events other than COMPOSITION_UPDATE,
57 * returns 0.
58 */
59 uint32_t (*GetSegmentNumber)(PP_Resource ime_event);
60 /**
61 * GetSegmentAt() returns the start and the end position of the index-th
62 * segment in the composition text. The positions are given by byte-offsets
63 * (not character-offsets) of the string returned by GetText(). The range of
64 * the segment extends from start (inclusive) to end (exclusive). They satisfy
65 * 0 <= start < end <= (byte-length of GetText()). When the event is not
66 * COMPOSITION_UPDATE or index >= GetSegmentNumber(), the function returns
67 * PP_FALSE and nothing else happens.
68 *
69 * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME
70 * event.
71 *
72 * @param[in] index An integer indicating a segment.
73 *
74 * @param[out] start The start position of the index-th segment.
75 *
76 * @param[out] end The end position of the index-th segment.
77 *
78 * @return PP_TRUE when the start and the end position is successfully
79 * obtained, and PP_FALSE otherwise.
80 */
81 PP_Bool (*GetSegmentAt)(PP_Resource ime_event,
82 uint32_t index,
83 uint32_t* start,
84 uint32_t* end);
85 /**
86 * GetTargetSegment() returns the index of the current target segment of
87 * composition.
88 *
89 * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME
90 * event.
91 *
92 * @return An integer indicating the index of the target segment. When there
93 * is no active target segment, or the event is not COMPOSITION_UPDATE,
94 * returns -1.
95 */
96 int32_t (*GetTargetSegment)(PP_Resource ime_event);
97 /**
98 * GetSelection() returns the range selected by caret in the composition text.
99 *
100 * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME
101 * event.
102 *
103 * @param[out] start The start position of the current selection.
104 *
105 * @param[out] end The end position of the current selection.
106 */
107 void (*GetSelection)(PP_Resource ime_event, uint32_t* start, uint32_t* end);
108 };
109 /**
110 * @}
111 */
112
113 #endif /* PPAPI_C_DEV_PPB_IME_INPUT_EVENT_DEV_H_ */
114
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698