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

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

Issue 6688049: New InputMethod api for Views. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 9 years, 8 months 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
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_WIN_H_
6 #define VIEWS_IME_INPUT_METHOD_WIN_H_
7 #pragma once
8
9 #include <windows.h>
10
11 #include <string>
12
13 #include "base/basictypes.h"
14 #include "base/compiler_specific.h"
15 #include "ui/base/win/ime_input.h"
16 #include "views/ime/input_method_base.h"
17 #include "views/view.h"
18 #include "views/widget/widget.h"
19
20 namespace views {
21
22 // An InputMethod implementation based on Windows IMM32 API.
23 class InputMethodWin : public InputMethodBase {
24 public:
25 explicit InputMethodWin(internal::InputMethodDelegate* delegate);
26 virtual ~InputMethodWin();
27
28 // Overridden from InputMethod:
29 virtual void Init(Widget* widget) OVERRIDE;
30 virtual void OnFocusIn() OVERRIDE;
31 virtual void OnFocusOut() OVERRIDE;
32 virtual void DispatchKeyEvent(const KeyEvent& key) OVERRIDE;
33 virtual void OnTextInputTypeChanged(View* view) OVERRIDE;
34 virtual void OnCaretBoundsChanged(View* view) OVERRIDE;
35 virtual void CancelComposition(View* view) OVERRIDE;
36 virtual std::string GetInputLocale() OVERRIDE;
37 virtual base::i18n::TextDirection GetInputTextDirection() OVERRIDE;
38 virtual bool IsActive() OVERRIDE;
39
40 // Message handlers. The native widget is responsible for forwarding following
41 // messages to the input method.
42 void OnInputLangChange(DWORD character_set, HKL input_language_id);
43 LRESULT OnImeSetContext(
44 UINT message, WPARAM wparam, LPARAM lparam, BOOL* handled);
45 LRESULT OnImeStartComposition(
46 UINT message, WPARAM wparam, LPARAM lparam, BOOL* handled);
47 LRESULT OnImeComposition(
48 UINT message, WPARAM wparam, LPARAM lparam, BOOL* handled);
49 LRESULT OnImeEndComposition(
50 UINT message, WPARAM wparam, LPARAM lparam, BOOL* handled);
51 // For both WM_CHAR and WM_SYSCHAR
52 LRESULT OnChar(
53 UINT message, WPARAM wparam, LPARAM lparam, BOOL* handled);
54 // For both WM_DEADCHAR and WM_SYSDEADCHAR
55 LRESULT OnDeadChar(
56 UINT message, WPARAM wparam, LPARAM lparam, BOOL* handled);
57
58 private:
59 // Overridden from InputMethodBase.
60 virtual void FocusedViewWillChange() OVERRIDE;
61 virtual void FocusedViewDidChange() OVERRIDE;
62
63 // A helper function to return the Widget's native window.
64 HWND hwnd() const { return widget()->GetNativeView(); }
65
66 // Asks the client to confirm current composition text.
67 void ConfirmCompositionText();
68
69 // Enables or disables the IME according to the current text input type.
70 void UpdateIMEState();
71
72 // Indicates if the current input locale has an IME.
73 bool active_;
74
75 // Name of the current input locale.
76 std::string locale_;
77
78 // The current input text direction.
79 base::i18n::TextDirection direction_;
80
81 // The new text direction and layout alignment requested by the user by
82 // pressing ctrl-shift. It'll be sent to the text input client when the key
83 // is released.
84 base::i18n::TextDirection pending_requested_direction_;
85
86 // Windows IMM32 wrapper.
87 // (See "ui/base/win/ime_input.h" for its details.)
88 ui::ImeInput ime_input_;
89
90 DISALLOW_COPY_AND_ASSIGN(InputMethodWin);
91 };
92
93 } // namespace views
94
95 #endif // VIEWS_IME_INPUT_METHOD_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698