* Made BTwoDimensionalLayout and BSplitLayout::GetInsets() const.
* Give access to BSplitLayout::SetInsets() and GetInsets() from BSplitView. * Give access to BSplitView::SetInsets() from BSplitLayoutBuilder and LayoutBuilder. * Some automatic white-space cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31197 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -175,6 +175,9 @@ public:
|
|||||||
inline ThisBuilder& SetCollapsible(int32 first, int32 last,
|
inline ThisBuilder& SetCollapsible(int32 first, int32 last,
|
||||||
bool collapsible);
|
bool collapsible);
|
||||||
|
|
||||||
|
inline ThisBuilder& SetInsets(float left, float top, float right,
|
||||||
|
float bottom);
|
||||||
|
|
||||||
inline operator BSplitView*();
|
inline operator BSplitView*();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -702,6 +705,16 @@ Split<ParentBuilder>::SetCollapsible(int32 first, int32 last, bool collapsible)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<typename ParentBuilder>
|
||||||
|
typename Split<ParentBuilder>::ThisBuilder&
|
||||||
|
Split<ParentBuilder>::SetInsets(float left, float top, float right,
|
||||||
|
float bottom)
|
||||||
|
{
|
||||||
|
fView->SetInsets(left, top, right, bottom);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<typename ParentBuilder>
|
template<typename ParentBuilder>
|
||||||
Split<ParentBuilder>::operator BSplitView*()
|
Split<ParentBuilder>::operator BSplitView*()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,6 +24,9 @@ public:
|
|||||||
|
|
||||||
BSplitLayoutBuilder& SetCollapsible(bool collapsible);
|
BSplitLayoutBuilder& SetCollapsible(bool collapsible);
|
||||||
|
|
||||||
|
BSplitLayoutBuilder& SetInsets(float left, float top, float right,
|
||||||
|
float bottom);
|
||||||
|
|
||||||
operator BSplitView*();
|
operator BSplitView*();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -17,6 +17,11 @@ public:
|
|||||||
float spacing = 0.0f);
|
float spacing = 0.0f);
|
||||||
virtual ~BSplitView();
|
virtual ~BSplitView();
|
||||||
|
|
||||||
|
void SetInsets(float left, float top, float right,
|
||||||
|
float bottom);
|
||||||
|
void GetInsets(float* left, float* top, float* right,
|
||||||
|
float* bottom) const;
|
||||||
|
|
||||||
float Spacing() const;
|
float Spacing() const;
|
||||||
void SetSpacing(float spacing);
|
void SetSpacing(float spacing);
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public:
|
|||||||
void SetInsets(float left, float top, float right,
|
void SetInsets(float left, float top, float right,
|
||||||
float bottom);
|
float bottom);
|
||||||
void GetInsets(float* left, float* top, float* right,
|
void GetInsets(float* left, float* top, float* right,
|
||||||
float* bottom);
|
float* bottom) const;
|
||||||
|
|
||||||
void AlignLayoutWith(BTwoDimensionalLayout* other,
|
void AlignLayoutWith(BTwoDimensionalLayout* other,
|
||||||
enum orientation orientation);
|
enum orientation orientation);
|
||||||
@@ -58,7 +58,7 @@ protected:
|
|||||||
virtual void PrepareItems(enum orientation orientation);
|
virtual void PrepareItems(enum orientation orientation);
|
||||||
virtual bool HasMultiColumnItems();
|
virtual bool HasMultiColumnItems();
|
||||||
virtual bool HasMultiRowItems();
|
virtual bool HasMultiRowItems();
|
||||||
|
|
||||||
virtual int32 InternalCountColumns() = 0;
|
virtual int32 InternalCountColumns() = 0;
|
||||||
virtual int32 InternalCountRows() = 0;
|
virtual int32 InternalCountRows() = 0;
|
||||||
virtual void GetColumnRowConstraints(
|
virtual void GetColumnRowConstraints(
|
||||||
|
|||||||
@@ -192,7 +192,8 @@ BSplitLayout::SetInsets(float left, float top, float right, float bottom)
|
|||||||
|
|
||||||
// GetInsets
|
// GetInsets
|
||||||
void
|
void
|
||||||
BSplitLayout::GetInsets(float* left, float* top, float* right, float* bottom)
|
BSplitLayout::GetInsets(float* left, float* top, float* right,
|
||||||
|
float* bottom) const
|
||||||
{
|
{
|
||||||
if (left)
|
if (left)
|
||||||
*left = fLeftInset;
|
*left = fLeftInset;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public:
|
|||||||
void SetInsets(float left, float top, float right,
|
void SetInsets(float left, float top, float right,
|
||||||
float bottom);
|
float bottom);
|
||||||
void GetInsets(float* left, float* top, float* right,
|
void GetInsets(float* left, float* top, float* right,
|
||||||
float* bottom);
|
float* bottom) const;
|
||||||
|
|
||||||
float Spacing() const;
|
float Spacing() const;
|
||||||
void SetSpacing(float spacing);
|
void SetSpacing(float spacing);
|
||||||
|
|||||||
@@ -81,6 +81,15 @@ BSplitLayoutBuilder::SetCollapsible(bool collapsible)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetInsets
|
||||||
|
BSplitLayoutBuilder&
|
||||||
|
BSplitLayoutBuilder::SetInsets(float left, float top, float right, float bottom)
|
||||||
|
{
|
||||||
|
fView->SetInsets(left, top, right, bottom);
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
// cast operator BSplitView*
|
// cast operator BSplitView*
|
||||||
BSplitLayoutBuilder::operator BSplitView*()
|
BSplitLayoutBuilder::operator BSplitView*()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -55,6 +55,21 @@ BSplitView::~BSplitView()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetInsets
|
||||||
|
void
|
||||||
|
BSplitView::SetInsets(float left, float top, float right, float bottom)
|
||||||
|
{
|
||||||
|
fSplitLayout->SetInsets(left, top, right, bottom);
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetInsets
|
||||||
|
void
|
||||||
|
BSplitView::GetInsets(float* left, float* top, float* right,
|
||||||
|
float* bottom) const
|
||||||
|
{
|
||||||
|
fSplitLayout->GetInsets(left, top, right, bottom);
|
||||||
|
}
|
||||||
|
|
||||||
// Spacing
|
// Spacing
|
||||||
float
|
float
|
||||||
BSplitView::Spacing() const
|
BSplitView::Spacing() const
|
||||||
|
|||||||
@@ -59,13 +59,13 @@ public:
|
|||||||
virtual Layouter* GetLayouter(bool minMax);
|
virtual Layouter* GetLayouter(bool minMax);
|
||||||
|
|
||||||
LayoutInfo* GetLayoutInfo();
|
LayoutInfo* GetLayoutInfo();
|
||||||
|
|
||||||
void AddLocalLayouter(LocalLayouter* localLayouter);
|
void AddLocalLayouter(LocalLayouter* localLayouter);
|
||||||
void RemoveLocalLayouter(
|
void RemoveLocalLayouter(
|
||||||
LocalLayouter* localLayouter);
|
LocalLayouter* localLayouter);
|
||||||
|
|
||||||
void AbsorbCompoundLayouter(CompoundLayouter* other);
|
void AbsorbCompoundLayouter(CompoundLayouter* other);
|
||||||
|
|
||||||
virtual void InvalidateLayout();
|
virtual void InvalidateLayout();
|
||||||
bool IsMinMaxValid();
|
bool IsMinMaxValid();
|
||||||
void ValidateMinMax();
|
void ValidateMinMax();
|
||||||
@@ -105,7 +105,7 @@ public:
|
|||||||
virtual void InvalidateLayout();
|
virtual void InvalidateLayout();
|
||||||
|
|
||||||
void InvalidateHeightForWidth();
|
void InvalidateHeightForWidth();
|
||||||
|
|
||||||
void InternalGetHeightForWidth(
|
void InternalGetHeightForWidth(
|
||||||
LocalLayouter* localLayouter,
|
LocalLayouter* localLayouter,
|
||||||
BLayoutContext* context,
|
BLayoutContext* context,
|
||||||
@@ -148,7 +148,7 @@ public:
|
|||||||
void Layout(BSize size);
|
void Layout(BSize size);
|
||||||
|
|
||||||
BRect ItemFrame(Dimensions itemDimensions);
|
BRect ItemFrame(Dimensions itemDimensions);
|
||||||
|
|
||||||
void ValidateMinMax();
|
void ValidateMinMax();
|
||||||
|
|
||||||
void DoHorizontalLayout(float width);
|
void DoHorizontalLayout(float width);
|
||||||
@@ -159,7 +159,7 @@ public:
|
|||||||
|
|
||||||
void AlignWith(LocalLayouter* other,
|
void AlignWith(LocalLayouter* other,
|
||||||
enum orientation orientation);
|
enum orientation orientation);
|
||||||
|
|
||||||
|
|
||||||
// interface for the compound layout context
|
// interface for the compound layout context
|
||||||
|
|
||||||
@@ -183,14 +183,14 @@ public:
|
|||||||
Layouter* layouter,
|
Layouter* layouter,
|
||||||
BLayoutContext* context);
|
BLayoutContext* context);
|
||||||
void SetHeightForWidthConstraintsAdded(bool added);
|
void SetHeightForWidthConstraintsAdded(bool added);
|
||||||
|
|
||||||
void SetCompoundLayouter(
|
void SetCompoundLayouter(
|
||||||
CompoundLayouter* compoundLayouter,
|
CompoundLayouter* compoundLayouter,
|
||||||
enum orientation orientation);
|
enum orientation orientation);
|
||||||
|
|
||||||
void InternalInvalidateLayout(
|
void InternalInvalidateLayout(
|
||||||
CompoundLayouter* compoundLayouter);
|
CompoundLayouter* compoundLayouter);
|
||||||
|
|
||||||
// implementation private
|
// implementation private
|
||||||
private:
|
private:
|
||||||
BTwoDimensionalLayout* fLayout;
|
BTwoDimensionalLayout* fLayout;
|
||||||
@@ -202,7 +202,7 @@ private:
|
|||||||
BLayoutContext* fHorizontalLayoutContext;
|
BLayoutContext* fHorizontalLayoutContext;
|
||||||
float fHorizontalLayoutWidth;
|
float fHorizontalLayoutWidth;
|
||||||
bool fHeightForWidthConstraintsAdded;
|
bool fHeightForWidthConstraintsAdded;
|
||||||
|
|
||||||
void _SetHorizontalLayoutContext(
|
void _SetHorizontalLayoutContext(
|
||||||
BLayoutContext* context, float width);
|
BLayoutContext* context, float width);
|
||||||
|
|
||||||
@@ -248,7 +248,7 @@ BTwoDimensionalLayout::SetInsets(float left, float top, float right,
|
|||||||
// GetInsets
|
// GetInsets
|
||||||
void
|
void
|
||||||
BTwoDimensionalLayout::GetInsets(float* left, float* top, float* right,
|
BTwoDimensionalLayout::GetInsets(float* left, float* top, float* right,
|
||||||
float* bottom)
|
float* bottom) const
|
||||||
{
|
{
|
||||||
if (left)
|
if (left)
|
||||||
*left = fLeftInset;
|
*left = fLeftInset;
|
||||||
@@ -379,7 +379,7 @@ frame.PrintToStream();
|
|||||||
// preferredHeight);
|
// preferredHeight);
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
item->AlignInFrame(frame);
|
item->AlignInFrame(frame);
|
||||||
}
|
}
|
||||||
//else
|
//else
|
||||||
@@ -499,7 +499,7 @@ BTwoDimensionalLayout::CompoundLayouter::GetLayoutInfo()
|
|||||||
return fLayoutInfo;
|
return fLayoutInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddLocalLayouter
|
// AddLocalLayouter
|
||||||
void
|
void
|
||||||
BTwoDimensionalLayout::CompoundLayouter::AddLocalLayouter(
|
BTwoDimensionalLayout::CompoundLayouter::AddLocalLayouter(
|
||||||
LocalLayouter* localLayouter)
|
LocalLayouter* localLayouter)
|
||||||
@@ -536,7 +536,7 @@ BTwoDimensionalLayout::CompoundLayouter::AbsorbCompoundLayouter(
|
|||||||
AddLocalLayouter(layouter);
|
AddLocalLayouter(layouter);
|
||||||
layouter->SetCompoundLayouter(this, fOrientation);
|
layouter->SetCompoundLayouter(this, fOrientation);
|
||||||
}
|
}
|
||||||
|
|
||||||
InvalidateLayout();
|
InvalidateLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -605,7 +605,7 @@ BTwoDimensionalLayout::CompoundLayouter::Layout(float size,
|
|||||||
LocalLayouter* localLayouter, BLayoutContext* context)
|
LocalLayouter* localLayouter, BLayoutContext* context)
|
||||||
{
|
{
|
||||||
ValidateMinMax();
|
ValidateMinMax();
|
||||||
|
|
||||||
if (context != fLayoutContext || fLastLayoutSize != size) {
|
if (context != fLayoutContext || fLastLayoutSize != size) {
|
||||||
DoLayout(size, localLayouter, context);
|
DoLayout(size, localLayouter, context);
|
||||||
fLayoutContext = context;
|
fLayoutContext = context;
|
||||||
@@ -852,7 +852,7 @@ BTwoDimensionalLayout::VerticalCompoundLayouter
|
|||||||
fHeightForWidthLayoutContext->AddListener(this);
|
fHeightForWidthLayoutContext->AddListener(this);
|
||||||
|
|
||||||
InvalidateHeightForWidth();
|
InvalidateHeightForWidth();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -868,7 +868,7 @@ BTwoDimensionalLayout::VerticalCompoundLayouter::LayoutContextLeft(
|
|||||||
// #pragma mark - LocalLayouter
|
// #pragma mark - LocalLayouter
|
||||||
|
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
BTwoDimensionalLayout::LocalLayouter::LocalLayouter(
|
BTwoDimensionalLayout::LocalLayouter::LocalLayouter(
|
||||||
BTwoDimensionalLayout* layout)
|
BTwoDimensionalLayout* layout)
|
||||||
: fLayout(layout),
|
: fLayout(layout),
|
||||||
@@ -1100,7 +1100,7 @@ BTwoDimensionalLayout::LocalLayouter::AddHeightForWidthConstraints(
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
LayoutInfo* hLayoutInfo = fHLayouter->GetLayoutInfo();
|
LayoutInfo* hLayoutInfo = fHLayouter->GetLayoutInfo();
|
||||||
|
|
||||||
// add the children's height for width constraints
|
// add the children's height for width constraints
|
||||||
int32 itemCount = fHeightForWidthItems.CountItems();
|
int32 itemCount = fHeightForWidthItems.CountItems();
|
||||||
for (int32 i = 0; i < itemCount; i++) {
|
for (int32 i = 0; i < itemCount; i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user