Remove the unused bounds parameter from DrawLabel

Also refactor BMenuField::Draw()
This commit is contained in:
John Scipione
2013-05-09 21:29:13 -04:00
parent 869e4bdca3
commit f6d93b80f3
2 changed files with 8 additions and 11 deletions
+1 -1
View File
@@ -123,7 +123,7 @@ private:
void InitObject(const char* label); void InitObject(const char* label);
void InitObject2(); void InitObject2();
void DrawLabel(BRect bounds, BRect updateRect); void DrawLabel(BRect updateRect);
static void InitMenu(BMenu* menu); static void InitMenu(BMenu* menu);
int32 _MenuTask(); int32 _MenuTask();
+7 -10
View File
@@ -356,22 +356,19 @@ BMenuField::AllUnarchived(const BMessage* from)
void void
BMenuField::Draw(BRect updateRect) BMenuField::Draw(BRect updateRect)
{ {
BRect bounds(Bounds()); DrawLabel(updateRect);
bool active = IsFocus() && Window()->IsActive();
DrawLabel(bounds, updateRect); BRect rect(fMenuBar->Frame());
rect.InsetBy(-kVMargin, -kVMargin);
BRect frame(fMenuBar->Frame());
frame.InsetBy(-kVMargin, -kVMargin);
rgb_color base = fMenuBar->LowColor(); rgb_color base = fMenuBar->LowColor();
rgb_color background = LowColor(); rgb_color background = LowColor();
uint32 flags = 0; uint32 flags = 0;
if (!fMenuBar->IsEnabled()) if (!fMenuBar->IsEnabled())
flags |= BControlLook::B_DISABLED; flags |= BControlLook::B_DISABLED;
if (active) if (IsFocus() && Window()->IsActive())
flags |= BControlLook::B_FOCUSED; flags |= BControlLook::B_FOCUSED;
be_control_look->DrawMenuFieldFrame(this, frame, updateRect, base,
be_control_look->DrawMenuFieldFrame(this, rect, updateRect, base,
background, flags); background, flags);
} }
@@ -981,7 +978,7 @@ BMenuField::InitObject2()
void void
BMenuField::DrawLabel(BRect bounds, BRect updateRect) BMenuField::DrawLabel(BRect updateRect)
{ {
CALLED(); CALLED();