@@ -100,27 +100,24 @@ AppMenuItem::~AppMenuItem()
|
|||||||
void
|
void
|
||||||
AppMenuItem::GetContentSize(float* _width, float* _height)
|
AppMenuItem::GetContentSize(float* _width, float* _height)
|
||||||
{
|
{
|
||||||
|
BMenuItem::GetContentSize(_width, _height);
|
||||||
if (_width)
|
if (_width)
|
||||||
*_width = fIcon->Bounds().Width()
|
*_width += fIcon->Bounds().Width();
|
||||||
+ be_plain_font->StringWidth(Label());
|
if (_height)
|
||||||
|
*_height = max_c(*_height, fIcon->Bounds().Height());
|
||||||
if (_height) {
|
|
||||||
struct font_height fh;
|
|
||||||
be_plain_font->GetHeight(&fh);
|
|
||||||
float fontHeight = ceilf(fh.ascent) + ceilf(fh.descent)
|
|
||||||
+ ceilf(fh.leading);
|
|
||||||
*_height = max_c(fontHeight, fIcon->Bounds().Height());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AppMenuItem::DrawContent()
|
AppMenuItem::DrawContent()
|
||||||
{
|
{
|
||||||
|
float yOffset, height;
|
||||||
|
GetContentSize(NULL, &height);
|
||||||
|
yOffset = (height - fIcon->Bounds().Height()) / 2;
|
||||||
Menu()->SetDrawingMode(B_OP_OVER);
|
Menu()->SetDrawingMode(B_OP_OVER);
|
||||||
Menu()->MovePenBy(0.0, -1.0);
|
Menu()->MovePenBy(0.0, yOffset);
|
||||||
Menu()->DrawBitmap(fIcon);
|
Menu()->DrawBitmap(fIcon);
|
||||||
Menu()->MovePenBy(fIcon->Bounds().Width() + kSmallHMargin, 0.0);
|
Menu()->MovePenBy(fIcon->Bounds().Width() + kSmallHMargin, -yOffset);
|
||||||
BMenuItem::DrawContent();
|
BMenuItem::DrawContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user