* 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
+60
View File
@@ -102,6 +102,8 @@ public:
inline ThisBuilder& SetInsets(float left, float top, float right, inline ThisBuilder& SetInsets(float left, float top, float right,
float bottom); float bottom);
inline ThisBuilder& SetInsets(float horizontal, float vertical);
inline ThisBuilder& SetInsets(float insets);
inline operator BGroupLayout*(); inline operator BGroupLayout*();
@@ -185,6 +187,8 @@ public:
inline ThisBuilder& SetInsets(float left, float top, float right, inline ThisBuilder& SetInsets(float left, float top, float right,
float bottom); float bottom);
inline ThisBuilder& SetInsets(float horizontal, float vertical);
inline ThisBuilder& SetInsets(float insets);
inline operator BGridLayout*(); inline operator BGridLayout*();
@@ -246,6 +250,8 @@ public:
inline ThisBuilder& SetInsets(float left, float top, float right, inline ThisBuilder& SetInsets(float left, float top, float right,
float bottom); float bottom);
inline ThisBuilder& SetInsets(float horizontal, float vertical);
inline ThisBuilder& SetInsets(float insets);
inline operator BSplitView*(); 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> template<typename ParentBuilder>
Group<ParentBuilder>::operator BGroupLayout*() 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> template<typename ParentBuilder>
Grid<ParentBuilder>::operator BGridLayout*() 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> template<typename ParentBuilder>
Split<ParentBuilder>::operator BSplitView*() Split<ParentBuilder>::operator BSplitView*()
{ {
+2
View File
@@ -21,6 +21,8 @@ public:
void SetInsets(float left, float top, float right, void SetInsets(float left, float top, float right,
float bottom); float bottom);
void SetInsets(float horizontal, float vertical);
void SetInsets(float insets);
void GetInsets(float* left, float* top, void GetInsets(float* left, float* top,
float* right, float* bottom) const; float* right, float* bottom) const;
@@ -19,6 +19,8 @@ public:
void SetInsets(float left, float top, float right, void SetInsets(float left, float top, float right,
float bottom); float bottom);
void SetInsets(float horizontal, float vertical);
void SetInsets(float insets);
void GetInsets(float* left, float* top, float* right, void GetInsets(float* left, float* top, float* right,
float* bottom) const; float* bottom) const;
+4 -4
View File
@@ -268,10 +268,10 @@ BSplitLayout::~BSplitLayout()
void void
BSplitLayout::SetInsets(float left, float top, float right, float bottom) BSplitLayout::SetInsets(float left, float top, float right, float bottom)
{ {
fLeftInset = BControlLook::ComposeSpacing(left); fLeftInset = left;
fTopInset = BControlLook::ComposeSpacing(top); fTopInset = top;
fRightInset = BControlLook::ComposeSpacing(right); fRightInset = right;
fBottomInset = BControlLook::ComposeSpacing(bottom); fBottomInset = bottom;
InvalidateLayout(); InvalidateLayout();
} }
+22
View File
@@ -41,10 +41,32 @@ BSplitView::~BSplitView()
void void
BSplitView::SetInsets(float left, float top, float right, float bottom) 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); 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 void
BSplitView::GetInsets(float* left, float* top, float* right, BSplitView::GetInsets(float* left, float* top, float* right,
float* bottom) const float* bottom) const
@@ -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 void
BTwoDimensionalLayout::GetInsets(float* left, float* top, float* right, BTwoDimensionalLayout::GetInsets(float* left, float* top, float* right,
float* bottom) const float* bottom) const