| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_VIEWS_WIDGET_NATIVE_WIDGET_WIN_H_ | 5 #ifndef UI_VIEWS_WIDGET_NATIVE_WIDGET_WIN_H_ |
| 6 #define UI_VIEWS_WIDGET_NATIVE_WIDGET_WIN_H_ | 6 #define UI_VIEWS_WIDGET_NATIVE_WIDGET_WIN_H_ |
| 7 | 7 |
| 8 #include <atlbase.h> | |
| 9 #include <atlapp.h> | |
| 10 #include <atlcrack.h> | |
| 11 #include <atlmisc.h> | |
| 12 | |
| 13 #include <set> | |
| 14 #include <string> | |
| 15 #include <vector> | 8 #include <vector> |
| 16 | 9 |
| 17 #include "base/memory/ref_counted.h" | |
| 18 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 19 #include "base/memory/scoped_vector.h" | 11 #include "base/memory/scoped_vector.h" |
| 20 #include "base/memory/weak_ptr.h" | |
| 21 #include "base/message_loop.h" | |
| 22 #include "base/win/scoped_comptr.h" | 12 #include "base/win/scoped_comptr.h" |
| 23 #include "base/win/win_util.h" | |
| 24 #include "ui/base/win/window_impl.h" | 13 #include "ui/base/win/window_impl.h" |
| 25 #include "ui/views/focus/focus_manager.h" | |
| 26 #include "ui/views/layout/layout_manager.h" | |
| 27 #include "ui/views/widget/native_widget_private.h" | 14 #include "ui/views/widget/native_widget_private.h" |
| 28 #include "ui/views/win/hwnd_message_handler_delegate.h" | 15 #include "ui/views/win/hwnd_message_handler_delegate.h" |
| 29 | 16 |
| 30 namespace ui { | 17 namespace ui { |
| 31 class Compositor; | 18 class Compositor; |
| 32 class ViewProp; | 19 class ViewProp; |
| 33 } | 20 } |
| 34 | 21 |
| 35 namespace gfx { | 22 namespace gfx { |
| 36 class Canvas; | 23 class Canvas; |
| 37 class Font; | 24 class Font; |
| 38 class Rect; | 25 class Rect; |
| 39 } | 26 } |
| 40 | 27 |
| 41 namespace views { | 28 namespace views { |
| 42 | 29 |
| 43 class DropTargetWin; | 30 class DropTargetWin; |
| 44 class HWNDMessageHandler; | 31 class HWNDMessageHandler; |
| 45 class InputMethodDelegate; | 32 class InputMethodDelegate; |
| 46 class RootView; | 33 class RootView; |
| 47 class TooltipManagerWin; | 34 class TooltipManagerWin; |
| 48 | 35 |
| 49 // These two messages aren't defined in winuser.h, but they are sent to windows | |
| 50 // with captions. They appear to paint the window caption and frame. | |
| 51 // Unfortunately if you override the standard non-client rendering as we do | |
| 52 // with CustomFrameWindow, sometimes Windows (not deterministically | |
| 53 // reproducibly but definitely frequently) will send these messages to the | |
| 54 // window and paint the standard caption/title over the top of the custom one. | |
| 55 // So we need to handle these messages in CustomFrameWindow to prevent this | |
| 56 // from happening. | |
| 57 const int WM_NCUAHDRAWCAPTION = 0xAE; | |
| 58 const int WM_NCUAHDRAWFRAME = 0xAF; | |
| 59 | |
| 60 /////////////////////////////////////////////////////////////////////////////// | 36 /////////////////////////////////////////////////////////////////////////////// |
| 61 // | 37 // |
| 62 // NativeWidgetWin | 38 // NativeWidgetWin |
| 63 // A Widget for a views hierarchy used to represent anything that can be | 39 // A Widget for a views hierarchy used to represent anything that can be |
| 64 // contained within an HWND, e.g. a control, a window, etc. Specializations | 40 // contained within an HWND, e.g. a control, a window, etc. Specializations |
| 65 // suitable for specific tasks, e.g. top level window, are derived from this. | 41 // suitable for specific tasks, e.g. top level window, are derived from this. |
| 66 // | 42 // |
| 67 // This Widget contains a RootView which owns the hierarchy of views within it. | 43 // This Widget contains a RootView which owns the hierarchy of views within it. |
| 68 // As long as views are part of this tree, they will be deleted automatically | 44 // As long as views are part of this tree, they will be deleted automatically |
| 69 // when the RootView is destroyed. If you remove a view from the tree, you are | 45 // when the RootView is destroyed. If you remove a view from the tree, you are |
| 70 // then responsible for cleaning up after it. | 46 // then responsible for cleaning up after it. |
| 71 // | 47 // |
| 72 /////////////////////////////////////////////////////////////////////////////// | 48 /////////////////////////////////////////////////////////////////////////////// |
| 73 class VIEWS_EXPORT NativeWidgetWin : public ui::WindowImpl, | 49 class VIEWS_EXPORT NativeWidgetWin : public internal::NativeWidgetPrivate, |
| 74 public MessageLoopForUI::Observer, | |
| 75 public internal::NativeWidgetPrivate, | |
| 76 public HWNDMessageHandlerDelegate { | 50 public HWNDMessageHandlerDelegate { |
| 77 public: | 51 public: |
| 78 explicit NativeWidgetWin(internal::NativeWidgetDelegate* delegate); | 52 explicit NativeWidgetWin(internal::NativeWidgetDelegate* delegate); |
| 79 virtual ~NativeWidgetWin(); | 53 virtual ~NativeWidgetWin(); |
| 80 | 54 |
| 81 // Returns the system set window title font. | 55 // Returns the system set window title font. |
| 82 static gfx::Font GetWindowTitleFont(); | 56 static gfx::Font GetWindowTitleFont(); |
| 83 | 57 |
| 84 // Show the window with the specified show command. | 58 // Show the window with the specified show command. |
| 85 void Show(int show_state); | 59 void Show(int show_state); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 97 // associated hWnd's (e.g. NativeWidgetWin). | 71 // associated hWnd's (e.g. NativeWidgetWin). |
| 98 int AddAccessibilityViewEvent(View* view); | 72 int AddAccessibilityViewEvent(View* view); |
| 99 | 73 |
| 100 // Clear a view that has recently been removed on a hierarchy change. | 74 // Clear a view that has recently been removed on a hierarchy change. |
| 101 void ClearAccessibilityViewEvent(View* view); | 75 void ClearAccessibilityViewEvent(View* view); |
| 102 | 76 |
| 103 // Places the window in a pseudo-fullscreen mode where it looks and acts as | 77 // Places the window in a pseudo-fullscreen mode where it looks and acts as |
| 104 // like a fullscreen window except that it remains within the boundaries | 78 // like a fullscreen window except that it remains within the boundaries |
| 105 // of the metro snap divider. | 79 // of the metro snap divider. |
| 106 void SetMetroSnapFullscreen(bool metro_snap); | 80 void SetMetroSnapFullscreen(bool metro_snap); |
| 107 | |
| 108 bool IsInMetroSnapMode() const; | 81 bool IsInMetroSnapMode() const; |
| 109 | 82 |
| 110 void SetCanUpdateLayeredWindow(bool can_update); | 83 void SetCanUpdateLayeredWindow(bool can_update); |
| 111 | 84 |
| 112 BOOL IsWindow() const { | |
| 113 return ::IsWindow(GetNativeView()); | |
| 114 } | |
| 115 | |
| 116 BOOL ShowWindow(int command) { | |
| 117 DCHECK(::IsWindow(GetNativeView())); | |
| 118 return ::ShowWindow(GetNativeView(), command); | |
| 119 } | |
| 120 | |
| 121 HWND GetParent() const { | |
| 122 return ::GetParent(GetNativeView()); | |
| 123 } | |
| 124 | |
| 125 LONG GetWindowLong(int index) { | |
| 126 DCHECK(::IsWindow(GetNativeView())); | |
| 127 return ::GetWindowLong(GetNativeView(), index); | |
| 128 } | |
| 129 | |
| 130 BOOL GetWindowRect(RECT* rect) const { | |
| 131 return ::GetWindowRect(GetNativeView(), rect); | |
| 132 } | |
| 133 | |
| 134 LONG SetWindowLong(int index, LONG new_long) { | |
| 135 DCHECK(::IsWindow(GetNativeView())); | |
| 136 return ::SetWindowLong(GetNativeView(), index, new_long); | |
| 137 } | |
| 138 | |
| 139 BOOL SetWindowPos(HWND hwnd_after, int x, int y, int cx, int cy, UINT flags) { | |
| 140 DCHECK(::IsWindow(GetNativeView())); | |
| 141 return ::SetWindowPos(GetNativeView(), hwnd_after, x, y, cx, cy, flags); | |
| 142 } | |
| 143 | |
| 144 BOOL IsZoomed() const { | |
| 145 DCHECK(::IsWindow(GetNativeView())); | |
| 146 return ::IsZoomed(GetNativeView()); | |
| 147 } | |
| 148 | |
| 149 BOOL MoveWindow(int x, int y, int width, int height) { | |
| 150 return MoveWindow(x, y, width, height, TRUE); | |
| 151 } | |
| 152 | |
| 153 BOOL MoveWindow(int x, int y, int width, int height, BOOL repaint) { | |
| 154 DCHECK(::IsWindow(GetNativeView())); | |
| 155 return ::MoveWindow(GetNativeView(), x, y, width, height, repaint); | |
| 156 } | |
| 157 | |
| 158 int SetWindowRgn(HRGN region, BOOL redraw) { | |
| 159 DCHECK(::IsWindow(GetNativeView())); | |
| 160 return ::SetWindowRgn(GetNativeView(), region, redraw); | |
| 161 } | |
| 162 | |
| 163 BOOL GetClientRect(RECT* rect) const { | |
| 164 DCHECK(::IsWindow(GetNativeView())); | |
| 165 return ::GetClientRect(GetNativeView(), rect); | |
| 166 } | |
| 167 | |
| 168 // Overridden from internal::NativeWidgetPrivate: | 85 // Overridden from internal::NativeWidgetPrivate: |
| 169 virtual void InitNativeWidget(const Widget::InitParams& params) OVERRIDE; | 86 virtual void InitNativeWidget(const Widget::InitParams& params) OVERRIDE; |
| 170 virtual NonClientFrameView* CreateNonClientFrameView() OVERRIDE; | 87 virtual NonClientFrameView* CreateNonClientFrameView() OVERRIDE; |
| 171 virtual void UpdateFrameAfterFrameChange() OVERRIDE; | 88 virtual void UpdateFrameAfterFrameChange() OVERRIDE; |
| 172 virtual bool ShouldUseNativeFrame() const OVERRIDE; | 89 virtual bool ShouldUseNativeFrame() const OVERRIDE; |
| 173 virtual void FrameTypeChanged() OVERRIDE; | 90 virtual void FrameTypeChanged() OVERRIDE; |
| 174 virtual Widget* GetWidget() OVERRIDE; | 91 virtual Widget* GetWidget() OVERRIDE; |
| 175 virtual const Widget* GetWidget() const OVERRIDE; | 92 virtual const Widget* GetWidget() const OVERRIDE; |
| 176 virtual gfx::NativeView GetNativeView() const OVERRIDE; | 93 virtual gfx::NativeView GetNativeView() const OVERRIDE; |
| 177 virtual gfx::NativeWindow GetNativeWindow() const OVERRIDE; | 94 virtual gfx::NativeWindow GetNativeWindow() const OVERRIDE; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 virtual void ClearNativeFocus() OVERRIDE; | 163 virtual void ClearNativeFocus() OVERRIDE; |
| 247 virtual void FocusNativeView(gfx::NativeView native_view) OVERRIDE; | 164 virtual void FocusNativeView(gfx::NativeView native_view) OVERRIDE; |
| 248 virtual gfx::Rect GetWorkAreaBoundsInScreen() const OVERRIDE; | 165 virtual gfx::Rect GetWorkAreaBoundsInScreen() const OVERRIDE; |
| 249 virtual void SetInactiveRenderingDisabled(bool value) OVERRIDE; | 166 virtual void SetInactiveRenderingDisabled(bool value) OVERRIDE; |
| 250 virtual Widget::MoveLoopResult RunMoveLoop( | 167 virtual Widget::MoveLoopResult RunMoveLoop( |
| 251 const gfx::Point& drag_offset) OVERRIDE; | 168 const gfx::Point& drag_offset) OVERRIDE; |
| 252 virtual void EndMoveLoop() OVERRIDE; | 169 virtual void EndMoveLoop() OVERRIDE; |
| 253 virtual void SetVisibilityChangedAnimationsEnabled(bool value) OVERRIDE; | 170 virtual void SetVisibilityChangedAnimationsEnabled(bool value) OVERRIDE; |
| 254 | 171 |
| 255 protected: | 172 protected: |
| 256 // Overridden from MessageLoop::Observer: | |
| 257 virtual base::EventStatus WillProcessEvent( | |
| 258 const base::NativeEvent& event) OVERRIDE; | |
| 259 virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE; | |
| 260 | |
| 261 // Overridden from WindowImpl: | |
| 262 virtual HICON GetDefaultWindowIcon() const OVERRIDE; | |
| 263 virtual LRESULT OnWndProc(UINT message, | |
| 264 WPARAM w_param, | |
| 265 LPARAM l_param) OVERRIDE; | |
| 266 | |
| 267 // Message Handlers ---------------------------------------------------------- | |
| 268 | |
| 269 BEGIN_MSG_MAP_EX(NativeWidgetWin) | |
| 270 // Range handlers must go first! | |
| 271 MESSAGE_RANGE_HANDLER_EX(WM_MOUSEFIRST, WM_MOUSELAST, OnMouseRange) | |
| 272 MESSAGE_RANGE_HANDLER_EX(WM_NCMOUSEMOVE, WM_NCXBUTTONDBLCLK, OnMouseRange) | |
| 273 | |
| 274 // Reflected message handler | |
| 275 MESSAGE_HANDLER_EX(base::win::kReflectedMessage, OnReflectedMessage) | |
| 276 | |
| 277 // CustomFrameWindow hacks | |
| 278 MESSAGE_HANDLER_EX(WM_NCUAHDRAWCAPTION, OnNCUAHDrawCaption) | |
| 279 MESSAGE_HANDLER_EX(WM_NCUAHDRAWFRAME, OnNCUAHDrawFrame) | |
| 280 | |
| 281 // Vista and newer | |
| 282 MESSAGE_HANDLER_EX(WM_DWMCOMPOSITIONCHANGED, OnDwmCompositionChanged) | |
| 283 | |
| 284 // Non-atlcrack.h handlers | |
| 285 MESSAGE_HANDLER_EX(WM_GETOBJECT, OnGetObject) | |
| 286 | |
| 287 // Mouse events. | |
| 288 MESSAGE_HANDLER_EX(WM_MOUSEACTIVATE, OnMouseActivate) | |
| 289 MESSAGE_HANDLER_EX(WM_MOUSELEAVE, OnMouseRange) | |
| 290 MESSAGE_HANDLER_EX(WM_NCMOUSELEAVE, OnMouseRange) | |
| 291 MESSAGE_HANDLER_EX(WM_SETCURSOR, OnSetCursor); | |
| 292 | |
| 293 // Key events. | |
| 294 MESSAGE_HANDLER_EX(WM_KEYDOWN, OnKeyEvent) | |
| 295 MESSAGE_HANDLER_EX(WM_KEYUP, OnKeyEvent) | |
| 296 MESSAGE_HANDLER_EX(WM_SYSKEYDOWN, OnKeyEvent) | |
| 297 MESSAGE_HANDLER_EX(WM_SYSKEYUP, OnKeyEvent) | |
| 298 | |
| 299 // IME Events. | |
| 300 MESSAGE_HANDLER_EX(WM_IME_SETCONTEXT, OnImeMessages) | |
| 301 MESSAGE_HANDLER_EX(WM_IME_STARTCOMPOSITION, OnImeMessages) | |
| 302 MESSAGE_HANDLER_EX(WM_IME_COMPOSITION, OnImeMessages) | |
| 303 MESSAGE_HANDLER_EX(WM_IME_ENDCOMPOSITION, OnImeMessages) | |
| 304 MESSAGE_HANDLER_EX(WM_IME_REQUEST, OnImeMessages) | |
| 305 MESSAGE_HANDLER_EX(WM_CHAR, OnImeMessages) | |
| 306 MESSAGE_HANDLER_EX(WM_SYSCHAR, OnImeMessages) | |
| 307 MESSAGE_HANDLER_EX(WM_DEADCHAR, OnImeMessages) | |
| 308 MESSAGE_HANDLER_EX(WM_SYSDEADCHAR, OnImeMessages) | |
| 309 | |
| 310 // Touch Events. | |
| 311 MESSAGE_HANDLER_EX(WM_TOUCH, OnTouchEvent) | |
| 312 | |
| 313 // This list is in _ALPHABETICAL_ order! OR I WILL HURT YOU. | |
| 314 MSG_WM_ACTIVATE(OnActivate) | |
| 315 MSG_WM_ACTIVATEAPP(OnActivateApp) | |
| 316 MSG_WM_APPCOMMAND(OnAppCommand) | |
| 317 MSG_WM_CANCELMODE(OnCancelMode) | |
| 318 MSG_WM_CAPTURECHANGED(OnCaptureChanged) | |
| 319 MSG_WM_CLOSE(OnClose) | |
| 320 MSG_WM_COMMAND(OnCommand) | |
| 321 MSG_WM_CREATE(OnCreate) | |
| 322 MSG_WM_DESTROY(OnDestroy) | |
| 323 MSG_WM_DISPLAYCHANGE(OnDisplayChange) | |
| 324 MSG_WM_ERASEBKGND(OnEraseBkgnd) | |
| 325 MSG_WM_ENDSESSION(OnEndSession) | |
| 326 MSG_WM_ENTERSIZEMOVE(OnEnterSizeMove) | |
| 327 MSG_WM_EXITMENULOOP(OnExitMenuLoop) | |
| 328 MSG_WM_EXITSIZEMOVE(OnExitSizeMove) | |
| 329 MSG_WM_GETMINMAXINFO(OnGetMinMaxInfo) | |
| 330 MSG_WM_HSCROLL(OnHScroll) | |
| 331 MSG_WM_INITMENU(OnInitMenu) | |
| 332 MSG_WM_INITMENUPOPUP(OnInitMenuPopup) | |
| 333 MSG_WM_INPUTLANGCHANGE(OnInputLangChange) | |
| 334 MSG_WM_KILLFOCUS(OnKillFocus) | |
| 335 MSG_WM_MOVE(OnMove) | |
| 336 MSG_WM_MOVING(OnMoving) | |
| 337 MSG_WM_NCACTIVATE(OnNCActivate) | |
| 338 MSG_WM_NCCALCSIZE(OnNCCalcSize) | |
| 339 MSG_WM_NCHITTEST(OnNCHitTest) | |
| 340 MSG_WM_NCPAINT(OnNCPaint) | |
| 341 MSG_WM_NOTIFY(OnNotify) | |
| 342 MSG_WM_PAINT(OnPaint) | |
| 343 MSG_WM_POWERBROADCAST(OnPowerBroadcast) | |
| 344 MSG_WM_SETFOCUS(OnSetFocus) | |
| 345 MSG_WM_SETICON(OnSetIcon) | |
| 346 MSG_WM_SETTEXT(OnSetText) | |
| 347 MSG_WM_SETTINGCHANGE(OnSettingChange) | |
| 348 MSG_WM_SIZE(OnSize) | |
| 349 MSG_WM_SYSCOMMAND(OnSysCommand) | |
| 350 MSG_WM_THEMECHANGED(OnThemeChanged) | |
| 351 MSG_WM_VSCROLL(OnVScroll) | |
| 352 MSG_WM_WINDOWPOSCHANGING(OnWindowPosChanging) | |
| 353 MSG_WM_WINDOWPOSCHANGED(OnWindowPosChanged) | |
| 354 END_MSG_MAP() | |
| 355 | |
| 356 // These are all virtual so that specialized Widgets can modify or augment | |
| 357 // processing. | |
| 358 // This list is in _ALPHABETICAL_ order! | |
| 359 // Note: in the base class these functions must do nothing but convert point | |
| 360 // coordinates to client coordinates (if necessary) and forward the | |
| 361 // handling to the appropriate Process* function. This is so that | |
| 362 // subclasses can easily override these methods to do different things | |
| 363 // and have a convenient function to call to get the default behavior. | |
| 364 virtual void OnActivate(UINT action, BOOL minimized, HWND window); | |
| 365 virtual void OnActivateApp(BOOL active, DWORD thread_id); | |
| 366 virtual LRESULT OnAppCommand(HWND window, short app_command, WORD device, | |
| 367 int keystate); | |
| 368 virtual void OnCancelMode(); | |
| 369 virtual void OnCaptureChanged(HWND hwnd); | |
| 370 virtual void OnClose(); | |
| 371 virtual void OnCommand(UINT notification_code, int command_id, HWND window); | |
| 372 virtual LRESULT OnCreate(CREATESTRUCT* create_struct); | |
| 373 // WARNING: If you override this be sure and invoke super, otherwise we'll | |
| 374 // leak a few things. | |
| 375 virtual void OnDestroy(); | |
| 376 virtual void OnDisplayChange(UINT bits_per_pixel, CSize screen_size); | |
| 377 virtual LRESULT OnDwmCompositionChanged(UINT msg, | |
| 378 WPARAM w_param, | |
| 379 LPARAM l_param); | |
| 380 virtual void OnEndSession(BOOL ending, UINT logoff); | |
| 381 virtual void OnEnterSizeMove(); | |
| 382 virtual LRESULT OnEraseBkgnd(HDC dc); | |
| 383 virtual void OnExitMenuLoop(BOOL is_track_popup_menu); | |
| 384 virtual void OnExitSizeMove(); | |
| 385 virtual LRESULT OnGetObject(UINT uMsg, WPARAM w_param, LPARAM l_param); | |
| 386 virtual void OnGetMinMaxInfo(MINMAXINFO* minmax_info); | |
| 387 virtual void OnHScroll(int scroll_type, short position, HWND scrollbar); | |
| 388 virtual LRESULT OnImeMessages(UINT message, WPARAM w_param, LPARAM l_param); | |
| 389 virtual void OnInitMenu(HMENU menu); | |
| 390 virtual void OnInitMenuPopup(HMENU menu, UINT position, BOOL is_system_menu); | |
| 391 virtual void OnInputLangChange(DWORD character_set, HKL input_language_id); | |
| 392 virtual LRESULT OnKeyEvent(UINT message, WPARAM w_param, LPARAM l_param); | |
| 393 virtual void OnKillFocus(HWND focused_window); | |
| 394 virtual LRESULT OnMouseActivate(UINT message, WPARAM w_param, LPARAM l_param); | |
| 395 virtual LRESULT OnMouseRange(UINT message, WPARAM w_param, LPARAM l_param); | |
| 396 virtual void OnMove(const CPoint& point); | |
| 397 virtual void OnMoving(UINT param, LPRECT new_bounds); | |
| 398 virtual LRESULT OnNCActivate(BOOL active); | |
| 399 virtual LRESULT OnNCCalcSize(BOOL w_param, LPARAM l_param); | |
| 400 virtual LRESULT OnNCHitTest(const CPoint& pt); | |
| 401 virtual void OnNCPaint(HRGN rgn); | |
| 402 virtual LRESULT OnNCUAHDrawCaption(UINT msg, | |
| 403 WPARAM w_param, | |
| 404 LPARAM l_param); | |
| 405 virtual LRESULT OnNCUAHDrawFrame(UINT msg, WPARAM w_param, LPARAM l_param); | |
| 406 virtual LRESULT OnNotify(int w_param, NMHDR* l_param); | |
| 407 virtual void OnPaint(HDC dc); | |
| 408 virtual LRESULT OnPowerBroadcast(DWORD power_event, DWORD data); | |
| 409 virtual LRESULT OnReflectedMessage(UINT msg, WPARAM w_param, LPARAM l_param); | |
| 410 virtual LRESULT OnSetCursor(UINT message, WPARAM w_param, LPARAM l_param); | |
| 411 virtual void OnSetFocus(HWND old_focused_window); | |
| 412 virtual LRESULT OnSetIcon(UINT size_type, HICON new_icon); | |
| 413 virtual LRESULT OnSetText(const wchar_t* text); | |
| 414 virtual void OnSettingChange(UINT flags, const wchar_t* section); | |
| 415 virtual void OnSize(UINT param, const CSize& size); | |
| 416 virtual void OnSysCommand(UINT notification_code, CPoint click); | |
| 417 virtual void OnThemeChanged(); | |
| 418 virtual LRESULT OnTouchEvent(UINT message, WPARAM w_param, LPARAM l_param); | |
| 419 virtual void OnVScroll(int scroll_type, short position, HWND scrollbar); | |
| 420 virtual void OnWindowPosChanging(WINDOWPOS* window_pos); | |
| 421 virtual void OnWindowPosChanged(WINDOWPOS* window_pos); | |
| 422 | |
| 423 // Deletes this window as it is destroyed, override to provide different | 173 // Deletes this window as it is destroyed, override to provide different |
| 424 // behavior. | 174 // behavior. |
| 425 virtual void OnFinalMessage(HWND window); | 175 virtual void OnFinalMessage(HWND window); |
| 426 | 176 |
| 427 // Called when a MSAA screen reader client is detected. | 177 // Called when a MSAA screen reader client is detected. |
| 428 virtual void OnScreenReaderDetected(); | 178 virtual void OnScreenReaderDetected(); |
| 429 | 179 |
| 430 // The TooltipManager. This is NULL if there is a problem creating the | 180 HWNDMessageHandler* GetMessageHandler(); |
| 431 // underlying tooltip window. | |
| 432 // WARNING: RootView's destructor calls into the TooltipManager. As such, this | |
| 433 // must be destroyed AFTER root_view_. | |
| 434 scoped_ptr<TooltipManagerWin> tooltip_manager_; | |
| 435 | |
| 436 scoped_refptr<DropTargetWin> drop_target_; | |
| 437 | 181 |
| 438 // Overridden from HWNDMessageHandlerDelegate: | 182 // Overridden from HWNDMessageHandlerDelegate: |
| 439 virtual bool IsWidgetWindow() const OVERRIDE; | 183 virtual bool IsWidgetWindow() const OVERRIDE; |
| 440 virtual bool IsUsingCustomFrame() const OVERRIDE; | 184 virtual bool IsUsingCustomFrame() const OVERRIDE; |
| 441 virtual void SchedulePaint() OVERRIDE; | 185 virtual void SchedulePaint() OVERRIDE; |
| 442 virtual void EnableInactiveRendering() OVERRIDE; | 186 virtual void EnableInactiveRendering() OVERRIDE; |
| 443 virtual bool IsInactiveRenderingDisabled() OVERRIDE; | 187 virtual bool IsInactiveRenderingDisabled() OVERRIDE; |
| 444 virtual bool CanResize() const OVERRIDE; | 188 virtual bool CanResize() const OVERRIDE; |
| 445 virtual bool CanMaximize() const OVERRIDE; | 189 virtual bool CanMaximize() const OVERRIDE; |
| 446 virtual bool CanActivate() const OVERRIDE; | 190 virtual bool CanActivate() const OVERRIDE; |
| 191 virtual bool WidgetSizeIsClientSize() const OVERRIDE; |
| 447 virtual bool CanSaveFocus() const OVERRIDE; | 192 virtual bool CanSaveFocus() const OVERRIDE; |
| 448 virtual void SaveFocusOnDeactivate() OVERRIDE; | 193 virtual void SaveFocusOnDeactivate() OVERRIDE; |
| 449 virtual void RestoreFocusOnActivate() OVERRIDE; | 194 virtual void RestoreFocusOnActivate() OVERRIDE; |
| 450 virtual void RestoreFocusOnEnable() OVERRIDE; | 195 virtual void RestoreFocusOnEnable() OVERRIDE; |
| 451 virtual bool IsModal() const OVERRIDE; | 196 virtual bool IsModal() const OVERRIDE; |
| 452 virtual int GetInitialShowState() const OVERRIDE; | 197 virtual int GetInitialShowState() const OVERRIDE; |
| 453 virtual bool WillProcessWorkAreaChange() const OVERRIDE; | 198 virtual bool WillProcessWorkAreaChange() const OVERRIDE; |
| 454 virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE; | 199 virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE; |
| 455 virtual void GetWindowMask(const gfx::Size& size, gfx::Path* path) OVERRIDE; | 200 virtual void GetWindowMask(const gfx::Size& size, gfx::Path* path) OVERRIDE; |
| 456 virtual bool GetClientAreaInsets(gfx::Insets* insets) const OVERRIDE; | 201 virtual bool GetClientAreaInsets(gfx::Insets* insets) const OVERRIDE; |
| 457 virtual void GetMinMaxSize(gfx::Size* min_size, | 202 virtual void GetMinMaxSize(gfx::Size* min_size, |
| 458 gfx::Size* max_size) const OVERRIDE; | 203 gfx::Size* max_size) const OVERRIDE; |
| 459 virtual gfx::Size GetRootViewSize() const OVERRIDE; | 204 virtual gfx::Size GetRootViewSize() const OVERRIDE; |
| 460 virtual void ResetWindowControls() OVERRIDE; | 205 virtual void ResetWindowControls() OVERRIDE; |
| 461 virtual void UpdateFrame() OVERRIDE; | 206 virtual void UpdateFrame() OVERRIDE; |
| 462 virtual void PaintLayeredWindow(gfx::Canvas* canvas) OVERRIDE; | 207 virtual void PaintLayeredWindow(gfx::Canvas* canvas) OVERRIDE; |
| 463 virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE; | 208 virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE; |
| 464 virtual InputMethod* GetInputMethod() OVERRIDE; | 209 virtual InputMethod* GetInputMethod() OVERRIDE; |
| 465 virtual void HandleAppDeactivated() OVERRIDE; | 210 virtual void HandleAppDeactivated() OVERRIDE; |
| 466 virtual void HandleActivationChanged(bool active) OVERRIDE; | 211 virtual void HandleActivationChanged(bool active) OVERRIDE; |
| 212 virtual void HandleMouseActivate(int hittest_code) OVERRIDE; |
| 467 virtual bool HandleAppCommand(short command) OVERRIDE; | 213 virtual bool HandleAppCommand(short command) OVERRIDE; |
| 468 virtual void HandleCaptureLost() OVERRIDE; | 214 virtual void HandleCaptureLost() OVERRIDE; |
| 469 virtual void HandleClose() OVERRIDE; | 215 virtual void HandleClose() OVERRIDE; |
| 470 virtual bool HandleCommand(int command) OVERRIDE; | 216 virtual bool HandleCommand(int command) OVERRIDE; |
| 471 virtual void HandleAccelerator(const ui::Accelerator& accelerator) OVERRIDE; | 217 virtual void HandleAccelerator(const ui::Accelerator& accelerator) OVERRIDE; |
| 472 virtual void HandleCreate() OVERRIDE; | 218 virtual void HandleCreate() OVERRIDE; |
| 473 virtual void HandleDestroying() OVERRIDE; | 219 virtual void HandleDestroying() OVERRIDE; |
| 474 virtual void HandleDestroyed() OVERRIDE; | 220 virtual void HandleDestroyed() OVERRIDE; |
| 475 virtual bool HandleInitialFocus() OVERRIDE; | 221 virtual bool HandleInitialFocus() OVERRIDE; |
| 476 virtual void HandleDisplayChange() OVERRIDE; | 222 virtual void HandleDisplayChange() OVERRIDE; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 487 virtual bool HandleKeyEvent(const ui::KeyEvent& event) OVERRIDE; | 233 virtual bool HandleKeyEvent(const ui::KeyEvent& event) OVERRIDE; |
| 488 virtual bool HandlePaintAccelerated(const gfx::Rect& invalid_rect) OVERRIDE; | 234 virtual bool HandlePaintAccelerated(const gfx::Rect& invalid_rect) OVERRIDE; |
| 489 virtual void HandlePaint(gfx::Canvas* canvas) OVERRIDE; | 235 virtual void HandlePaint(gfx::Canvas* canvas) OVERRIDE; |
| 490 virtual void HandleScreenReaderDetected() OVERRIDE; | 236 virtual void HandleScreenReaderDetected() OVERRIDE; |
| 491 virtual bool HandleTooltipNotify(int w_param, | 237 virtual bool HandleTooltipNotify(int w_param, |
| 492 NMHDR* l_param, | 238 NMHDR* l_param, |
| 493 LRESULT* l_result) OVERRIDE; | 239 LRESULT* l_result) OVERRIDE; |
| 494 virtual void HandleTooltipMouseMove(UINT message, | 240 virtual void HandleTooltipMouseMove(UINT message, |
| 495 WPARAM w_param, | 241 WPARAM w_param, |
| 496 LPARAM l_param) OVERRIDE; | 242 LPARAM l_param) OVERRIDE; |
| 497 virtual NativeWidgetWin* AsNativeWidgetWin() OVERRIDE; | 243 virtual void HandleEndSession() OVERRIDE; |
| 244 virtual void HandleInitMenuPopup() OVERRIDE; |
| 245 virtual void HandleFrameChanged() OVERRIDE; |
| 246 virtual bool HandleMSG(UINT message, |
| 247 WPARAM w_param, |
| 248 LPARAM l_param, |
| 249 LRESULT* result); |
| 250 // The TooltipManager. This is NULL if there is a problem creating the |
| 251 // underlying tooltip window. |
| 252 // WARNING: RootView's destructor calls into the TooltipManager. As such, this |
| 253 // must be destroyed AFTER root_view_. |
| 254 scoped_ptr<TooltipManagerWin> tooltip_manager_; |
| 255 |
| 256 scoped_refptr<DropTargetWin> drop_target_; |
| 498 | 257 |
| 499 private: | 258 private: |
| 500 typedef ScopedVector<ui::ViewProp> ViewProps; | 259 typedef ScopedVector<ui::ViewProp> ViewProps; |
| 501 | 260 |
| 502 // TODO(beng): This friendship can be removed once all methods relating to | |
| 503 // this object being a WindowImpl are moved to HWNDMessageHandler. | |
| 504 friend HWNDMessageHandler; | |
| 505 | |
| 506 void SetInitParams(const Widget::InitParams& params); | 261 void SetInitParams(const Widget::InitParams& params); |
| 507 | 262 |
| 508 // Determines whether the delegate expects the client size or the window size. | |
| 509 bool WidgetSizeIsClientSize() const; | |
| 510 | |
| 511 // A delegate implementation that handles events received here. | 263 // A delegate implementation that handles events received here. |
| 512 // See class documentation for Widget in widget.h for a note about ownership. | 264 // See class documentation for Widget in widget.h for a note about ownership. |
| 513 internal::NativeWidgetDelegate* delegate_; | 265 internal::NativeWidgetDelegate* delegate_; |
| 514 | 266 |
| 515 // See class documentation for Widget in widget.h for a note about ownership. | 267 // See class documentation for Widget in widget.h for a note about ownership. |
| 516 Widget::InitParams::Ownership ownership_; | 268 Widget::InitParams::Ownership ownership_; |
| 517 | 269 |
| 518 // Instance of accessibility information and handling for MSAA root | 270 // Instance of accessibility information and handling for MSAA root |
| 519 base::win::ScopedComPtr<IAccessible> accessibility_root_; | 271 base::win::ScopedComPtr<IAccessible> accessibility_root_; |
| 520 | 272 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 544 bool has_non_client_view_; | 296 bool has_non_client_view_; |
| 545 | 297 |
| 546 scoped_ptr<HWNDMessageHandler> message_handler_; | 298 scoped_ptr<HWNDMessageHandler> message_handler_; |
| 547 | 299 |
| 548 DISALLOW_COPY_AND_ASSIGN(NativeWidgetWin); | 300 DISALLOW_COPY_AND_ASSIGN(NativeWidgetWin); |
| 549 }; | 301 }; |
| 550 | 302 |
| 551 } // namespace views | 303 } // namespace views |
| 552 | 304 |
| 553 #endif // UI_VIEWS_WIDGET_NATIVE_WIDGET_WIN_H_ | 305 #endif // UI_VIEWS_WIDGET_NATIVE_WIDGET_WIN_H_ |
| OLD | NEW |