Removed the BSize(const BRect&) constructor and added BRect::Size()
instead. Also added a BRect(BPoint, BSize) constructor. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21120 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#include <SupportDefs.h>
|
#include <SupportDefs.h>
|
||||||
#include <Point.h>
|
#include <Point.h>
|
||||||
|
#include <Size.h>
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
@@ -26,6 +27,7 @@ class BRect {
|
|||||||
BRect(const BRect &r);
|
BRect(const BRect &r);
|
||||||
BRect(float l, float t, float r, float b);
|
BRect(float l, float t, float r, float b);
|
||||||
BRect(BPoint lt, BPoint rb);
|
BRect(BPoint lt, BPoint rb);
|
||||||
|
BRect(BPoint leftTop, BSize size);
|
||||||
|
|
||||||
BRect &operator=(const BRect &r);
|
BRect &operator=(const BRect &r);
|
||||||
void Set(float l, float t, float r, float b);
|
void Set(float l, float t, float r, float b);
|
||||||
@@ -72,12 +74,14 @@ class BRect {
|
|||||||
BRect operator&(BRect r) const;
|
BRect operator&(BRect r) const;
|
||||||
BRect operator|(BRect r) const;
|
BRect operator|(BRect r) const;
|
||||||
|
|
||||||
bool Intersects(BRect r) const;
|
|
||||||
bool IsValid() const;
|
bool IsValid() const;
|
||||||
float Width() const;
|
float Width() const;
|
||||||
int32 IntegerWidth() const;
|
int32 IntegerWidth() const;
|
||||||
float Height() const;
|
float Height() const;
|
||||||
int32 IntegerHeight() const;
|
int32 IntegerHeight() const;
|
||||||
|
BSize Size() const;
|
||||||
|
|
||||||
|
bool Intersects(BRect r) const;
|
||||||
bool Contains(BPoint p) const;
|
bool Contains(BPoint p) const;
|
||||||
bool Contains(BRect r) const;
|
bool Contains(BRect r) const;
|
||||||
};
|
};
|
||||||
@@ -151,6 +155,16 @@ BRect::BRect(BPoint leftTop, BPoint rightBottom)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
BRect::BRect(BPoint leftTop, BSize size)
|
||||||
|
: left(leftTop.x),
|
||||||
|
top(leftTop.y),
|
||||||
|
right(leftTop.x + size.width),
|
||||||
|
bottom(leftTop.y + size.height)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline BRect &
|
inline BRect &
|
||||||
BRect::operator=(const BRect& from)
|
BRect::operator=(const BRect& from)
|
||||||
{
|
{
|
||||||
@@ -206,4 +220,11 @@ BRect::Height() const
|
|||||||
return bottom - top;
|
return bottom - top;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline BSize
|
||||||
|
BRect::Size() const
|
||||||
|
{
|
||||||
|
return BSize(right - left, bottom - top);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif // _RECT_H
|
#endif // _RECT_H
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
#include <Rect.h>
|
|
||||||
#include <SupportDefs.h>
|
#include <SupportDefs.h>
|
||||||
|
|
||||||
|
|
||||||
@@ -25,7 +24,6 @@ public:
|
|||||||
inline BSize();
|
inline BSize();
|
||||||
inline BSize(const BSize& other);
|
inline BSize(const BSize& other);
|
||||||
inline BSize(float width, float height);
|
inline BSize(float width, float height);
|
||||||
inline BSize(const BRect& rect);
|
|
||||||
|
|
||||||
inline float Width() const;
|
inline float Width() const;
|
||||||
inline float Height() const;
|
inline float Height() const;
|
||||||
@@ -73,15 +71,6 @@ BSize::BSize(float width, float height)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// constructor
|
|
||||||
inline
|
|
||||||
BSize::BSize(const BRect& rect)
|
|
||||||
: width(rect.Width()),
|
|
||||||
height(rect.Height())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Width
|
// Width
|
||||||
inline float
|
inline float
|
||||||
BSize::Width() const
|
BSize::Width() const
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ BCardLayout::LayoutView()
|
|||||||
{
|
{
|
||||||
_ValidateMinMax();
|
_ValidateMinMax();
|
||||||
|
|
||||||
BSize size = BSize(View()->Bounds());
|
BSize size = View()->Bounds().Size();
|
||||||
size.width = max_c(size.width, fMin.width);
|
size.width = max_c(size.width, fMin.width);
|
||||||
size.height = max_c(size.height, fMin.height);
|
size.height = max_c(size.height, fMin.height);
|
||||||
|
|
||||||
|
|||||||
@@ -470,7 +470,7 @@ BSplitLayout::LayoutView()
|
|||||||
_ValidateMinMax();
|
_ValidateMinMax();
|
||||||
|
|
||||||
// layout the elements
|
// layout the elements
|
||||||
BSize size = _SubtractInsets(BSize(View()->Bounds()));
|
BSize size = _SubtractInsets(View()->Bounds().Size());
|
||||||
fHorizontalLayouter->Layout(fHorizontalLayoutInfo, size.width);
|
fHorizontalLayouter->Layout(fHorizontalLayoutInfo, size.width);
|
||||||
|
|
||||||
Layouter* verticalLayouter;
|
Layouter* verticalLayouter;
|
||||||
@@ -562,7 +562,7 @@ BSplitLayout::StartDraggingSplitter(BPoint point)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Things shouldn't be draggable, if we have a >= max layout.
|
// Things shouldn't be draggable, if we have a >= max layout.
|
||||||
BSize size = _SubtractInsets(BSize(View()->Frame()));
|
BSize size = _SubtractInsets(View()->Frame().Size());
|
||||||
if (fOrientation == B_HORIZONTAL && size.width >= fMax.width
|
if (fOrientation == B_HORIZONTAL && size.width >= fMax.width
|
||||||
|| fOrientation == B_VERTICAL && size.height >= fMax.height) {
|
|| fOrientation == B_VERTICAL && size.height >= fMax.height) {
|
||||||
return false;
|
return false;
|
||||||
@@ -757,7 +757,7 @@ BSplitLayout::_LayoutItem(BLayoutItem* item, BRect frame, bool visible)
|
|||||||
info->max = item->MaxSize();
|
info->max = item->MaxSize();
|
||||||
|
|
||||||
if (item->HasHeightForWidth()) {
|
if (item->HasHeightForWidth()) {
|
||||||
BSize size = _SubtractInsets(BSize(View()->Frame()));
|
BSize size = _SubtractInsets(View()->Frame().Size());
|
||||||
float minHeight, maxHeight;
|
float minHeight, maxHeight;
|
||||||
item->GetHeightForWidth(size.width, &minHeight, &maxHeight, NULL);
|
item->GetHeightForWidth(size.width, &minHeight, &maxHeight, NULL);
|
||||||
info->min.height = max_c(info->min.height, minHeight);
|
info->min.height = max_c(info->min.height, minHeight);
|
||||||
|
|||||||
@@ -5,7 +5,10 @@
|
|||||||
#ifndef _SPLIT_LAYOUT_H
|
#ifndef _SPLIT_LAYOUT_H
|
||||||
#define _SPLIT_LAYOUT_H
|
#define _SPLIT_LAYOUT_H
|
||||||
|
|
||||||
|
|
||||||
#include <Layout.h>
|
#include <Layout.h>
|
||||||
|
#include <Point.h>
|
||||||
|
|
||||||
|
|
||||||
namespace BPrivate {
|
namespace BPrivate {
|
||||||
namespace Layout {
|
namespace Layout {
|
||||||
|
|||||||
@@ -341,7 +341,7 @@ BTwoDimensionalLayout::LayoutView()
|
|||||||
_ValidateMinMax();
|
_ValidateMinMax();
|
||||||
|
|
||||||
// layout the horizontal/vertical elements
|
// layout the horizontal/vertical elements
|
||||||
BSize size = SubtractInsets(BSize(View()->Frame()));
|
BSize size = SubtractInsets(View()->Frame().Size());
|
||||||
printf("BTwoDimensionalLayout::LayoutView(%p): size: (%.1f, %.1f)\n",
|
printf("BTwoDimensionalLayout::LayoutView(%p): size: (%.1f, %.1f)\n",
|
||||||
View(), size.width, size.height);
|
View(), size.width, size.height);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user