Make Area insets more consistent with other HAIKU inset APIs.
This commit is contained in:
@@ -90,10 +90,17 @@ public:
|
|||||||
void SetShrinkPenalties(BSize shrink);
|
void SetShrinkPenalties(BSize shrink);
|
||||||
void SetGrowPenalties(BSize grow);
|
void SetGrowPenalties(BSize grow);
|
||||||
|
|
||||||
|
void GetInsets(float* left, float* top, float* right,
|
||||||
|
float* bottom) const;
|
||||||
float LeftInset() const;
|
float LeftInset() const;
|
||||||
float TopInset() const;
|
float TopInset() const;
|
||||||
float RightInset() const;
|
float RightInset() const;
|
||||||
float BottomInset() const;
|
float BottomInset() const;
|
||||||
|
|
||||||
|
void SetInsets(float insets);
|
||||||
|
void SetInsets(float horizontal, float vertical);
|
||||||
|
void SetInsets(float left, float top, float right,
|
||||||
|
float bottom);
|
||||||
void SetLeftInset(float left);
|
void SetLeftInset(float left);
|
||||||
void SetTopInset(float top);
|
void SetTopInset(float top);
|
||||||
void SetRightInset(float right);
|
void SetRightInset(float right);
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#include <Button.h>
|
#include <Button.h>
|
||||||
#include <CheckBox.h>
|
#include <CheckBox.h>
|
||||||
|
#include <ControlLook.h>
|
||||||
#include <PictureButton.h>
|
#include <PictureButton.h>
|
||||||
#include <RadioButton.h>
|
#include <RadioButton.h>
|
||||||
#include <StatusBar.h>
|
#include <StatusBar.h>
|
||||||
@@ -327,6 +328,20 @@ Area::SetContentAspectRatio(double ratio)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Area::GetInsets(float* left, float* top, float* right, float* bottom) const
|
||||||
|
{
|
||||||
|
if (left)
|
||||||
|
*left = fTopLeftInset.Width();
|
||||||
|
if (top)
|
||||||
|
*top = fTopLeftInset.Height();
|
||||||
|
if (right)
|
||||||
|
*right = fRightBottomInset.Width();
|
||||||
|
if (bottom)
|
||||||
|
*bottom = fRightBottomInset.Height();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets left inset between area and its content.
|
* Gets left inset between area and its content.
|
||||||
*/
|
*/
|
||||||
@@ -383,6 +398,50 @@ Area::BottomInset() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Area::SetInsets(float insets)
|
||||||
|
{
|
||||||
|
if (insets != B_SIZE_UNSET)
|
||||||
|
insets = BControlLook::ComposeSpacing(insets);
|
||||||
|
|
||||||
|
fTopLeftInset.Set(insets, insets);
|
||||||
|
fRightBottomInset.Set(insets, insets);
|
||||||
|
fLayoutItem->Layout()->InvalidateLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Area::SetInsets(float horizontal, float vertical)
|
||||||
|
{
|
||||||
|
if (horizontal != B_SIZE_UNSET)
|
||||||
|
horizontal = BControlLook::ComposeSpacing(horizontal);
|
||||||
|
if (vertical != B_SIZE_UNSET)
|
||||||
|
vertical = BControlLook::ComposeSpacing(vertical);
|
||||||
|
|
||||||
|
fTopLeftInset.Set(horizontal, horizontal);
|
||||||
|
fRightBottomInset.Set(vertical, vertical);
|
||||||
|
fLayoutItem->Layout()->InvalidateLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Area::SetInsets(float left, float top, float right, float bottom)
|
||||||
|
{
|
||||||
|
if (left != B_SIZE_UNSET)
|
||||||
|
left = BControlLook::ComposeSpacing(left);
|
||||||
|
if (right != B_SIZE_UNSET)
|
||||||
|
right = BControlLook::ComposeSpacing(right);
|
||||||
|
if (top != B_SIZE_UNSET)
|
||||||
|
top = BControlLook::ComposeSpacing(top);
|
||||||
|
if (bottom != B_SIZE_UNSET)
|
||||||
|
bottom = BControlLook::ComposeSpacing(bottom);
|
||||||
|
|
||||||
|
fTopLeftInset.Set(left, top);
|
||||||
|
fRightBottomInset.Set(right, bottom);
|
||||||
|
fLayoutItem->Layout()->InvalidateLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets left inset between area and its content.
|
* Sets left inset between area and its content.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user