| 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_WIDGET_WIDGET_H_ | 5 #ifndef VIEWS_WIDGET_WIDGET_H_ |
| 6 #define VIEWS_WIDGET_WIDGET_H_ | 6 #define VIEWS_WIDGET_WIDGET_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "ui/base/accessibility/accessibility_types.h" | 13 #include "ui/base/accessibility/accessibility_types.h" |
| 14 #include "ui/gfx/native_widget_types.h" | 14 #include "ui/gfx/native_widget_types.h" |
| 15 #include "ui/gfx/rect.h" | 15 #include "ui/gfx/rect.h" |
| 16 #include "views/focus/focus_manager.h" | 16 #include "views/focus/focus_manager.h" |
| 17 #include "views/widget/native_widget_delegate.h" | 17 #include "views/widget/native_widget_delegate.h" |
| 18 | 18 |
| 19 #if defined(OS_WIN) | |
| 20 // Windows headers define macros for these function names which screw with us. | |
| 21 #if defined(IsMaximized) | |
| 22 #undef IsMaximized | |
| 23 #endif | |
| 24 #if defined(IsMinimized) | |
| 25 #undef IsMinimized | |
| 26 #endif | |
| 27 #endif | |
| 28 | |
| 29 namespace gfx { | 19 namespace gfx { |
| 30 class Canvas; | 20 class Canvas; |
| 31 class Path; | 21 class Path; |
| 32 class Point; | 22 class Point; |
| 33 class Rect; | 23 class Rect; |
| 34 } | 24 } |
| 35 | 25 |
| 36 namespace ui { | 26 namespace ui { |
| 37 class Accelerator; | 27 class Accelerator; |
| 38 class Compositor; | 28 class Compositor; |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 // Hides the widget then closes it after a return to the message loop. | 213 // Hides the widget then closes it after a return to the message loop. |
| 224 virtual void Close(); | 214 virtual void Close(); |
| 225 | 215 |
| 226 // TODO(beng): Move off public API. | 216 // TODO(beng): Move off public API. |
| 227 // Closes the widget immediately. Compare to |Close|. This will destroy the | 217 // Closes the widget immediately. Compare to |Close|. This will destroy the |
| 228 // window handle associated with this Widget, so should not be called from | 218 // window handle associated with this Widget, so should not be called from |
| 229 // any code that expects it to be valid beyond this call. | 219 // any code that expects it to be valid beyond this call. |
| 230 void CloseNow(); | 220 void CloseNow(); |
| 231 | 221 |
| 232 // Shows or hides the widget, without changing activation state. | 222 // Shows or hides the widget, without changing activation state. |
| 233 virtual void Show(); | 223 void Show(); |
| 234 void Hide(); | 224 void Hide(); |
| 235 | 225 |
| 236 // Activates the widget, assuming it already exists and is visible. | |
| 237 void Activate(); | |
| 238 | |
| 239 // Deactivates the widget, making the next window in the Z order the active | |
| 240 // window. | |
| 241 void Deactivate(); | |
| 242 | |
| 243 // Returns whether the Widget is the currently active window. | |
| 244 virtual bool IsActive() const; | |
| 245 | |
| 246 // Sets the widget to be on top of all other widgets in the windowing system. | |
| 247 void SetAlwaysOnTop(bool on_top); | |
| 248 | |
| 249 // Maximizes/minimizes/restores the window. | |
| 250 void Maximize(); | |
| 251 void Minimize(); | |
| 252 void Restore(); | |
| 253 | |
| 254 // Whether or not the window is maximized or minimized. | |
| 255 virtual bool IsMaximized() const; | |
| 256 bool IsMinimized() const; | |
| 257 | |
| 258 // Sets the opacity of the widget. This may allow widgets behind the widget | 226 // Sets the opacity of the widget. This may allow widgets behind the widget |
| 259 // in the Z-order to become visible, depending on the capabilities of the | 227 // in the Z-order to become visible, depending on the capabilities of the |
| 260 // underlying windowing system. Note that the caller must then schedule a | 228 // underlying windowing system. Note that the caller must then schedule a |
| 261 // repaint to allow this change to take effect. | 229 // repaint to allow this change to take effect. |
| 262 void SetOpacity(unsigned char opacity); | 230 void SetOpacity(unsigned char opacity); |
| 263 | 231 |
| 232 // Sets the widget to be on top of all other widgets in the windowing system. |
| 233 void SetAlwaysOnTop(bool on_top); |
| 234 |
| 264 // Returns the View at the root of the View hierarchy contained by this | 235 // Returns the View at the root of the View hierarchy contained by this |
| 265 // Widget. | 236 // Widget. |
| 266 View* GetRootView(); | 237 View* GetRootView(); |
| 267 | 238 |
| 268 // A secondary widget is one that is automatically closed (via Close()) when | 239 // A secondary widget is one that is automatically closed (via Close()) when |
| 269 // all non-secondary widgets are closed. | 240 // all non-secondary widgets are closed. |
| 270 // Default is true. | 241 // Default is true. |
| 271 // TODO(beng): This is an ugly API, should be handled implicitly via | 242 // TODO(beng): This is an ugly API, should be handled implicitly via |
| 272 // transience. | 243 // transience. |
| 273 void set_is_secondary_widget(bool is_secondary_widget) { | 244 void set_is_secondary_widget(bool is_secondary_widget) { |
| 274 is_secondary_widget_ = is_secondary_widget; | 245 is_secondary_widget_ = is_secondary_widget; |
| 275 } | 246 } |
| 276 bool is_secondary_widget() const { return is_secondary_widget_; } | 247 bool is_secondary_widget() const { return is_secondary_widget_; } |
| 277 | 248 |
| 278 // Returns whether the Widget is visible to the user. | 249 // Returns whether the Widget is visible to the user. |
| 279 virtual bool IsVisible() const; | 250 bool IsVisible() const; |
| 251 |
| 252 // Returns whether the Widget is the currently active window. |
| 253 bool IsActive() const; |
| 280 | 254 |
| 281 // Returns whether the Widget is customized for accessibility. | 255 // Returns whether the Widget is customized for accessibility. |
| 282 bool IsAccessibleWidget() const; | 256 bool IsAccessibleWidget() const; |
| 283 | 257 |
| 284 // Returns the ThemeProvider that provides theme resources for this Widget. | 258 // Returns the ThemeProvider that provides theme resources for this Widget. |
| 285 virtual ThemeProvider* GetThemeProvider() const; | 259 virtual ThemeProvider* GetThemeProvider() const; |
| 286 | 260 |
| 287 // Returns the FocusManager for this widget. | 261 // Returns the FocusManager for this widget. |
| 288 // Note that all widgets in a widget hierarchy share the same focus manager. | 262 // Note that all widgets in a widget hierarchy share the same focus manager. |
| 289 // TODO(beng): remove virtual. | 263 // TODO(beng): remove virtual. |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 | 417 |
| 444 // See set_is_secondary_widget(). | 418 // See set_is_secondary_widget(). |
| 445 bool is_secondary_widget_; | 419 bool is_secondary_widget_; |
| 446 | 420 |
| 447 DISALLOW_COPY_AND_ASSIGN(Widget); | 421 DISALLOW_COPY_AND_ASSIGN(Widget); |
| 448 }; | 422 }; |
| 449 | 423 |
| 450 } // namespace views | 424 } // namespace views |
| 451 | 425 |
| 452 #endif // VIEWS_WIDGET_WIDGET_H_ | 426 #endif // VIEWS_WIDGET_WIDGET_H_ |
| OLD | NEW |