menufields should default to B_ITEMS_IN_COLUMN. This fixes the workspaces menu (in Screen) opened at the wrong position. As a consequence of this, I had to change the drawing code a bit

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15892 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2006-01-10 16:00:07 +00:00
parent b120bcd665
commit 797d1a66fa
3 changed files with 15 additions and 12 deletions

View File

@ -69,12 +69,16 @@ BArchivable *_BMCItem_::Instantiate(BMessage *data)
//------------------------------------------------------------------------------
void _BMCItem_::Draw()
{
BMenuItem::Draw();
BMenu *menu = Menu();
// Copy / pasted from BMenuItem::Draw(). We can't use it directly
// because we want to skip the Submenu symbol and the rest
menu->MovePenTo(ContentLocation());
DrawContent();
if (!fShowPopUpMarker)
return;
BMenu *menu = Menu();
BRect rect(menu->Bounds());
rect.right -= 4;
@ -119,7 +123,7 @@ _BMCFilter_ &_BMCFilter_::operator=(const _BMCFilter_ &)
}*/
//------------------------------------------------------------------------------
_BMCMenuBar_::_BMCMenuBar_(BRect frame, bool fixed_size, BMenuField *menuField)
: BMenuBar(frame, "_mc_mb_", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_ITEMS_IN_ROW,
: BMenuBar(frame, "_mc_mb_", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_ITEMS_IN_COLUMN,
!fixed_size)
{
SetFlags(Flags() | B_FRAME_EVENTS);

View File

@ -356,6 +356,8 @@ BMenuItem::TruncateLabel(float maxWidth, char *newLabel)
void
BMenuItem::DrawContent()
{
fSuper->CacheFontInfo();
fSuper->MovePenBy(0, fSuper->fAscent);
BPoint lineStart = fSuper->PenLocation();
@ -400,8 +402,6 @@ BMenuItem::Draw()
// TODO: Cleanup
bool enabled = IsEnabled();
fSuper->CacheFontInfo();
if (IsSelected() && (enabled || Submenu()) /*&& fSuper->fRedrawAfterSticky*/) {
fSuper->SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
B_DARKEN_2_TINT));

View File

@ -252,15 +252,14 @@ BPopUpMenu::ScreenLocation()
if (fUseWhere)
return fWhere;
BMenuItem *item = Superitem();
BMenu *menu = Supermenu();
BMenuItem *selectedItem = FindItem(item->Label());
BRect rect = item->Frame();
BPoint point = rect.LeftTop();
BMenuItem *superItem = Superitem();
BMenu *superMenu = Supermenu();
BMenuItem *selectedItem = FindItem(superItem->Label());
BPoint point = superItem->Frame().LeftTop();
menu->ConvertToScreen(&point);
superMenu->ConvertToScreen(&point);
if (selectedItem)
if (selectedItem != NULL)
point.y -= selectedItem->Frame().top;
return point;