Label and text support, minor drawing changes

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1558 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Marc Flerackers
2002-10-17 07:22:41 +00:00
parent c4d97e021e
commit 0dc199a5c3
+32 -6
View File
@@ -240,18 +240,44 @@ void BStatusBar::MessageReceived(BMessage *message)
void BStatusBar::Draw(BRect updateRect) void BStatusBar::Draw(BRect updateRect)
{ {
float width = Frame().Width(); float width = Frame().Width();
if (fLabel)
{
font_height fh; font_height fh;
GetFontHeight(&fh); GetFontHeight(&fh);
SetHighColor(0, 0, 0); SetHighColor(0, 0, 0);
DrawString(fLabel, BPoint(0.0f, (float)ceil(fh.ascent + fh.leading))); MovePenTo(2.0f, (float)ceil(fh.ascent) + 1.0f);
if (fLabel)
DrawString(fLabel);
if (fText)
DrawString(fText);
if (fTrailingText)
{
if (fTrailingLabel)
{
MovePenTo(width - StringWidth(fTrailingText) -
StringWidth(fTrailingLabel) - 2.0f,
(float)ceil(fh.ascent) + 1.0f);
DrawString(fTrailingText);
DrawString(fTrailingLabel);
}
else
{
MovePenTo(width - StringWidth(fTrailingText) - 2.0f,
(float)ceil(fh.ascent) + 1.0f);
DrawString(fTrailingText);
} }
BRect rect(0.0f, 16.0f, width, 16.0f + fBarHeight); }
else if (fTrailingLabel)
{
MovePenTo(width - StringWidth(fTrailingLabel) - 2.0f,
(float)ceil(fh.ascent) + 1.0f);
DrawString(fTrailingLabel);
}
BRect rect(0.0f, (float)ceil(fh.ascent) + 4.0f, width,
(float)ceil(fh.ascent) + 4.0f + fBarHeight);
// First bevel // First bevel
SetHighColor(tint_color(ui_color ( B_PANEL_BACKGROUND_COLOR ), B_DARKEN_1_TINT)); SetHighColor(tint_color(ui_color ( B_PANEL_BACKGROUND_COLOR ), B_DARKEN_1_TINT));