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(views::ButtonListener* listener, | 36 OverviewLabelButton(WindowSelectorItem* selector_item, |
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 |
43 protected: | 46 protected: |
44 // views::LabelButton: | 47 // views::LabelButton: |
45 gfx::Rect GetChildAreaBounds() override; | 48 gfx::Rect GetChildAreaBounds() override; |
46 | 49 |
47 private: | 50 private: |
| 51 // The WindowSelectorItem that the touch gestures are delegated to. |
| 52 // Not owned. |
| 53 WindowSelectorItem* selector_item_; |
| 54 |
48 // Padding on top of the button. | 55 // Padding on top of the button. |
49 int top_padding_; | 56 int top_padding_; |
50 | 57 |
51 DISALLOW_COPY_AND_ASSIGN(OverviewLabelButton); | 58 DISALLOW_COPY_AND_ASSIGN(OverviewLabelButton); |
52 }; | 59 }; |
53 | 60 |
54 explicit WindowSelectorItem(aura::Window* window); | 61 explicit WindowSelectorItem(aura::Window* window); |
55 ~WindowSelectorItem() override; | 62 ~WindowSelectorItem() override; |
56 | 63 |
57 aura::Window* GetWindow(); | 64 aura::Window* GetWindow(); |
(...skipping 29 matching lines...) Expand all Loading... |
87 // label is read. | 94 // label is read. |
88 void SendFocusAlert() const; | 95 void SendFocusAlert() const; |
89 | 96 |
90 // Sets if the item is dimmed in the overview. Changing the value will also | 97 // Sets if the item is dimmed in the overview. Changing the value will also |
91 // change the visibility of the transform windows. | 98 // change the visibility of the transform windows. |
92 void SetDimmed(bool dimmed); | 99 void SetDimmed(bool dimmed); |
93 bool dimmed() const { return dimmed_; } | 100 bool dimmed() const { return dimmed_; } |
94 | 101 |
95 const gfx::Rect& target_bounds() const { return target_bounds_; } | 102 const gfx::Rect& target_bounds() const { return target_bounds_; } |
96 | 103 |
| 104 // Handles the gestures on the Window |
| 105 void OnGestureEvent(ui::GestureEvent* event); |
| 106 |
97 // views::ButtonListener: | 107 // views::ButtonListener: |
98 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 108 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
99 | 109 |
100 // aura::WindowObserver: | 110 // aura::WindowObserver: |
101 void OnWindowDestroying(aura::Window* window) override; | 111 void OnWindowDestroying(aura::Window* window) override; |
102 void OnWindowTitleChanged(aura::Window* window) override; | 112 void OnWindowTitleChanged(aura::Window* window) override; |
103 | 113 |
104 private: | 114 private: |
105 friend class WindowSelectorTest; | 115 friend class WindowSelectorTest; |
106 | 116 |
(...skipping 13 matching lines...) Expand all Loading... |
120 // Creates the window label. | 130 // Creates the window label. |
121 void CreateWindowLabel(const base::string16& title); | 131 void CreateWindowLabel(const base::string16& title); |
122 | 132 |
123 // Updates the close button's bounds. Any change in bounds will be animated | 133 // Updates the close button's bounds. Any change in bounds will be animated |
124 // from the current bounds to the new bounds as per the |animation_type|. | 134 // from the current bounds to the new bounds as per the |animation_type|. |
125 void UpdateCloseButtonLayout(OverviewAnimationType animation_type); | 135 void UpdateCloseButtonLayout(OverviewAnimationType animation_type); |
126 | 136 |
127 // Updates the close buttons accessibility name. | 137 // Updates the close buttons accessibility name. |
128 void UpdateCloseButtonAccessibilityName(); | 138 void UpdateCloseButtonAccessibilityName(); |
129 | 139 |
| 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 |
130 // True if the item is being shown in the overview, false if it's being | 148 // True if the item is being shown in the overview, false if it's being |
131 // filtered. | 149 // filtered. |
132 bool dimmed_; | 150 bool dimmed_; |
133 | 151 |
134 // The root window this item is being displayed on. | 152 // The root window this item is being displayed on. |
135 aura::Window* root_window_; | 153 aura::Window* root_window_; |
136 | 154 |
137 // The contained Window's wrapper. | 155 // The contained Window's wrapper. |
138 ScopedTransformOverviewWindow transform_window_; | 156 ScopedTransformOverviewWindow transform_window_; |
139 | 157 |
(...skipping 11 matching lines...) Expand all Loading... |
151 // View for the label under the window. | 169 // View for the label under the window. |
152 OverviewLabelButton* window_label_button_view_; | 170 OverviewLabelButton* window_label_button_view_; |
153 | 171 |
154 // The close buttons widget container. | 172 // The close buttons widget container. |
155 views::Widget close_button_widget_; | 173 views::Widget close_button_widget_; |
156 | 174 |
157 // An easy to access close button for the window in this item. Owned by the | 175 // An easy to access close button for the window in this item. Owned by the |
158 // close_button_widget_. | 176 // close_button_widget_. |
159 views::ImageButton* close_button_; | 177 views::ImageButton* close_button_; |
160 | 178 |
| 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 |
161 DISALLOW_COPY_AND_ASSIGN(WindowSelectorItem); | 183 DISALLOW_COPY_AND_ASSIGN(WindowSelectorItem); |
162 }; | 184 }; |
163 | 185 |
164 } // namespace ash | 186 } // namespace ash |
165 | 187 |
166 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ | 188 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ |
OLD | NEW |