Enlarged a bit the BMCMenuBar's frame, so that it's drawn more nicely

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16795 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2006-03-14 20:41:50 +00:00
parent 1fdb18f7dd
commit e3d0715523
2 changed files with 15 additions and 13 deletions

View File

@ -123,7 +123,10 @@ _BMCMenuBar_::_BMCMenuBar_(BRect frame, bool fixed_size, BMenuField *menuField)
float left, top, right, bottom;
GetItemMargins(&left, &top, &right, &bottom);
SetItemMargins(left, top, right, bottom); // TODO:
// give a bit more space to draw the small thumb
left -= 1;
right += 3;
SetItemMargins(left, top, right, bottom);
SetMaxContentWidth(frame.Width() - (left + right));
}
@ -153,15 +156,15 @@ _BMCMenuBar_::Instantiate(BMessage *data)
{
if (validate_instantiation(data, "_BMCMenuBar_"))
return new _BMCMenuBar_(data);
else
return NULL;
return NULL;
}
void
_BMCMenuBar_::AttachedToWindow()
{
fMenuField = (BMenuField*)Parent();
fMenuField = static_cast<BMenuField *>(Parent());
BMenuBar *menuBar = Window()->KeyMenuBar();
BMenuBar::AttachedToWindow();

View File

@ -29,13 +29,12 @@ BMenuField::BMenuField(BRect frame, const char *name, const char *label,
fMenu = menu;
InitMenu(menu);
frame.OffsetTo(0.0f, 0.0f);
fMenuBar = new _BMCMenuBar_(BRect(frame.left + fDivider + 1.0,
frame.top + kVMargin, frame.right - 2.0f, frame.bottom - kVMargin),
frame.OffsetTo(B_ORIGIN);
fMenuBar = new _BMCMenuBar_(BRect(frame.left + fDivider + 1,
frame.top + kVMargin, frame.right, frame.bottom - kVMargin),
false, this);
AddChild(fMenuBar);
// fMenuBar->AddItem(new _BMCItem_(menu));
fMenuBar->AddItem(menu);
fMenuBar->SetFont(be_plain_font);
@ -55,13 +54,12 @@ BMenuField::BMenuField(BRect frame, const char *name, const char *label,
fFixedSizeMB = fixedSize;
frame.OffsetTo(0.0f, 0.0f);
fMenuBar = new _BMCMenuBar_(BRect(frame.left + fDivider + 1.0,
frame.top + kVMargin, frame.right - 2.0f, frame.bottom - kVMargin),
frame.OffsetTo(B_ORIGIN);
fMenuBar = new _BMCMenuBar_(BRect(frame.left + fDivider + 1,
frame.top + kVMargin, frame.right, frame.bottom - kVMargin),
fixedSize, this);
AddChild(fMenuBar);
// fMenuBar->AddItem(new _BMCItem_(menu));
fMenuBar->AddItem(menu);
fMenuBar->SetFont(be_plain_font);
@ -115,8 +113,9 @@ BMenuField::~BMenuField()
{
free(fLabel);
status_t dummy;
if (fMenuTaskID >= 0)
kill_thread(fMenuTaskID);
wait_for_thread(fMenuTaskID, &dummy);
}