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 <stack> | 9 #include <stack> |
10 | 10 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 // ownership = NATIVE_WIDGET_OWNS_WIDGET (default) | 80 // ownership = NATIVE_WIDGET_OWNS_WIDGET (default) |
81 // The Widget instance is owned by its NativeWidget. When the NativeWidget | 81 // The Widget instance is owned by its NativeWidget. When the NativeWidget |
82 // is destroyed (in response to a native destruction message), it deletes | 82 // is destroyed (in response to a native destruction message), it deletes |
83 // the Widget from its destructor. | 83 // the Widget from its destructor. |
84 // ownership = WIDGET_OWNS_NATIVE_WIDGET (non-default) | 84 // ownership = WIDGET_OWNS_NATIVE_WIDGET (non-default) |
85 // The Widget instance owns its NativeWidget. This state implies someone | 85 // The Widget instance owns its NativeWidget. This state implies someone |
86 // else wants to control the lifetime of this object. When they destroy | 86 // else wants to control the lifetime of this object. When they destroy |
87 // the Widget it is responsible for destroying the NativeWidget (from its | 87 // the Widget it is responsible for destroying the NativeWidget (from its |
88 // destructor). | 88 // destructor). |
89 // | 89 // |
90 class VIEWS_API Widget : public internal::NativeWidgetDelegate, | 90 class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, |
91 public FocusTraversable { | 91 public FocusTraversable { |
92 public: | 92 public: |
93 // Observers can listen to various events on the Widgets. | 93 // Observers can listen to various events on the Widgets. |
94 class Observer { | 94 class Observer { |
95 public: | 95 public: |
96 virtual void OnWidgetClosing(Widget* widget) {} | 96 virtual void OnWidgetClosing(Widget* widget) {} |
97 virtual void OnWidgetVisibilityChanged(Widget* widget, bool visible) {} | 97 virtual void OnWidgetVisibilityChanged(Widget* widget, bool visible) {} |
98 virtual void OnWidgetActivationChanged(Widget* widget, bool active) {} | 98 virtual void OnWidgetActivationChanged(Widget* widget, bool active) {} |
99 }; | 99 }; |
100 | 100 |
101 typedef std::set<Widget*> Widgets; | 101 typedef std::set<Widget*> Widgets; |
102 | 102 |
103 enum FrameType { | 103 enum FrameType { |
104 FRAME_TYPE_DEFAULT, // Use whatever the default would be. | 104 FRAME_TYPE_DEFAULT, // Use whatever the default would be. |
105 FRAME_TYPE_FORCE_CUSTOM, // Force the custom frame. | 105 FRAME_TYPE_FORCE_CUSTOM, // Force the custom frame. |
106 FRAME_TYPE_FORCE_NATIVE // Force the native frame. | 106 FRAME_TYPE_FORCE_NATIVE // Force the native frame. |
107 }; | 107 }; |
108 | 108 |
109 struct VIEWS_API InitParams { | 109 struct VIEWS_EXPORT InitParams { |
110 enum Type { | 110 enum Type { |
111 TYPE_WINDOW, // A decorated Window, like a frame window. | 111 TYPE_WINDOW, // A decorated Window, like a frame window. |
112 // Widgets of TYPE_WINDOW will have a NonClientView. | 112 // Widgets of TYPE_WINDOW will have a NonClientView. |
113 TYPE_WINDOW_FRAMELESS, | 113 TYPE_WINDOW_FRAMELESS, |
114 // An undecorated Window. | 114 // An undecorated Window. |
115 TYPE_CONTROL, // A control, like a button. | 115 TYPE_CONTROL, // A control, like a button. |
116 TYPE_POPUP, // An undecorated Window, with transient properties. | 116 TYPE_POPUP, // An undecorated Window, with transient properties. |
117 TYPE_MENU, // An undecorated Window, with transient properties | 117 TYPE_MENU, // An undecorated Window, with transient properties |
118 // specialized to menus. | 118 // specialized to menus. |
119 TYPE_TOOLTIP, | 119 TYPE_TOOLTIP, |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 | 697 |
698 // Factory used to create Compositors. Settable by tests. | 698 // Factory used to create Compositors. Settable by tests. |
699 static ui::Compositor*(*compositor_factory_)(); | 699 static ui::Compositor*(*compositor_factory_)(); |
700 | 700 |
701 DISALLOW_COPY_AND_ASSIGN(Widget); | 701 DISALLOW_COPY_AND_ASSIGN(Widget); |
702 }; | 702 }; |
703 | 703 |
704 } // namespace views | 704 } // namespace views |
705 | 705 |
706 #endif // VIEWS_WIDGET_WIDGET_H_ | 706 #endif // VIEWS_WIDGET_WIDGET_H_ |
OLD | NEW |