OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ | 5 #ifndef ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ |
6 #define ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ | 6 #define ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "ash/wm/overview/scoped_transform_overview_window.h" | 9 #include "ash/wm/overview/scoped_transform_overview_window.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "ui/aura/scoped_window_targeter.h" | 12 #include "ui/aura/scoped_window_targeter.h" |
13 #include "ui/aura/window_observer.h" | 13 #include "ui/aura/window_observer.h" |
14 #include "ui/gfx/geometry/rect.h" | 14 #include "ui/gfx/geometry/rect.h" |
15 #include "ui/views/controls/button/button.h" | 15 #include "ui/views/controls/button/button.h" |
16 #include "ui/views/controls/button/image_button.h" | 16 #include "ui/views/controls/button/image_button.h" |
| 17 #include "ui/views/controls/button/label_button.h" |
17 | 18 |
18 namespace aura { | 19 namespace aura { |
19 class Window; | 20 class Window; |
20 } | 21 } |
21 | 22 |
22 namespace views { | 23 namespace views { |
23 class LabelButton; | 24 class LabelButton; |
24 class Widget; | 25 class Widget; |
25 } | 26 } |
26 | 27 |
27 namespace ash { | 28 namespace ash { |
28 | 29 |
29 class OverviewWindowButton; | |
30 | |
31 // This class represents an item in overview mode. | 30 // This class represents an item in overview mode. |
32 class ASH_EXPORT WindowSelectorItem : public views::ButtonListener, | 31 class ASH_EXPORT WindowSelectorItem : public views::ButtonListener, |
33 public aura::WindowObserver { | 32 public aura::WindowObserver { |
34 public: | 33 public: |
| 34 class OverviewLabelButton : public views::LabelButton { |
| 35 public: |
| 36 OverviewLabelButton(views::ButtonListener* listener, |
| 37 const base::string16& text); |
| 38 |
| 39 ~OverviewLabelButton() override; |
| 40 |
| 41 void set_top_padding(int top_padding) { top_padding_ = top_padding; } |
| 42 |
| 43 protected: |
| 44 // views::LabelButton: |
| 45 gfx::Rect GetChildAreaBounds() override; |
| 46 |
| 47 private: |
| 48 // Padding on top of the button. |
| 49 int top_padding_; |
| 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(OverviewLabelButton); |
| 52 }; |
| 53 |
35 explicit WindowSelectorItem(aura::Window* window); | 54 explicit WindowSelectorItem(aura::Window* window); |
36 ~WindowSelectorItem() override; | 55 ~WindowSelectorItem() override; |
37 | 56 |
38 aura::Window* GetWindow(); | 57 aura::Window* GetWindow(); |
39 | 58 |
40 // Returns the root window on which this item is shown. | 59 // Returns the root window on which this item is shown. |
41 aura::Window* root_window() { return root_window_; } | 60 aura::Window* root_window() { return root_window_; } |
42 | 61 |
43 // Returns true if |target| is contained in this WindowSelectorItem. | 62 // Returns true if |target| is contained in this WindowSelectorItem. |
44 bool Contains(const aura::Window* target) const; | 63 bool Contains(const aura::Window* target) const; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 106 |
88 // Sets the bounds of this selector's items to |target_bounds| in | 107 // Sets the bounds of this selector's items to |target_bounds| in |
89 // |root_window_|. The bounds change will be animated as specified | 108 // |root_window_|. The bounds change will be animated as specified |
90 // by |animation_type|. | 109 // by |animation_type|. |
91 void SetItemBounds(const gfx::Rect& target_bounds, | 110 void SetItemBounds(const gfx::Rect& target_bounds, |
92 OverviewAnimationType animation_type); | 111 OverviewAnimationType animation_type); |
93 | 112 |
94 // Changes the opacity of all the windows the item owns. | 113 // Changes the opacity of all the windows the item owns. |
95 void SetOpacity(float opacity); | 114 void SetOpacity(float opacity); |
96 | 115 |
| 116 // Updates the window label bounds. |
| 117 void UpdateWindowLabel(const gfx::Rect& window_bounds, |
| 118 OverviewAnimationType animation_type); |
| 119 |
| 120 // Creates the window label. |
| 121 void CreateWindowLabel(const base::string16& title); |
| 122 |
97 // Updates the close button's bounds. Any change in bounds will be animated | 123 // Updates the close button's bounds. Any change in bounds will be animated |
98 // from the current bounds to the new bounds as per the |animation_type|. | 124 // from the current bounds to the new bounds as per the |animation_type|. |
99 void UpdateCloseButtonLayout(OverviewAnimationType animation_type); | 125 void UpdateCloseButtonLayout(OverviewAnimationType animation_type); |
100 | 126 |
101 // Updates the close buttons accessibility name. | 127 // Updates the close buttons accessibility name. |
102 void UpdateCloseButtonAccessibilityName(); | 128 void UpdateCloseButtonAccessibilityName(); |
103 | 129 |
104 // True if the item is being shown in the overview, false if it's being | 130 // True if the item is being shown in the overview, false if it's being |
105 // filtered. | 131 // filtered. |
106 bool dimmed_; | 132 bool dimmed_; |
107 | 133 |
108 // The root window this item is being displayed on. | 134 // The root window this item is being displayed on. |
109 aura::Window* root_window_; | 135 aura::Window* root_window_; |
110 | 136 |
111 // The contained Window's wrapper. | 137 // The contained Window's wrapper. |
112 ScopedTransformOverviewWindow transform_window_; | 138 ScopedTransformOverviewWindow transform_window_; |
113 | 139 |
114 // The target bounds this selector item is fit within. | 140 // The target bounds this selector item is fit within. |
115 gfx::Rect target_bounds_; | 141 gfx::Rect target_bounds_; |
116 | 142 |
117 // True if running SetItemBounds. This prevents recursive calls resulting from | 143 // True if running SetItemBounds. This prevents recursive calls resulting from |
118 // the bounds update when calling ::wm::RecreateWindowLayers to copy | 144 // the bounds update when calling ::wm::RecreateWindowLayers to copy |
119 // a window layer for display on another monitor. | 145 // a window layer for display on another monitor. |
120 bool in_bounds_update_; | 146 bool in_bounds_update_; |
121 | 147 |
| 148 // Label under the window displaying its active tab name. |
| 149 scoped_ptr<views::Widget> window_label_; |
| 150 |
| 151 // View for the label under the window. |
| 152 OverviewLabelButton* window_label_button_view_; |
| 153 |
122 // The close buttons widget container. | 154 // The close buttons widget container. |
123 views::Widget close_button_widget_; | 155 views::Widget close_button_widget_; |
124 | 156 |
125 // An easy to access close button for the window in this item. Owned by the | 157 // An easy to access close button for the window in this item. Owned by the |
126 // close_button_widget_. | 158 // close_button_widget_. |
127 views::ImageButton* close_button_; | 159 views::ImageButton* close_button_; |
128 | 160 |
129 // Button that handles window activation. | |
130 scoped_ptr<OverviewWindowButton> overview_window_button_; | |
131 | |
132 DISALLOW_COPY_AND_ASSIGN(WindowSelectorItem); | 161 DISALLOW_COPY_AND_ASSIGN(WindowSelectorItem); |
133 }; | 162 }; |
134 | 163 |
135 } // namespace ash | 164 } // namespace ash |
136 | 165 |
137 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ | 166 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ |
OLD | NEW |