diff --git a/src/preferences/menu/BitmapMenuItem.cpp b/src/preferences/menu/BitmapMenuItem.cpp index 1f035f1a46..9e05ebedde 100644 --- a/src/preferences/menu/BitmapMenuItem.cpp +++ b/src/preferences/menu/BitmapMenuItem.cpp @@ -43,3 +43,21 @@ BitmapMenuItem::DrawContent() 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; +} diff --git a/src/preferences/menu/BitmapMenuItem.h b/src/preferences/menu/BitmapMenuItem.h index 37ddde848c..c2269820dc 100644 --- a/src/preferences/menu/BitmapMenuItem.h +++ b/src/preferences/menu/BitmapMenuItem.h @@ -11,7 +11,10 @@ public: char shortcut = 0, uint32 modifiers = 0); ~BitmapMenuItem(); virtual void DrawContent(); - + +protected: + virtual void GetContentSize(float *width, float *height); + private: BBitmap *fBitmap; BString fName; diff --git a/src/preferences/menu/MenuBar.cpp b/src/preferences/menu/MenuBar.cpp index 7d184b5f6f..a33fe49f56 100644 --- a/src/preferences/menu/MenuBar.cpp +++ b/src/preferences/menu/MenuBar.cpp @@ -48,13 +48,11 @@ MenuBar::build_menu() colorSchemeItem = new BMenuItem("Color Scheme...", new BMessage(COLOR_SCHEME_MSG), 0, 0); // create the separator menu - // TODO: Use B_ITEMS_IN_MATRIX here separatorStyleMenu = new BMenu("Separator Style", B_ITEMS_IN_COLUMN); separatorStyleMenu->SetRadioMode(true); BMessage *msg = new BMessage(MENU_SEP_TYPE); msg->AddInt32("sep", 0); - separatorStyleZero = new BitmapMenuItem(" ", msg, - BTranslationUtils::GetBitmap(B_RAW_TYPE, "SEP0")); + separatorStyleZero = new BitmapMenuItem("", msg, BTranslationUtils::GetBitmap(B_RAW_TYPE, "SEP0")); msg = new BMessage(MENU_SEP_TYPE); msg->AddInt32("sep", 1); separatorStyleOne = new BitmapMenuItem("", msg, BTranslationUtils::GetBitmap(B_RAW_TYPE, "SEP1"));