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