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