| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 87 |
| 88 // Retrieves the restored bounds for the window. | 88 // Retrieves the restored bounds for the window. |
| 89 gfx::Rect GetNormalBounds() const; | 89 gfx::Rect GetNormalBounds() const; |
| 90 | 90 |
| 91 // Sets the Window's bounds. The window is inserted after |other_window| in | 91 // Sets the Window's bounds. The window is inserted after |other_window| in |
| 92 // the window Z-order. If this window is not yet visible, other_window's | 92 // the window Z-order. If this window is not yet visible, other_window's |
| 93 // monitor is used as the constraining rectangle, rather than this window's | 93 // monitor is used as the constraining rectangle, rather than this window's |
| 94 // monitor. | 94 // monitor. |
| 95 void SetWindowBounds(const gfx::Rect& bounds, gfx::NativeWindow other_window); | 95 void SetWindowBounds(const gfx::Rect& bounds, gfx::NativeWindow other_window); |
| 96 | 96 |
| 97 // Makes the window visible. | |
| 98 void Show(); | |
| 99 | |
| 100 // Like Show(), but does not activate the window. | 97 // Like Show(), but does not activate the window. |
| 101 void ShowInactive(); | 98 void ShowInactive(); |
| 102 | 99 |
| 103 // Hides the window. This does not delete the window, it just hides it. This | |
| 104 // always hides the window, it is separate from the stack maintained by | |
| 105 // Push/PopForceHidden. | |
| 106 virtual void HideWindow(); | |
| 107 | |
| 108 // Prevents the window from being rendered as deactivated the next time it is. | 100 // Prevents the window from being rendered as deactivated the next time it is. |
| 109 // This state is reset automatically as soon as the window becomes activated | 101 // This state is reset automatically as soon as the window becomes activated |
| 110 // again. There is no ability to control the state through this API as this | 102 // again. There is no ability to control the state through this API as this |
| 111 // leads to sync problems. | 103 // leads to sync problems. |
| 112 void DisableInactiveRendering(); | 104 void DisableInactiveRendering(); |
| 113 | 105 |
| 114 // Activates the window, assuming it already exists and is visible. | |
| 115 void Activate(); | |
| 116 | |
| 117 // Deactivates the window, making the next window in the Z order the active | |
| 118 // window. | |
| 119 void Deactivate(); | |
| 120 | |
| 121 // Closes the window, ultimately destroying it. The window hides immediately, | |
| 122 // and is destroyed after a return to the message loop. Close() can be called | |
| 123 // multiple times. | |
| 124 virtual void Close() OVERRIDE; | |
| 125 | |
| 126 // Maximizes/minimizes/restores the window. | |
| 127 void Maximize(); | |
| 128 void Minimize(); | |
| 129 void Restore(); | |
| 130 | |
| 131 // Whether or not the window is currently active. | |
| 132 bool IsActive() const; | |
| 133 | |
| 134 // Whether or not the window is currently visible. | |
| 135 bool IsVisible() const; | |
| 136 | |
| 137 // Whether or not the window is maximized or minimized. | |
| 138 virtual bool IsMaximized() const; | |
| 139 bool IsMinimized() const; | |
| 140 | |
| 141 // Accessors for fullscreen state. | 106 // Accessors for fullscreen state. |
| 142 void SetFullscreen(bool fullscreen); | 107 void SetFullscreen(bool fullscreen); |
| 143 bool IsFullscreen() const; | 108 bool IsFullscreen() const; |
| 144 | 109 |
| 145 // Sets whether or not the window should show its frame as a "transient drag | 110 // Sets whether or not the window should show its frame as a "transient drag |
| 146 // frame" - slightly transparent and without the standard window controls. | 111 // frame" - slightly transparent and without the standard window controls. |
| 147 void SetUseDragFrame(bool use_drag_frame); | 112 void SetUseDragFrame(bool use_drag_frame); |
| 148 | 113 |
| 149 // Toggles the enable state for the Close button (and the Close menu item in | 114 // Toggles the enable state for the Close button (and the Close menu item in |
| 150 // the system menu). | 115 // the system menu). |
| 151 void EnableClose(bool enable); | 116 void EnableClose(bool enable); |
| 152 | 117 |
| 153 // Tell the window to update its title from the delegate. | 118 // Tell the window to update its title from the delegate. |
| 154 void UpdateWindowTitle(); | 119 void UpdateWindowTitle(); |
| 155 | 120 |
| 156 // Tell the window to update its icon from the delegate. | 121 // Tell the window to update its icon from the delegate. |
| 157 void UpdateWindowIcon(); | 122 void UpdateWindowIcon(); |
| 158 | 123 |
| 159 // Sets whether or not the window is always-on-top. | |
| 160 void SetIsAlwaysOnTop(bool always_on_top); | |
| 161 | |
| 162 // Creates an appropriate NonClientFrameView for this window. | 124 // Creates an appropriate NonClientFrameView for this window. |
| 163 virtual NonClientFrameView* CreateFrameViewForWindow(); | 125 virtual NonClientFrameView* CreateFrameViewForWindow(); |
| 164 | 126 |
| 165 // Updates the frame after an event caused it to be changed. | 127 // Updates the frame after an event caused it to be changed. |
| 166 virtual void UpdateFrameAfterFrameChange(); | 128 virtual void UpdateFrameAfterFrameChange(); |
| 167 | 129 |
| 168 // Retrieves the Window's native window handle. | 130 // Retrieves the Window's native window handle. |
| 169 gfx::NativeWindow GetNativeWindow() const; | 131 gfx::NativeWindow GetNativeWindow() const; |
| 170 | 132 |
| 171 void set_frame_type(FrameType frame_type) { frame_type_ = frame_type; } | 133 void set_frame_type(FrameType frame_type) { frame_type_ = frame_type; } |
| 172 FrameType frame_type() const { return frame_type_; } | 134 FrameType frame_type() const { return frame_type_; } |
| 173 | 135 |
| 174 // Whether we should be using a native frame. | 136 // Whether we should be using a native frame. |
| 175 bool ShouldUseNativeFrame() const; | 137 bool ShouldUseNativeFrame() const; |
| 176 | 138 |
| 177 // Forces the frame into the alternate frame type (custom or native) depending | 139 // Forces the frame into the alternate frame type (custom or native) depending |
| 178 // on its current state. | 140 // on its current state. |
| 179 void DebugToggleFrameType(); | 141 void DebugToggleFrameType(); |
| 180 | 142 |
| 181 // Tell the window that something caused the frame type to change. | 143 // Tell the window that something caused the frame type to change. |
| 182 void FrameTypeChanged(); | 144 void FrameTypeChanged(); |
| 183 | 145 |
| 146 // Overridden from Widget: |
| 147 virtual void Show() OVERRIDE; |
| 148 virtual void Close() OVERRIDE; |
| 149 |
| 184 WindowDelegate* window_delegate() { | 150 WindowDelegate* window_delegate() { |
| 185 return const_cast<WindowDelegate*>( | 151 return const_cast<WindowDelegate*>( |
| 186 const_cast<const Window*>(this)->window_delegate()); | 152 const_cast<const Window*>(this)->window_delegate()); |
| 187 } | 153 } |
| 188 const WindowDelegate* window_delegate() const { | 154 const WindowDelegate* window_delegate() const { |
| 189 return window_delegate_; | 155 return window_delegate_; |
| 190 } | 156 } |
| 191 | 157 |
| 192 NonClientView* non_client_view() { | 158 NonClientView* non_client_view() { |
| 193 return const_cast<NonClientView*>( | 159 return const_cast<NonClientView*>( |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 // The current frame type in use by this window. Defaults to | 229 // The current frame type in use by this window. Defaults to |
| 264 // FRAME_TYPE_DEFAULT. | 230 // FRAME_TYPE_DEFAULT. |
| 265 FrameType frame_type_; | 231 FrameType frame_type_; |
| 266 | 232 |
| 267 DISALLOW_COPY_AND_ASSIGN(Window); | 233 DISALLOW_COPY_AND_ASSIGN(Window); |
| 268 }; | 234 }; |
| 269 | 235 |
| 270 } // namespace views | 236 } // namespace views |
| 271 | 237 |
| 272 #endif // #ifndef VIEWS_WINDOW_WINDOW_H_ | 238 #endif // #ifndef VIEWS_WINDOW_WINDOW_H_ |
| OLD | NEW |