* some simplifications in the code, I'm not sure if it supported NULL texts as
the BeBook mentions it does * make sure the view is invalidated on resize * needs more fixes (for example GetPreferredSize() does not take everything into account) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22370 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -91,6 +91,8 @@ BStatusBar::_InitObject()
|
|||||||
|
|
||||||
fBarColor = kDefaultBarColor;
|
fBarColor = kDefaultBarColor;
|
||||||
fCustomBarHeight = false;
|
fCustomBarHeight = false;
|
||||||
|
|
||||||
|
SetFlags(Flags() | B_FRAME_EVENTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -356,12 +358,8 @@ BStatusBar::Update(float delta, const char* text, const char* trailingText)
|
|||||||
void
|
void
|
||||||
BStatusBar::SetTo(float value, const char* text, const char* trailingText)
|
BStatusBar::SetTo(float value, const char* text, const char* trailingText)
|
||||||
{
|
{
|
||||||
if (text != NULL)
|
SetText(text);
|
||||||
_SetTextData(fText, fTextWidth, text, fLabelWidth, false);
|
SetTrailingText(trailingText);
|
||||||
if (trailingText != NULL) {
|
|
||||||
_SetTextData(fTrailingText, fTrailingTextWidth, trailingText,
|
|
||||||
fTrailingLabelWidth, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (value > fMax)
|
if (value > fMax)
|
||||||
value = fMax;
|
value = fMax;
|
||||||
@@ -527,6 +525,7 @@ void
|
|||||||
BStatusBar::FrameResized(float newWidth, float newHeight)
|
BStatusBar::FrameResized(float newWidth, float newHeight)
|
||||||
{
|
{
|
||||||
BView::FrameResized(newWidth, newHeight);
|
BView::FrameResized(newWidth, newHeight);
|
||||||
|
Invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -656,6 +655,9 @@ void
|
|||||||
BStatusBar::_SetTextData(BString& text, float& width, const char* source,
|
BStatusBar::_SetTextData(BString& text, float& width, const char* source,
|
||||||
float position, bool rightAligned)
|
float position, bool rightAligned)
|
||||||
{
|
{
|
||||||
|
if (source == NULL)
|
||||||
|
source = "";
|
||||||
|
|
||||||
// If there were no changes, we don't have to do anything
|
// If there were no changes, we don't have to do anything
|
||||||
if (text == source)
|
if (text == source)
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user