From e3d0715523c6d2b7a93dfd158339fad13162d3ea Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Tue, 14 Mar 2006 20:41:50 +0000 Subject: [PATCH] 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 --- src/kits/interface/BMCPrivate.cpp | 11 +++++++---- src/kits/interface/MenuField.cpp | 17 ++++++++--------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/kits/interface/BMCPrivate.cpp b/src/kits/interface/BMCPrivate.cpp index b4369c3e45..35346d3e5d 100644 --- a/src/kits/interface/BMCPrivate.cpp +++ b/src/kits/interface/BMCPrivate.cpp @@ -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(Parent()); BMenuBar *menuBar = Window()->KeyMenuBar(); BMenuBar::AttachedToWindow(); diff --git a/src/kits/interface/MenuField.cpp b/src/kits/interface/MenuField.cpp index 603f949db6..592e3974f8 100644 --- a/src/kits/interface/MenuField.cpp +++ b/src/kits/interface/MenuField.cpp @@ -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); }