Implemented BitmapMenuItem::GetContentSize() to get rid of a ugly hack.
This fixes bug 488, the dash was actually the "trigger" :) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18461 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -43,3 +43,21 @@ BitmapMenuItem::DrawContent()
|
|||||||
menu->SetDrawingMode(B_OP_COPY);
|
menu->SetDrawingMode(B_OP_COPY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BitmapMenuItem::GetContentSize(float *_width, float *_height)
|
||||||
|
{
|
||||||
|
float width, height;
|
||||||
|
BMenuItem::GetContentSize(&width, &height);
|
||||||
|
|
||||||
|
if (fBitmap != NULL) {
|
||||||
|
width += fBitmap->Bounds().Width();
|
||||||
|
height = max_c(height, fBitmap->Bounds().Height());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_width != NULL)
|
||||||
|
*_width = width;
|
||||||
|
if (_height != NULL)
|
||||||
|
*_height = height;
|
||||||
|
}
|
||||||
|
|||||||
@@ -11,7 +11,10 @@ public:
|
|||||||
char shortcut = 0, uint32 modifiers = 0);
|
char shortcut = 0, uint32 modifiers = 0);
|
||||||
~BitmapMenuItem();
|
~BitmapMenuItem();
|
||||||
virtual void DrawContent();
|
virtual void DrawContent();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void GetContentSize(float *width, float *height);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BBitmap *fBitmap;
|
BBitmap *fBitmap;
|
||||||
BString fName;
|
BString fName;
|
||||||
|
|||||||
@@ -48,13 +48,11 @@ MenuBar::build_menu()
|
|||||||
colorSchemeItem = new BMenuItem("Color Scheme...", new BMessage(COLOR_SCHEME_MSG), 0, 0);
|
colorSchemeItem = new BMenuItem("Color Scheme...", new BMessage(COLOR_SCHEME_MSG), 0, 0);
|
||||||
|
|
||||||
// create the separator menu
|
// create the separator menu
|
||||||
// TODO: Use B_ITEMS_IN_MATRIX here
|
|
||||||
separatorStyleMenu = new BMenu("Separator Style", B_ITEMS_IN_COLUMN);
|
separatorStyleMenu = new BMenu("Separator Style", B_ITEMS_IN_COLUMN);
|
||||||
separatorStyleMenu->SetRadioMode(true);
|
separatorStyleMenu->SetRadioMode(true);
|
||||||
BMessage *msg = new BMessage(MENU_SEP_TYPE);
|
BMessage *msg = new BMessage(MENU_SEP_TYPE);
|
||||||
msg->AddInt32("sep", 0);
|
msg->AddInt32("sep", 0);
|
||||||
separatorStyleZero = new BitmapMenuItem(" ", msg,
|
separatorStyleZero = new BitmapMenuItem("", msg, BTranslationUtils::GetBitmap(B_RAW_TYPE, "SEP0"));
|
||||||
BTranslationUtils::GetBitmap(B_RAW_TYPE, "SEP0"));
|
|
||||||
msg = new BMessage(MENU_SEP_TYPE);
|
msg = new BMessage(MENU_SEP_TYPE);
|
||||||
msg->AddInt32("sep", 1);
|
msg->AddInt32("sep", 1);
|
||||||
separatorStyleOne = new BitmapMenuItem("", msg, BTranslationUtils::GetBitmap(B_RAW_TYPE, "SEP1"));
|
separatorStyleOne = new BitmapMenuItem("", msg, BTranslationUtils::GetBitmap(B_RAW_TYPE, "SEP1"));
|
||||||
|
|||||||
Reference in New Issue
Block a user