Override Update() so we can return an item width that includes our flag.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39145 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
31a81a2b93
commit
04e916ccb5
@ -30,6 +30,8 @@
|
||||
#define B_TRANSLATE_CONTEXT "LanguageListView"
|
||||
|
||||
|
||||
static const float kFlagWidth = 17.0;
|
||||
|
||||
LanguageListItem::LanguageListItem(const char* text, const char* id,
|
||||
const char* code, const char* countryCode)
|
||||
:
|
||||
@ -104,10 +106,10 @@ LanguageListItem::DrawItem(BView* owner, BRect frame, bool complete)
|
||||
owner->DrawString(text.String());
|
||||
|
||||
// Draw the icon
|
||||
frame.left = frame.right - 17;
|
||||
frame.left = frame.right - kFlagWidth;
|
||||
BRect iconFrame(frame);
|
||||
iconFrame.Set(iconFrame.left, iconFrame.top + 1, iconFrame.left + 15,
|
||||
iconFrame.top + 16);
|
||||
iconFrame.Set(iconFrame.left, iconFrame.top + 1, iconFrame.left + kFlagWidth - 2,
|
||||
iconFrame.top + kFlagWidth - 1);
|
||||
|
||||
if (fIcon != NULL && fIcon->IsValid()) {
|
||||
owner->SetDrawingMode(B_OP_OVER);
|
||||
@ -118,6 +120,14 @@ LanguageListItem::DrawItem(BView* owner, BRect frame, bool complete)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LanguageListItem::Update(BView* owner, const BFont* font)
|
||||
{
|
||||
BStringItem::Update(owner, font);
|
||||
SetWidth(Width() + kFlagWidth);
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
|
@ -31,6 +31,8 @@ public:
|
||||
virtual void DrawItem(BView* owner, BRect frame,
|
||||
bool complete = false);
|
||||
|
||||
virtual void Update(BView* owner, const BFont* font);
|
||||
|
||||
private:
|
||||
BString fID;
|
||||
BString fCode;
|
||||
|
Loading…
Reference in New Issue
Block a user