TeamMonitor: Use BControlLook::ComposeIconSize.
And DefaultLabelSpacing, too. Fixes appearance on HiDPI.
This commit is contained in:
parent
1f0c87711b
commit
e6ab6daf98
@ -10,6 +10,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <ControlLook.h>
|
||||
#include <FindDirectory.h>
|
||||
#include <LocaleRoster.h>
|
||||
#include <NodeInfo.h>
|
||||
@ -17,9 +18,6 @@
|
||||
#include <View.h>
|
||||
|
||||
|
||||
static const int32 kItemMargin = 2;
|
||||
|
||||
|
||||
bool gLocalizedNamePreferred;
|
||||
|
||||
|
||||
@ -27,8 +25,8 @@ TeamListItem::TeamListItem(team_info &teamInfo)
|
||||
:
|
||||
fTeamInfo(teamInfo),
|
||||
fAppInfo(),
|
||||
fMiniIcon(BRect(0, 0, 15, 15), B_RGBA32),
|
||||
fLargeIcon(BRect(0, 0, 31, 31), B_RGBA32),
|
||||
fMiniIcon(BRect(BPoint(0, 0), be_control_look->ComposeIconSize(B_MINI_ICON)), B_RGBA32),
|
||||
fLargeIcon(BRect(BPoint(0, 0), be_control_look->ComposeIconSize(B_LARGE_ICON)), B_RGBA32),
|
||||
fFound(false),
|
||||
fRefusingToQuit(false)
|
||||
{
|
||||
@ -38,8 +36,8 @@ TeamListItem::TeamListItem(team_info &teamInfo)
|
||||
fPath = BPath(info.name);
|
||||
BNode node(info.name);
|
||||
BNodeInfo nodeInfo(&node);
|
||||
nodeInfo.GetTrackerIcon(&fMiniIcon, B_MINI_ICON);
|
||||
nodeInfo.GetTrackerIcon(&fLargeIcon, B_LARGE_ICON);
|
||||
nodeInfo.GetTrackerIcon(&fMiniIcon, (icon_size)-1);
|
||||
nodeInfo.GetTrackerIcon(&fLargeIcon, (icon_size)-1);
|
||||
}
|
||||
|
||||
if (be_roster->GetRunningAppInfo(fTeamInfo.team, &fAppInfo) != B_OK)
|
||||
@ -87,14 +85,15 @@ TeamListItem::DrawItem(BView* owner, BRect frame, bool complete)
|
||||
|
||||
frame.left += 4;
|
||||
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 + fMiniIcon.Bounds().Width(),
|
||||
iconFrame.top + fMiniIcon.Bounds().Height() + 1);
|
||||
owner->SetDrawingMode(B_OP_ALPHA);
|
||||
owner->SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
|
||||
owner->DrawBitmap(&fMiniIcon, iconFrame);
|
||||
owner->SetDrawingMode(B_OP_COPY);
|
||||
|
||||
frame.left += 16;
|
||||
frame.left += fMiniIcon.Bounds().Width();
|
||||
if (fRefusingToQuit)
|
||||
owner->SetHighColor(IsSelected() ? kHighlightRed : kRed);
|
||||
else {
|
||||
@ -107,7 +106,8 @@ TeamListItem::DrawItem(BView* owner, BRect frame, bool complete)
|
||||
font_height finfo;
|
||||
font.GetHeight(&finfo);
|
||||
owner->SetFont(&font);
|
||||
owner->MovePenTo(frame.left + 8, frame.top + ((frame.Height()
|
||||
owner->MovePenTo(frame.left + (fMiniIcon.Bounds().Width() / 2),
|
||||
frame.top + ((frame.Height()
|
||||
- (finfo.ascent + finfo.descent + finfo.leading)) / 2)
|
||||
+ finfo.ascent);
|
||||
|
||||
@ -118,10 +118,11 @@ TeamListItem::DrawItem(BView* owner, BRect frame, bool complete)
|
||||
}
|
||||
|
||||
|
||||
/*static*/ int32
|
||||
int32
|
||||
TeamListItem::MinimalHeight()
|
||||
{
|
||||
return 16 + kItemMargin;
|
||||
return fMiniIcon.Bounds().Height() +
|
||||
(int32)(be_control_look->DefaultLabelSpacing() / 3.0f);
|
||||
}
|
||||
|
||||
|
||||
@ -131,6 +132,7 @@ TeamListItem::Update(BView* owner, const BFont* font)
|
||||
// we need to override the update method so we can make sure
|
||||
// the list item size doesn't change
|
||||
BListItem::Update(owner, font);
|
||||
|
||||
if (Height() < MinimalHeight())
|
||||
SetHeight(MinimalHeight());
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ public:
|
||||
void SetRefusingToQuit(bool refusing);
|
||||
bool IsRefusingToQuit();
|
||||
|
||||
static int32 MinimalHeight();
|
||||
int32 MinimalHeight();
|
||||
|
||||
private:
|
||||
team_info fTeamInfo;
|
||||
|
@ -709,7 +709,7 @@ TeamDescriptionView::SetItem(TeamListItem* item)
|
||||
fQuitOverdue->Hide();
|
||||
}
|
||||
|
||||
fIconView->SetIcon(item->Path()->Path());
|
||||
fIconView->SetIcon(item->LargeIcon());
|
||||
}
|
||||
|
||||
if (fLayout == NULL)
|
||||
@ -722,5 +722,3 @@ TeamDescriptionView::SetItem(TeamListItem* item)
|
||||
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user