Merge from layout management branch.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18649 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -12,7 +12,9 @@
|
||||
|
||||
|
||||
#include <Button.h>
|
||||
|
||||
#include <Font.h>
|
||||
#include <LayoutUtils.h>
|
||||
#include <String.h>
|
||||
#include <Window.h>
|
||||
|
||||
@@ -31,6 +33,35 @@ BButton::BButton(BRect frame, const char *name, const char *label, BMessage *mes
|
||||
}
|
||||
|
||||
|
||||
BButton::BButton(const char* name, const char* label, BMessage *message,
|
||||
uint32 flags)
|
||||
: BControl(BRect(0, 0, -1, -1), name, label, message, B_FOLLOW_NONE,
|
||||
flags | B_WILL_DRAW | B_SUPPORTS_LAYOUT),
|
||||
fDrawAsDefault(false)
|
||||
{
|
||||
// Resize to minimum height if needed
|
||||
font_height fh;
|
||||
GetFontHeight(&fh);
|
||||
float minHeight = 12.0f + (float)ceil(fh.ascent + fh.descent);
|
||||
if (Bounds().Height() < minHeight)
|
||||
ResizeTo(Bounds().Width(), minHeight);
|
||||
}
|
||||
|
||||
|
||||
BButton::BButton(const char* label, BMessage *message)
|
||||
: BControl(BRect(0, 0, -1, -1), NULL, label, message, B_FOLLOW_NONE,
|
||||
B_WILL_DRAW | B_NAVIGABLE | B_SUPPORTS_LAYOUT),
|
||||
fDrawAsDefault(false)
|
||||
{
|
||||
// Resize to minimum height if needed
|
||||
font_height fh;
|
||||
GetFontHeight(&fh);
|
||||
float minHeight = 12.0f + (float)ceil(fh.ascent + fh.descent);
|
||||
if (Bounds().Height() < minHeight)
|
||||
ResizeTo(Bounds().Width(), minHeight);
|
||||
}
|
||||
|
||||
|
||||
BButton::~BButton()
|
||||
{
|
||||
}
|
||||
@@ -690,6 +721,16 @@ BButton::Perform(perform_code d, void *arg)
|
||||
}
|
||||
|
||||
|
||||
BSize
|
||||
BButton::MaxSize()
|
||||
{
|
||||
float width, height;
|
||||
GetPreferredSize(&width, &height);
|
||||
|
||||
return BLayoutUtils::ComposeSize(ExplicitMaxSize(), BSize(width, height));
|
||||
}
|
||||
|
||||
|
||||
void BButton::_ReservedButton1() {}
|
||||
void BButton::_ReservedButton2() {}
|
||||
void BButton::_ReservedButton3() {}
|
||||
|
||||
Reference in New Issue
Block a user