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

Side by Side Diff: views/widget/widget_win.h

Issue 6675005: Integrate the new input method API for Views into Chromium. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 9 years, 9 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
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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 VIEWS_WIDGET_WIDGET_WIN_H_ 5 #ifndef VIEWS_WIDGET_WIDGET_WIN_H_
6 #define VIEWS_WIDGET_WIDGET_WIN_H_ 6 #define VIEWS_WIDGET_WIDGET_WIN_H_
7 #pragma once 7 #pragma once
8 8
9 #include <atlbase.h> 9 #include <atlbase.h>
10 #include <atlapp.h> 10 #include <atlapp.h>
11 #include <atlcrack.h> 11 #include <atlcrack.h>
12 #include <atlmisc.h> 12 #include <atlmisc.h>
13 13
14 #include <string> 14 #include <string>
15 #include <vector> 15 #include <vector>
16 16
17 #include "base/message_loop.h" 17 #include "base/message_loop.h"
18 #include "base/scoped_ptr.h" 18 #include "base/scoped_ptr.h"
19 #include "base/scoped_vector.h" 19 #include "base/scoped_vector.h"
20 #include "base/win/scoped_comptr.h" 20 #include "base/win/scoped_comptr.h"
21 #include "ui/base/win/window_impl.h" 21 #include "ui/base/win/window_impl.h"
22 #include "views/focus/focus_manager.h" 22 #include "views/focus/focus_manager.h"
23 #include "views/ime/input_method_delegate.h"
23 #include "views/layout/layout_manager.h" 24 #include "views/layout/layout_manager.h"
24 #include "views/widget/native_widget.h" 25 #include "views/widget/native_widget.h"
25 #include "views/widget/widget.h" 26 #include "views/widget/widget.h"
26 27
27 namespace ui { 28 namespace ui {
28 class ViewProp; 29 class ViewProp;
29 } 30 }
30 31
31 namespace gfx { 32 namespace gfx {
32 class CanvasSkia; 33 class CanvasSkia;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 // 75 //
75 // This Widget contains a RootView which owns the hierarchy of views within it. 76 // This Widget contains a RootView which owns the hierarchy of views within it.
76 // As long as views are part of this tree, they will be deleted automatically 77 // As long as views are part of this tree, they will be deleted automatically
77 // when the RootView is destroyed. If you remove a view from the tree, you are 78 // when the RootView is destroyed. If you remove a view from the tree, you are
78 // then responsible for cleaning up after it. 79 // then responsible for cleaning up after it.
79 // 80 //
80 /////////////////////////////////////////////////////////////////////////////// 81 ///////////////////////////////////////////////////////////////////////////////
81 class WidgetWin : public ui::WindowImpl, 82 class WidgetWin : public ui::WindowImpl,
82 public Widget, 83 public Widget,
83 public NativeWidget, 84 public NativeWidget,
84 public MessageLoopForUI::Observer { 85 public MessageLoopForUI::Observer,
86 public internal::InputMethodDelegate {
85 public: 87 public:
86 WidgetWin(); 88 WidgetWin();
87 virtual ~WidgetWin(); 89 virtual ~WidgetWin();
88 90
89 // Initializes native widget properties based on |params|. 91 // Initializes native widget properties based on |params|.
90 void SetCreateParams(const CreateParams& params); 92 void SetCreateParams(const CreateParams& params);
91 93
92 // Returns the Widget associated with the specified HWND (if any). 94 // Returns the Widget associated with the specified HWND (if any).
93 static WidgetWin* GetWidget(HWND hwnd); 95 static WidgetWin* GetWidget(HWND hwnd);
94 96
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 204
203 // Overridden from NativeWidget: 205 // Overridden from NativeWidget:
204 virtual Widget* GetWidget() OVERRIDE; 206 virtual Widget* GetWidget() OVERRIDE;
205 virtual void SetNativeWindowProperty(const char* name, void* value) OVERRIDE; 207 virtual void SetNativeWindowProperty(const char* name, void* value) OVERRIDE;
206 virtual void* GetNativeWindowProperty(const char* name) OVERRIDE; 208 virtual void* GetNativeWindowProperty(const char* name) OVERRIDE;
207 virtual TooltipManager* GetTooltipManager() const OVERRIDE; 209 virtual TooltipManager* GetTooltipManager() const OVERRIDE;
208 virtual bool IsScreenReaderActive() const OVERRIDE; 210 virtual bool IsScreenReaderActive() const OVERRIDE;
209 virtual void SetNativeCapture() OVERRIDE; 211 virtual void SetNativeCapture() OVERRIDE;
210 virtual void ReleaseNativeCapture() OVERRIDE; 212 virtual void ReleaseNativeCapture() OVERRIDE;
211 virtual bool HasNativeCapture() const OVERRIDE; 213 virtual bool HasNativeCapture() const OVERRIDE;
214 virtual InputMethod* GetInputMethodNative() OVERRIDE;
215 virtual void ReplaceInputMethod(InputMethod* input_method) OVERRIDE;
212 virtual gfx::Rect GetWindowScreenBounds() const OVERRIDE; 216 virtual gfx::Rect GetWindowScreenBounds() const OVERRIDE;
213 virtual gfx::Rect GetClientAreaScreenBounds() const OVERRIDE; 217 virtual gfx::Rect GetClientAreaScreenBounds() const OVERRIDE;
214 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; 218 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
215 virtual void MoveAbove(Widget* widget) OVERRIDE; 219 virtual void MoveAbove(Widget* widget) OVERRIDE;
216 virtual void SetShape(gfx::NativeRegion shape) OVERRIDE; 220 virtual void SetShape(gfx::NativeRegion shape) OVERRIDE;
217 virtual void Close() OVERRIDE; 221 virtual void Close() OVERRIDE;
218 virtual void CloseNow() OVERRIDE; 222 virtual void CloseNow() OVERRIDE;
219 virtual void Show() OVERRIDE; 223 virtual void Show() OVERRIDE;
220 virtual void Hide() OVERRIDE; 224 virtual void Hide() OVERRIDE;
221 virtual void SetOpacity(unsigned char opacity) OVERRIDE; 225 virtual void SetOpacity(unsigned char opacity) OVERRIDE;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 MESSAGE_HANDLER_EX(WM_MOUSEACTIVATE, OnMouseActivate) 269 MESSAGE_HANDLER_EX(WM_MOUSEACTIVATE, OnMouseActivate)
266 MESSAGE_HANDLER_EX(WM_MOUSELEAVE, OnMouseLeave) 270 MESSAGE_HANDLER_EX(WM_MOUSELEAVE, OnMouseLeave)
267 MESSAGE_HANDLER_EX(WM_MOUSEMOVE, OnMouseMove) 271 MESSAGE_HANDLER_EX(WM_MOUSEMOVE, OnMouseMove)
268 MESSAGE_HANDLER_EX(WM_MOUSEWHEEL, OnMouseWheel) 272 MESSAGE_HANDLER_EX(WM_MOUSEWHEEL, OnMouseWheel)
269 MESSAGE_HANDLER_EX(WM_NCMOUSELEAVE, OnNCMouseLeave) 273 MESSAGE_HANDLER_EX(WM_NCMOUSELEAVE, OnNCMouseLeave)
270 MESSAGE_HANDLER_EX(WM_NCMOUSEMOVE, OnNCMouseMove) 274 MESSAGE_HANDLER_EX(WM_NCMOUSEMOVE, OnNCMouseMove)
271 275
272 // Key events. 276 // Key events.
273 MESSAGE_HANDLER_EX(WM_KEYDOWN, OnKeyDown) 277 MESSAGE_HANDLER_EX(WM_KEYDOWN, OnKeyDown)
274 MESSAGE_HANDLER_EX(WM_KEYUP, OnKeyUp) 278 MESSAGE_HANDLER_EX(WM_KEYUP, OnKeyUp)
275 MESSAGE_HANDLER_EX(WM_SYSKEYDOWN, OnKeyDown); 279 MESSAGE_HANDLER_EX(WM_SYSKEYDOWN, OnKeyDown)
276 MESSAGE_HANDLER_EX(WM_SYSKEYUP, OnKeyUp); 280 MESSAGE_HANDLER_EX(WM_SYSKEYUP, OnKeyUp)
281
282 // IME Events.
283 MESSAGE_HANDLER_EX(WM_IME_SETCONTEXT, OnImeMessages)
284 MESSAGE_HANDLER_EX(WM_IME_STARTCOMPOSITION, OnImeMessages)
285 MESSAGE_HANDLER_EX(WM_IME_COMPOSITION, OnImeMessages)
286 MESSAGE_HANDLER_EX(WM_IME_ENDCOMPOSITION, OnImeMessages)
287 MESSAGE_HANDLER_EX(WM_CHAR, OnImeMessages)
288 MESSAGE_HANDLER_EX(WM_SYSCHAR, OnImeMessages)
289 MESSAGE_HANDLER_EX(WM_DEADCHAR, OnImeMessages)
290 MESSAGE_HANDLER_EX(WM_SYSDEADCHAR, OnImeMessages)
277 291
278 // This list is in _ALPHABETICAL_ order! OR I WILL HURT YOU. 292 // This list is in _ALPHABETICAL_ order! OR I WILL HURT YOU.
279 MSG_WM_ACTIVATE(OnActivate) 293 MSG_WM_ACTIVATE(OnActivate)
280 MSG_WM_ACTIVATEAPP(OnActivateApp) 294 MSG_WM_ACTIVATEAPP(OnActivateApp)
281 MSG_WM_APPCOMMAND(OnAppCommand) 295 MSG_WM_APPCOMMAND(OnAppCommand)
282 MSG_WM_CANCELMODE(OnCancelMode) 296 MSG_WM_CANCELMODE(OnCancelMode)
283 MSG_WM_CAPTURECHANGED(OnCaptureChanged) 297 MSG_WM_CAPTURECHANGED(OnCaptureChanged)
284 MSG_WM_CLOSE(OnClose) 298 MSG_WM_CLOSE(OnClose)
285 MSG_WM_COMMAND(OnCommand) 299 MSG_WM_COMMAND(OnCommand)
286 MSG_WM_CREATE(OnCreate) 300 MSG_WM_CREATE(OnCreate)
287 MSG_WM_DESTROY(OnDestroy) 301 MSG_WM_DESTROY(OnDestroy)
288 MSG_WM_DISPLAYCHANGE(OnDisplayChange) 302 MSG_WM_DISPLAYCHANGE(OnDisplayChange)
289 MSG_WM_ERASEBKGND(OnEraseBkgnd) 303 MSG_WM_ERASEBKGND(OnEraseBkgnd)
290 MSG_WM_ENDSESSION(OnEndSession) 304 MSG_WM_ENDSESSION(OnEndSession)
291 MSG_WM_ENTERSIZEMOVE(OnEnterSizeMove) 305 MSG_WM_ENTERSIZEMOVE(OnEnterSizeMove)
292 MSG_WM_EXITMENULOOP(OnExitMenuLoop) 306 MSG_WM_EXITMENULOOP(OnExitMenuLoop)
293 MSG_WM_EXITSIZEMOVE(OnExitSizeMove) 307 MSG_WM_EXITSIZEMOVE(OnExitSizeMove)
294 MSG_WM_GETMINMAXINFO(OnGetMinMaxInfo) 308 MSG_WM_GETMINMAXINFO(OnGetMinMaxInfo)
295 MSG_WM_HSCROLL(OnHScroll) 309 MSG_WM_HSCROLL(OnHScroll)
296 MSG_WM_INITMENU(OnInitMenu) 310 MSG_WM_INITMENU(OnInitMenu)
297 MSG_WM_INITMENUPOPUP(OnInitMenuPopup) 311 MSG_WM_INITMENUPOPUP(OnInitMenuPopup)
312 MSG_WM_INPUTLANGCHANGE(OnInputLangChange)
298 MSG_WM_KILLFOCUS(OnKillFocus) 313 MSG_WM_KILLFOCUS(OnKillFocus)
299 MSG_WM_MOVE(OnMove) 314 MSG_WM_MOVE(OnMove)
300 MSG_WM_MOVING(OnMoving) 315 MSG_WM_MOVING(OnMoving)
301 MSG_WM_NCACTIVATE(OnNCActivate) 316 MSG_WM_NCACTIVATE(OnNCActivate)
302 MSG_WM_NCCALCSIZE(OnNCCalcSize) 317 MSG_WM_NCCALCSIZE(OnNCCalcSize)
303 MSG_WM_NCHITTEST(OnNCHitTest) 318 MSG_WM_NCHITTEST(OnNCHitTest)
304 MSG_WM_NCPAINT(OnNCPaint) 319 MSG_WM_NCPAINT(OnNCPaint)
305 MSG_WM_NOTIFY(OnNotify) 320 MSG_WM_NOTIFY(OnNotify)
306 MSG_WM_PAINT(OnPaint) 321 MSG_WM_PAINT(OnPaint)
307 MSG_WM_POWERBROADCAST(OnPowerBroadcast) 322 MSG_WM_POWERBROADCAST(OnPowerBroadcast)
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 WPARAM w_param, 357 WPARAM w_param,
343 LPARAM l_param); 358 LPARAM l_param);
344 virtual void OnEndSession(BOOL ending, UINT logoff); 359 virtual void OnEndSession(BOOL ending, UINT logoff);
345 virtual void OnEnterSizeMove(); 360 virtual void OnEnterSizeMove();
346 virtual LRESULT OnEraseBkgnd(HDC dc); 361 virtual LRESULT OnEraseBkgnd(HDC dc);
347 virtual void OnExitMenuLoop(BOOL is_track_popup_menu); 362 virtual void OnExitMenuLoop(BOOL is_track_popup_menu);
348 virtual void OnExitSizeMove(); 363 virtual void OnExitSizeMove();
349 virtual LRESULT OnGetObject(UINT uMsg, WPARAM w_param, LPARAM l_param); 364 virtual LRESULT OnGetObject(UINT uMsg, WPARAM w_param, LPARAM l_param);
350 virtual void OnGetMinMaxInfo(MINMAXINFO* minmax_info); 365 virtual void OnGetMinMaxInfo(MINMAXINFO* minmax_info);
351 virtual void OnHScroll(int scroll_type, short position, HWND scrollbar); 366 virtual void OnHScroll(int scroll_type, short position, HWND scrollbar);
367 virtual LRESULT OnImeMessages(UINT message, WPARAM w_param, LPARAM l_param);
352 virtual void OnInitMenu(HMENU menu); 368 virtual void OnInitMenu(HMENU menu);
353 virtual void OnInitMenuPopup(HMENU menu, UINT position, BOOL is_system_menu); 369 virtual void OnInitMenuPopup(HMENU menu, UINT position, BOOL is_system_menu);
370 virtual void OnInputLangChange(DWORD character_set, HKL input_language_id);
354 virtual LRESULT OnKeyDown(UINT message, WPARAM w_param, LPARAM l_param); 371 virtual LRESULT OnKeyDown(UINT message, WPARAM w_param, LPARAM l_param);
355 virtual LRESULT OnKeyUp(UINT message, WPARAM w_param, LPARAM l_param); 372 virtual LRESULT OnKeyUp(UINT message, WPARAM w_param, LPARAM l_param);
356 virtual void OnKillFocus(HWND focused_window); 373 virtual void OnKillFocus(HWND focused_window);
357 virtual LRESULT OnMouseActivate(UINT message, WPARAM w_param, LPARAM l_param); 374 virtual LRESULT OnMouseActivate(UINT message, WPARAM w_param, LPARAM l_param);
358 virtual LRESULT OnMouseLeave(UINT message, WPARAM w_param, LPARAM l_param); 375 virtual LRESULT OnMouseLeave(UINT message, WPARAM w_param, LPARAM l_param);
359 virtual LRESULT OnMouseMove(UINT message, WPARAM w_param, LPARAM l_param); 376 virtual LRESULT OnMouseMove(UINT message, WPARAM w_param, LPARAM l_param);
360 virtual LRESULT OnMouseRange(UINT message, WPARAM w_param, LPARAM l_param); 377 virtual LRESULT OnMouseRange(UINT message, WPARAM w_param, LPARAM l_param);
361 virtual LRESULT OnMouseWheel(UINT message, WPARAM w_param, LPARAM l_param); 378 virtual LRESULT OnMouseWheel(UINT message, WPARAM w_param, LPARAM l_param);
362 virtual void OnMove(const CPoint& point); 379 virtual void OnMove(const CPoint& point);
363 virtual void OnMoving(UINT param, LPRECT new_bounds); 380 virtual void OnMoving(UINT param, LPRECT new_bounds);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 // layered windows only. 467 // layered windows only.
451 void RedrawLayeredWindowContents(); 468 void RedrawLayeredWindowContents();
452 469
453 // Responds to the client area changing size, either at window creation time 470 // Responds to the client area changing size, either at window creation time
454 // or subsequently. 471 // or subsequently.
455 void ClientAreaSizeChanged(); 472 void ClientAreaSizeChanged();
456 473
457 // Overridden from NativeWidget. 474 // Overridden from NativeWidget.
458 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; 475 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE;
459 476
477 // Overridden from internal::InputMethodDelegate
478 virtual void DispatchKeyEventPostIME(const KeyEvent& key) OVERRIDE;
479
460 // A delegate implementation that handles events received here. 480 // A delegate implementation that handles events received here.
461 internal::NativeWidgetDelegate* delegate_; 481 internal::NativeWidgetDelegate* delegate_;
462 482
463 // The following factory is used for calls to close the WidgetWin 483 // The following factory is used for calls to close the WidgetWin
464 // instance. 484 // instance.
465 ScopedRunnableMethodFactory<WidgetWin> close_widget_factory_; 485 ScopedRunnableMethodFactory<WidgetWin> close_widget_factory_;
466 486
467 // The flags currently being used with TrackMouseEvent to track mouse 487 // The flags currently being used with TrackMouseEvent to track mouse
468 // messages. 0 if there is no active tracking. The value of this member is 488 // messages. 0 if there is no active tracking. The value of this member is
469 // used when tracking is canceled. 489 // used when tracking is canceled.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 // The current position of the view events vector. When incrementing, 555 // The current position of the view events vector. When incrementing,
536 // we always mod this value with the max view events above . 556 // we always mod this value with the max view events above .
537 int accessibility_view_events_index_; 557 int accessibility_view_events_index_;
538 558
539 // The last cursor that was active before the current one was selected. Saved 559 // The last cursor that was active before the current one was selected. Saved
540 // so that we can restore it. 560 // so that we can restore it.
541 gfx::NativeCursor previous_cursor_; 561 gfx::NativeCursor previous_cursor_;
542 562
543 ViewProps props_; 563 ViewProps props_;
544 564
565 scoped_ptr<InputMethod> input_method_;
566
567 // Indicates if the |input_method_| is an InputMethodWin instance.
568 bool is_input_method_win_;
569
545 DISALLOW_COPY_AND_ASSIGN(WidgetWin); 570 DISALLOW_COPY_AND_ASSIGN(WidgetWin);
546 }; 571 };
547 572
548 } // namespace views 573 } // namespace views
549 574
550 #endif // VIEWS_WIDGET_WIDGET_WIN_H_ 575 #endif // VIEWS_WIDGET_WIDGET_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698