OLD | NEW |
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_WINDOW_WINDOW_H_ | 5 #ifndef VIEWS_WINDOW_WINDOW_H_ |
6 #define VIEWS_WINDOW_WINDOW_H_ | 6 #define VIEWS_WINDOW_WINDOW_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "ui/gfx/native_widget_types.h" | 9 #include "ui/gfx/native_widget_types.h" |
10 #include "views/widget/widget.h" | 10 #include "views/widget/widget.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 struct InitParams { | 45 struct InitParams { |
46 // |window_delegate| cannot be NULL. | 46 // |window_delegate| cannot be NULL. |
47 explicit InitParams(WindowDelegate* window_delegate); | 47 explicit InitParams(WindowDelegate* window_delegate); |
48 | 48 |
49 WindowDelegate* window_delegate; | 49 WindowDelegate* window_delegate; |
50 gfx::NativeWindow parent_window; | 50 gfx::NativeWindow parent_window; |
51 NativeWindow* native_window; | 51 NativeWindow* native_window; |
52 Widget::InitParams widget_init_params; | 52 Widget::InitParams widget_init_params; |
53 }; | 53 }; |
54 | 54 |
| 55 enum FrameType { |
| 56 FRAME_TYPE_DEFAULT, // Use whatever the default would be. |
| 57 FRAME_TYPE_FORCE_CUSTOM, // Force the custom frame. |
| 58 FRAME_TYPE_FORCE_NATIVE // Force the native frame. |
| 59 }; |
| 60 |
55 Window(); | 61 Window(); |
56 virtual ~Window(); | 62 virtual ~Window(); |
57 | 63 |
58 // Creates an instance of an object implementing this interface. | 64 // Creates an instance of an object implementing this interface. |
59 // TODO(beng): create a version of this function that takes a NativeView, for | 65 // TODO(beng): create a version of this function that takes a NativeView, for |
60 // constrained windows. | 66 // constrained windows. |
61 static Window* CreateChromeWindow(gfx::NativeWindow parent, | 67 static Window* CreateChromeWindow(gfx::NativeWindow parent, |
62 const gfx::Rect& bounds, | 68 const gfx::Rect& bounds, |
63 WindowDelegate* window_delegate); | 69 WindowDelegate* window_delegate); |
64 | 70 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 | 161 |
156 // Creates an appropriate NonClientFrameView for this window. | 162 // Creates an appropriate NonClientFrameView for this window. |
157 virtual NonClientFrameView* CreateFrameViewForWindow(); | 163 virtual NonClientFrameView* CreateFrameViewForWindow(); |
158 | 164 |
159 // Updates the frame after an event caused it to be changed. | 165 // Updates the frame after an event caused it to be changed. |
160 virtual void UpdateFrameAfterFrameChange(); | 166 virtual void UpdateFrameAfterFrameChange(); |
161 | 167 |
162 // Retrieves the Window's native window handle. | 168 // Retrieves the Window's native window handle. |
163 gfx::NativeWindow GetNativeWindow() const; | 169 gfx::NativeWindow GetNativeWindow() const; |
164 | 170 |
| 171 void set_frame_type(FrameType frame_type) { frame_type_ = frame_type; } |
| 172 FrameType frame_type() const { return frame_type_; } |
| 173 |
165 // Whether we should be using a native frame. | 174 // Whether we should be using a native frame. |
166 bool ShouldUseNativeFrame() const; | 175 bool ShouldUseNativeFrame() const; |
167 | 176 |
| 177 // Forces the frame into the alternate frame type (custom or native) depending |
| 178 // on its current state. |
| 179 void DebugToggleFrameType(); |
| 180 |
168 // Tell the window that something caused the frame type to change. | 181 // Tell the window that something caused the frame type to change. |
169 void FrameTypeChanged(); | 182 void FrameTypeChanged(); |
170 | 183 |
171 WindowDelegate* window_delegate() { | 184 WindowDelegate* window_delegate() { |
172 return const_cast<WindowDelegate*>( | 185 return const_cast<WindowDelegate*>( |
173 const_cast<const Window*>(this)->window_delegate()); | 186 const_cast<const Window*>(this)->window_delegate()); |
174 } | 187 } |
175 const WindowDelegate* window_delegate() const { | 188 const WindowDelegate* window_delegate() const { |
176 return window_delegate_; | 189 return window_delegate_; |
177 } | 190 } |
(...skipping 16 matching lines...) Expand all Loading... |
194 | 207 |
195 NativeWindow* native_window() { return native_window_; } | 208 NativeWindow* native_window() { return native_window_; } |
196 | 209 |
197 protected: | 210 protected: |
198 // Overridden from NativeWindowDelegate: | 211 // Overridden from NativeWindowDelegate: |
199 virtual bool CanActivate() const OVERRIDE; | 212 virtual bool CanActivate() const OVERRIDE; |
200 virtual bool IsInactiveRenderingDisabled() const OVERRIDE; | 213 virtual bool IsInactiveRenderingDisabled() const OVERRIDE; |
201 virtual void EnableInactiveRendering() OVERRIDE; | 214 virtual void EnableInactiveRendering() OVERRIDE; |
202 virtual bool IsModal() const OVERRIDE; | 215 virtual bool IsModal() const OVERRIDE; |
203 virtual bool IsDialogBox() const OVERRIDE; | 216 virtual bool IsDialogBox() const OVERRIDE; |
204 virtual bool IsUsingNativeFrame() const OVERRIDE; | |
205 virtual gfx::Size GetMinimumSize() const OVERRIDE; | 217 virtual gfx::Size GetMinimumSize() const OVERRIDE; |
206 virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE; | 218 virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE; |
207 virtual bool ExecuteCommand(int command_id) OVERRIDE; | 219 virtual bool ExecuteCommand(int command_id) OVERRIDE; |
208 virtual void OnNativeWindowCreated(const gfx::Rect& bounds) OVERRIDE; | 220 virtual void OnNativeWindowCreated(const gfx::Rect& bounds) OVERRIDE; |
209 virtual void OnNativeWindowActivationChanged(bool active) OVERRIDE; | 221 virtual void OnNativeWindowActivationChanged(bool active) OVERRIDE; |
210 virtual void OnNativeWindowBeginUserBoundsChange() OVERRIDE; | 222 virtual void OnNativeWindowBeginUserBoundsChange() OVERRIDE; |
211 virtual void OnNativeWindowEndUserBoundsChange() OVERRIDE; | 223 virtual void OnNativeWindowEndUserBoundsChange() OVERRIDE; |
212 virtual void OnNativeWindowDestroying() OVERRIDE; | 224 virtual void OnNativeWindowDestroying() OVERRIDE; |
213 virtual void OnNativeWindowDestroyed() OVERRIDE; | 225 virtual void OnNativeWindowDestroyed() OVERRIDE; |
214 virtual void OnNativeWindowBoundsChanged() OVERRIDE; | 226 virtual void OnNativeWindowBoundsChanged() OVERRIDE; |
(...skipping 26 matching lines...) Expand all Loading... |
241 // The smallest size the window can be. | 253 // The smallest size the window can be. |
242 gfx::Size minimum_size_; | 254 gfx::Size minimum_size_; |
243 | 255 |
244 // True when the window should be rendered as active, regardless of whether | 256 // True when the window should be rendered as active, regardless of whether |
245 // or not it actually is. | 257 // or not it actually is. |
246 bool disable_inactive_rendering_; | 258 bool disable_inactive_rendering_; |
247 | 259 |
248 // Set to true if the window is in the process of closing . | 260 // Set to true if the window is in the process of closing . |
249 bool window_closed_; | 261 bool window_closed_; |
250 | 262 |
| 263 // The current frame type in use by this window. Defaults to |
| 264 // FRAME_TYPE_DEFAULT. |
| 265 FrameType frame_type_; |
| 266 |
251 DISALLOW_COPY_AND_ASSIGN(Window); | 267 DISALLOW_COPY_AND_ASSIGN(Window); |
252 }; | 268 }; |
253 | 269 |
254 } // namespace views | 270 } // namespace views |
255 | 271 |
256 #endif // #ifndef VIEWS_WINDOW_WINDOW_H_ | 272 #endif // #ifndef VIEWS_WINDOW_WINDOW_H_ |
OLD | NEW |