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_SHELF_SHELF_H_ | 5 #ifndef ASH_SHELF_SHELF_H_ |
6 #define ASH_SHELF_SHELF_H_ | 6 #define ASH_SHELF_SHELF_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "ash/shelf/shelf_constants.h" | 9 #include "ash/shelf/shelf_constants.h" |
10 #include "ash/shelf/shelf_types.h" | 10 #include "ash/shelf/shelf_types.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 void SetAlignment(ShelfAlignment alignment); | 59 void SetAlignment(ShelfAlignment alignment); |
60 ShelfAlignment alignment() const { return alignment_; } | 60 ShelfAlignment alignment() const { return alignment_; } |
61 bool IsHorizontalAlignment() const; | 61 bool IsHorizontalAlignment() const; |
62 | 62 |
63 // Sets the ShelfAutoHideBehavior. See enum description for details. | 63 // Sets the ShelfAutoHideBehavior. See enum description for details. |
64 void SetAutoHideBehavior(ShelfAutoHideBehavior behavior); | 64 void SetAutoHideBehavior(ShelfAutoHideBehavior behavior); |
65 ShelfAutoHideBehavior GetAutoHideBehavior() const; | 65 ShelfAutoHideBehavior GetAutoHideBehavior() const; |
66 | 66 |
67 // A helper functions that chooses values specific to a shelf alignment. | 67 // A helper functions that chooses values specific to a shelf alignment. |
68 template <typename T> | 68 template <typename T> |
69 T SelectValueForShelfAlignment(T bottom, T left, T right, T top) const { | 69 T SelectValueForShelfAlignment(T bottom, T left, T right) const { |
70 switch (alignment_) { | 70 switch (alignment_) { |
71 case SHELF_ALIGNMENT_BOTTOM: | 71 case SHELF_ALIGNMENT_BOTTOM: |
72 return bottom; | 72 return bottom; |
73 case SHELF_ALIGNMENT_LEFT: | 73 case SHELF_ALIGNMENT_LEFT: |
74 return left; | 74 return left; |
75 case SHELF_ALIGNMENT_RIGHT: | 75 case SHELF_ALIGNMENT_RIGHT: |
76 return right; | 76 return right; |
77 case SHELF_ALIGNMENT_TOP: | |
78 return top; | |
79 } | 77 } |
80 NOTREACHED(); | 78 NOTREACHED(); |
81 return right; | 79 return right; |
82 } | 80 } |
83 | 81 |
84 // A helper functions that chooses values specific to a shelf alignment type. | 82 // A helper functions that chooses values specific to a shelf alignment type. |
85 template <typename T> | 83 template <typename T> |
86 T PrimaryAxisValue(T horizontal, T vertical) const { | 84 T PrimaryAxisValue(T horizontal, T vertical) const { |
87 return IsHorizontalAlignment() ? horizontal : vertical; | 85 return IsHorizontalAlignment() ? horizontal : vertical; |
88 } | 86 } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 ShelfDelegate* delegate_; | 144 ShelfDelegate* delegate_; |
147 | 145 |
148 ShelfWidget* shelf_widget_; | 146 ShelfWidget* shelf_widget_; |
149 | 147 |
150 DISALLOW_COPY_AND_ASSIGN(Shelf); | 148 DISALLOW_COPY_AND_ASSIGN(Shelf); |
151 }; | 149 }; |
152 | 150 |
153 } // namespace ash | 151 } // namespace ash |
154 | 152 |
155 #endif // ASH_SHELF_SHELF_H_ | 153 #endif // ASH_SHELF_SHELF_H_ |
OLD | NEW |