summaryrefslogtreecommitdiffstats
path: root/base/gfx/rect.h
diff options
context:
space:
mode:
Diffstat (limited to 'base/gfx/rect.h')
-rw-r--r--base/gfx/rect.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/base/gfx/rect.h b/base/gfx/rect.h
index 486f799..d19bf7e 100644
--- a/base/gfx/rect.h
+++ b/base/gfx/rect.h
@@ -40,7 +40,9 @@
#include "base/gfx/size.h"
#include "base/gfx/point.h"
+#if defined(OS_WIN)
typedef struct tagRECT RECT;
+#endif
namespace gfx {
@@ -49,12 +51,20 @@ class Rect {
Rect();
Rect(int width, int height);
Rect(int x, int y, int width, int height);
+#if defined(OS_WIN)
explicit Rect(const RECT& r);
+#elif defined(OS_MACOSX)
+ explicit Rect(const CGRect& r);
+#endif
Rect(const gfx::Point& origin, const gfx::Size& size);
~Rect() {}
+#if defined(OS_WIN)
Rect& operator=(const RECT& r);
+#elif defined(OS_MACOSX)
+ Rect& operator=(const CGRect& r);
+#endif
int x() const { return origin_.x(); }
void set_x(int x) { origin_.set_x(x); }
@@ -93,8 +103,13 @@ class Rect {
return !(*this == other);
}
+#if defined(OS_WIN)
// Construct an equivalent Win32 RECT object.
RECT ToRECT() const;
+#elif defined(OS_MACOSX)
+ // Construct an equivalent CoreGraphics object.
+ CGRect ToCGRect() const;
+#endif
// Returns true if the point identified by point_x and point_y falls inside
// this rectangle. The point (x, y) is inside the rectangle, but the