Rewrote parts related to drawing the labels. The order of drawing happens as
this (seems to be what R5 BStatusBar does): * combine the "trailing text" with the "trailing label" and truncate the resulting string on the left side according to the width of the entire control * combine the "label" with the "text" and truncate that on the right side according to the space left by the right hand text. -> No more overlaps (theoretically, in practise there are still overlaps because our BFont::TruncateString() does not respect the width in some situations.) * Changed _SetTextData() accordingly, it is not used anymore for the label and trailing label, and could therefor be simplified a little. * fixed _BarFrame() to not return fractional coords, which could sometimes leave a dirty line of pixels. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25244 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006, Haiku, Inc. All Rights Reserved.
|
||||
* Copyright 2006-2008, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _STATUS_BAR_H
|
||||
@@ -84,8 +84,8 @@ class BStatusBar : public BView {
|
||||
BStatusBar &operator=(const BStatusBar& other);
|
||||
|
||||
void _InitObject();
|
||||
void _SetTextData(BString& text, float& width, const char* string, float pos,
|
||||
bool rightAligned);
|
||||
void _SetTextData(BString& text, const char* string,
|
||||
const BString& combineWith, bool rightAligned);
|
||||
BRect _BarFrame(const font_height* fontHeight = NULL) const;
|
||||
float _BarPosition(const BRect& barFrame) const;
|
||||
|
||||
@@ -96,14 +96,11 @@ class BStatusBar : public BView {
|
||||
float fMax;
|
||||
float fCurrent;
|
||||
float fBarHeight;
|
||||
float fLabelWidth;
|
||||
float fTrailingLabelWidth;
|
||||
float fTextWidth;
|
||||
float fTrailingTextWidth;
|
||||
float fTextDivider;
|
||||
rgb_color fBarColor;
|
||||
bool fCustomBarHeight;
|
||||
|
||||
uint32 _reserved[2];
|
||||
uint32 _reserved[5];
|
||||
};
|
||||
|
||||
#endif // _STATUS_BAR_H
|
||||
|
||||
Reference in New Issue
Block a user