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