OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_LAUNCHER_LAUNCHER_VIEW_H_ | 5 #ifndef ASH_LAUNCHER_LAUNCHER_VIEW_H_ |
6 #define ASH_LAUNCHER_LAUNCHER_VIEW_H_ | 6 #define ASH_LAUNCHER_LAUNCHER_VIEW_H_ |
7 | 7 |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 private: | 99 private: |
100 friend class ash::test::LauncherViewTestAPI; | 100 friend class ash::test::LauncherViewTestAPI; |
101 | 101 |
102 class FadeOutAnimationDelegate; | 102 class FadeOutAnimationDelegate; |
103 class StartFadeAnimationDelegate; | 103 class StartFadeAnimationDelegate; |
104 | 104 |
105 struct IdealBounds { | 105 struct IdealBounds { |
106 gfx::Rect overflow_bounds; | 106 gfx::Rect overflow_bounds; |
107 }; | 107 }; |
108 | 108 |
109 // Used in calculating ideal bounds. | |
110 int primary_axis_coordinate(int x, int y) const { | |
111 return is_horizontal_alignment() ? x : y; | |
112 } | |
113 | |
114 bool is_horizontal_alignment() const { | |
115 return alignment_ == SHELF_ALIGNMENT_BOTTOM; | |
116 } | |
117 | |
118 // Used in calculating ideal bounds. | |
119 int alignment_based_value(int bottom, int left, int right) const { | |
120 return (SHELF_ALIGNMENT_BOTTOM == alignment_ ? bottom : | |
121 (SHELF_ALIGNMENT_LEFT == alignment_ ? left : right)); | |
122 } | |
123 | |
124 bool is_overflow_mode() const { | 109 bool is_overflow_mode() const { |
125 return first_visible_index_ > 0; | 110 return first_visible_index_ > 0; |
126 } | 111 } |
127 | 112 |
128 bool dragging() const { | 113 bool dragging() const { |
129 return drag_pointer_ != NONE; | 114 return drag_pointer_ != NONE; |
130 } | 115 } |
131 | 116 |
132 // Sets the bounds of each view to its ideal bounds. | 117 // Sets the bounds of each view to its ideal bounds. |
133 void LayoutToIdealBounds(); | 118 void LayoutToIdealBounds(); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 virtual void PointerDraggedOnButton( | 187 virtual void PointerDraggedOnButton( |
203 views::View* view, | 188 views::View* view, |
204 Pointer pointer, | 189 Pointer pointer, |
205 const ui::LocatedEvent& event) OVERRIDE; | 190 const ui::LocatedEvent& event) OVERRIDE; |
206 virtual void PointerReleasedOnButton(views::View* view, | 191 virtual void PointerReleasedOnButton(views::View* view, |
207 Pointer pointer, | 192 Pointer pointer, |
208 bool canceled) OVERRIDE; | 193 bool canceled) OVERRIDE; |
209 virtual void MouseMovedOverButton(views::View* view) OVERRIDE; | 194 virtual void MouseMovedOverButton(views::View* view) OVERRIDE; |
210 virtual void MouseEnteredButton(views::View* view) OVERRIDE; | 195 virtual void MouseEnteredButton(views::View* view) OVERRIDE; |
211 virtual void MouseExitedButton(views::View* view) OVERRIDE; | 196 virtual void MouseExitedButton(views::View* view) OVERRIDE; |
212 virtual ShelfAlignment GetShelfAlignment() const OVERRIDE; | |
213 virtual string16 GetAccessibleName(const views::View* view) OVERRIDE; | 197 virtual string16 GetAccessibleName(const views::View* view) OVERRIDE; |
214 | 198 |
215 // Overridden from views::ButtonListener: | 199 // Overridden from views::ButtonListener: |
216 virtual void ButtonPressed(views::Button* sender, | 200 virtual void ButtonPressed(views::Button* sender, |
217 const ui::Event& event) OVERRIDE; | 201 const ui::Event& event) OVERRIDE; |
218 | 202 |
219 // Overridden from views::ContextMenuController: | 203 // Overridden from views::ContextMenuController: |
220 virtual void ShowContextMenuForView(views::View* source, | 204 virtual void ShowContextMenuForView(views::View* source, |
221 const gfx::Point& point) OVERRIDE; | 205 const gfx::Point& point) OVERRIDE; |
222 | 206 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 | 269 |
286 ShelfGestureHandler gesture_handler_; | 270 ShelfGestureHandler gesture_handler_; |
287 | 271 |
288 DISALLOW_COPY_AND_ASSIGN(LauncherView); | 272 DISALLOW_COPY_AND_ASSIGN(LauncherView); |
289 }; | 273 }; |
290 | 274 |
291 } // namespace internal | 275 } // namespace internal |
292 } // namespace ash | 276 } // namespace ash |
293 | 277 |
294 #endif // ASH_LAUNCHER_LAUNCHER_VIEW_H_ | 278 #endif // ASH_LAUNCHER_LAUNCHER_VIEW_H_ |
OLD | NEW |