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

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: Fix Windows build. 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
« no previous file with comments | « views/widget/widget_gtk.cc ('k') | views/widget/widget_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
18 #include "base/memory/scoped_vector.h" 18 #include "base/memory/scoped_vector.h"
19 #include "base/message_loop.h" 19 #include "base/message_loop.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 SetMouseCapture() OVERRIDE; 211 virtual void SetMouseCapture() OVERRIDE;
210 virtual void ReleaseMouseCapture() OVERRIDE; 212 virtual void ReleaseMouseCapture() OVERRIDE;
211 virtual bool HasMouseCapture() const OVERRIDE; 213 virtual bool HasMouseCapture() 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(gfx::NativeView native_view) OVERRIDE; 219 virtual void MoveAbove(gfx::NativeView native_view) 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 267
264 // Mouse events. 268 // Mouse events.
265 MESSAGE_HANDLER_EX(WM_MOUSEACTIVATE, OnMouseActivate) 269 MESSAGE_HANDLER_EX(WM_MOUSEACTIVATE, OnMouseActivate)
266 MESSAGE_HANDLER_EX(WM_MOUSELEAVE, OnMouseRange) 270 MESSAGE_HANDLER_EX(WM_MOUSELEAVE, OnMouseRange)
267 MESSAGE_HANDLER_EX(WM_MOUSEWHEEL, OnMouseWheel) 271 MESSAGE_HANDLER_EX(WM_MOUSEWHEEL, OnMouseWheel)
268 MESSAGE_HANDLER_EX(WM_NCMOUSELEAVE, OnMouseRange) 272 MESSAGE_HANDLER_EX(WM_NCMOUSELEAVE, OnMouseRange)
269 273
270 // Key events. 274 // Key events.
271 MESSAGE_HANDLER_EX(WM_KEYDOWN, OnKeyDown) 275 MESSAGE_HANDLER_EX(WM_KEYDOWN, OnKeyDown)
272 MESSAGE_HANDLER_EX(WM_KEYUP, OnKeyUp) 276 MESSAGE_HANDLER_EX(WM_KEYUP, OnKeyUp)
273 MESSAGE_HANDLER_EX(WM_SYSKEYDOWN, OnKeyDown); 277 MESSAGE_HANDLER_EX(WM_SYSKEYDOWN, OnKeyDown)
274 MESSAGE_HANDLER_EX(WM_SYSKEYUP, OnKeyUp); 278 MESSAGE_HANDLER_EX(WM_SYSKEYUP, OnKeyUp)
279
280 // IME Events.
281 MESSAGE_HANDLER_EX(WM_IME_SETCONTEXT, OnImeMessages)
282 MESSAGE_HANDLER_EX(WM_IME_STARTCOMPOSITION, OnImeMessages)
283 MESSAGE_HANDLER_EX(WM_IME_COMPOSITION, OnImeMessages)
284 MESSAGE_HANDLER_EX(WM_IME_ENDCOMPOSITION, OnImeMessages)
285 MESSAGE_HANDLER_EX(WM_CHAR, OnImeMessages)
286 MESSAGE_HANDLER_EX(WM_SYSCHAR, OnImeMessages)
287 MESSAGE_HANDLER_EX(WM_DEADCHAR, OnImeMessages)
288 MESSAGE_HANDLER_EX(WM_SYSDEADCHAR, OnImeMessages)
275 289
276 // This list is in _ALPHABETICAL_ order! OR I WILL HURT YOU. 290 // This list is in _ALPHABETICAL_ order! OR I WILL HURT YOU.
277 MSG_WM_ACTIVATE(OnActivate) 291 MSG_WM_ACTIVATE(OnActivate)
278 MSG_WM_ACTIVATEAPP(OnActivateApp) 292 MSG_WM_ACTIVATEAPP(OnActivateApp)
279 MSG_WM_APPCOMMAND(OnAppCommand) 293 MSG_WM_APPCOMMAND(OnAppCommand)
280 MSG_WM_CANCELMODE(OnCancelMode) 294 MSG_WM_CANCELMODE(OnCancelMode)
281 MSG_WM_CAPTURECHANGED(OnCaptureChanged) 295 MSG_WM_CAPTURECHANGED(OnCaptureChanged)
282 MSG_WM_CLOSE(OnClose) 296 MSG_WM_CLOSE(OnClose)
283 MSG_WM_COMMAND(OnCommand) 297 MSG_WM_COMMAND(OnCommand)
284 MSG_WM_CREATE(OnCreate) 298 MSG_WM_CREATE(OnCreate)
285 MSG_WM_DESTROY(OnDestroy) 299 MSG_WM_DESTROY(OnDestroy)
286 MSG_WM_DISPLAYCHANGE(OnDisplayChange) 300 MSG_WM_DISPLAYCHANGE(OnDisplayChange)
287 MSG_WM_ERASEBKGND(OnEraseBkgnd) 301 MSG_WM_ERASEBKGND(OnEraseBkgnd)
288 MSG_WM_ENDSESSION(OnEndSession) 302 MSG_WM_ENDSESSION(OnEndSession)
289 MSG_WM_ENTERSIZEMOVE(OnEnterSizeMove) 303 MSG_WM_ENTERSIZEMOVE(OnEnterSizeMove)
290 MSG_WM_EXITMENULOOP(OnExitMenuLoop) 304 MSG_WM_EXITMENULOOP(OnExitMenuLoop)
291 MSG_WM_EXITSIZEMOVE(OnExitSizeMove) 305 MSG_WM_EXITSIZEMOVE(OnExitSizeMove)
292 MSG_WM_GETMINMAXINFO(OnGetMinMaxInfo) 306 MSG_WM_GETMINMAXINFO(OnGetMinMaxInfo)
293 MSG_WM_HSCROLL(OnHScroll) 307 MSG_WM_HSCROLL(OnHScroll)
294 MSG_WM_INITMENU(OnInitMenu) 308 MSG_WM_INITMENU(OnInitMenu)
295 MSG_WM_INITMENUPOPUP(OnInitMenuPopup) 309 MSG_WM_INITMENUPOPUP(OnInitMenuPopup)
310 MSG_WM_INPUTLANGCHANGE(OnInputLangChange)
296 MSG_WM_KILLFOCUS(OnKillFocus) 311 MSG_WM_KILLFOCUS(OnKillFocus)
297 MSG_WM_MOVE(OnMove) 312 MSG_WM_MOVE(OnMove)
298 MSG_WM_MOVING(OnMoving) 313 MSG_WM_MOVING(OnMoving)
299 MSG_WM_NCACTIVATE(OnNCActivate) 314 MSG_WM_NCACTIVATE(OnNCActivate)
300 MSG_WM_NCCALCSIZE(OnNCCalcSize) 315 MSG_WM_NCCALCSIZE(OnNCCalcSize)
301 MSG_WM_NCHITTEST(OnNCHitTest) 316 MSG_WM_NCHITTEST(OnNCHitTest)
302 MSG_WM_NCPAINT(OnNCPaint) 317 MSG_WM_NCPAINT(OnNCPaint)
303 MSG_WM_NOTIFY(OnNotify) 318 MSG_WM_NOTIFY(OnNotify)
304 MSG_WM_PAINT(OnPaint) 319 MSG_WM_PAINT(OnPaint)
305 MSG_WM_POWERBROADCAST(OnPowerBroadcast) 320 MSG_WM_POWERBROADCAST(OnPowerBroadcast)
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 WPARAM w_param, 355 WPARAM w_param,
341 LPARAM l_param); 356 LPARAM l_param);
342 virtual void OnEndSession(BOOL ending, UINT logoff); 357 virtual void OnEndSession(BOOL ending, UINT logoff);
343 virtual void OnEnterSizeMove(); 358 virtual void OnEnterSizeMove();
344 virtual LRESULT OnEraseBkgnd(HDC dc); 359 virtual LRESULT OnEraseBkgnd(HDC dc);
345 virtual void OnExitMenuLoop(BOOL is_track_popup_menu); 360 virtual void OnExitMenuLoop(BOOL is_track_popup_menu);
346 virtual void OnExitSizeMove(); 361 virtual void OnExitSizeMove();
347 virtual LRESULT OnGetObject(UINT uMsg, WPARAM w_param, LPARAM l_param); 362 virtual LRESULT OnGetObject(UINT uMsg, WPARAM w_param, LPARAM l_param);
348 virtual void OnGetMinMaxInfo(MINMAXINFO* minmax_info); 363 virtual void OnGetMinMaxInfo(MINMAXINFO* minmax_info);
349 virtual void OnHScroll(int scroll_type, short position, HWND scrollbar); 364 virtual void OnHScroll(int scroll_type, short position, HWND scrollbar);
365 virtual LRESULT OnImeMessages(UINT message, WPARAM w_param, LPARAM l_param);
350 virtual void OnInitMenu(HMENU menu); 366 virtual void OnInitMenu(HMENU menu);
351 virtual void OnInitMenuPopup(HMENU menu, UINT position, BOOL is_system_menu); 367 virtual void OnInitMenuPopup(HMENU menu, UINT position, BOOL is_system_menu);
368 virtual void OnInputLangChange(DWORD character_set, HKL input_language_id);
352 virtual LRESULT OnKeyDown(UINT message, WPARAM w_param, LPARAM l_param); 369 virtual LRESULT OnKeyDown(UINT message, WPARAM w_param, LPARAM l_param);
353 virtual LRESULT OnKeyUp(UINT message, WPARAM w_param, LPARAM l_param); 370 virtual LRESULT OnKeyUp(UINT message, WPARAM w_param, LPARAM l_param);
354 virtual void OnKillFocus(HWND focused_window); 371 virtual void OnKillFocus(HWND focused_window);
355 virtual LRESULT OnMouseActivate(UINT message, WPARAM w_param, LPARAM l_param); 372 virtual LRESULT OnMouseActivate(UINT message, WPARAM w_param, LPARAM l_param);
356 virtual LRESULT OnMouseRange(UINT message, WPARAM w_param, LPARAM l_param); 373 virtual LRESULT OnMouseRange(UINT message, WPARAM w_param, LPARAM l_param);
357 virtual LRESULT OnMouseWheel(UINT message, WPARAM w_param, LPARAM l_param); 374 virtual LRESULT OnMouseWheel(UINT message, WPARAM w_param, LPARAM l_param);
358 virtual void OnMove(const CPoint& point); 375 virtual void OnMove(const CPoint& point);
359 virtual void OnMoving(UINT param, LPRECT new_bounds); 376 virtual void OnMoving(UINT param, LPRECT new_bounds);
360 virtual LRESULT OnNCActivate(BOOL active); 377 virtual LRESULT OnNCActivate(BOOL active);
361 virtual LRESULT OnNCCalcSize(BOOL w_param, LPARAM l_param); 378 virtual LRESULT OnNCCalcSize(BOOL w_param, LPARAM l_param);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 // layered windows only. 441 // layered windows only.
425 void RedrawLayeredWindowContents(); 442 void RedrawLayeredWindowContents();
426 443
427 // Responds to the client area changing size, either at window creation time 444 // Responds to the client area changing size, either at window creation time
428 // or subsequently. 445 // or subsequently.
429 void ClientAreaSizeChanged(); 446 void ClientAreaSizeChanged();
430 447
431 // Overridden from NativeWidget. 448 // Overridden from NativeWidget.
432 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; 449 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE;
433 450
451 // Overridden from internal::InputMethodDelegate
452 virtual void DispatchKeyEventPostIME(const KeyEvent& key) OVERRIDE;
453
434 // A delegate implementation that handles events received here. 454 // A delegate implementation that handles events received here.
435 internal::NativeWidgetDelegate* delegate_; 455 internal::NativeWidgetDelegate* delegate_;
436 456
437 // The following factory is used for calls to close the WidgetWin 457 // The following factory is used for calls to close the WidgetWin
438 // instance. 458 // instance.
439 ScopedRunnableMethodFactory<WidgetWin> close_widget_factory_; 459 ScopedRunnableMethodFactory<WidgetWin> close_widget_factory_;
440 460
441 // The flags currently being used with TrackMouseEvent to track mouse 461 // The flags currently being used with TrackMouseEvent to track mouse
442 // messages. 0 if there is no active tracking. The value of this member is 462 // messages. 0 if there is no active tracking. The value of this member is
443 // used when tracking is canceled. 463 // used when tracking is canceled.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 // The current position of the view events vector. When incrementing, 518 // The current position of the view events vector. When incrementing,
499 // we always mod this value with the max view events above . 519 // we always mod this value with the max view events above .
500 int accessibility_view_events_index_; 520 int accessibility_view_events_index_;
501 521
502 // The last cursor that was active before the current one was selected. Saved 522 // The last cursor that was active before the current one was selected. Saved
503 // so that we can restore it. 523 // so that we can restore it.
504 gfx::NativeCursor previous_cursor_; 524 gfx::NativeCursor previous_cursor_;
505 525
506 ViewProps props_; 526 ViewProps props_;
507 527
528 scoped_ptr<InputMethod> input_method_;
529
530 // Indicates if the |input_method_| is an InputMethodWin instance.
531 bool is_input_method_win_;
532
508 DISALLOW_COPY_AND_ASSIGN(WidgetWin); 533 DISALLOW_COPY_AND_ASSIGN(WidgetWin);
509 }; 534 };
510 535
511 } // namespace views 536 } // namespace views
512 537
513 #endif // VIEWS_WIDGET_WIDGET_WIN_H_ 538 #endif // VIEWS_WIDGET_WIDGET_WIN_H_
OLDNEW
« no previous file with comments | « views/widget/widget_gtk.cc ('k') | views/widget/widget_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698