| 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. |
| 11 | 11 |
| 12 #ifndef UI_GFX_RECT_H_ | 12 #ifndef UI_GFX_RECT_H_ |
| 13 #define UI_GFX_RECT_H_ | 13 #define UI_GFX_RECT_H_ |
| 14 | 14 |
| 15 #include <string> | 15 #include <string> |
| 16 | 16 |
| 17 #include "base/export_template_type.h" |
| 17 #include "ui/gfx/point.h" | 18 #include "ui/gfx/point.h" |
| 18 #include "ui/gfx/rect_base.h" | 19 #include "ui/gfx/rect_base.h" |
| 19 #include "ui/gfx/rect_f.h" | 20 #include "ui/gfx/rect_f.h" |
| 20 #include "ui/gfx/size.h" | 21 #include "ui/gfx/size.h" |
| 21 #include "ui/gfx/vector2d.h" | 22 #include "ui/gfx/vector2d.h" |
| 22 | 23 |
| 23 #if defined(OS_WIN) | 24 #if defined(OS_WIN) |
| 24 typedef struct tagRECT RECT; | 25 typedef struct tagRECT RECT; |
| 25 #elif defined(TOOLKIT_GTK) | 26 #elif defined(TOOLKIT_GTK) |
| 26 typedef struct _GdkRectangle GdkRectangle; | 27 typedef struct _GdkRectangle GdkRectangle; |
| 27 #elif defined(OS_IOS) | 28 #elif defined(OS_IOS) |
| 28 #include <CoreGraphics/CoreGraphics.h> | 29 #include <CoreGraphics/CoreGraphics.h> |
| 29 #elif defined(OS_MACOSX) | 30 #elif defined(OS_MACOSX) |
| 30 #include <ApplicationServices/ApplicationServices.h> | 31 #include <ApplicationServices/ApplicationServices.h> |
| 31 #endif | 32 #endif |
| 32 | 33 |
| 33 namespace gfx { | 34 namespace gfx { |
| 34 | 35 |
| 35 class Insets; | 36 EXPORT_TEMPLATE_TYPE(class, UI_EXPORT, Insets); |
| 36 | 37 |
| 37 class UI_EXPORT Rect | 38 class UI_EXPORT Rect |
| 38 : public RectBase<Rect, Point, Size, Insets, Vector2d, int> { | 39 : public RectBase<Rect, Point, Size, Insets, Vector2d, int> { |
| 39 public: | 40 public: |
| 40 Rect() : RectBase<Rect, Point, Size, Insets, Vector2d, int>(Point()) {} | 41 Rect() : RectBase<Rect, Point, Size, Insets, Vector2d, int>(Point()) {} |
| 41 | 42 |
| 42 Rect(int width, int height) | 43 Rect(int width, int height) |
| 43 : RectBase<Rect, Point, Size, Insets, Vector2d, int> | 44 : RectBase<Rect, Point, Size, Insets, Vector2d, int> |
| 44 (Size(width, height)) {} | 45 (Size(width, height)) {} |
| 45 | 46 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 // contained within the rect, because they will appear on one of these edges. | 108 // contained within the rect, because they will appear on one of these edges. |
| 108 UI_EXPORT Rect BoundingRect(const Point& p1, const Point& p2); | 109 UI_EXPORT Rect BoundingRect(const Point& p1, const Point& p2); |
| 109 | 110 |
| 110 #if !defined(COMPILER_MSVC) | 111 #if !defined(COMPILER_MSVC) |
| 111 extern template class RectBase<Rect, Point, Size, Insets, Vector2d, int>; | 112 extern template class RectBase<Rect, Point, Size, Insets, Vector2d, int>; |
| 112 #endif | 113 #endif |
| 113 | 114 |
| 114 } // namespace gfx | 115 } // namespace gfx |
| 115 | 116 |
| 116 #endif // UI_GFX_RECT_H_ | 117 #endif // UI_GFX_RECT_H_ |
| OLD | NEW |