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

Side by Side Diff: views/ime/input_method_base.h

Issue 8581003: views: Move ime and test directories to ui/views. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix linux 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 | « views/ime/input_method.h ('k') | views/ime/input_method_base.cc » ('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 VIEWS_IME_INPUT_METHOD_BASE_H_
6 #define VIEWS_IME_INPUT_METHOD_BASE_H_
7 #pragma once
8
9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h"
11 #include "views/focus/focus_manager.h"
12 #include "views/ime/input_method.h"
13 #include "views/ime/input_method_delegate.h"
14
15 namespace gfx {
16 class Rect;
17 } // namespace gfx
18
19 namespace ui {
20 class TextInputClient;
21 } // namespace ui
22
23 namespace views {
24
25 class View;
26
27 // A helper class providing functionalities shared among InputMethod
28 // implementations.
29 class VIEWS_EXPORT InputMethodBase : public InputMethod,
30 public FocusChangeListener {
31 public:
32 InputMethodBase();
33 virtual ~InputMethodBase();
34
35 // Overriden from InputMethod.
36 virtual void set_delegate(internal::InputMethodDelegate* delegate) OVERRIDE;
37
38 // If a derived class overrides this method, it should call parent's
39 // implementation first.
40 virtual void Init(Widget* widget) OVERRIDE;
41
42 // If a derived class overrides this method, it should call parent's
43 // implementation first, to make sure |widget_focused_| flag can be updated
44 // correctly.
45 virtual void OnFocus() OVERRIDE;
46
47 // If a derived class overrides this method, it should call parent's
48 // implementation first, to make sure |widget_focused_| flag can be updated
49 // correctly.
50 virtual void OnBlur() OVERRIDE;
51
52 // If a derived class overrides this method, it should call parent's
53 // implementation.
54 virtual void OnTextInputTypeChanged(View* view) OVERRIDE;
55
56 virtual ui::TextInputClient* GetTextInputClient() const OVERRIDE;
57 virtual ui::TextInputType GetTextInputType() const OVERRIDE;
58 virtual bool IsMock() const OVERRIDE;
59
60 // Overridden from FocusChangeListener.
61 virtual void OnWillChangeFocus(View* focused_before, View* focused) OVERRIDE;
62 virtual void OnDidChangeFocus(View* focused_before, View* focused) OVERRIDE;
63
64 protected:
65 // Getters and setters of properties.
66 internal::InputMethodDelegate* delegate() const { return delegate_; }
67 Widget* widget() const { return widget_; }
68 bool widget_focused() const { return widget_focused_; }
69 View* GetFocusedView() const;
70
71 // Checks if the given View is focused. Returns true only if the View and
72 // the Widget are both focused.
73 bool IsViewFocused(View* view) const;
74
75 // Checks if the focused text input client's text input type is
76 // ui::TEXT_INPUT_TYPE_NONE. Also returns true if there is no focused text
77 // input client.
78 bool IsTextInputTypeNone() const;
79
80 // Convenience method to call the focused text input client's
81 // OnInputMethodChanged() method. It'll only take effect if the current text
82 // input type is not ui::TEXT_INPUT_TYPE_NONE.
83 void OnInputMethodChanged() const;
84
85 // Convenience method to call delegate_->DispatchKeyEventPostIME().
86 void DispatchKeyEventPostIME(const KeyEvent& key) const;
87
88 // Gets the current text input client's caret bounds in Widget's coordinates.
89 // Returns false if the current text input client doesn't support text input.
90 bool GetCaretBoundsInWidget(gfx::Rect* rect) const;
91
92 private:
93 internal::InputMethodDelegate* delegate_;
94 Widget* widget_;
95
96 // Indicates if the top-level widget is focused or not.
97 bool widget_focused_;
98
99 DISALLOW_COPY_AND_ASSIGN(InputMethodBase);
100 };
101
102 } // namespace views
103
104 #endif // VIEWS_IME_INPUT_METHOD_BASE_H_
OLDNEW
« no previous file with comments | « views/ime/input_method.h ('k') | views/ime/input_method_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698