From a788be674b7ce52753dea0af308d98eab95b275d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Sat, 29 Sep 2007 12:58:59 +0000 Subject: [PATCH] * 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 --- src/kits/interface/StatusBar.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/kits/interface/StatusBar.cpp b/src/kits/interface/StatusBar.cpp index 8368771bdb..e17f27c257 100644 --- a/src/kits/interface/StatusBar.cpp +++ b/src/kits/interface/StatusBar.cpp @@ -91,6 +91,8 @@ BStatusBar::_InitObject() fBarColor = kDefaultBarColor; fCustomBarHeight = false; + + SetFlags(Flags() | B_FRAME_EVENTS); } @@ -356,12 +358,8 @@ BStatusBar::Update(float delta, const char* text, const char* trailingText) void BStatusBar::SetTo(float value, const char* text, const char* trailingText) { - if (text != NULL) - _SetTextData(fText, fTextWidth, text, fLabelWidth, false); - if (trailingText != NULL) { - _SetTextData(fTrailingText, fTrailingTextWidth, trailingText, - fTrailingLabelWidth, true); - } + SetText(text); + SetTrailingText(trailingText); if (value > fMax) value = fMax; @@ -527,6 +525,7 @@ void BStatusBar::FrameResized(float newWidth, float newHeight) { BView::FrameResized(newWidth, newHeight); + Invalidate(); } @@ -656,6 +655,9 @@ void BStatusBar::_SetTextData(BString& text, float& width, const char* source, float position, bool rightAligned) { + if (source == NULL) + source = ""; + // If there were no changes, we don't have to do anything if (text == source) return;