summaryrefslogtreecommitdiffstats
path: root/ppapi/api/dev/ppb_ime_input_event_dev.idl
blob: 689900848d9c657fce9813f8f1a333880dd7166a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/* Copyright (c) 2011 The Chromium Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

/**
 * This file defines the <code>PPB_IMEInputEvent_Dev</code> interface.
 */

label Chrome {
  M16 = 0.1
};

[version=0.1, macro="PPB_IME_INPUT_EVENT_DEV_INTERFACE"]
interface PPB_IMEInputEvent_Dev {
  /**
   * IsIMEInputEvent() determines if a resource is an IME event.
   *
   * @param[in] resource A <code>PP_Resource</code> corresponding to an event.
   *
   * @return <code>PP_TRUE</code> if the given resource is a valid input event.
   */
  PP_Bool IsIMEInputEvent([in] PP_Resource resource);

  /**
   * GetText() returns the composition text as a UTF-8 string for the given IME
   * event.
   *
   * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME
   * event.
   *
   * @return A string var representing the composition text. For non-IME input
   * events the return value will be an undefined var.
   */
  PP_Var GetText([in] PP_Resource ime_event);

  /**
   * GetSegmentNumber() returns the number of segments in the composition text.
   *
   * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME
   * event.
   *
   * @return The number of segments. For events other than COMPOSITION_UPDATE,
   * returns 0.
   */
  uint32_t GetSegmentNumber([in] PP_Resource ime_event);

  /**
   * GetSegmentAt() returns the start and the end position of the index-th
   * segment in the composition text. The positions are given by byte-offsets
   * (not character-offsets) of the string returned by GetText(). The range of
   * the segment extends from start (inclusive) to end (exclusive). They satisfy
   * 0 <= start < end <= (byte-length of GetText()). When the event is not
   * COMPOSITION_UPDATE or index >= GetSegmentNumber(), the function returns
   * PP_FALSE and nothing else happens.
   *
   * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME
   * event.
   *
   * @param[in] index An integer indicating a segment.
   *
   * @param[out] start The start position of the index-th segment.
   *
   * @param[out] end The end position of the index-th segment.
   *
   * @return PP_TRUE when the start and the end position is successfully
   * obtained, and PP_FALSE otherwise.
   */
  PP_Bool GetSegmentAt([in] PP_Resource ime_event,
                       [in] uint32_t index,
                       [out] uint32_t start,
                       [out] uint32_t end);

  /**
   * GetTargetSegment() returns the index of the current target segment of
   * composition.
   *
   * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME
   * event.
   *
   * @return An integer indicating the index of the target segment. When there
   * is no active target segment, or the event is not COMPOSITION_UPDATE,
   * returns -1.
   */
  int32_t GetTargetSegment([in] PP_Resource ime_event);

  /**
   * GetSelection() returns the range selected by caret in the composition text.
   *
   * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME
   * event.
   *
   * @param[out] start The start position of the current selection.
   *
   * @param[out] end The end position of the current selection.
   */
  void GetSelection([in] PP_Resource ime_event,
                    [out] uint32_t start,
                    [out] uint32_t end);
};