Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_LINUX_LINUX_INPUT_METHOD_CONTEXT_H_ | 5 #ifndef UI_BASE_IME_LINUX_LINUX_INPUT_METHOD_CONTEXT_H_ |
| 6 #define UI_BASE_IME_LINUX_LINUX_INPUT_METHOD_CONTEXT_H_ | 6 #define UI_BASE_IME_LINUX_LINUX_INPUT_METHOD_CONTEXT_H_ |
| 7 | 7 |
| 8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
| 9 #include "ui/base/ime/text_input_type.h" | 9 #include "ui/base/ime/text_input_type.h" |
| 10 #include "ui/base/ime/ui_base_ime_export.h" | 10 #include "ui/base/ime/ui_base_ime_export.h" |
| 11 | 11 |
| 12 // X forward decls to avoid including Xlib.h in a header file. | |
| 13 typedef unsigned long Window; | |
|
Seigo Nonaka
2015/04/08 07:14:58
Who use this?
Shu Chen
2015/04/08 08:24:12
That is useless, removed.
| |
| 14 | |
| 12 namespace gfx { | 15 namespace gfx { |
| 13 class Rect; | 16 class Rect; |
| 14 } | 17 } |
| 15 | 18 |
| 16 namespace ui { | 19 namespace ui { |
| 17 | 20 |
| 18 struct CompositionText; | 21 struct CompositionText; |
| 19 class KeyEvent; | 22 class KeyEvent; |
| 20 | 23 |
| 21 // An interface of input method context for input method frameworks on | 24 // An interface of input method context for input method frameworks on |
| 22 // GNU/Linux and likes. | 25 // GNU/Linux and likes. |
| 23 class UI_BASE_IME_EXPORT LinuxInputMethodContext { | 26 class UI_BASE_IME_EXPORT LinuxInputMethodContext { |
| 24 public: | 27 public: |
| 25 virtual ~LinuxInputMethodContext() {} | 28 virtual ~LinuxInputMethodContext() {} |
| 26 | 29 |
| 27 // Dispatches the key event to an underlying IME. Returns true if the key | 30 // Dispatches the key event to an underlying IME. Returns true if the key |
| 28 // event is handled, otherwise false. A client must set the text input type | 31 // event is handled, otherwise false. A client must set the text input type |
| 29 // before dispatching a key event. | 32 // before dispatching a key event. |
| 30 virtual bool DispatchKeyEvent(const ui::KeyEvent& key_event) = 0; | 33 virtual bool DispatchKeyEvent(const ui::KeyEvent& key_event) = 0; |
| 31 | 34 |
| 35 // Tells the system IME for the cursor rect which is relative to the | |
| 36 // client window rect. | |
| 37 virtual void SetCursorLocation(const gfx::Rect& rect) = 0; | |
| 38 | |
| 32 // Resets the context. A client needs to call OnTextInputTypeChanged() again | 39 // Resets the context. A client needs to call OnTextInputTypeChanged() again |
| 33 // before calling DispatchKeyEvent(). | 40 // before calling DispatchKeyEvent(). |
| 34 virtual void Reset() = 0; | 41 virtual void Reset() = 0; |
| 35 | 42 |
| 36 // Notifies the context that the text input type has changed. | 43 // Focus the context. |
|
Seigo Nonaka
2015/04/08 07:14:58
nit: Focuses
Shu Chen
2015/04/08 08:24:12
Done.
| |
| 37 virtual void OnTextInputTypeChanged(TextInputType text_input_type) = 0; | 44 virtual void Focus() = 0; |
| 38 | 45 |
| 39 // Notifies the context that the caret bounds have changed. |caret_bounds| is | 46 // Blurs the context. |
| 40 // relative to screen coordinates. | 47 virtual void Blur() = 0; |
| 41 virtual void OnCaretBoundsChanged(const gfx::Rect& caret_bounds) = 0; | |
| 42 }; | 48 }; |
| 43 | 49 |
| 44 // An interface of callback functions called from LinuxInputMethodContext. | 50 // An interface of callback functions called from LinuxInputMethodContext. |
| 45 class UI_BASE_IME_EXPORT LinuxInputMethodContextDelegate { | 51 class UI_BASE_IME_EXPORT LinuxInputMethodContextDelegate { |
| 46 public: | 52 public: |
| 47 virtual ~LinuxInputMethodContextDelegate() {} | 53 virtual ~LinuxInputMethodContextDelegate() {} |
| 48 | 54 |
| 49 // Commits the |text| to the text input client. | 55 // Commits the |text| to the text input client. |
| 50 virtual void OnCommit(const base::string16& text) = 0; | 56 virtual void OnCommit(const base::string16& text) = 0; |
| 51 | 57 |
| 52 // Sets the composition text to the text input client. | 58 // Sets the composition text to the text input client. |
| 53 virtual void OnPreeditChanged(const CompositionText& composition_text) = 0; | 59 virtual void OnPreeditChanged(const CompositionText& composition_text) = 0; |
| 54 | 60 |
| 55 // Cleans up a composition session and makes sure that the composition text is | 61 // Cleans up a composition session and makes sure that the composition text is |
| 56 // cleared. | 62 // cleared. |
| 57 virtual void OnPreeditEnd() = 0; | 63 virtual void OnPreeditEnd() = 0; |
| 58 | 64 |
| 59 // Prepares things for a new composition session. | 65 // Prepares things for a new composition session. |
| 60 virtual void OnPreeditStart() = 0; | 66 virtual void OnPreeditStart() = 0; |
| 61 }; | 67 }; |
| 62 | 68 |
| 63 } // namespace ui | 69 } // namespace ui |
| 64 | 70 |
| 65 #endif // UI_BASE_IME_LINUX_LINUX_INPUT_METHOD_CONTEXT_H_ | 71 #endif // UI_BASE_IME_LINUX_LINUX_INPUT_METHOD_CONTEXT_H_ |
| OLD | NEW |