Update StringItem use be_control_look->DefaultLabelSpacing()
Also update the Update() method to take into account the added spacing. Thanks Axel and Stippi.
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <ControlLook.h>
|
||||||
#include <Message.h>
|
#include <Message.h>
|
||||||
#include <View.h>
|
#include <View.h>
|
||||||
|
|
||||||
@@ -85,7 +86,8 @@ BStringItem::DrawItem(BView *owner, BRect frame, bool complete)
|
|||||||
owner->FillRect(frame);
|
owner->FillRect(frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
owner->MovePenTo(frame.left + 4, frame.top + fBaselineOffset);
|
owner->MovePenTo(frame.left + be_control_look->DefaultLabelSpacing(),
|
||||||
|
frame.top + fBaselineOffset);
|
||||||
|
|
||||||
if (!IsEnabled()) {
|
if (!IsEnabled()) {
|
||||||
rgb_color textColor = ui_color(B_LIST_ITEM_TEXT_COLOR);
|
rgb_color textColor = ui_color(B_LIST_ITEM_TEXT_COLOR);
|
||||||
@@ -128,8 +130,10 @@ BStringItem::Text() const
|
|||||||
void
|
void
|
||||||
BStringItem::Update(BView *owner, const BFont *font)
|
BStringItem::Update(BView *owner, const BFont *font)
|
||||||
{
|
{
|
||||||
if (fText)
|
if (fText) {
|
||||||
SetWidth(font->StringWidth(fText));
|
SetWidth(font->StringWidth(fText)
|
||||||
|
+ be_control_look->DefaultLabelSpacing());
|
||||||
|
}
|
||||||
|
|
||||||
font_height fheight;
|
font_height fheight;
|
||||||
font->GetHeight(&fheight);
|
font->GetHeight(&fheight);
|
||||||
|
|||||||
Reference in New Issue
Block a user