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 #ifndef PPAPI_CPP_DEV_IME_INPUT_EVENT_DEV_H_ | 5 #ifndef PPAPI_CPP_DEV_IME_INPUT_EVENT_DEV_H_ |
6 #define PPAPI_CPP_DEV_IME_INPUT_EVENT_DEV_H_ | 6 #define PPAPI_CPP_DEV_IME_INPUT_EVENT_DEV_H_ |
7 | 7 |
8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> |
9 | 10 |
10 #include "ppapi/c/dev/ppb_ime_input_event_dev.h" | 11 #include "ppapi/c/dev/ppb_ime_input_event_dev.h" |
11 #include "ppapi/cpp/input_event.h" | 12 #include "ppapi/cpp/input_event.h" |
12 | 13 |
13 /// @file | 14 /// @file |
14 /// This file defines the API used to handle IME input events. | 15 /// This file defines the API used to handle IME input events. |
15 | 16 |
16 namespace pp { | 17 namespace pp { |
17 | 18 |
18 class Var; | 19 class Var; |
19 | 20 |
20 class IMEInputEvent_Dev : public InputEvent { | 21 class IMEInputEvent_Dev : public InputEvent { |
21 public: | 22 public: |
22 /// Constructs an is_null() IME input event object. | 23 /// Constructs an is_null() IME input event object. |
23 IMEInputEvent_Dev(); | 24 IMEInputEvent_Dev(); |
24 | 25 |
25 /// Constructs an IME input event object from the provided generic input | 26 /// Constructs an IME input event object from the provided generic input |
26 /// event. If the given event is itself is_null() or is not an IME input | 27 /// event. If the given event is itself is_null() or is not an IME input |
27 /// event, the object will be is_null(). | 28 /// event, the object will be is_null(). |
28 /// | 29 /// |
29 /// @param[in] event A generic input event. | 30 /// @param[in] event A generic input event. |
30 explicit IMEInputEvent_Dev(const InputEvent& event); | 31 explicit IMEInputEvent_Dev(const InputEvent& event); |
31 | 32 |
| 33 /// This constructor manually constructs an IME event from the provided |
| 34 /// parameters. |
| 35 /// |
| 36 /// @param[in] instance The instance for which this event occurred. |
| 37 /// |
| 38 /// @param[in] type A <code>PP_InputEvent_Type</code> identifying the type of |
| 39 /// input event. The type must be one of the ime event types. |
| 40 /// |
| 41 /// @param[in] time_stamp A <code>PP_TimeTicks</code> indicating the time |
| 42 /// when the event occurred. |
| 43 /// |
| 44 /// @param[in] text The string returned by <code>GetText</code>. |
| 45 /// |
| 46 /// @param[in] segment_offsets The array of numbers returned by |
| 47 /// <code>GetSegmentOffset</code>. |
| 48 /// |
| 49 /// @param[in] target_segment The number returned by |
| 50 /// <code>GetTargetSegment</code>. |
| 51 /// |
| 52 /// @param[in] selection The range returned by <code>GetSelection</code>. |
| 53 IMEInputEvent_Dev(const InstanceHandle& instance, |
| 54 PP_InputEvent_Type type, |
| 55 PP_TimeTicks time_stamp, |
| 56 Var text, |
| 57 const std::vector<uint32_t>& segment_offsets, |
| 58 int32_t target_segment, |
| 59 const std::pair<uint32_t, uint32_t>& selection); |
| 60 |
32 /// Returns the composition text as a UTF-8 string for the given IME event. | 61 /// Returns the composition text as a UTF-8 string for the given IME event. |
33 /// | 62 /// |
34 /// @return A string var representing the composition text. For non-IME | 63 /// @return A string var representing the composition text. For non-IME |
35 /// input events the return value will be an undefined var. | 64 /// input events the return value will be an undefined var. |
36 Var GetText() const; | 65 Var GetText() const; |
37 | 66 |
38 /// Returns the number of segments in the composition text. | 67 /// Returns the number of segments in the composition text. |
39 /// | 68 /// |
40 /// @return The number of segments. For events other than COMPOSITION_UPDATE, | 69 /// @return The number of segments. For events other than COMPOSITION_UPDATE, |
41 /// returns 0. | 70 /// returns 0. |
(...skipping 26 matching lines...) Expand all Loading... |
68 | 97 |
69 /// Returns the range selected by caret in the composition text. | 98 /// Returns the range selected by caret in the composition text. |
70 /// | 99 /// |
71 /// @return A pair of integers indicating the selection range. | 100 /// @return A pair of integers indicating the selection range. |
72 std::pair<uint32_t, uint32_t> GetSelection() const; | 101 std::pair<uint32_t, uint32_t> GetSelection() const; |
73 }; | 102 }; |
74 | 103 |
75 } // namespace pp | 104 } // namespace pp |
76 | 105 |
77 #endif // PPAPI_CPP_DEV_IME_INPUT_EVENT_DEV_H_ | 106 #endif // PPAPI_CPP_DEV_IME_INPUT_EVENT_DEV_H_ |
OLD | NEW |