* Add new SetInsets() methods to BTwoDimensionalLayout, BSplitView

* Also add equivalent methods to the layout builders in LayoutBuilder.h
* BSplitView now calls BControlLook::ComposeSpacing(), instead of BSplitLayout
* part of #7447


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42077 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Alex Wilson 2011-06-09 20:58:52 +00:00
parent cd511790d7
commit 813147df83
6 changed files with 115 additions and 4 deletions

View File

@ -102,6 +102,8 @@ public:
inline ThisBuilder& SetInsets(float left, float top, float right,
float bottom);
inline ThisBuilder& SetInsets(float horizontal, float vertical);
inline ThisBuilder& SetInsets(float insets);
inline operator BGroupLayout*();
@ -185,6 +187,8 @@ public:
inline ThisBuilder& SetInsets(float left, float top, float right,
float bottom);
inline ThisBuilder& SetInsets(float horizontal, float vertical);
inline ThisBuilder& SetInsets(float insets);
inline operator BGridLayout*();
@ -246,6 +250,8 @@ public:
inline ThisBuilder& SetInsets(float left, float top, float right,
float bottom);
inline ThisBuilder& SetInsets(float horizontal, float vertical);
inline ThisBuilder& SetInsets(float insets);
inline operator BSplitView*();
@ -562,6 +568,24 @@ Group<ParentBuilder>::SetInsets(float left, float top, float right,
}
template<typename ParentBuilder>
typename Group<ParentBuilder>::ThisBuilder&
Group<ParentBuilder>::SetInsets(float horizontal, float vertical)
{
fLayout->SetInsets(horizontal, vertical);
return *this;
}
template<typename ParentBuilder>
typename Group<ParentBuilder>::ThisBuilder&
Group<ParentBuilder>::SetInsets(float insets)
{
fLayout->SetInsets(insets);
return *this;
}
template<typename ParentBuilder>
Group<ParentBuilder>::operator BGroupLayout*()
{
@ -807,6 +831,24 @@ Grid<ParentBuilder>::SetInsets(float left, float top, float right,
}
template<typename ParentBuilder>
typename Grid<ParentBuilder>::ThisBuilder&
Grid<ParentBuilder>::SetInsets(float horizontal, float vertical)
{
fLayout->SetInsets(horizontal, vertical);
return *this;
}
template<typename ParentBuilder>
typename Grid<ParentBuilder>::ThisBuilder&
Grid<ParentBuilder>::SetInsets(float insets)
{
fLayout->SetInsets(insets);
return *this;
}
template<typename ParentBuilder>
Grid<ParentBuilder>::operator BGridLayout*()
{
@ -1012,6 +1054,24 @@ Split<ParentBuilder>::SetInsets(float left, float top, float right,
}
template<typename ParentBuilder>
typename Split<ParentBuilder>::ThisBuilder&
Split<ParentBuilder>::SetInsets(float horizontal, float vertical)
{
fView->SetInsets(horizontal, vertical);
return *this;
}
template<typename ParentBuilder>
typename Split<ParentBuilder>::ThisBuilder&
Split<ParentBuilder>::SetInsets(float insets)
{
fView->SetInsets(insets);
return *this;
}
template<typename ParentBuilder>
Split<ParentBuilder>::operator BSplitView*()
{

View File

@ -21,6 +21,8 @@ public:
void SetInsets(float left, float top, float right,
float bottom);
void SetInsets(float horizontal, float vertical);
void SetInsets(float insets);
void GetInsets(float* left, float* top,
float* right, float* bottom) const;

View File

@ -19,6 +19,8 @@ public:
void SetInsets(float left, float top, float right,
float bottom);
void SetInsets(float horizontal, float vertical);
void SetInsets(float insets);
void GetInsets(float* left, float* top, float* right,
float* bottom) const;

View File

@ -268,10 +268,10 @@ BSplitLayout::~BSplitLayout()
void
BSplitLayout::SetInsets(float left, float top, float right, float bottom)
{
fLeftInset = BControlLook::ComposeSpacing(left);
fTopInset = BControlLook::ComposeSpacing(top);
fRightInset = BControlLook::ComposeSpacing(right);
fBottomInset = BControlLook::ComposeSpacing(bottom);
fLeftInset = left;
fTopInset = top;
fRightInset = right;
fBottomInset = bottom;
InvalidateLayout();
}

View File

@ -41,10 +41,32 @@ BSplitView::~BSplitView()
void
BSplitView::SetInsets(float left, float top, float right, float bottom)
{
left = BControlLook::ComposeSpacing(left);
top = BControlLook::ComposeSpacing(top);
right = BControlLook::ComposeSpacing(right);
bottom = BControlLook::ComposeSpacing(bottom);
fSplitLayout->SetInsets(left, top, right, bottom);
}
void
BSplitView::SetInsets(float horizontal, float vertical)
{
horizontal = BControlLook::ComposeSpacing(horizontal);
vertical = BControlLook::ComposeSpacing(vertical);
fSplitLayout->SetInsets(horizontal, vertical, horizontal, vertical);
}
void
BSplitView::SetInsets(float insets)
{
insets = BControlLook::ComposeSpacing(insets);
fSplitLayout->SetInsets(insets, insets, insets, insets);
}
void
BSplitView::GetInsets(float* left, float* top, float* right,
float* bottom) const

View File

@ -294,6 +294,31 @@ BTwoDimensionalLayout::SetInsets(float left, float top, float right,
}
void
BTwoDimensionalLayout::SetInsets(float horizontal, float vertical)
{
fLeftInset = BControlLook::ComposeSpacing(horizontal);
fRightInset = fLeftInset;
fTopInset = BControlLook::ComposeSpacing(vertical);
fBottomInset = fTopInset;
InvalidateLayout();
}
void
BTwoDimensionalLayout::SetInsets(float insets)
{
fLeftInset = BControlLook::ComposeSpacing(insets);
fRightInset = fLeftInset;
fTopInset = fLeftInset;
fBottomInset = fLeftInset;
InvalidateLayout();
}
void
BTwoDimensionalLayout::GetInsets(float* left, float* top, float* right,
float* bottom) const