OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 CHROME_VIEWS_WINDOW_H__ | 5 #ifndef CHROME_VIEWS_WINDOW_H__ |
6 #define CHROME_VIEWS_WINDOW_H__ | 6 #define CHROME_VIEWS_WINDOW_H__ |
7 | 7 |
8 #include "chrome/views/container_win.h" | 8 #include "chrome/views/container_win.h" |
9 | 9 |
10 namespace gfx { | 10 namespace gfx { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 virtual gfx::Size CalculateWindowSizeForClientSize( | 45 virtual gfx::Size CalculateWindowSizeForClientSize( |
46 const gfx::Size& client_size) const; | 46 const gfx::Size& client_size) const; |
47 | 47 |
48 // Return the maximum size possible size the window should be have if it is | 48 // Return the maximum size possible size the window should be have if it is |
49 // to be positioned within the bounds of the current "work area" (screen or | 49 // to be positioned within the bounds of the current "work area" (screen or |
50 // parent window). | 50 // parent window). |
51 gfx::Size CalculateMaximumSize() const; | 51 gfx::Size CalculateMaximumSize() const; |
52 | 52 |
53 // Show the window. | 53 // Show the window. |
54 void Show(); | 54 void Show(); |
55 void Show(int show_style); | 55 void Show(int show_state); |
| 56 |
| 57 // Retrieve the show state of the window. This is one of the SW_SHOW* flags |
| 58 // passed into Windows' ShowWindow method. For normal windows this defaults |
| 59 // to SW_SHOWNORMAL, however windows (e.g. the main window) can override this |
| 60 // method to provide different values (e.g. retrieve the user's specified |
| 61 // show state from the shortcut starutp info). |
| 62 virtual int GetShowState() const; |
56 | 63 |
57 // Activate the window, assuming it already exists and is visible. | 64 // Activate the window, assuming it already exists and is visible. |
58 void Activate(); | 65 void Activate(); |
59 | 66 |
60 // Sizes and/or places the window to the specified bounds, size or position. | 67 // Sizes and/or places the window to the specified bounds, size or position. |
61 void SetBounds(const gfx::Rect& bounds); | 68 void SetBounds(const gfx::Rect& bounds); |
62 // As above, except the window is inserted after |other_hwnd| in the window | 69 // As above, except the window is inserted after |other_hwnd| in the window |
63 // Z-order. If this window's HWND is not yet visible, other_hwnd's monitor | 70 // Z-order. If this window's HWND is not yet visible, other_hwnd's monitor |
64 // is used as the constraining rectangle, rather than this window's hwnd's | 71 // is used as the constraining rectangle, rather than this window's hwnd's |
65 // monitor. | 72 // monitor. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 104 |
98 // Tell the window to update its icon from the delegate. | 105 // Tell the window to update its icon from the delegate. |
99 virtual void UpdateWindowIcon(); | 106 virtual void UpdateWindowIcon(); |
100 | 107 |
101 // Executes the specified SC_command. | 108 // Executes the specified SC_command. |
102 void ExecuteSystemMenuCommand(int command); | 109 void ExecuteSystemMenuCommand(int command); |
103 | 110 |
104 // The parent of this window. | 111 // The parent of this window. |
105 HWND owning_window() const { return owning_hwnd_; } | 112 HWND owning_window() const { return owning_hwnd_; } |
106 | 113 |
107 // Convenience methods for storing/retrieving window location information | |
108 // to/from a PrefService using the specified |entry| name. | |
109 // WindowDelegate instances can use these methods in their implementation of | |
110 // SaveWindowPosition/RestoreWindowPosition to save windows' location to | |
111 // preferences. | |
112 static bool SaveWindowPositionToPrefService(PrefService* pref_service, | |
113 const std::wstring& entry, | |
114 const CRect& bounds, | |
115 bool maximized, | |
116 bool always_on_top); | |
117 // Returns true if the window location was retrieved from the PrefService and | |
118 // set in |bounds|, |maximized| and |always_on_top|. | |
119 static bool RestoreWindowPositionFromPrefService(PrefService* pref_service, | |
120 const std::wstring& entry, | |
121 CRect* bounds, | |
122 bool* maximized, | |
123 bool* always_on_top); | |
124 | |
125 // Returns the preferred size of the contents view of this window based on | 114 // Returns the preferred size of the contents view of this window based on |
126 // its localized size data. The width in cols is held in a localized string | 115 // its localized size data. The width in cols is held in a localized string |
127 // resource identified by |col_resource_id|, the height in the same fashion. | 116 // resource identified by |col_resource_id|, the height in the same fashion. |
128 // TODO(beng): This should eventually live somewhere else, probably closer to | 117 // TODO(beng): This should eventually live somewhere else, probably closer to |
129 // ClientView. | 118 // ClientView. |
130 static gfx::Size GetLocalizedContentsSize(int col_resource_id, | 119 static gfx::Size GetLocalizedContentsSize(int col_resource_id, |
131 int row_resource_id); | 120 int row_resource_id); |
132 | 121 |
133 protected: | 122 protected: |
134 // Constructs the Window. |window_delegate| cannot be NULL. | 123 // Constructs the Window. |window_delegate| cannot be NULL. |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 | 177 |
189 // Sets-up the focus manager with the view that should have focus when the | 178 // Sets-up the focus manager with the view that should have focus when the |
190 // window is shown the first time. If NULL is returned, the focus goes to the | 179 // window is shown the first time. If NULL is returned, the focus goes to the |
191 // button if there is one, otherwise the to the Cancel button. | 180 // button if there is one, otherwise the to the Cancel button. |
192 void SetInitialFocus(); | 181 void SetInitialFocus(); |
193 | 182 |
194 // Place and size the window when it is created. |create_bounds| are the | 183 // Place and size the window when it is created. |create_bounds| are the |
195 // bounds used when the window was created. | 184 // bounds used when the window was created. |
196 void SetInitialBounds(const gfx::Rect& create_bounds); | 185 void SetInitialBounds(const gfx::Rect& create_bounds); |
197 | 186 |
| 187 // Restore saved always on stop state and add the always on top system menu |
| 188 // if needed. |
| 189 void InitAlwaysOnTopState(); |
| 190 |
198 // Add an item for "Always on Top" to the System Menu. | 191 // Add an item for "Always on Top" to the System Menu. |
199 void AddAlwaysOnTopSystemMenuItem(); | 192 void AddAlwaysOnTopSystemMenuItem(); |
200 | 193 |
201 // If necessary, enables all ancestors. | 194 // If necessary, enables all ancestors. |
202 void RestoreEnabledIfNecessary(); | 195 void RestoreEnabledIfNecessary(); |
203 | 196 |
204 // Update the window style to reflect the always on top state. | 197 // Update the window style to reflect the always on top state. |
205 void AlwaysOnTopChanged(); | 198 void AlwaysOnTopChanged(); |
206 | 199 |
207 // Calculate the appropriate window styles for this window. | 200 // Calculate the appropriate window styles for this window. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 // or not it actually is. | 249 // or not it actually is. |
257 bool disable_inactive_rendering_; | 250 bool disable_inactive_rendering_; |
258 | 251 |
259 DISALLOW_EVIL_CONSTRUCTORS(Window); | 252 DISALLOW_EVIL_CONSTRUCTORS(Window); |
260 }; | 253 }; |
261 | 254 |
262 } // namespace views | 255 } // namespace views |
263 | 256 |
264 #endif // CHROME_VIEWS_WINDOW_H__ | 257 #endif // CHROME_VIEWS_WINDOW_H__ |
265 | 258 |
OLD | NEW |