Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(195)

Side by Side Diff: ui/base/ime/text_input_client.h

Issue 8491035: Revert 109583 - Move views/ime/text_input_client.h to ui/base/ime/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/renderer_host/render_widget_host_view_views.cc ('k') | ui/ui.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef UI_BASE_IME_TEXT_INPUT_CLIENT_H_
6 #define UI_BASE_IME_TEXT_INPUT_CLIENT_H_
7 #pragma once
8
9 #include "base/basictypes.h"
10 #include "base/i18n/rtl.h"
11 #include "base/string16.h"
12 #include "ui/base/ime/composition_text.h"
13 #include "ui/base/ime/text_input_type.h"
14 #include "ui/base/range/range.h"
15 #include "ui/base/ui_export.h"
16
17 namespace gfx {
18 class Rect;
19 }
20
21 namespace ui {
22
23 // An interface implemented by a View that needs text input support.
24 class UI_EXPORT TextInputClient {
25 public:
26 virtual ~TextInputClient() {}
27
28 // Input method result -------------------------------------------------------
29
30 // Sets composition text and attributes. If there is composition text already,
31 // it’ll be replaced by the new one. Otherwise, current selection will be
32 // replaced. If there is no selection, the composition text will be inserted
33 // at the insertion point.
34 virtual void SetCompositionText(const ui::CompositionText& composition) = 0;
35
36 // Converts current composition text into final content.
37 virtual void ConfirmCompositionText() = 0;
38
39 // Removes current composition text.
40 virtual void ClearCompositionText() = 0;
41
42 // Inserts a given text at the insertion point. Current composition text or
43 // selection will be removed. This method should never be called when the
44 // current text input type is TEXT_INPUT_TYPE_NONE.
45 virtual void InsertText(const string16& text) = 0;
46
47 // Inserts a single char at the insertion point. Unlike above InsertText()
48 // method, this method has an extra |flags| parameter indicating the modifier
49 // key states when the character is generated. This method should only be
50 // called when a key press is not handled by the input method but still
51 // generates a character (eg. by the keyboard driver). In another word, the
52 // preceding key press event should not be a VKEY_PROCESSKEY.
53 // This method will be called whenever a char is generated by the keyboard,
54 // even if the current text input type is TEXT_INPUT_TYPE_NONE.
55 virtual void InsertChar(char16 ch, int flags) = 0;
56
57 // Input context information -------------------------------------------------
58
59 // Returns current text input type. It could be changed and even becomes
60 // TEXT_INPUT_TYPE_NONE at runtime.
61 virtual ui::TextInputType GetTextInputType() const = 0;
62
63 // Returns current caret (insertion point) bounds relative to the View’s
64 // coordinates. If there is selection, then the selection bounds will be
65 // returned.
66 virtual gfx::Rect GetCaretBounds() = 0;
67
68 // Returns true if there is composition text.
69 virtual bool HasCompositionText() = 0;
70
71 // Document content operations ----------------------------------------------
72
73 // Retrieves the UTF-16 based character range containing accessibled text in
74 // the View. It must cover the composition and selection range.
75 // Returns false if the information cannot be retrieved right now.
76 virtual bool GetTextRange(ui::Range* range) = 0;
77
78 // Retrieves the UTF-16 based character range of current composition text.
79 // Returns false if the information cannot be retrieved right now.
80 virtual bool GetCompositionTextRange(ui::Range* range) = 0;
81
82 // Retrieves the UTF-16 based character range of current selection.
83 // Returns false if the information cannot be retrieved right now.
84 virtual bool GetSelectionRange(ui::Range* range) = 0;
85
86 // Selects the given UTF-16 based character range. Current composition text
87 // will be confirmed before selecting the range.
88 // Returns false if the operation is not supported.
89 virtual bool SetSelectionRange(const ui::Range& range) = 0;
90
91 // Deletes contents in the given UTF-16 based character range. Current
92 // composition text will be confirmed before deleting the range.
93 // The input caret will be moved to the place where the range gets deleted.
94 // Returns false if the oepration is not supported.
95 virtual bool DeleteRange(const ui::Range& range) = 0;
96
97 // Retrieves the text content in a given UTF-16 based character range.
98 // The result will be stored into |*text|.
99 // Returns false if the operation is not supported or the specified range
100 // is out of the text range returned by GetTextRange().
101 virtual bool GetTextFromRange(const ui::Range& range, string16* text) = 0;
102
103 // Miscellaneous ------------------------------------------------------------
104
105 // Called whenever current keyboard layout or input method is changed,
106 // especially the change of input locale and text direction.
107 virtual void OnInputMethodChanged() = 0;
108
109 // Called whenever the user requests to change the text direction and layout
110 // alignment of the current text box. It’s for supporting ctrl-shift on
111 // Windows.
112 // Returns false if the operation is not supported.
113 virtual bool ChangeTextDirectionAndLayoutAlignment(
114 base::i18n::TextDirection direction) = 0;
115 };
116
117 } // namespace ui
118
119 #endif // UI_BASE_IME_TEXT_INPUT_CLIENT_H_
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/render_widget_host_view_views.cc ('k') | ui/ui.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698