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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 // Observers can listen to various events on the Widgets. | 94 // Observers can listen to various events on the Widgets. |
95 class Observer { | 95 class Observer { |
96 public: | 96 public: |
97 virtual void OnWidgetClosing(Widget* widget) {} | 97 virtual void OnWidgetClosing(Widget* widget) {} |
98 virtual void OnWidgetVisibilityChanged(Widget* widget, bool visible) {} | 98 virtual void OnWidgetVisibilityChanged(Widget* widget, bool visible) {} |
99 virtual void OnWidgetActivationChanged(Widget* widget, bool active) {} | 99 virtual void OnWidgetActivationChanged(Widget* widget, bool active) {} |
100 }; | 100 }; |
101 | 101 |
102 typedef std::set<Widget*> Widgets; | 102 typedef std::set<Widget*> Widgets; |
103 | 103 |
104 enum DestroyState { | |
105 // The default, everything is good and alive. | |
106 DESTROY_STATE_NONE = 1, | |
107 | |
108 // Set once OnNativeWidgetDestroying has been invoked. | |
109 DESTROY_STATE_IN_DESTROYING, | |
110 | |
111 // Set once OnNativeWidgetDestroyed has been invoked. | |
112 DESTROY_STATE_DESTROYED, | |
113 | |
114 // Set once the destructor is invoked. | |
115 DESTROY_STATE_DELETED, | |
116 }; | |
117 | |
118 enum FrameType { | 104 enum FrameType { |
119 FRAME_TYPE_DEFAULT, // Use whatever the default would be. | 105 FRAME_TYPE_DEFAULT, // Use whatever the default would be. |
120 FRAME_TYPE_FORCE_CUSTOM, // Force the custom frame. | 106 FRAME_TYPE_FORCE_CUSTOM, // Force the custom frame. |
121 FRAME_TYPE_FORCE_NATIVE // Force the native frame. | 107 FRAME_TYPE_FORCE_NATIVE // Force the native frame. |
122 }; | 108 }; |
123 | 109 |
124 struct VIEWS_EXPORT InitParams { | 110 struct VIEWS_EXPORT InitParams { |
125 enum Type { | 111 enum Type { |
126 TYPE_WINDOW, // A decorated Window, like a frame window. | 112 TYPE_WINDOW, // A decorated Window, like a frame window. |
127 // Widgets of TYPE_WINDOW will have a NonClientView. | 113 // Widgets of TYPE_WINDOW will have a NonClientView. |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 // are added to. The default implementation returns the contents view | 557 // are added to. The default implementation returns the contents view |
572 // if it exists and the root view otherwise. | 558 // if it exists and the root view otherwise. |
573 virtual View* GetChildViewParent(); | 559 virtual View* GetChildViewParent(); |
574 | 560 |
575 // True if the widget is considered top level widget. Top level widget | 561 // True if the widget is considered top level widget. Top level widget |
576 // is a widget of TYPE_WINDOW, TYPE_WINDOW_FRAMELESS, POPUP or MENU, and | 562 // is a widget of TYPE_WINDOW, TYPE_WINDOW_FRAMELESS, POPUP or MENU, and |
577 // has a focus manager and input method object associated with it. | 563 // has a focus manager and input method object associated with it. |
578 // TYPE_CONTROL and TYPE_TOOLTIP is not considered top level. | 564 // TYPE_CONTROL and TYPE_TOOLTIP is not considered top level. |
579 bool is_top_level() const { return is_top_level_; } | 565 bool is_top_level() const { return is_top_level_; } |
580 | 566 |
581 DestroyState destroy_state() const { return destroy_state_; } | |
582 | |
583 // Overridden from NativeWidgetDelegate: | 567 // Overridden from NativeWidgetDelegate: |
584 virtual bool IsModal() const OVERRIDE; | 568 virtual bool IsModal() const OVERRIDE; |
585 virtual bool IsDialogBox() const OVERRIDE; | 569 virtual bool IsDialogBox() const OVERRIDE; |
586 virtual bool CanActivate() const OVERRIDE; | 570 virtual bool CanActivate() const OVERRIDE; |
587 virtual bool IsInactiveRenderingDisabled() const OVERRIDE; | 571 virtual bool IsInactiveRenderingDisabled() const OVERRIDE; |
588 virtual void EnableInactiveRendering() OVERRIDE; | 572 virtual void EnableInactiveRendering() OVERRIDE; |
589 virtual void OnNativeWidgetActivationChanged(bool active) OVERRIDE; | 573 virtual void OnNativeWidgetActivationChanged(bool active) OVERRIDE; |
590 virtual void OnNativeFocus(gfx::NativeView focused_view) OVERRIDE; | 574 virtual void OnNativeFocus(gfx::NativeView focused_view) OVERRIDE; |
591 virtual void OnNativeBlur(gfx::NativeView focused_view) OVERRIDE; | 575 virtual void OnNativeBlur(gfx::NativeView focused_view) OVERRIDE; |
592 virtual void OnNativeWidgetVisibilityChanged(bool visible) OVERRIDE; | 576 virtual void OnNativeWidgetVisibilityChanged(bool visible) OVERRIDE; |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 bool focus_on_creation_; | 720 bool focus_on_creation_; |
737 | 721 |
738 scoped_ptr<InputMethod> input_method_; | 722 scoped_ptr<InputMethod> input_method_; |
739 | 723 |
740 // See |is_top_leve()| accessor. | 724 // See |is_top_leve()| accessor. |
741 bool is_top_level_; | 725 bool is_top_level_; |
742 | 726 |
743 // Factory used to create Compositors. Settable by tests. | 727 // Factory used to create Compositors. Settable by tests. |
744 static ui::Compositor*(*compositor_factory_)(); | 728 static ui::Compositor*(*compositor_factory_)(); |
745 | 729 |
746 // Tracks destroy state. | |
747 // TODO(sky): remove this, used in tracking 91396. | |
748 DestroyState destroy_state_; | |
749 | |
750 DISALLOW_COPY_AND_ASSIGN(Widget); | 730 DISALLOW_COPY_AND_ASSIGN(Widget); |
751 }; | 731 }; |
752 | 732 |
753 } // namespace views | 733 } // namespace views |
754 | 734 |
755 #endif // VIEWS_WIDGET_WIDGET_H_ | 735 #endif // VIEWS_WIDGET_WIDGET_H_ |
OLD | NEW |