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 UI_BASE_IME_TEXT_INPUT_CLIENT_H_ | 5 #ifndef UI_BASE_IME_TEXT_INPUT_CLIENT_H_ |
6 #define UI_BASE_IME_TEXT_INPUT_CLIENT_H_ | 6 #define UI_BASE_IME_TEXT_INPUT_CLIENT_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 // TEXT_INPUT_TYPE_NONE at runtime. | 64 // TEXT_INPUT_TYPE_NONE at runtime. |
65 virtual ui::TextInputType GetTextInputType() const = 0; | 65 virtual ui::TextInputType GetTextInputType() const = 0; |
66 | 66 |
67 // Returns current text input mode. It could be changed and even becomes | 67 // Returns current text input mode. It could be changed and even becomes |
68 // TEXT_INPUT_MODE_DEFAULT at runtime. | 68 // TEXT_INPUT_MODE_DEFAULT at runtime. |
69 virtual ui::TextInputMode GetTextInputMode() const = 0; | 69 virtual ui::TextInputMode GetTextInputMode() const = 0; |
70 | 70 |
71 // Returns if the client supports inline composition currently. | 71 // Returns if the client supports inline composition currently. |
72 virtual bool CanComposeInline() const = 0; | 72 virtual bool CanComposeInline() const = 0; |
73 | 73 |
74 // Returns current caret (insertion point) bounds relative to the screen | 74 // Returns current caret (insertion point) bounds in the universal screen |
75 // coordinates. If there is selection, then the selection bounds will be | 75 // coordinates. If there is selection, then the selection bounds will be |
76 // returned. | 76 // returned. |
| 77 // Note: On Windows, the returned value is supposed to be DIP (Density |
| 78 // Independent Pixel). |
| 79 // TODO(ime): Have a clear spec whether the returned value is DIP or not. |
| 80 // http://crbug.com/360334 |
77 virtual gfx::Rect GetCaretBounds() const = 0; | 81 virtual gfx::Rect GetCaretBounds() const = 0; |
78 | 82 |
79 // Retrieves the composition character boundary rectangle relative to the | 83 // Retrieves the composition character boundary rectangle in the universal |
80 // screen coordinates. The |index| is zero-based index of character position | 84 // screen coordinates. The |index| is zero-based index of character position |
81 // in composition text. | 85 // in composition text. |
82 // Returns false if there is no composition text or |index| is out of range. | 86 // Returns false if there is no composition text or |index| is out of range. |
83 // The |rect| is not touched in the case of failure. | 87 // The |rect| is not touched in the case of failure. |
| 88 // Note: On Windows, the returned value is supposed to be DIP |
| 89 // (Density Independent Pixel). |
| 90 // TODO(ime): Have a clear spec whether the returned value is DIP or not. |
| 91 // http://crbug.com/360334 |
84 virtual bool GetCompositionCharacterBounds(uint32 index, | 92 virtual bool GetCompositionCharacterBounds(uint32 index, |
85 gfx::Rect* rect) const = 0; | 93 gfx::Rect* rect) const = 0; |
86 | 94 |
87 // Returns true if there is composition text. | 95 // Returns true if there is composition text. |
88 virtual bool HasCompositionText() const = 0; | 96 virtual bool HasCompositionText() const = 0; |
89 | 97 |
90 // Document content operations ---------------------------------------------- | 98 // Document content operations ---------------------------------------------- |
91 | 99 |
92 // Retrieves the UTF-16 based character range containing accessibled text in | 100 // Retrieves the UTF-16 based character range containing accessibled text in |
93 // the View. It must cover the composition and selection range. | 101 // the View. It must cover the composition and selection range. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 147 |
140 // Deletes the current selection plus the specified number of characters | 148 // Deletes the current selection plus the specified number of characters |
141 // before and after the selection or caret. This function should be used | 149 // before and after the selection or caret. This function should be used |
142 // instead of calling DeleteRange with GetSelectionRange, because | 150 // instead of calling DeleteRange with GetSelectionRange, because |
143 // GetSelectionRange may not be the latest value due to asynchronous of IPC | 151 // GetSelectionRange may not be the latest value due to asynchronous of IPC |
144 // between browser and renderer. | 152 // between browser and renderer. |
145 virtual void ExtendSelectionAndDelete(size_t before, size_t after) = 0; | 153 virtual void ExtendSelectionAndDelete(size_t before, size_t after) = 0; |
146 | 154 |
147 // Ensure the caret is within |rect|. |rect| is in screen coordinates and | 155 // Ensure the caret is within |rect|. |rect| is in screen coordinates and |
148 // may extend beyond the bounds of this TextInputClient. | 156 // may extend beyond the bounds of this TextInputClient. |
| 157 // Note: On Windows, the returned value is supposed to be DIP (Density |
| 158 // Independent Pixel). |
| 159 // TODO(ime): Have a clear spec whether the returned value is DIP or not. |
| 160 // http://crbug.com/360334 |
149 virtual void EnsureCaretInRect(const gfx::Rect& rect) = 0; | 161 virtual void EnsureCaretInRect(const gfx::Rect& rect) = 0; |
150 | 162 |
151 // Called when IME shows a candidate window. | 163 // Called when IME shows a candidate window. |
152 virtual void OnCandidateWindowShown() = 0; | 164 virtual void OnCandidateWindowShown() = 0; |
153 // Called when IME updates any appearance of the current candidate window. | 165 // Called when IME updates any appearance of the current candidate window. |
154 virtual void OnCandidateWindowUpdated() = 0; | 166 virtual void OnCandidateWindowUpdated() = 0; |
155 // Called when IME hides the candidate window. | 167 // Called when IME hides the candidate window. |
156 virtual void OnCandidateWindowHidden() = 0; | 168 virtual void OnCandidateWindowHidden() = 0; |
157 }; | 169 }; |
158 | 170 |
159 } // namespace ui | 171 } // namespace ui |
160 | 172 |
161 #endif // UI_BASE_IME_TEXT_INPUT_CLIENT_H_ | 173 #endif // UI_BASE_IME_TEXT_INPUT_CLIENT_H_ |
OLD | NEW |