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 // A template for a simple rectangle class. The containment semantics | 5 // A template for a simple rectangle class. The containment semantics |
6 // are array-like; that is, the coordinate (x, y) is considered to be | 6 // are array-like; that is, the coordinate (x, y) is considered to be |
7 // contained by the rectangle, but the coordinate (x + width, y) is not. | 7 // contained by the rectangle, but the coordinate (x + width, y) is not. |
8 // The class will happily let you create malformed rectangles (that is, | 8 // The class will happily let you create malformed rectangles (that is, |
9 // rectangles with negative width and/or height), but there will be assertions | 9 // rectangles with negative width and/or height), but there will be assertions |
10 // in the operations (such as Contains()) to complain in this case. | 10 // in the operations (such as Contains()) to complain in this case. |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 void SplitVertically(Class* left_half, Class* right_half) const; | 133 void SplitVertically(Class* left_half, Class* right_half) const; |
134 | 134 |
135 // Returns true if this rectangle shares an entire edge (i.e., same width or | 135 // Returns true if this rectangle shares an entire edge (i.e., same width or |
136 // same height) with the given rectangle, and the rectangles do not overlap. | 136 // same height) with the given rectangle, and the rectangles do not overlap. |
137 bool SharesEdgeWith(const Class& rect) const; | 137 bool SharesEdgeWith(const Class& rect) const; |
138 | 138 |
139 protected: | 139 protected: |
140 RectBase(const PointClass& origin, const SizeClass& size); | 140 RectBase(const PointClass& origin, const SizeClass& size); |
141 explicit RectBase(const SizeClass& size); | 141 explicit RectBase(const SizeClass& size); |
142 explicit RectBase(const PointClass& origin); | 142 explicit RectBase(const PointClass& origin); |
143 virtual ~RectBase(); | 143 ~RectBase(); |
144 | 144 |
145 private: | 145 private: |
146 PointClass origin_; | 146 PointClass origin_; |
147 SizeClass size_; | 147 SizeClass size_; |
148 }; | 148 }; |
149 | 149 |
150 } // namespace gfx | 150 } // namespace gfx |
151 | 151 |
152 #endif // UI_GFX_RECT_BASE_H_ | 152 #endif // UI_GFX_RECT_BASE_H_ |
OLD | NEW |