Make SpaceLayoutItem compose spacing using BControlLook.
This allows for passing spacing/inset flags to BSpaceLayoutItem. Eg. in a builder, you could AddStrut(B_USE_ITEM_SPACING)
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#include <new>
|
#include <new>
|
||||||
|
|
||||||
|
#include <ControlLook.h>
|
||||||
#include <Message.h>
|
#include <Message.h>
|
||||||
|
|
||||||
|
|
||||||
@@ -18,6 +19,13 @@ namespace {
|
|||||||
const char* const kAlignmentField = "BSpaceLayoutItem:alignment";
|
const char* const kAlignmentField = "BSpaceLayoutItem:alignment";
|
||||||
const char* const kFrameField = "BSpaceLayoutItem:frame";
|
const char* const kFrameField = "BSpaceLayoutItem:frame";
|
||||||
const char* const kVisibleField = "BSpaceLayoutItem:visible";
|
const char* const kVisibleField = "BSpaceLayoutItem:visible";
|
||||||
|
|
||||||
|
BSize& ComposeSpacingInPlace(BSize& size)
|
||||||
|
{
|
||||||
|
size.width = BControlLook::ComposeSpacing(size.width);
|
||||||
|
size.height = BControlLook::ComposeSpacing(size.height);
|
||||||
|
return size;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -25,9 +33,9 @@ BSpaceLayoutItem::BSpaceLayoutItem(BSize minSize, BSize maxSize,
|
|||||||
BSize preferredSize, BAlignment alignment)
|
BSize preferredSize, BAlignment alignment)
|
||||||
:
|
:
|
||||||
fFrame(),
|
fFrame(),
|
||||||
fMinSize(minSize),
|
fMinSize(ComposeSpacingInPlace(minSize)),
|
||||||
fMaxSize(maxSize),
|
fMaxSize(ComposeSpacingInPlace(maxSize)),
|
||||||
fPreferredSize(preferredSize),
|
fPreferredSize(ComposeSpacingInPlace(preferredSize)),
|
||||||
fAlignment(alignment),
|
fAlignment(alignment),
|
||||||
fVisible(true)
|
fVisible(true)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user