| OLD | NEW |
| 1 // Copyright (c) 2010 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_WINDOW_WINDOW_WIN_H_ | 5 #ifndef VIEWS_WINDOW_WINDOW_WIN_H_ |
| 6 #define VIEWS_WINDOW_WINDOW_WIN_H_ | 6 #define VIEWS_WINDOW_WINDOW_WIN_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "views/widget/widget_win.h" | 9 #include "views/widget/widget_win.h" |
| 10 #include "views/window/window.h" | 10 #include "views/window/window.h" |
| 11 | 11 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 // Executes the specified SC_command. | 57 // Executes the specified SC_command. |
| 58 void ExecuteSystemMenuCommand(int command); | 58 void ExecuteSystemMenuCommand(int command); |
| 59 | 59 |
| 60 // Accessors and setters for various properties. | 60 // Accessors and setters for various properties. |
| 61 HWND owning_window() const { return owning_hwnd_; } | 61 HWND owning_window() const { return owning_hwnd_; } |
| 62 void set_focus_on_creation(bool focus_on_creation) { | 62 void set_focus_on_creation(bool focus_on_creation) { |
| 63 focus_on_creation_ = focus_on_creation; | 63 focus_on_creation_ = focus_on_creation; |
| 64 } | 64 } |
| 65 | 65 |
| 66 // Overridden from Window: | 66 // Overridden from Window: |
| 67 virtual gfx::Rect GetBounds() const; | 67 virtual gfx::Rect GetBounds() const OVERRIDE; |
| 68 virtual gfx::Rect GetNormalBounds() const; | 68 virtual gfx::Rect GetNormalBounds() const OVERRIDE; |
| 69 virtual void SetBounds(const gfx::Rect& bounds, | 69 virtual void SetBounds(const gfx::Rect& bounds, |
| 70 gfx::NativeWindow other_window); | 70 gfx::NativeWindow other_window) OVERRIDE; |
| 71 virtual void Show(); | 71 virtual void Show() OVERRIDE; |
| 72 virtual void HideWindow(); | 72 virtual void HideWindow() OVERRIDE; |
| 73 virtual void SetNativeWindowProperty(const char* name, void* value); | 73 virtual void SetNativeWindowProperty(const char* name, void* value) OVERRIDE; |
| 74 virtual void* GetNativeWindowProperty(const char* name); | 74 virtual void* GetNativeWindowProperty(const char* name) OVERRIDE; |
| 75 virtual void PushForceHidden(); | 75 virtual void PushForceHidden() OVERRIDE; |
| 76 virtual void PopForceHidden(); | 76 virtual void PopForceHidden() OVERRIDE; |
| 77 virtual void Activate(); | 77 virtual void Activate() OVERRIDE; |
| 78 virtual void Deactivate(); | 78 virtual void Deactivate() OVERRIDE; |
| 79 virtual void Close(); | 79 virtual void Close() OVERRIDE; |
| 80 virtual void Maximize(); | 80 virtual void Maximize() OVERRIDE; |
| 81 virtual void Minimize(); | 81 virtual void Minimize() OVERRIDE; |
| 82 virtual void Restore(); | 82 virtual void Restore() OVERRIDE; |
| 83 virtual bool IsActive() const; | 83 virtual bool IsActive() const OVERRIDE; |
| 84 virtual bool IsVisible() const; | 84 virtual bool IsVisible() const OVERRIDE; |
| 85 virtual bool IsMaximized() const; | 85 virtual bool IsMaximized() const OVERRIDE; |
| 86 virtual bool IsMinimized() const; | 86 virtual bool IsMinimized() const OVERRIDE; |
| 87 virtual void SetFullscreen(bool fullscreen); | 87 virtual void SetFullscreen(bool fullscreen) OVERRIDE; |
| 88 virtual bool IsFullscreen() const; | 88 virtual bool IsFullscreen() const OVERRIDE; |
| 89 virtual void SetUseDragFrame(bool use_drag_frame); | 89 virtual void SetUseDragFrame(bool use_drag_frame) OVERRIDE; |
| 90 virtual void EnableClose(bool enable); | 90 virtual void EnableClose(bool enable) OVERRIDE; |
| 91 virtual void DisableInactiveRendering(); | 91 virtual void DisableInactiveRendering() OVERRIDE; |
| 92 virtual void UpdateWindowTitle(); | 92 virtual void UpdateWindowTitle() OVERRIDE; |
| 93 virtual void UpdateWindowIcon(); | 93 virtual void UpdateWindowIcon() OVERRIDE; |
| 94 virtual void SetIsAlwaysOnTop(bool always_on_top); | 94 virtual void SetIsAlwaysOnTop(bool always_on_top) OVERRIDE; |
| 95 virtual NonClientFrameView* CreateFrameViewForWindow(); | 95 virtual NonClientFrameView* CreateFrameViewForWindow() OVERRIDE; |
| 96 virtual void UpdateFrameAfterFrameChange(); | 96 virtual void UpdateFrameAfterFrameChange() OVERRIDE; |
| 97 virtual WindowDelegate* GetDelegate() const; | 97 virtual WindowDelegate* GetDelegate() const OVERRIDE; |
| 98 virtual NonClientView* GetNonClientView() const; | 98 virtual NonClientView* GetNonClientView() const OVERRIDE; |
| 99 virtual ClientView* GetClientView() const; | 99 virtual ClientView* GetClientView() const OVERRIDE; |
| 100 virtual gfx::NativeWindow GetNativeWindow() const; | 100 virtual gfx::NativeWindow GetNativeWindow() const OVERRIDE; |
| 101 virtual bool ShouldUseNativeFrame() const; | 101 virtual bool ShouldUseNativeFrame() const OVERRIDE; |
| 102 virtual void FrameTypeChanged(); | 102 virtual void FrameTypeChanged() OVERRIDE; |
| 103 | 103 |
| 104 // Returns the system set window title font. | 104 // Returns the system set window title font. |
| 105 static gfx::Font GetWindowTitleFont(); | 105 static gfx::Font GetWindowTitleFont(); |
| 106 | 106 |
| 107 protected: | 107 protected: |
| 108 friend Window; | 108 friend Window; |
| 109 | 109 |
| 110 // Constructs the WindowWin. |window_delegate| cannot be NULL. | 110 // Constructs the WindowWin. |window_delegate| cannot be NULL. |
| 111 explicit WindowWin(WindowDelegate* window_delegate); | 111 explicit WindowWin(WindowDelegate* window_delegate); |
| 112 | 112 |
| 113 // Create the Window. | 113 // Create the Window. |
| 114 // If parent is NULL, this WindowWin is top level on the desktop. | 114 // If parent is NULL, this WindowWin is top level on the desktop. |
| 115 // If |bounds| is empty, the view is queried for its preferred size and | 115 // If |bounds| is empty, the view is queried for its preferred size and |
| 116 // centered on screen. | 116 // centered on screen. |
| 117 virtual void Init(HWND parent, const gfx::Rect& bounds); | 117 virtual void Init(gfx::NativeView parent, const gfx::Rect& bounds) OVERRIDE; |
| 118 | 118 |
| 119 // Sizes the window to the default size specified by its ClientView. | 119 // Sizes the window to the default size specified by its ClientView. |
| 120 // TODO(msw): Doesn't override any base member, but similar to WindowGtk::Size
WindowToDefault |
| 121 // Add base definition to Window or move to private? |
| 120 virtual void SizeWindowToDefault(); | 122 virtual void SizeWindowToDefault(); |
| 121 | 123 |
| 122 // Returns the insets of the client area relative to the non-client area of | 124 // Returns the insets of the client area relative to the non-client area of |
| 123 // the window. Override this function instead of OnNCCalcSize, which is | 125 // the window. Override this function instead of OnNCCalcSize, which is |
| 124 // crazily complicated. | 126 // crazily complicated. |
| 125 virtual gfx::Insets GetClientAreaInsets() const; | 127 virtual gfx::Insets GetClientAreaInsets() const; |
| 126 | 128 |
| 127 // Overridden from WidgetWin: | 129 // Overridden from WidgetWin: |
| 128 virtual void OnActivate(UINT action, BOOL minimized, HWND window); | 130 virtual void OnActivate(UINT action, BOOL minimized, HWND window) OVERRIDE; |
| 129 virtual void OnActivateApp(BOOL active, DWORD thread_id); | 131 virtual void OnActivateApp(BOOL active, DWORD thread_id) OVERRIDE; |
| 130 virtual LRESULT OnAppCommand(HWND window, short app_command, WORD device, | 132 virtual LRESULT OnAppCommand(HWND window, short app_command, WORD device, |
| 131 int keystate); | 133 int keystate) OVERRIDE; |
| 132 virtual void OnCommand(UINT notification_code, int command_id, HWND window); | 134 virtual void OnCommand(UINT notification_code, int command_id, HWND window) |
| 133 virtual void OnDestroy(); | 135 OVERRIDE; |
| 136 virtual void OnDestroy() OVERRIDE; |
| 134 virtual LRESULT OnDwmCompositionChanged(UINT msg, WPARAM w_param, | 137 virtual LRESULT OnDwmCompositionChanged(UINT msg, WPARAM w_param, |
| 135 LPARAM l_param); | 138 LPARAM l_param) OVERRIDE; |
| 136 virtual void OnFinalMessage(HWND window); | 139 virtual void OnFinalMessage(HWND window) OVERRIDE; |
| 137 virtual void OnGetMinMaxInfo(MINMAXINFO* minmax_info); | 140 virtual void OnGetMinMaxInfo(MINMAXINFO* minmax_info) OVERRIDE; |
| 138 virtual void OnInitMenu(HMENU menu); | 141 virtual void OnInitMenu(HMENU menu) OVERRIDE; |
| 139 virtual void OnMouseLeave(); | 142 virtual LRESULT OnMouseLeave(UINT message, WPARAM w_param, LPARAM l_param) |
| 140 virtual LRESULT OnNCActivate(BOOL active); | 143 OVERRIDE; |
| 144 virtual LRESULT OnNCActivate(BOOL active) OVERRIDE; |
| 141 LRESULT OnNCCalcSize(BOOL mode, LPARAM l_param); // Don't override. | 145 LRESULT OnNCCalcSize(BOOL mode, LPARAM l_param); // Don't override. |
| 142 virtual LRESULT OnNCHitTest(const CPoint& point); | 146 virtual LRESULT OnNCHitTest(const CPoint& point) OVERRIDE; |
| 143 virtual void OnNCPaint(HRGN rgn); | 147 virtual void OnNCPaint(HRGN rgn) OVERRIDE; |
| 144 virtual void OnNCLButtonDown(UINT ht_component, const CPoint& point); | 148 virtual LRESULT OnNCLButtonDown(UINT message, WPARAM w_param, LPARAM l_param) |
| 145 virtual void OnNCRButtonDown(UINT ht_component, const CPoint& point); | 149 OVERRIDE; |
| 146 virtual void OnRButtonUp(UINT ht_component, const CPoint& point); | 150 virtual LRESULT OnNCRButtonDown(UINT message, WPARAM w_param, LPARAM l_param) |
| 147 virtual LRESULT OnNCUAHDrawCaption(UINT msg, WPARAM w_param, LPARAM l_param); | 151 OVERRIDE; |
| 148 virtual LRESULT OnNCUAHDrawFrame(UINT msg, WPARAM w_param, LPARAM l_param); | 152 virtual LRESULT OnRButtonUp(UINT message, WPARAM w_param, LPARAM l_param) |
| 149 virtual LRESULT OnSetIcon(UINT size_type, HICON new_icon); | 153 OVERRIDE; |
| 150 virtual LRESULT OnSetText(const wchar_t* text); | 154 virtual LRESULT OnNCUAHDrawCaption(UINT msg, WPARAM w_param, LPARAM l_param) |
| 151 virtual void OnSettingChange(UINT flags, const wchar_t* section); | 155 OVERRIDE; |
| 152 virtual void OnSize(UINT size_param, const CSize& new_size); | 156 virtual LRESULT OnNCUAHDrawFrame(UINT msg, WPARAM w_param, LPARAM l_param) |
| 153 virtual void OnSysCommand(UINT notification_code, CPoint click); | 157 OVERRIDE; |
| 154 virtual void OnWindowPosChanging(WINDOWPOS* window_pos); | 158 virtual LRESULT OnSetIcon(UINT size_type, HICON new_icon) OVERRIDE; |
| 155 virtual Window* GetWindow() { return this; } | 159 virtual LRESULT OnSetText(const wchar_t* text) OVERRIDE; |
| 156 virtual const Window* GetWindow() const { return this; } | 160 virtual void OnSettingChange(UINT flags, const wchar_t* section) OVERRIDE; |
| 157 virtual gfx::Size GetRootViewSize() const; | 161 virtual void OnSize(UINT size_param, const CSize& new_size) OVERRIDE; |
| 162 virtual void OnSysCommand(UINT notification_code, CPoint click) OVERRIDE; |
| 163 virtual void OnWindowPosChanging(WINDOWPOS* window_pos) OVERRIDE; |
| 164 virtual Window* GetWindow() OVERRIDE { return this; } |
| 165 virtual const Window* GetWindow() const OVERRIDE { return this; } |
| 166 virtual gfx::Size GetRootViewSize() const OVERRIDE; |
| 158 | 167 |
| 159 // Accessor for disable_inactive_rendering_. | 168 // Accessor for disable_inactive_rendering_. |
| 160 bool disable_inactive_rendering() const { | 169 bool disable_inactive_rendering() const { |
| 161 return disable_inactive_rendering_; | 170 return disable_inactive_rendering_; |
| 162 } | 171 } |
| 163 | 172 |
| 164 private: | 173 private: |
| 165 // Information saved before going into fullscreen mode, used to restore the | 174 // Information saved before going into fullscreen mode, used to restore the |
| 166 // window afterwards. | 175 // window afterwards. |
| 167 struct SavedWindowInfo { | 176 struct SavedWindowInfo { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 // Resets the window region for the current window bounds if necessary. | 214 // Resets the window region for the current window bounds if necessary. |
| 206 // If |force| is true, the window region is reset to NULL even for native | 215 // If |force| is true, the window region is reset to NULL even for native |
| 207 // frame windows. | 216 // frame windows. |
| 208 void ResetWindowRegion(bool force); | 217 void ResetWindowRegion(bool force); |
| 209 | 218 |
| 210 // Update accessibility information via our WindowDelegate. | 219 // Update accessibility information via our WindowDelegate. |
| 211 void UpdateAccessibleName(std::wstring& accessible_name); | 220 void UpdateAccessibleName(std::wstring& accessible_name); |
| 212 void UpdateAccessibleRole(); | 221 void UpdateAccessibleRole(); |
| 213 void UpdateAccessibleState(); | 222 void UpdateAccessibleState(); |
| 214 | 223 |
| 224 // TODO(msw): Remove redundancy with new Event processing. |
| 225 // TODO(msw): ProcessNCMousePress could be made class/file private (or inlined
in OnNCLButtonDown). |
| 215 // Converts a non-client mouse down message to a regular ChromeViews event | 226 // Converts a non-client mouse down message to a regular ChromeViews event |
| 216 // and handle it. |point| is the mouse position of the message in screen | 227 // and handles it. |l_param| contains the mouse position of the message in |
| 217 // coords. |flags| are flags that would be passed with a WM_L/M/RBUTTON* | 228 // screen coords. |w_param| contains flags that would be passed with a |
| 218 // message and relate to things like which button was pressed. These are | 229 // WM_L/M/RBUTTON* message and relate to things like which button was pressed. |
| 219 // combined with flags relating to the current key state. | 230 // These are combined with flags relating to the current key state. |
| 220 void ProcessNCMousePress(const CPoint& point, int flags); | 231 void ProcessNCMousePress(UINT message, WPARAM w_param, LPARAM l_param); |
| 221 | 232 |
| 222 // Calls the default WM_NCACTIVATE handler with the specified activation | 233 // Calls the default WM_NCACTIVATE handler with the specified activation |
| 223 // value, safely wrapping the call in a ScopedRedrawLock to prevent frame | 234 // value, safely wrapping the call in a ScopedRedrawLock to prevent frame |
| 224 // flicker. | 235 // flicker. |
| 225 LRESULT CallDefaultNCActivateHandler(BOOL active); | 236 LRESULT CallDefaultNCActivateHandler(BOOL active); |
| 226 | 237 |
| 227 // Returns the normal bounds of the window in screen coordinates and | 238 // Returns the normal bounds of the window in screen coordinates and |
| 228 // whether the window is maximized. The arguments can be NULL. | 239 // whether the window is maximized. The arguments can be NULL. |
| 229 void GetWindowBoundsAndMaximizedState(gfx::Rect* bounds, | 240 void GetWindowBoundsAndMaximizedState(gfx::Rect* bounds, |
| 230 bool* maximized) const; | 241 bool* maximized) const; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 // The window styles before we modified them for the drag frame appearance. | 329 // The window styles before we modified them for the drag frame appearance. |
| 319 DWORD drag_frame_saved_window_style_; | 330 DWORD drag_frame_saved_window_style_; |
| 320 DWORD drag_frame_saved_window_ex_style_; | 331 DWORD drag_frame_saved_window_ex_style_; |
| 321 | 332 |
| 322 DISALLOW_COPY_AND_ASSIGN(WindowWin); | 333 DISALLOW_COPY_AND_ASSIGN(WindowWin); |
| 323 }; | 334 }; |
| 324 | 335 |
| 325 } // namespace views | 336 } // namespace views |
| 326 | 337 |
| 327 #endif // VIEWS_WINDOW_WINDOW_WIN_H_ | 338 #endif // VIEWS_WINDOW_WINDOW_WIN_H_ |
| OLD | NEW |