OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_VIEWS_WIDGET_WIDGET_H_ | 5 #ifndef UI_VIEWS_WIDGET_WIDGET_H_ |
6 #define UI_VIEWS_WIDGET_WIDGET_H_ | 6 #define UI_VIEWS_WIDGET_WIDGET_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <stack> | 10 #include <stack> |
11 | 11 |
12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/weak_ptr.h" | |
15 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
16 #include "ui/base/accessibility/accessibility_types.h" | 15 #include "ui/base/accessibility/accessibility_types.h" |
17 #include "ui/base/ui_base_types.h" | 16 #include "ui/base/ui_base_types.h" |
18 #include "ui/compositor/layer_type.h" | 17 #include "ui/compositor/layer_type.h" |
19 #include "ui/gfx/native_widget_types.h" | 18 #include "ui/gfx/native_widget_types.h" |
20 #include "ui/gfx/rect.h" | 19 #include "ui/gfx/rect.h" |
21 #include "ui/views/focus/focus_manager.h" | 20 #include "ui/views/focus/focus_manager.h" |
22 #include "ui/views/widget/native_widget_delegate.h" | 21 #include "ui/views/widget/native_widget_delegate.h" |
23 #include "ui/views/window/client_view.h" | 22 #include "ui/views/window/client_view.h" |
24 #include "ui/views/window/non_client_view.h" | 23 #include "ui/views/window/non_client_view.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 WidgetDelegate* delegate; | 156 WidgetDelegate* delegate; |
158 bool child; | 157 bool child; |
159 bool transient; | 158 bool transient; |
160 // If true, the widget may be fully or partially transparent. If false, | 159 // If true, the widget may be fully or partially transparent. If false, |
161 // we can perform optimizations based on the widget being fully opaque. | 160 // we can perform optimizations based on the widget being fully opaque. |
162 // For window widgets, defaults to ViewsDelegate::UseTransparentWindows(). | 161 // For window widgets, defaults to ViewsDelegate::UseTransparentWindows(). |
163 // Defaults to false for non-window widgets. | 162 // Defaults to false for non-window widgets. |
164 bool transparent; | 163 bool transparent; |
165 bool accept_events; | 164 bool accept_events; |
166 bool can_activate; | 165 bool can_activate; |
167 bool close_on_deactivate; | |
168 bool keep_on_top; | 166 bool keep_on_top; |
169 Ownership ownership; | 167 Ownership ownership; |
170 bool mirror_origin_in_rtl; | 168 bool mirror_origin_in_rtl; |
171 bool has_dropshadow; | 169 bool has_dropshadow; |
172 // Only used by NativeWidgetWin. Specifies that the system default caption | 170 // Only used by NativeWidgetWin. Specifies that the system default caption |
173 // and icon should not be rendered, and that the client area should be | 171 // and icon should not be rendered, and that the client area should be |
174 // equivalent to the window area. | 172 // equivalent to the window area. |
175 bool remove_standard_frame; | 173 bool remove_standard_frame; |
176 // Whether the widget should be maximized or minimized. | 174 // Whether the widget should be maximized or minimized. |
177 ui::WindowShowState show_state; | 175 ui::WindowShowState show_state; |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 // Returns the bounds and "show" state from the delegate. Returns true if | 686 // Returns the bounds and "show" state from the delegate. Returns true if |
689 // the delegate wants to use a specified bounds. | 687 // the delegate wants to use a specified bounds. |
690 bool GetSavedWindowPlacement(gfx::Rect* bounds, | 688 bool GetSavedWindowPlacement(gfx::Rect* bounds, |
691 ui::WindowShowState* show_state); | 689 ui::WindowShowState* show_state); |
692 | 690 |
693 // Sets a different InputMethod instance to this widget. The instance | 691 // Sets a different InputMethod instance to this widget. The instance |
694 // must not be initialized, the ownership will be assumed by the widget. | 692 // must not be initialized, the ownership will be assumed by the widget. |
695 // It's only for testing purpose. | 693 // It's only for testing purpose. |
696 void ReplaceInputMethod(InputMethod* input_method); | 694 void ReplaceInputMethod(InputMethod* input_method); |
697 | 695 |
698 base::WeakPtrFactory<Widget> set_capture_factory_; | |
699 | |
700 internal::NativeWidgetPrivate* native_widget_; | 696 internal::NativeWidgetPrivate* native_widget_; |
701 | 697 |
702 ObserverList<Observer> observers_; | 698 ObserverList<Observer> observers_; |
703 | 699 |
704 // Non-owned pointer to the Widget's delegate. May be NULL if no delegate is | 700 // Non-owned pointer to the Widget's delegate. May be NULL if no delegate is |
705 // being used. | 701 // being used. |
706 WidgetDelegate* widget_delegate_; | 702 WidgetDelegate* widget_delegate_; |
707 | 703 |
708 // The root of the View hierarchy attached to this window. | 704 // The root of the View hierarchy attached to this window. |
709 // WARNING: see warning in tooltip_manager_ for ordering dependencies with | 705 // WARNING: see warning in tooltip_manager_ for ordering dependencies with |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 | 751 |
756 // The restored bounds used for the initial show. This is only used if | 752 // The restored bounds used for the initial show. This is only used if |
757 // |saved_show_state_| is maximized. | 753 // |saved_show_state_| is maximized. |
758 gfx::Rect initial_restored_bounds_; | 754 gfx::Rect initial_restored_bounds_; |
759 | 755 |
760 // Focus is automatically set to the view provided by the delegate | 756 // Focus is automatically set to the view provided by the delegate |
761 // when the widget is shown. Set this value to false to override | 757 // when the widget is shown. Set this value to false to override |
762 // initial focus for the widget. | 758 // initial focus for the widget. |
763 bool focus_on_creation_; | 759 bool focus_on_creation_; |
764 | 760 |
765 // If true, the widget is closed when the user clicks outside the root view's | |
766 // bounds. This intentionally encompasses some situations where deactivation | |
767 // does not happen. | |
768 bool close_on_deactivate_; | |
769 | |
770 scoped_ptr<InputMethod> input_method_; | 761 scoped_ptr<InputMethod> input_method_; |
771 | 762 |
772 // See |is_top_level()| accessor. | 763 // See |is_top_level()| accessor. |
773 bool is_top_level_; | 764 bool is_top_level_; |
774 | 765 |
775 // Tracks whether native widget has been initialized. | 766 // Tracks whether native widget has been initialized. |
776 bool native_widget_initialized_; | 767 bool native_widget_initialized_; |
777 | 768 |
778 // Whether native widget has been destroyed. | 769 // Whether native widget has been destroyed. |
779 bool native_widget_destroyed_; | 770 bool native_widget_destroyed_; |
780 | 771 |
781 // TODO(beng): Remove NativeWidgetGtk's dependence on these: | 772 // TODO(beng): Remove NativeWidgetGtk's dependence on these: |
782 // If true, the mouse is currently down. | 773 // If true, the mouse is currently down. |
783 bool is_mouse_button_pressed_; | 774 bool is_mouse_button_pressed_; |
784 | 775 |
785 // TODO(beng): Remove NativeWidgetGtk's dependence on these: | 776 // TODO(beng): Remove NativeWidgetGtk's dependence on these: |
786 // The following are used to detect duplicate mouse move events and not | 777 // The following are used to detect duplicate mouse move events and not |
787 // deliver them. Displaying a window may result in the system generating | 778 // deliver them. Displaying a window may result in the system generating |
788 // duplicate move events even though the mouse hasn't moved. | 779 // duplicate move events even though the mouse hasn't moved. |
789 bool last_mouse_event_was_move_; | 780 bool last_mouse_event_was_move_; |
790 gfx::Point last_mouse_event_position_; | 781 gfx::Point last_mouse_event_position_; |
791 | 782 |
792 DISALLOW_COPY_AND_ASSIGN(Widget); | 783 DISALLOW_COPY_AND_ASSIGN(Widget); |
793 }; | 784 }; |
794 | 785 |
795 } // namespace views | 786 } // namespace views |
796 | 787 |
797 #endif // UI_VIEWS_WIDGET_WIDGET_H_ | 788 #endif // UI_VIEWS_WIDGET_WIDGET_H_ |
OLD | NEW |