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 UI_VIEWS_VIEW_MODEL_UTILS_H_ | 5 #ifndef UI_VIEWS_VIEW_MODEL_UTILS_H_ |
6 #define UI_VIEWS_VIEW_MODEL_UTILS_H_ | 6 #define UI_VIEWS_VIEW_MODEL_UTILS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "ui/views/views_export.h" | 10 #include "ui/views/views_export.h" |
11 | 11 |
12 namespace views { | 12 namespace views { |
13 | 13 |
14 class View; | 14 class View; |
15 class ViewModel; | 15 class ViewModel; |
16 | 16 |
17 class VIEWS_EXPORT ViewModelUtils { | 17 class VIEWS_EXPORT ViewModelUtils { |
18 public: | 18 public: |
| 19 enum Alignment { |
| 20 HORIZONTAL, |
| 21 VERTICAL |
| 22 }; |
| 23 |
19 // Sets the bounds of each view to its ideal bounds. | 24 // Sets the bounds of each view to its ideal bounds. |
20 static void SetViewBoundsToIdealBounds(const ViewModel& model); | 25 static void SetViewBoundsToIdealBounds(const ViewModel& model); |
21 | 26 |
22 // Returns true if the Views in |model| are at their ideal bounds. | 27 // Returns true if the Views in |model| are at their ideal bounds. |
23 static bool IsAtIdealBounds(const ViewModel& model); | 28 static bool IsAtIdealBounds(const ViewModel& model); |
24 | 29 |
25 // Returns the index to move |view| to based on a x-coordinate of |x|. | 30 // Returns the index to move |view| to based on a coordinate of |x| and |y|. |
26 static int DetermineMoveIndex(const ViewModel& model, | 31 static int DetermineMoveIndex(const ViewModel& model, |
27 View* view, | 32 View* view, |
28 int x); | 33 Alignment alignment, |
| 34 int x, |
| 35 int y); |
29 | 36 |
30 private: | 37 private: |
31 DISALLOW_IMPLICIT_CONSTRUCTORS(ViewModelUtils); | 38 DISALLOW_IMPLICIT_CONSTRUCTORS(ViewModelUtils); |
32 }; | 39 }; |
33 | 40 |
34 } // namespace views | 41 } // namespace views |
35 | 42 |
36 #endif // UI_VIEWS_VIEW_MODEL_UTILS_H_ | 43 #endif // UI_VIEWS_VIEW_MODEL_UTILS_H_ |
OLD | NEW |