Cleanup. Addition of constructor BRect(float side), allowing e.g. BRect(B_LARGE_ICON).

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40984 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jonas Sundström
2011-03-17 01:08:01 +00:00
parent 495ecdfea8
commit 2d4087c90a
+40 -20
View File
@@ -25,6 +25,7 @@ public:
float bottom); float bottom);
BRect(BPoint leftTop, BPoint rightBottom); BRect(BPoint leftTop, BPoint rightBottom);
BRect(BPoint leftTop, BSize size); BRect(BPoint leftTop, BSize size);
BRect(float side);
BRect& operator=(const BRect& other); BRect& operator=(const BRect& other);
void Set(float left, float top, float right, void Set(float left, float top, float right,
@@ -90,14 +91,14 @@ public:
inline BPoint inline BPoint
BRect::LeftTop() const BRect::LeftTop() const
{ {
return *(const BPoint *)&left; return *(const BPoint*)&left;
} }
inline BPoint inline BPoint
BRect::RightBottom() const BRect::RightBottom() const
{ {
return *(const BPoint *)&right; return *(const BPoint*)&right;
} }
@@ -117,48 +118,66 @@ BRect::RightTop() const
inline inline
BRect::BRect() BRect::BRect()
:
left(0),
top(0),
right(-1),
bottom(-1)
{ {
top = left = 0;
bottom = right = -1;
} }
inline inline
BRect::BRect(float l, float t, float r, float b) BRect::BRect(float l, float t, float r, float b)
:
left(l),
top(t),
right(r),
bottom(b)
{ {
left = l;
top = t;
right = r;
bottom = b;
} }
inline inline
BRect::BRect(const BRect& r) BRect::BRect(const BRect& r)
:
left(r.left),
top(r.top),
right(r.right),
bottom(r.bottom)
{ {
left = r.left;
top = r.top;
right = r.right;
bottom = r.bottom;
} }
inline inline
BRect::BRect(BPoint leftTop, BPoint rightBottom) BRect::BRect(BPoint leftTop, BPoint rightBottom)
:
left(leftTop.x),
top(leftTop.y),
right(rightBottom.x),
bottom(rightBottom.y)
{ {
left = leftTop.x;
top = leftTop.y;
right = rightBottom.x;
bottom = rightBottom.y;
} }
inline inline
BRect::BRect(BPoint leftTop, BSize size) BRect::BRect(BPoint leftTop, BSize size)
: left(leftTop.x), :
top(leftTop.y), left(leftTop.x),
right(leftTop.x + size.width), top(leftTop.y),
bottom(leftTop.y + size.height) right(leftTop.x + size.width),
bottom(leftTop.y + size.height)
{
}
inline
BRect::BRect(float side)
:
left(0),
top(0),
right(side - 1),
bottom(side - 1)
{ {
} }
@@ -218,6 +237,7 @@ BRect::Height() const
return bottom - top; return bottom - top;
} }
inline BSize inline BSize
BRect::Size() const BRect::Size() const
{ {