Patch by Łukasz 'Sil2100' Zemczak: Made BStatusBar layout friendly.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21936 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2007-08-13 23:34:06 +00:00
parent ac04b57177
commit d23c482278
2 changed files with 52 additions and 0 deletions

View File

@ -14,6 +14,8 @@ class BStatusBar : public BView {
public:
BStatusBar(BRect frame, const char* name, const char* label = NULL,
const char* trailingLabel = NULL);
BStatusBar(const char* name, const char* label = NULL,
const char* trailingLabel = NULL);
BStatusBar(BMessage* archive);
virtual ~BStatusBar();
@ -69,6 +71,11 @@ class BStatusBar : public BView {
virtual status_t Perform(perform_code d, void* arg);
// Layout methods
virtual BSize MinSize();
virtual BSize MaxSize();
virtual BSize PreferredSize();
private:
virtual void _ReservedStatusBar2();
virtual void _ReservedStatusBar3();

View File

@ -13,6 +13,9 @@
#include <Region.h>
#include <StatusBar.h>
#include <Layout.h>
#include <LayoutUtils.h>
#include <stdlib.h>
#include <string.h>
@ -30,6 +33,17 @@ BStatusBar::BStatusBar(BRect frame, const char *name, const char *label,
}
BStatusBar::BStatusBar(const char *name, const char *label,
const char *trailingLabel)
: BView(BRect(0, 0, -1, -1), name, B_FOLLOW_LEFT | B_FOLLOW_TOP,
B_WILL_DRAW | B_SUPPORTS_LAYOUT),
fLabel(label),
fTrailingLabel(trailingLabel)
{
_InitObject();
}
BStatusBar::BStatusBar(BMessage *archive)
: BView(archive)
{
@ -580,6 +594,37 @@ BStatusBar::GetSupportedSuites(BMessage* data)
}
BSize
BStatusBar::MinSize()
{
float width, height;
GetPreferredSize(&width, &height);
return BLayoutUtils::ComposeSize(ExplicitMaxSize(), BSize(width, height));
}
BSize
BStatusBar::MaxSize()
{
float width, height;
GetPreferredSize(&width, &height);
return BLayoutUtils::ComposeSize(ExplicitMaxSize(),
BSize(B_SIZE_UNLIMITED, height));
}
BSize
BStatusBar::PreferredSize()
{
float width, height;
GetPreferredSize(&width, &height);
return BLayoutUtils::ComposeSize(ExplicitMaxSize(), BSize(width, height));
}
status_t
BStatusBar::Perform(perform_code d, void* arg)
{