Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(392)

Side by Side Diff: views/window/window.h

Issue 7075019: Move a bunch of functions from Window onto Widget. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « views/window/native_window_win.cc ('k') | views/window/window.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 12 matching lines...) Expand all
23 class NativeWindow; 23 class NativeWindow;
24 class NonClientFrameView; 24 class NonClientFrameView;
25 class Widget; 25 class Widget;
26 class WindowDelegate; 26 class WindowDelegate;
27 27
28 //////////////////////////////////////////////////////////////////////////////// 28 ////////////////////////////////////////////////////////////////////////////////
29 // Window class 29 // Window class
30 // 30 //
31 // Encapsulates window-like behavior. See WindowDelegate. 31 // Encapsulates window-like behavior. See WindowDelegate.
32 // 32 //
33 // TODO(beng): Subclass Widget as part of V2.
34 //
35 // TODO(beng): Note that this class being non-abstract means that we have a
36 // violation of Google style in that we are using multiple
37 // inheritance. The intention is to split this into a separate
38 // object associated with but not equal to a NativeWidget
39 // implementation. Multiple inheritance is required for this
40 // transitional step.
41 //
42 class Window : public Widget, 33 class Window : public Widget,
43 public internal::NativeWindowDelegate { 34 public internal::NativeWindowDelegate {
44 public: 35 public:
45 struct InitParams { 36 struct InitParams {
46 // |window_delegate| cannot be NULL. 37 // |window_delegate| cannot be NULL.
47 explicit InitParams(WindowDelegate* window_delegate); 38 explicit InitParams(WindowDelegate* window_delegate);
48 39
49 WindowDelegate* window_delegate; 40 WindowDelegate* window_delegate;
50 gfx::NativeWindow parent_window; 41 gfx::NativeWindow parent_window;
51 NativeWindow* native_window; 42 NativeWindow* native_window;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 78
88 // Retrieves the restored bounds for the window. 79 // Retrieves the restored bounds for the window.
89 gfx::Rect GetNormalBounds() const; 80 gfx::Rect GetNormalBounds() const;
90 81
91 // Sets the Window's bounds. The window is inserted after |other_window| in 82 // 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 83 // 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 84 // monitor is used as the constraining rectangle, rather than this window's
94 // monitor. 85 // monitor.
95 void SetWindowBounds(const gfx::Rect& bounds, gfx::NativeWindow other_window); 86 void SetWindowBounds(const gfx::Rect& bounds, gfx::NativeWindow other_window);
96 87
97 // Makes the window visible.
98 void Show();
99
100 // Like Show(), but does not activate the window. 88 // Like Show(), but does not activate the window.
101 void ShowInactive(); 89 void ShowInactive();
102 90
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. 91 // 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 92 // 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 93 // again. There is no ability to control the state through this API as this
111 // leads to sync problems. 94 // leads to sync problems.
112 void DisableInactiveRendering(); 95 void DisableInactiveRendering();
113 96
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. 97 // Accessors for fullscreen state.
142 void SetFullscreen(bool fullscreen); 98 void SetFullscreen(bool fullscreen);
143 bool IsFullscreen() const; 99 bool IsFullscreen() const;
144 100
145 // Sets whether or not the window should show its frame as a "transient drag 101 // Sets whether or not the window should show its frame as a "transient drag
146 // frame" - slightly transparent and without the standard window controls. 102 // frame" - slightly transparent and without the standard window controls.
147 void SetUseDragFrame(bool use_drag_frame); 103 void SetUseDragFrame(bool use_drag_frame);
148 104
149 // Toggles the enable state for the Close button (and the Close menu item in 105 // Toggles the enable state for the Close button (and the Close menu item in
150 // the system menu). 106 // the system menu).
151 void EnableClose(bool enable); 107 void EnableClose(bool enable);
152 108
153 // Tell the window to update its title from the delegate. 109 // Tell the window to update its title from the delegate.
154 void UpdateWindowTitle(); 110 void UpdateWindowTitle();
155 111
156 // Tell the window to update its icon from the delegate. 112 // Tell the window to update its icon from the delegate.
157 void UpdateWindowIcon(); 113 void UpdateWindowIcon();
158 114
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. 115 // Creates an appropriate NonClientFrameView for this window.
163 virtual NonClientFrameView* CreateFrameViewForWindow(); 116 virtual NonClientFrameView* CreateFrameViewForWindow();
164 117
165 // Updates the frame after an event caused it to be changed. 118 // Updates the frame after an event caused it to be changed.
166 virtual void UpdateFrameAfterFrameChange(); 119 virtual void UpdateFrameAfterFrameChange();
167 120
168 // Retrieves the Window's native window handle.
169 gfx::NativeWindow GetNativeWindow() const;
170
171 void set_frame_type(FrameType frame_type) { frame_type_ = frame_type; } 121 void set_frame_type(FrameType frame_type) { frame_type_ = frame_type; }
172 FrameType frame_type() const { return frame_type_; } 122 FrameType frame_type() const { return frame_type_; }
173 123
174 // Whether we should be using a native frame. 124 // Whether we should be using a native frame.
175 bool ShouldUseNativeFrame() const; 125 bool ShouldUseNativeFrame() const;
176 126
177 // Forces the frame into the alternate frame type (custom or native) depending 127 // Forces the frame into the alternate frame type (custom or native) depending
178 // on its current state. 128 // on its current state.
179 void DebugToggleFrameType(); 129 void DebugToggleFrameType();
180 130
181 // Tell the window that something caused the frame type to change. 131 // Tell the window that something caused the frame type to change.
182 void FrameTypeChanged(); 132 void FrameTypeChanged();
183 133
134 // Overridden from Widget:
135 virtual void Show() OVERRIDE;
136 virtual void Close() OVERRIDE;
137
184 WindowDelegate* window_delegate() { 138 WindowDelegate* window_delegate() {
185 return const_cast<WindowDelegate*>( 139 return const_cast<WindowDelegate*>(
186 const_cast<const Window*>(this)->window_delegate()); 140 const_cast<const Window*>(this)->window_delegate());
187 } 141 }
188 const WindowDelegate* window_delegate() const { 142 const WindowDelegate* window_delegate() const {
189 return window_delegate_; 143 return window_delegate_;
190 } 144 }
191 145
192 NonClientView* non_client_view() { 146 NonClientView* non_client_view() {
193 return const_cast<NonClientView*>( 147 return const_cast<NonClientView*>(
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 // The current frame type in use by this window. Defaults to 217 // The current frame type in use by this window. Defaults to
264 // FRAME_TYPE_DEFAULT. 218 // FRAME_TYPE_DEFAULT.
265 FrameType frame_type_; 219 FrameType frame_type_;
266 220
267 DISALLOW_COPY_AND_ASSIGN(Window); 221 DISALLOW_COPY_AND_ASSIGN(Window);
268 }; 222 };
269 223
270 } // namespace views 224 } // namespace views
271 225
272 #endif // #ifndef VIEWS_WINDOW_WINDOW_H_ 226 #endif // #ifndef VIEWS_WINDOW_WINDOW_H_
OLDNEW
« no previous file with comments | « views/window/native_window_win.cc ('k') | views/window/window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698