Deskbar: Center window icons in WindowMenuItem

* They had a fixed top offset which looked bad with larger font sizes.
* The icons should be replaced with vector icons, though, and properly
  resized.
This commit is contained in:
Axel Dörfler 2018-11-03 19:58:19 +00:00
parent 5fd3bc6d2c
commit 1fab551726

@ -157,7 +157,7 @@ void
TWindowMenuItem::DrawContent() TWindowMenuItem::DrawContent()
{ {
BMenu* menu = Menu(); BMenu* menu = Menu();
BPoint contentLocation = ContentLocation() + BPoint(kHPad, kVPad); BPoint contentLocation = ContentLocation() + BPoint(kHPad, 0);
if (fID >= 0) { if (fID >= 0) {
menu->SetDrawingMode(B_OP_OVER); menu->SetDrawingMode(B_OP_OVER);
@ -166,6 +166,10 @@ TWindowMenuItem::DrawContent()
if (width > 16) if (width > 16)
contentLocation.x -= 8; contentLocation.x -= 8;
float height;
GetContentSize(NULL, &height);
contentLocation.y += (height - fBitmap->Bounds().Height()) / 2;
menu->MovePenTo(contentLocation); menu->MovePenTo(contentLocation);
menu->DrawBitmapAsync(fBitmap); menu->DrawBitmapAsync(fBitmap);
@ -174,7 +178,7 @@ TWindowMenuItem::DrawContent()
contentLocation.x += kIconRect.Width() + kLabelOffset; contentLocation.x += kIconRect.Width() + kLabelOffset;
} }
contentLocation.y += fLabelAscent; contentLocation.y = ContentLocation().y + kVPad + fLabelAscent;
menu->SetDrawingMode(B_OP_COPY); menu->SetDrawingMode(B_OP_COPY);
menu->MovePenTo(contentLocation); menu->MovePenTo(contentLocation);