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_VIEWS_IME_INPUT_METHOD_H_ | 5 #ifndef UI_VIEWS_IME_INPUT_METHOD_H_ |
6 #define UI_VIEWS_IME_INPUT_METHOD_H_ | 6 #define UI_VIEWS_IME_INPUT_METHOD_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/i18n/rtl.h" | 11 #include "base/i18n/rtl.h" |
12 #include "ui/base/ime/text_input_type.h" | 12 #include "ui/base/ime/text_input_type.h" |
13 #include "ui/views/views_export.h" | 13 #include "ui/views/views_export.h" |
14 | 14 |
15 namespace ui { | 15 namespace ui { |
| 16 class KeyEvent; |
16 class TextInputClient; | 17 class TextInputClient; |
17 } // namespace ui | 18 } // namespace ui |
18 | 19 |
19 namespace views { | 20 namespace views { |
20 | 21 |
21 namespace internal { | 22 namespace internal { |
22 class InputMethodDelegate; | 23 class InputMethodDelegate; |
23 } // namespace internal | 24 } // namespace internal |
24 | 25 |
25 class KeyEvent; | |
26 class View; | 26 class View; |
27 class Widget; | 27 class Widget; |
28 | 28 |
29 // An interface implemented by an object that encapsulates a native input method | 29 // An interface implemented by an object that encapsulates a native input method |
30 // service provided by the underlying operation system. | 30 // service provided by the underlying operation system. |
31 // Because on most systems, the system input method service is bound to | 31 // Because on most systems, the system input method service is bound to |
32 // individual native window. On Windows, its HWND, on Aura, its | 32 // individual native window. On Windows, its HWND, on Aura, its |
33 // ui::aura::Window. And in Views control system, only the top-level | 33 // ui::aura::Window. And in Views control system, only the top-level |
34 // NativeWidget has a native window that can get keyboard focus. So this API is | 34 // NativeWidget has a native window that can get keyboard focus. So this API is |
35 // designed to be bound to the top-level NativeWidget. | 35 // designed to be bound to the top-level NativeWidget. |
(...skipping 17 matching lines...) Expand all Loading... |
53 // Called when the top-level NativeWidget loses keyboard focus. It should only | 53 // Called when the top-level NativeWidget loses keyboard focus. It should only |
54 // be called by the top-level NativeWidget which owns this InputMethod | 54 // be called by the top-level NativeWidget which owns this InputMethod |
55 // instance. | 55 // instance. |
56 virtual void OnBlur() = 0; | 56 virtual void OnBlur() = 0; |
57 | 57 |
58 // Dispatch a key event to the input method. The key event will be dispatched | 58 // Dispatch a key event to the input method. The key event will be dispatched |
59 // back to the caller via InputMethodDelegate::DispatchKeyEventPostIME(), once | 59 // back to the caller via InputMethodDelegate::DispatchKeyEventPostIME(), once |
60 // it's processed by the input method. It should only be called by the | 60 // it's processed by the input method. It should only be called by the |
61 // top-level NativeWidget which owns this InputMethod instance, or other | 61 // top-level NativeWidget which owns this InputMethod instance, or other |
62 // related platform dependent code, such as a message dispatcher. | 62 // related platform dependent code, such as a message dispatcher. |
63 virtual void DispatchKeyEvent(const KeyEvent& key) = 0; | 63 virtual void DispatchKeyEvent(const ui::KeyEvent& key) = 0; |
64 | 64 |
65 // Called by the focused |view| whenever its text input type is changed. | 65 // Called by the focused |view| whenever its text input type is changed. |
66 // Before calling this method, the focused |view| must confirm or clear | 66 // Before calling this method, the focused |view| must confirm or clear |
67 // existing composition text and call InputMethod::CancelComposition() when | 67 // existing composition text and call InputMethod::CancelComposition() when |
68 // necessary. Otherwise unexpected behavior may happen. This method has no | 68 // necessary. Otherwise unexpected behavior may happen. This method has no |
69 // effect if the |view| is not focused. | 69 // effect if the |view| is not focused. |
70 virtual void OnTextInputTypeChanged(View* view) = 0; | 70 virtual void OnTextInputTypeChanged(View* view) = 0; |
71 | 71 |
72 // Called by the focused |view| whenever its caret bounds is changed. | 72 // Called by the focused |view| whenever its caret bounds is changed. |
73 // This method has no effect if the |view| is not focused. | 73 // This method has no effect if the |view| is not focused. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 106 |
107 // Returns true if the input method is a mock and not real. | 107 // Returns true if the input method is a mock and not real. |
108 virtual bool IsMock() const = 0; | 108 virtual bool IsMock() const = 0; |
109 | 109 |
110 // TODO(suzhe): Support mouse/touch event. | 110 // TODO(suzhe): Support mouse/touch event. |
111 }; | 111 }; |
112 | 112 |
113 } // namespace views | 113 } // namespace views |
114 | 114 |
115 #endif // UI_VIEWS_IME_INPUT_METHOD_H_ | 115 #endif // UI_VIEWS_IME_INPUT_METHOD_H_ |
OLD | NEW |