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
+35 -15
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,
@@ -117,45 +118,52 @@ 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), :
left(leftTop.x),
top(leftTop.y), top(leftTop.y),
right(leftTop.x + size.width), right(leftTop.x + size.width),
bottom(leftTop.y + size.height) bottom(leftTop.y + size.height)
@@ -163,6 +171,17 @@ BRect::BRect(BPoint leftTop, BSize size)
} }
inline
BRect::BRect(float side)
:
left(0),
top(0),
right(side - 1),
bottom(side - 1)
{
}
inline BRect& inline BRect&
BRect::operator=(const BRect& from) BRect::operator=(const BRect& from)
{ {
@@ -218,6 +237,7 @@ BRect::Height() const
return bottom - top; return bottom - top;
} }
inline BSize inline BSize
BRect::Size() const BRect::Size() const
{ {