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" |
(...skipping 15 matching lines...) Expand all Loading... |
26 } | 26 } |
27 | 27 |
28 namespace ash { | 28 namespace ash { |
29 | 29 |
30 // This class represents an item in overview mode. | 30 // This class represents an item in overview mode. |
31 class ASH_EXPORT WindowSelectorItem : public views::ButtonListener, | 31 class ASH_EXPORT WindowSelectorItem : public views::ButtonListener, |
32 public aura::WindowObserver { | 32 public aura::WindowObserver { |
33 public: | 33 public: |
34 class OverviewLabelButton : public views::LabelButton { | 34 class OverviewLabelButton : public views::LabelButton { |
35 public: | 35 public: |
36 OverviewLabelButton(WindowSelectorItem* selector_item, | 36 OverviewLabelButton(views::ButtonListener* listener, |
37 const base::string16& text); | 37 const base::string16& text); |
38 | 38 |
39 ~OverviewLabelButton() override; | 39 ~OverviewLabelButton() override; |
40 | 40 |
41 void set_top_padding(int top_padding) { top_padding_ = top_padding; } | 41 void set_top_padding(int top_padding) { top_padding_ = top_padding; } |
42 | 42 |
43 // views::LabelButton: | |
44 void OnGestureEvent(ui::GestureEvent* event) override; | |
45 | |
46 protected: | 43 protected: |
47 // views::LabelButton: | 44 // views::LabelButton: |
48 gfx::Rect GetChildAreaBounds() override; | 45 gfx::Rect GetChildAreaBounds() override; |
49 | 46 |
50 private: | 47 private: |
51 // The WindowSelectorItem that the touch gestures are delegated to. | |
52 // Not owned. | |
53 WindowSelectorItem* selector_item_; | |
54 | |
55 // Padding on top of the button. | 48 // Padding on top of the button. |
56 int top_padding_; | 49 int top_padding_; |
57 | 50 |
58 DISALLOW_COPY_AND_ASSIGN(OverviewLabelButton); | 51 DISALLOW_COPY_AND_ASSIGN(OverviewLabelButton); |
59 }; | 52 }; |
60 | 53 |
61 explicit WindowSelectorItem(aura::Window* window); | 54 explicit WindowSelectorItem(aura::Window* window); |
62 ~WindowSelectorItem() override; | 55 ~WindowSelectorItem() override; |
63 | 56 |
64 aura::Window* GetWindow(); | 57 aura::Window* GetWindow(); |
(...skipping 29 matching lines...) Expand all Loading... |
94 // label is read. | 87 // label is read. |
95 void SendFocusAlert() const; | 88 void SendFocusAlert() const; |
96 | 89 |
97 // Sets if the item is dimmed in the overview. Changing the value will also | 90 // Sets if the item is dimmed in the overview. Changing the value will also |
98 // change the visibility of the transform windows. | 91 // change the visibility of the transform windows. |
99 void SetDimmed(bool dimmed); | 92 void SetDimmed(bool dimmed); |
100 bool dimmed() const { return dimmed_; } | 93 bool dimmed() const { return dimmed_; } |
101 | 94 |
102 const gfx::Rect& target_bounds() const { return target_bounds_; } | 95 const gfx::Rect& target_bounds() const { return target_bounds_; } |
103 | 96 |
104 // Handles the gestures on the Window | |
105 void OnGestureEvent(ui::GestureEvent* event); | |
106 | |
107 // views::ButtonListener: | 97 // views::ButtonListener: |
108 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 98 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
109 | 99 |
110 // aura::WindowObserver: | 100 // aura::WindowObserver: |
111 void OnWindowDestroying(aura::Window* window) override; | 101 void OnWindowDestroying(aura::Window* window) override; |
112 void OnWindowTitleChanged(aura::Window* window) override; | 102 void OnWindowTitleChanged(aura::Window* window) override; |
113 | 103 |
114 private: | 104 private: |
115 friend class WindowSelectorTest; | 105 friend class WindowSelectorTest; |
116 | 106 |
(...skipping 13 matching lines...) Expand all Loading... |
130 // Creates the window label. | 120 // Creates the window label. |
131 void CreateWindowLabel(const base::string16& title); | 121 void CreateWindowLabel(const base::string16& title); |
132 | 122 |
133 // 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 |
134 // 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|. |
135 void UpdateCloseButtonLayout(OverviewAnimationType animation_type); | 125 void UpdateCloseButtonLayout(OverviewAnimationType animation_type); |
136 | 126 |
137 // Updates the close buttons accessibility name. | 127 // Updates the close buttons accessibility name. |
138 void UpdateCloseButtonAccessibilityName(); | 128 void UpdateCloseButtonAccessibilityName(); |
139 | 129 |
140 // Animates the |transform_window_| back to it's original overview mode | |
141 // position. | |
142 void ResetScrolledWindow(); | |
143 | |
144 // Returns the minimum distance at which a scroll gesture will cause this | |
145 // selector item to be closed. | |
146 int GetMinimumCloseDistance() const; | |
147 | |
148 // 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 |
149 // filtered. | 131 // filtered. |
150 bool dimmed_; | 132 bool dimmed_; |
151 | 133 |
152 // The root window this item is being displayed on. | 134 // The root window this item is being displayed on. |
153 aura::Window* root_window_; | 135 aura::Window* root_window_; |
154 | 136 |
155 // The contained Window's wrapper. | 137 // The contained Window's wrapper. |
156 ScopedTransformOverviewWindow transform_window_; | 138 ScopedTransformOverviewWindow transform_window_; |
157 | 139 |
(...skipping 11 matching lines...) Expand all Loading... |
169 // View for the label under the window. | 151 // View for the label under the window. |
170 OverviewLabelButton* window_label_button_view_; | 152 OverviewLabelButton* window_label_button_view_; |
171 | 153 |
172 // The close buttons widget container. | 154 // The close buttons widget container. |
173 views::Widget close_button_widget_; | 155 views::Widget close_button_widget_; |
174 | 156 |
175 // 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 |
176 // close_button_widget_. | 158 // close_button_widget_. |
177 views::ImageButton* close_button_; | 159 views::ImageButton* close_button_; |
178 | 160 |
179 // The original X location for a scroll begin event. |original_x_| is in the | |
180 // local coordinate space of |window_label_button_view_|. | |
181 float scroll_x_origin_; | |
182 | |
183 DISALLOW_COPY_AND_ASSIGN(WindowSelectorItem); | 161 DISALLOW_COPY_AND_ASSIGN(WindowSelectorItem); |
184 }; | 162 }; |
185 | 163 |
186 } // namespace ash | 164 } // namespace ash |
187 | 165 |
188 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ | 166 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ |
OLD | NEW |