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 // Defines a simple integer rectangle class. The containment semantics | 5 // Defines a simple integer 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 26 matching lines...) Expand all Loading... |
37 #if defined(OS_WIN) | 37 #if defined(OS_WIN) |
38 explicit Rect(const RECT& r); | 38 explicit Rect(const RECT& r); |
39 #elif defined(OS_MACOSX) | 39 #elif defined(OS_MACOSX) |
40 explicit Rect(const CGRect& r); | 40 explicit Rect(const CGRect& r); |
41 #elif defined(TOOLKIT_GTK) | 41 #elif defined(TOOLKIT_GTK) |
42 explicit Rect(const GdkRectangle& r); | 42 explicit Rect(const GdkRectangle& r); |
43 #endif | 43 #endif |
44 explicit Rect(const gfx::Size& size); | 44 explicit Rect(const gfx::Size& size); |
45 Rect(const gfx::Point& origin, const gfx::Size& size); | 45 Rect(const gfx::Point& origin, const gfx::Size& size); |
46 | 46 |
47 virtual ~Rect(); | 47 ~Rect(); |
48 | 48 |
49 #if defined(OS_WIN) | 49 #if defined(OS_WIN) |
50 Rect& operator=(const RECT& r); | 50 Rect& operator=(const RECT& r); |
51 #elif defined(OS_MACOSX) | 51 #elif defined(OS_MACOSX) |
52 Rect& operator=(const CGRect& r); | 52 Rect& operator=(const CGRect& r); |
53 #elif defined(TOOLKIT_GTK) | 53 #elif defined(TOOLKIT_GTK) |
54 Rect& operator=(const GdkRectangle& r); | 54 Rect& operator=(const GdkRectangle& r); |
55 #endif | 55 #endif |
56 | 56 |
57 #if defined(OS_WIN) | 57 #if defined(OS_WIN) |
58 // Construct an equivalent Win32 RECT object. | 58 // Construct an equivalent Win32 RECT object. |
59 RECT ToRECT() const; | 59 RECT ToRECT() const; |
60 #elif defined(TOOLKIT_GTK) | 60 #elif defined(TOOLKIT_GTK) |
61 GdkRectangle ToGdkRectangle() const; | 61 GdkRectangle ToGdkRectangle() const; |
62 #elif defined(OS_MACOSX) | 62 #elif defined(OS_MACOSX) |
63 // Construct an equivalent CoreGraphics object. | 63 // Construct an equivalent CoreGraphics object. |
64 CGRect ToCGRect() const; | 64 CGRect ToCGRect() const; |
65 #endif | 65 #endif |
66 | 66 |
67 std::string ToString() const; | 67 std::string ToString() const; |
68 }; | 68 }; |
69 | 69 |
70 } // namespace gfx | 70 } // namespace gfx |
71 | 71 |
72 #endif // UI_GFX_RECT_H_ | 72 #endif // UI_GFX_RECT_H_ |
OLD | NEW |