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 SetWindowBounds(const gfx::Rect& bounds, | 69 virtual void SetWindowBounds(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 virtual void SizeWindowToDefault(); | 120 virtual void SizeWindowToDefault(); |
121 | 121 |
122 // Returns the insets of the client area relative to the non-client area of | 122 // 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 | 123 // the window. Override this function instead of OnNCCalcSize, which is |
124 // crazily complicated. | 124 // crazily complicated. |
125 virtual gfx::Insets GetClientAreaInsets() const; | 125 virtual gfx::Insets GetClientAreaInsets() const; |
126 | 126 |
127 // Overridden from WidgetWin: | 127 // Overridden from WidgetWin: |
128 virtual void OnActivate(UINT action, BOOL minimized, HWND window); | 128 virtual void OnActivate(UINT action, BOOL minimized, HWND window) OVERRIDE; |
129 virtual void OnActivateApp(BOOL active, DWORD thread_id); | 129 virtual void OnActivateApp(BOOL active, DWORD thread_id) OVERRIDE; |
130 virtual LRESULT OnAppCommand(HWND window, short app_command, WORD device, | 130 virtual LRESULT OnAppCommand(HWND window, short app_command, WORD device, |
131 int keystate); | 131 int keystate) OVERRIDE; |
132 virtual void OnCommand(UINT notification_code, int command_id, HWND window); | 132 virtual void OnCommand(UINT notification_code, int command_id, HWND window) |
133 virtual void OnDestroy(); | 133 OVERRIDE; |
| 134 virtual void OnDestroy() OVERRIDE; |
134 virtual LRESULT OnDwmCompositionChanged(UINT msg, WPARAM w_param, | 135 virtual LRESULT OnDwmCompositionChanged(UINT msg, WPARAM w_param, |
135 LPARAM l_param); | 136 LPARAM l_param) OVERRIDE; |
136 virtual void OnFinalMessage(HWND window); | 137 virtual void OnFinalMessage(HWND window) OVERRIDE; |
137 virtual void OnGetMinMaxInfo(MINMAXINFO* minmax_info); | 138 virtual void OnGetMinMaxInfo(MINMAXINFO* minmax_info) OVERRIDE; |
138 virtual void OnInitMenu(HMENU menu); | 139 virtual void OnInitMenu(HMENU menu) OVERRIDE; |
139 virtual void OnMouseLeave(); | 140 virtual LRESULT OnMouseLeave(UINT message, WPARAM w_param, LPARAM l_param) |
140 virtual LRESULT OnNCActivate(BOOL active); | 141 OVERRIDE; |
| 142 virtual LRESULT OnMouseRange(UINT message, WPARAM w_param, LPARAM l_param) |
| 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 OnNCMouseRange(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 OnNCUAHDrawCaption(UINT msg, 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 OnNCUAHDrawFrame(UINT msg, 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 OnSetIcon(UINT size_type, HICON new_icon) OVERRIDE; |
151 virtual void OnSettingChange(UINT flags, const wchar_t* section); | 155 virtual LRESULT OnSetText(const wchar_t* text) OVERRIDE; |
152 virtual void OnSize(UINT size_param, const CSize& new_size); | 156 virtual void OnSettingChange(UINT flags, const wchar_t* section) OVERRIDE; |
153 virtual void OnSysCommand(UINT notification_code, CPoint click); | 157 virtual void OnSize(UINT size_param, const CSize& new_size) OVERRIDE; |
154 virtual void OnWindowPosChanging(WINDOWPOS* window_pos); | 158 virtual void OnSysCommand(UINT notification_code, CPoint click) OVERRIDE; |
155 virtual Window* GetWindow() { return this; } | 159 virtual void OnWindowPosChanging(WINDOWPOS* window_pos) OVERRIDE; |
156 virtual const Window* GetWindow() const { return this; } | 160 virtual Window* GetWindow() OVERRIDE { return this; } |
| 161 virtual const Window* GetWindow() const OVERRIDE { return this; } |
157 | 162 |
158 // Accessor for disable_inactive_rendering_. | 163 // Accessor for disable_inactive_rendering_. |
159 bool disable_inactive_rendering() const { | 164 bool disable_inactive_rendering() const { |
160 return disable_inactive_rendering_; | 165 return disable_inactive_rendering_; |
161 } | 166 } |
162 | 167 |
163 private: | 168 private: |
164 // Information saved before going into fullscreen mode, used to restore the | 169 // Information saved before going into fullscreen mode, used to restore the |
165 // window afterwards. | 170 // window afterwards. |
166 struct SavedWindowInfo { | 171 struct SavedWindowInfo { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 // Resets the window region for the current window bounds if necessary. | 209 // Resets the window region for the current window bounds if necessary. |
205 // If |force| is true, the window region is reset to NULL even for native | 210 // If |force| is true, the window region is reset to NULL even for native |
206 // frame windows. | 211 // frame windows. |
207 void ResetWindowRegion(bool force); | 212 void ResetWindowRegion(bool force); |
208 | 213 |
209 // Update accessibility information via our WindowDelegate. | 214 // Update accessibility information via our WindowDelegate. |
210 void UpdateAccessibleName(std::wstring& accessible_name); | 215 void UpdateAccessibleName(std::wstring& accessible_name); |
211 void UpdateAccessibleRole(); | 216 void UpdateAccessibleRole(); |
212 void UpdateAccessibleState(); | 217 void UpdateAccessibleState(); |
213 | 218 |
214 // Converts a non-client mouse down message to a regular ChromeViews event | |
215 // and handle it. |point| is the mouse position of the message in screen | |
216 // coords. |flags| are flags that would be passed with a WM_L/M/RBUTTON* | |
217 // message and relate to things like which button was pressed. These are | |
218 // combined with flags relating to the current key state. | |
219 void ProcessNCMousePress(const CPoint& point, int flags); | |
220 | |
221 // Calls the default WM_NCACTIVATE handler with the specified activation | 219 // Calls the default WM_NCACTIVATE handler with the specified activation |
222 // value, safely wrapping the call in a ScopedRedrawLock to prevent frame | 220 // value, safely wrapping the call in a ScopedRedrawLock to prevent frame |
223 // flicker. | 221 // flicker. |
224 LRESULT CallDefaultNCActivateHandler(BOOL active); | 222 LRESULT CallDefaultNCActivateHandler(BOOL active); |
225 | 223 |
226 // Returns the normal bounds of the window in screen coordinates and | 224 // Returns the normal bounds of the window in screen coordinates and |
227 // whether the window is maximized. The arguments can be NULL. | 225 // whether the window is maximized. The arguments can be NULL. |
228 void GetWindowBoundsAndMaximizedState(gfx::Rect* bounds, | 226 void GetWindowBoundsAndMaximizedState(gfx::Rect* bounds, |
229 bool* maximized) const; | 227 bool* maximized) const; |
230 | 228 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 // The window styles before we modified them for the drag frame appearance. | 315 // The window styles before we modified them for the drag frame appearance. |
318 DWORD drag_frame_saved_window_style_; | 316 DWORD drag_frame_saved_window_style_; |
319 DWORD drag_frame_saved_window_ex_style_; | 317 DWORD drag_frame_saved_window_ex_style_; |
320 | 318 |
321 DISALLOW_COPY_AND_ASSIGN(WindowWin); | 319 DISALLOW_COPY_AND_ASSIGN(WindowWin); |
322 }; | 320 }; |
323 | 321 |
324 } // namespace views | 322 } // namespace views |
325 | 323 |
326 #endif // VIEWS_WINDOW_WINDOW_WIN_H_ | 324 #endif // VIEWS_WINDOW_WINDOW_WIN_H_ |
OLD | NEW |