| 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 WidgetDelegate* delegate; | 152 WidgetDelegate* delegate; |
| 152 bool child; | 153 bool child; |
| 153 bool transient; | 154 bool transient; |
| 154 bool transparent; | 155 bool transparent; |
| 155 bool accept_events; | 156 bool accept_events; |
| 156 bool can_activate; | 157 bool can_activate; |
| 157 bool keep_on_top; | 158 bool keep_on_top; |
| 158 Ownership ownership; | 159 Ownership ownership; |
| 159 bool mirror_origin_in_rtl; | 160 bool mirror_origin_in_rtl; |
| 160 bool has_dropshadow; | 161 bool has_dropshadow; |
| 161 // Whether the widget should be maximized. | 162 // Whether the widget should be maximized or minimized. |
| 162 bool maximize; | 163 ui::WindowShowState show_state; |
| 163 // Should the widget be double buffered? Default is false. | 164 // Should the widget be double buffered? Default is false. |
| 164 bool double_buffer; | 165 bool double_buffer; |
| 165 gfx::NativeView parent; | 166 gfx::NativeView parent; |
| 166 Widget* parent_widget; | 167 Widget* parent_widget; |
| 167 // Specifies the initial bounds of the Widget. Default is empty, which means | 168 // Specifies the initial bounds of the Widget. Default is empty, which means |
| 168 // the NativeWidget may specify a default size. | 169 // the NativeWidget may specify a default size. |
| 169 gfx::Rect bounds; | 170 gfx::Rect bounds; |
| 170 // When set, this value is used as the Widget's NativeWidget implementation. | 171 // When set, this value is used as the Widget's NativeWidget implementation. |
| 171 // The Widget will not construct a default one. Default is NULL. | 172 // The Widget will not construct a default one. Default is NULL. |
| 172 NativeWidget* native_widget; | 173 NativeWidget* native_widget; |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 gfx::Point last_mouse_event_position_; | 645 gfx::Point last_mouse_event_position_; |
| 645 | 646 |
| 646 private: | 647 private: |
| 647 friend class NativeTextfieldViewsTest; | 648 friend class NativeTextfieldViewsTest; |
| 648 friend class NativeComboboxViewsTest; | 649 friend class NativeComboboxViewsTest; |
| 649 friend class ScopedEvent; | 650 friend class ScopedEvent; |
| 650 | 651 |
| 651 // Returns whether capture should be released on mouse release. | 652 // Returns whether capture should be released on mouse release. |
| 652 virtual bool ShouldReleaseCaptureOnMouseReleased() const; | 653 virtual bool ShouldReleaseCaptureOnMouseReleased() const; |
| 653 | 654 |
| 654 // Persists the window's restored position and maximized state using the | 655 // Persists the window's restored position and "show" state using the |
| 655 // window delegate. | 656 // window delegate. |
| 656 void SaveWindowPosition(); | 657 void SaveWindowPosition(); |
| 657 | 658 |
| 658 // Sizes and positions the window just after it is created. | 659 // Sizes and positions the window just after it is created. |
| 659 void SetInitialBounds(const gfx::Rect& bounds); | 660 void SetInitialBounds(const gfx::Rect& bounds); |
| 660 | 661 |
| 661 // Returns the bounds and maximized state from the delegate. Returns true if | 662 // Returns the bounds and "show" state from the delegate. Returns true if |
| 662 // the delegate wants to use a specified bounds. | 663 // the delegate wants to use a specified bounds. |
| 663 bool GetSavedBounds(gfx::Rect* bounds, bool* maximize); | 664 bool GetSavedBounds(gfx::Rect* bounds, ui::WindowShowState* show_state); |
| 664 | 665 |
| 665 // Sets a different InputMethod instance to this widget. The instance | 666 // Sets a different InputMethod instance to this widget. The instance |
| 666 // must not be initialized, the ownership will be assumed by the widget. | 667 // must not be initialized, the ownership will be assumed by the widget. |
| 667 // It's only for testing purpose. | 668 // It's only for testing purpose. |
| 668 void ReplaceInputMethod(InputMethod* input_method); | 669 void ReplaceInputMethod(InputMethod* input_method); |
| 669 | 670 |
| 670 internal::NativeWidgetPrivate* native_widget_; | 671 internal::NativeWidgetPrivate* native_widget_; |
| 671 | 672 |
| 672 ObserverList<Observer> observers_; | 673 ObserverList<Observer> observers_; |
| 673 | 674 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 // FRAME_TYPE_DEFAULT. | 713 // FRAME_TYPE_DEFAULT. |
| 713 FrameType frame_type_; | 714 FrameType frame_type_; |
| 714 | 715 |
| 715 // True when the window should be rendered as active, regardless of whether | 716 // True when the window should be rendered as active, regardless of whether |
| 716 // or not it actually is. | 717 // or not it actually is. |
| 717 bool disable_inactive_rendering_; | 718 bool disable_inactive_rendering_; |
| 718 | 719 |
| 719 // Set to true if the widget is in the process of closing. | 720 // Set to true if the widget is in the process of closing. |
| 720 bool widget_closed_; | 721 bool widget_closed_; |
| 721 | 722 |
| 722 // The saved maximized state for this window. See note in SetInitialBounds | 723 // The saved "show" state for this window. See note in SetInitialBounds |
| 723 // that explains why we save this. | 724 // that explains why we save this. |
| 724 bool saved_maximized_state_; | 725 ui::WindowShowState saved_show_state_; |
| 725 | 726 |
| 726 // The restored bounds used for the initial show. This is only used if | 727 // The restored bounds used for the initial show. This is only used if |
| 727 // |saved_maximized_state_| is true. | 728 // |saved_show_state_| is maximized. |
| 728 gfx::Rect initial_restored_bounds_; | 729 gfx::Rect initial_restored_bounds_; |
| 729 | 730 |
| 730 // The smallest size the window can be. | 731 // The smallest size the window can be. |
| 731 gfx::Size minimum_size_; | 732 gfx::Size minimum_size_; |
| 732 | 733 |
| 733 // Focus is automatically set to the view provided by the delegate | 734 // Focus is automatically set to the view provided by the delegate |
| 734 // when the widget is shown. Set this value to false to override | 735 // when the widget is shown. Set this value to false to override |
| 735 // initial focus for the widget. | 736 // initial focus for the widget. |
| 736 bool focus_on_creation_; | 737 bool focus_on_creation_; |
| 737 | 738 |
| 738 scoped_ptr<InputMethod> input_method_; | 739 scoped_ptr<InputMethod> input_method_; |
| 739 | 740 |
| 740 // See |is_top_leve()| accessor. | 741 // See |is_top_leve()| accessor. |
| 741 bool is_top_level_; | 742 bool is_top_level_; |
| 742 | 743 |
| 743 // Factory used to create Compositors. Settable by tests. | 744 // Factory used to create Compositors. Settable by tests. |
| 744 static ui::Compositor*(*compositor_factory_)(); | 745 static ui::Compositor*(*compositor_factory_)(); |
| 745 | 746 |
| 746 // Tracks destroy state. | 747 // Tracks destroy state. |
| 747 // TODO(sky): remove this, used in tracking 91396. | 748 // TODO(sky): remove this, used in tracking 91396. |
| 748 DestroyState destroy_state_; | 749 DestroyState destroy_state_; |
| 749 | 750 |
| 750 DISALLOW_COPY_AND_ASSIGN(Widget); | 751 DISALLOW_COPY_AND_ASSIGN(Widget); |
| 751 }; | 752 }; |
| 752 | 753 |
| 753 } // namespace views | 754 } // namespace views |
| 754 | 755 |
| 755 #endif // VIEWS_WIDGET_WIDGET_H_ | 756 #endif // VIEWS_WIDGET_WIDGET_H_ |
| OLD | NEW |