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 |
11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
14 #include "ui/base/accessibility/accessibility_types.h" | 14 #include "ui/base/accessibility/accessibility_types.h" |
| 15 #include "ui/base/ui_base_types.h" |
15 #include "ui/gfx/native_widget_types.h" | 16 #include "ui/gfx/native_widget_types.h" |
16 #include "ui/gfx/rect.h" | 17 #include "ui/gfx/rect.h" |
17 #include "views/focus/focus_manager.h" | 18 #include "views/focus/focus_manager.h" |
18 #include "views/widget/native_widget_delegate.h" | 19 #include "views/widget/native_widget_delegate.h" |
19 #include "views/window/client_view.h" | 20 #include "views/window/client_view.h" |
20 #include "views/window/non_client_view.h" | 21 #include "views/window/non_client_view.h" |
21 | 22 |
22 #if defined(OS_WIN) | 23 #if defined(OS_WIN) |
23 // Windows headers define macros for these function names which screw with us. | 24 // Windows headers define macros for these function names which screw with us. |
24 #if defined(IsMaximized) | 25 #if defined(IsMaximized) |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 WidgetDelegate* delegate; | 138 WidgetDelegate* delegate; |
138 bool child; | 139 bool child; |
139 bool transient; | 140 bool transient; |
140 bool transparent; | 141 bool transparent; |
141 bool accept_events; | 142 bool accept_events; |
142 bool can_activate; | 143 bool can_activate; |
143 bool keep_on_top; | 144 bool keep_on_top; |
144 Ownership ownership; | 145 Ownership ownership; |
145 bool mirror_origin_in_rtl; | 146 bool mirror_origin_in_rtl; |
146 bool has_dropshadow; | 147 bool has_dropshadow; |
147 // Whether the widget should be maximized. | 148 // Whether the widget should be maximized or minimized. |
148 bool maximize; | 149 ui::WindowShowState show_state; |
149 // Should the widget be double buffered? Default is false. | 150 // Should the widget be double buffered? Default is false. |
150 bool double_buffer; | 151 bool double_buffer; |
151 gfx::NativeView parent; | 152 gfx::NativeView parent; |
152 Widget* parent_widget; | 153 Widget* parent_widget; |
153 // Specifies the initial bounds of the Widget. Default is empty, which means | 154 // Specifies the initial bounds of the Widget. Default is empty, which means |
154 // the NativeWidget may specify a default size. | 155 // the NativeWidget may specify a default size. |
155 gfx::Rect bounds; | 156 gfx::Rect bounds; |
156 // When set, this value is used as the Widget's NativeWidget implementation. | 157 // When set, this value is used as the Widget's NativeWidget implementation. |
157 // The Widget will not construct a default one. Default is NULL. | 158 // The Widget will not construct a default one. Default is NULL. |
158 NativeWidget* native_widget; | 159 NativeWidget* native_widget; |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 gfx::Point last_mouse_event_position_; | 629 gfx::Point last_mouse_event_position_; |
629 | 630 |
630 private: | 631 private: |
631 friend class NativeTextfieldViewsTest; | 632 friend class NativeTextfieldViewsTest; |
632 friend class NativeComboboxViewsTest; | 633 friend class NativeComboboxViewsTest; |
633 friend class ScopedEvent; | 634 friend class ScopedEvent; |
634 | 635 |
635 // Returns whether capture should be released on mouse release. | 636 // Returns whether capture should be released on mouse release. |
636 virtual bool ShouldReleaseCaptureOnMouseReleased() const; | 637 virtual bool ShouldReleaseCaptureOnMouseReleased() const; |
637 | 638 |
638 // Persists the window's restored position and maximized state using the | 639 // Persists the window's restored position and "show" state using the |
639 // window delegate. | 640 // window delegate. |
640 void SaveWindowPosition(); | 641 void SaveWindowPlacement(); |
641 | 642 |
642 // Sizes and positions the window just after it is created. | 643 // Sizes and positions the window just after it is created. |
643 void SetInitialBounds(const gfx::Rect& bounds); | 644 void SetInitialBounds(const gfx::Rect& bounds); |
644 | 645 |
645 // Returns the bounds and maximized state from the delegate. Returns true if | 646 // Returns the bounds and "show" state from the delegate. Returns true if |
646 // the delegate wants to use a specified bounds. | 647 // the delegate wants to use a specified bounds. |
647 bool GetSavedBounds(gfx::Rect* bounds, bool* maximize); | 648 bool GetSavedWindowPlacement(gfx::Rect* bounds, |
| 649 ui::WindowShowState* show_state); |
648 | 650 |
649 // Sets a different InputMethod instance to this widget. The instance | 651 // Sets a different InputMethod instance to this widget. The instance |
650 // must not be initialized, the ownership will be assumed by the widget. | 652 // must not be initialized, the ownership will be assumed by the widget. |
651 // It's only for testing purpose. | 653 // It's only for testing purpose. |
652 void ReplaceInputMethod(InputMethod* input_method); | 654 void ReplaceInputMethod(InputMethod* input_method); |
653 | 655 |
654 internal::NativeWidgetPrivate* native_widget_; | 656 internal::NativeWidgetPrivate* native_widget_; |
655 | 657 |
656 ObserverList<Observer> observers_; | 658 ObserverList<Observer> observers_; |
657 | 659 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 // FRAME_TYPE_DEFAULT. | 698 // FRAME_TYPE_DEFAULT. |
697 FrameType frame_type_; | 699 FrameType frame_type_; |
698 | 700 |
699 // True when the window should be rendered as active, regardless of whether | 701 // True when the window should be rendered as active, regardless of whether |
700 // or not it actually is. | 702 // or not it actually is. |
701 bool disable_inactive_rendering_; | 703 bool disable_inactive_rendering_; |
702 | 704 |
703 // Set to true if the widget is in the process of closing. | 705 // Set to true if the widget is in the process of closing. |
704 bool widget_closed_; | 706 bool widget_closed_; |
705 | 707 |
706 // The saved maximized state for this window. See note in SetInitialBounds | 708 // The saved "show" state for this window. See note in SetInitialBounds |
707 // that explains why we save this. | 709 // that explains why we save this. |
708 bool saved_maximized_state_; | 710 ui::WindowShowState saved_show_state_; |
709 | 711 |
710 // The restored bounds used for the initial show. This is only used if | 712 // The restored bounds used for the initial show. This is only used if |
711 // |saved_maximized_state_| is true. | 713 // |saved_show_state_| is maximized. |
712 gfx::Rect initial_restored_bounds_; | 714 gfx::Rect initial_restored_bounds_; |
713 | 715 |
714 // The smallest size the window can be. | 716 // The smallest size the window can be. |
715 gfx::Size minimum_size_; | 717 gfx::Size minimum_size_; |
716 | 718 |
717 // Focus is automatically set to the view provided by the delegate | 719 // Focus is automatically set to the view provided by the delegate |
718 // when the widget is shown. Set this value to false to override | 720 // when the widget is shown. Set this value to false to override |
719 // initial focus for the widget. | 721 // initial focus for the widget. |
720 bool focus_on_creation_; | 722 bool focus_on_creation_; |
721 | 723 |
722 scoped_ptr<InputMethod> input_method_; | 724 scoped_ptr<InputMethod> input_method_; |
723 | 725 |
724 // See |is_top_leve()| accessor. | 726 // See |is_top_leve()| accessor. |
725 bool is_top_level_; | 727 bool is_top_level_; |
726 | 728 |
727 // Factory used to create Compositors. Settable by tests. | 729 // Factory used to create Compositors. Settable by tests. |
728 static ui::Compositor*(*compositor_factory_)(); | 730 static ui::Compositor*(*compositor_factory_)(); |
729 | 731 |
| 732 // Tracks whether native widget has been initialized. |
| 733 bool native_widget_initialized_; |
| 734 |
730 DISALLOW_COPY_AND_ASSIGN(Widget); | 735 DISALLOW_COPY_AND_ASSIGN(Widget); |
731 }; | 736 }; |
732 | 737 |
733 } // namespace views | 738 } // namespace views |
734 | 739 |
735 #endif // VIEWS_WIDGET_WIDGET_H_ | 740 #endif // VIEWS_WIDGET_WIDGET_H_ |
OLD | NEW |