* Cleanup, no functional change.

* Remove superfluous operator=() implementations.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32174 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2009-08-07 08:01:27 +00:00
parent d82ea8abda
commit 50f8cd14bb
6 changed files with 320 additions and 319 deletions
+6 -5
View File
@@ -1,17 +1,19 @@
/* /*
* Copyright 2006-2008, Haiku, Inc. All Rights Reserved. * Copyright 2006-2009, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _MENU_FIELD_H #ifndef _MENU_FIELD_H
#define _MENU_FIELD_H #define _MENU_FIELD_H
#include <BeBuild.h> #include <BeBuild.h>
#include <Menu.h> /* For convenience */ #include <Menu.h>
#include <View.h> #include <View.h>
class BMenuBar; class BMenuBar;
class BMenuField : public BView { class BMenuField : public BView {
public: public:
BMenuField(BRect frame, const char* name, BMenuField(BRect frame, const char* name,
@@ -107,8 +109,7 @@ private:
virtual void _ReservedMenuField2(); virtual void _ReservedMenuField2();
virtual void _ReservedMenuField3(); virtual void _ReservedMenuField3();
BMenuField &operator=(const BMenuField&); BMenuField& operator=(const BMenuField& other);
void InitObject(const char* label); void InitObject(const char* label);
void InitObject2(); void InitObject2();
-14
View File
@@ -52,13 +52,6 @@ _BMCFilter_::Filter(BMessage *message, BHandler **handler)
} }
_BMCFilter_ &
_BMCFilter_::operator=(const _BMCFilter_ &)
{
return *this;
}
// #pragma mark - // #pragma mark -
@@ -389,13 +382,6 @@ _BMCMenuBar_::MaxSize()
} }
_BMCMenuBar_
&_BMCMenuBar_::operator=(const _BMCMenuBar_ &)
{
return *this;
}
void void
_BMCMenuBar_::_Init(bool setMaxContentWidth) _BMCMenuBar_::_Init(bool setMaxContentWidth)
{ {
+16 -17
View File
@@ -8,6 +8,7 @@
* Rene Gollent ([email protected]) * Rene Gollent ([email protected])
*/ */
#include <Menu.h> #include <Menu.h>
#include <new> #include <new>
@@ -399,9 +400,10 @@ BMenu::AddItem(BMenuItem *item)
bool bool
BMenu::AddItem(BMenuItem* item, int32 index) BMenu::AddItem(BMenuItem* item, int32 index)
{ {
if (fLayout == B_ITEMS_IN_MATRIX) if (fLayout == B_ITEMS_IN_MATRIX) {
debugger("BMenu::AddItem(BMenuItem*, int32) this method can only " debugger("BMenu::AddItem(BMenuItem*, int32) this method can only "
"be called if the menu layout is not B_ITEMS_IN_MATRIX"); "be called if the menu layout is not B_ITEMS_IN_MATRIX");
}
if (!item || !_AddItem(item, index)) if (!item || !_AddItem(item, index))
return false; return false;
@@ -422,9 +424,10 @@ BMenu::AddItem(BMenuItem *item, int32 index)
bool bool
BMenu::AddItem(BMenuItem* item, BRect frame) BMenu::AddItem(BMenuItem* item, BRect frame)
{ {
if (fLayout != B_ITEMS_IN_MATRIX) if (fLayout != B_ITEMS_IN_MATRIX) {
debugger("BMenu::AddItem(BMenuItem*, BRect) this method can only " debugger("BMenu::AddItem(BMenuItem*, BRect) this method can only "
"be called if the menu layout is B_ITEMS_IN_MATRIX"); "be called if the menu layout is B_ITEMS_IN_MATRIX");
}
if (!item) if (!item)
return false; return false;
@@ -468,9 +471,10 @@ BMenu::AddItem(BMenu *submenu)
bool bool
BMenu::AddItem(BMenu* submenu, int32 index) BMenu::AddItem(BMenu* submenu, int32 index)
{ {
if (fLayout == B_ITEMS_IN_MATRIX) if (fLayout == B_ITEMS_IN_MATRIX) {
debugger("BMenu::AddItem(BMenuItem*, int32) this method can only " debugger("BMenu::AddItem(BMenuItem*, int32) this method can only "
"be called if the menu layout is not B_ITEMS_IN_MATRIX"); "be called if the menu layout is not B_ITEMS_IN_MATRIX");
}
BMenuItem* item = new (nothrow) BMenuItem(submenu); BMenuItem* item = new (nothrow) BMenuItem(submenu);
if (!item) if (!item)
@@ -489,9 +493,10 @@ BMenu::AddItem(BMenu *submenu, int32 index)
bool bool
BMenu::AddItem(BMenu* submenu, BRect frame) BMenu::AddItem(BMenu* submenu, BRect frame)
{ {
if (fLayout != B_ITEMS_IN_MATRIX) if (fLayout != B_ITEMS_IN_MATRIX) {
debugger("BMenu::AddItem(BMenu*, BRect) this method can only " debugger("BMenu::AddItem(BMenu*, BRect) this method can only "
"be called if the menu layout is B_ITEMS_IN_MATRIX"); "be called if the menu layout is B_ITEMS_IN_MATRIX");
}
BMenuItem* item = new (nothrow) BMenuItem(submenu); BMenuItem* item = new (nothrow) BMenuItem(submenu);
if (!item) if (!item)
@@ -607,7 +612,7 @@ BMenu *
BMenu::SubmenuAt(int32 index) const BMenu::SubmenuAt(int32 index) const
{ {
BMenuItem* item = static_cast<BMenuItem*>(fItems.ItemAt(index)); BMenuItem* item = static_cast<BMenuItem*>(fItems.ItemAt(index));
return (item != NULL) ? item->Submenu() : NULL; return item != NULL ? item->Submenu() : NULL;
} }
@@ -1364,13 +1369,6 @@ void BMenu::_ReservedMenu5() {}
void BMenu::_ReservedMenu6() {} void BMenu::_ReservedMenu6() {}
BMenu &
BMenu::operator=(const BMenu &)
{
return *this;
}
void void
BMenu::_InitData(BMessage* archive) BMenu::_InitData(BMessage* archive)
{ {
@@ -1627,7 +1625,8 @@ BMenu::_Track(int *action, long start)
// mouseSpeed in px per ms // mouseSpeed in px per ms
// (actually point_distance returns the square of the distance, // (actually point_distance returns the square of the distance,
// so it's more px^2 per ms) // so it's more px^2 per ms)
mouseSpeed = (int32)(point_distance(newLocation, location) * 1000 / (newPollTime - pollTime)); mouseSpeed = (int32)(point_distance(newLocation, location) * 1000
/ (newPollTime - pollTime));
pollTime = newPollTime; pollTime = newPollTime;
if (newLocation != location || newButtons != buttons) { if (newLocation != location || newButtons != buttons) {
@@ -2217,7 +2216,6 @@ BMenu::_CalcFrame(BPoint where, bool *scrollOn)
frame.OffsetBy(screenFrame.right - frame.right, 0); frame.OffsetBy(screenFrame.right - frame.right, 0);
else if (frame.left < screenFrame.left) else if (frame.left < screenFrame.left)
frame.OffsetBy(-frame.left, 0); frame.OffsetBy(-frame.left, 0);
} else if (superMenu->Layout() == B_ITEMS_IN_COLUMN) { } else if (superMenu->Layout() == B_ITEMS_IN_COLUMN) {
if (frame.right > screenFrame.right) if (frame.right > screenFrame.right)
frame.OffsetBy(-superItem->Frame().Width() - frame.Width() - 2, 0); frame.OffsetBy(-superItem->Frame().Width() - frame.Width() - 2, 0);
@@ -2640,8 +2638,8 @@ BMenu::_UpdateWindowViewSize(bool updatePosition)
return; return;
bool scroll = false; bool scroll = false;
const BPoint screenLocation = updatePosition ? ScreenLocation() const BPoint screenLocation = updatePosition
: window->Frame().LeftTop(); ? ScreenLocation() : window->Frame().LeftTop();
BRect frame = _CalcFrame(screenLocation, &scroll); BRect frame = _CalcFrame(screenLocation, &scroll);
ResizeTo(frame.Width(), frame.Height()); ResizeTo(frame.Width(), frame.Height());
@@ -2732,7 +2730,8 @@ BMenu::_QuitTracking(bool onlyThis)
// TODO: Maybe the following two methods would fit better into InterfaceDefs.cpp // TODO: Maybe the following two methods would fit better into InterfaceDefs.cpp
// In R5, they do all the work client side, we let the app_server handle the details. // In R5, they do all the work client side, we let the app_server handle the
// details.
status_t status_t
set_menu_info(menu_info* info) set_menu_info(menu_info* info)
{ {
+20 -11
View File
@@ -8,6 +8,7 @@
* Stephan Aßmus <superstippi@gmx.de> * Stephan Aßmus <superstippi@gmx.de>
*/ */
#include <MenuBar.h> #include <MenuBar.h>
#include <math.h> #include <math.h>
@@ -44,7 +45,8 @@ struct menubar_data {
BMenuBar::BMenuBar(BRect frame, const char* title, uint32 resizeMask, BMenuBar::BMenuBar(BRect frame, const char* title, uint32 resizeMask,
menu_layout layout, bool resizeToFit) menu_layout layout, bool resizeToFit)
: BMenu(frame, title, resizeMask, B_WILL_DRAW | B_FRAME_EVENTS, layout, :
BMenu(frame, title, resizeMask, B_WILL_DRAW | B_FRAME_EVENTS, layout,
resizeToFit), resizeToFit),
fBorder(B_BORDER_FRAME), fBorder(B_BORDER_FRAME),
fTrackingPID(-1), fTrackingPID(-1),
@@ -58,7 +60,8 @@ BMenuBar::BMenuBar(BRect frame, const char *title, uint32 resizeMask,
BMenuBar::BMenuBar(const char* title, menu_layout layout, uint32 flags) BMenuBar::BMenuBar(const char* title, menu_layout layout, uint32 flags)
: BMenu(BRect(), title, B_FOLLOW_NONE, :
BMenu(BRect(), title, B_FOLLOW_NONE,
flags | B_WILL_DRAW | B_FRAME_EVENTS | B_SUPPORTS_LAYOUT, flags | B_WILL_DRAW | B_FRAME_EVENTS | B_SUPPORTS_LAYOUT,
layout, false), layout, false),
fBorder(B_BORDER_FRAME), fBorder(B_BORDER_FRAME),
@@ -73,7 +76,8 @@ BMenuBar::BMenuBar(const char *title, menu_layout layout, uint32 flags)
BMenuBar::BMenuBar(BMessage* data) BMenuBar::BMenuBar(BMessage* data)
: BMenu(data), :
BMenu(data),
fBorder(B_BORDER_FRAME), fBorder(B_BORDER_FRAME),
fTrackingPID(-1), fTrackingPID(-1),
fPrevFocusToken(-1), fPrevFocusToken(-1),
@@ -183,7 +187,8 @@ BMenuBar::Draw(BRect updateRect)
BPoint(bounds.right, bounds.bottom - 1.0f)); BPoint(bounds.right, bounds.bottom - 1.0f));
SetHighColor(tint_color(noTint, B_DARKEN_2_TINT)); SetHighColor(tint_color(noTint, B_DARKEN_2_TINT));
StrokeLine(BPoint(0.0f, bounds.bottom), BPoint(bounds.right, bounds.bottom)); StrokeLine(BPoint(0.0f, bounds.bottom),
BPoint(bounds.right, bounds.bottom));
StrokeLine(BPoint(bounds.right, 0.0f), BPoint(bounds.right, bounds.bottom)); StrokeLine(BPoint(bounds.right, 0.0f), BPoint(bounds.right, bounds.bottom));
SetHighColor(color); SetHighColor(color);
@@ -294,7 +299,8 @@ BMenuBar::Hide()
BHandler* BHandler*
BMenuBar::ResolveSpecifier(BMessage *msg, int32 index, BMessage *specifier, int32 form, const char *property) BMenuBar::ResolveSpecifier(BMessage* msg, int32 index, BMessage* specifier,
int32 form, const char* property)
{ {
return BMenu::ResolveSpecifier(msg, index, specifier, form, property); return BMenu::ResolveSpecifier(msg, index, specifier, form, property);
} }
@@ -438,7 +444,8 @@ BMenuBar::operator=(const BMenuBar &)
void void
BMenuBar::StartMenuBar(int32 menuIndex, bool sticky, bool showMenu, BRect *specialRect) BMenuBar::StartMenuBar(int32 menuIndex, bool sticky, bool showMenu,
BRect* specialRect)
{ {
if (fTracking) if (fTracking)
return; return;
@@ -461,7 +468,8 @@ BMenuBar::StartMenuBar(int32 menuIndex, bool sticky, bool showMenu, BRect *speci
fMenuSem = create_sem(0, "window close sem"); fMenuSem = create_sem(0, "window close sem");
_set_menu_sem_(window, fMenuSem); _set_menu_sem_(window, fMenuSem);
fTrackingPID = spawn_thread(_TrackTask, "menu_tracking", B_DISPLAY_PRIORITY, NULL); fTrackingPID = spawn_thread(_TrackTask, "menu_tracking", B_DISPLAY_PRIORITY,
NULL);
if (fTrackingPID >= 0) { if (fTrackingPID >= 0) {
menubar_data data; menubar_data data;
data.menuBar = this; data.menuBar = this;
@@ -482,8 +490,7 @@ BMenuBar::StartMenuBar(int32 menuIndex, bool sticky, bool showMenu, BRect *speci
} }
/* static */ /*static*/ int32
int32
BMenuBar::_TrackTask(void* arg) BMenuBar::_TrackTask(void* arg)
{ {
menubar_data data; menubar_data data;
@@ -571,7 +578,8 @@ BMenuBar::_Track(int32 *action, int32 startIndex, bool showMenu)
// that are children of BMenuFields "sticky" (see ticket #953) // that are children of BMenuFields "sticky" (see ticket #953)
if (localAction == MENU_STATE_CLOSED) { if (localAction == MENU_STATE_CLOSED) {
if (fExtraRect != NULL && fExtraRect->Contains(where) if (fExtraRect != NULL && fExtraRect->Contains(where)
// 9 = 3 pixels ^ 2 (since point_distance() returns the square of the distance) // 9 = 3 pixels ^ 2 (since point_distance() returns the
// square of the distance)
&& point_distance(newWhere, where) < 9) { && point_distance(newWhere, where) < 9) {
_SetStickyMode(true); _SetStickyMode(true);
fExtraRect = NULL; fExtraRect = NULL;
@@ -687,7 +695,8 @@ BMenuBar::_RestoreFocus()
if (window != NULL && window->Lock()) { if (window != NULL && window->Lock()) {
BHandler* handler = NULL; BHandler* handler = NULL;
if (fPrevFocusToken != -1 if (fPrevFocusToken != -1
&& gDefaultTokens.GetToken(fPrevFocusToken, B_HANDLER_TOKEN, (void **)&handler) == B_OK) { && gDefaultTokens.GetToken(fPrevFocusToken, B_HANDLER_TOKEN,
(void**)&handler) == B_OK) {
BView* view = dynamic_cast<BView*>(handler); BView* view = dynamic_cast<BView*>(handler);
if (view != NULL && view->Window() == window) if (view != NULL && view->Window() == window)
view->MakeFocus(); view->MakeFocus();
+20 -24
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2001-2008, Haiku, Inc. * Copyright 2001-2009, Haiku, Inc.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@@ -8,6 +8,7 @@
* Ingo Weinhold <bonefish@cs.tu-berlin.de> * Ingo Weinhold <bonefish@cs.tu-berlin.de>
*/ */
#include <MenuField.h> #include <MenuField.h>
#include <stdlib.h> #include <stdlib.h>
@@ -87,7 +88,8 @@ private:
struct BMenuField::LayoutData { struct BMenuField::LayoutData {
LayoutData() LayoutData()
: label_layout_item(NULL), :
label_layout_item(NULL),
menu_bar_layout_item(NULL), menu_bar_layout_item(NULL),
previous_height(-1), previous_height(-1),
valid(false) valid(false)
@@ -115,7 +117,8 @@ static float kVMargin = 2.0f;
BMenuField::BMenuField(BRect frame, const char* name, const char* label, BMenuField::BMenuField(BRect frame, const char* name, const char* label,
BMenu* menu, uint32 resize, uint32 flags) BMenu* menu, uint32 resize, uint32 flags)
: BView(frame, name, resize, flags) :
BView(frame, name, resize, flags)
{ {
CALLED(); CALLED();
@@ -132,7 +135,8 @@ BMenuField::BMenuField(BRect frame, const char *name, const char *label,
BMenuField::BMenuField(BRect frame, const char* name, const char* label, BMenuField::BMenuField(BRect frame, const char* name, const char* label,
BMenu* menu, bool fixedSize, uint32 resize, uint32 flags) BMenu* menu, bool fixedSize, uint32 resize, uint32 flags)
: BView(frame, name, resize, flags) :
BView(frame, name, resize, flags)
{ {
InitObject(label); InitObject(label);
@@ -147,7 +151,8 @@ BMenuField::BMenuField(BRect frame, const char *name, const char *label,
BMenuField::BMenuField(const char* name, const char* label, BMenu* menu, BMenuField::BMenuField(const char* name, const char* label, BMenu* menu,
BMessage* message, uint32 flags) BMessage* message, uint32 flags)
: BView(name, flags | B_FRAME_EVENTS) :
BView(name, flags | B_FRAME_EVENTS)
{ {
InitObject(label); InitObject(label);
@@ -157,9 +162,9 @@ BMenuField::BMenuField(const char* name, const char* label, BMenu* menu,
} }
BMenuField::BMenuField(const char* label, BMenuField::BMenuField(const char* label, BMenu* menu, BMessage* message)
BMenu* menu, BMessage* message) :
: BView(NULL, B_WILL_DRAW | B_NAVIGABLE | B_FRAME_EVENTS) BView(NULL, B_WILL_DRAW | B_NAVIGABLE | B_FRAME_EVENTS)
{ {
InitObject(label); InitObject(label);
@@ -170,7 +175,8 @@ BMenuField::BMenuField(const char* label,
BMenuField::BMenuField(BMessage* data) BMenuField::BMenuField(BMessage* data)
: BView(data) :
BView(data)
{ {
const char* label = NULL; const char* label = NULL;
data->FindString("_label", &label); data->FindString("_label", &label);
@@ -200,10 +206,9 @@ BMenuField::BMenuField(BMessage *data)
bool dmark = false; bool dmark = false;
data->FindBool("be:dmark", &dmark); data->FindBool("be:dmark", &dmark);
if (_BMCMenuBar_ *menuBar = dynamic_cast<_BMCMenuBar_ *>(fMenuBar)) { if (_BMCMenuBar_* menuBar = dynamic_cast<_BMCMenuBar_*>(fMenuBar))
menuBar->TogglePopUpMarker(dmark); menuBar->TogglePopUpMarker(dmark);
} }
}
BMenuField::~BMenuField() BMenuField::~BMenuField()
@@ -248,9 +253,9 @@ BMenuField::Archive(BMessage *data, bool deep) const
ret = data->AddBool("be:fixeds", true); ret = data->AddBool("be:fixeds", true);
bool dmark = false; bool dmark = false;
if (_BMCMenuBar_ *menuBar = dynamic_cast<_BMCMenuBar_ *>(fMenuBar)) { if (_BMCMenuBar_* menuBar = dynamic_cast<_BMCMenuBar_*>(fMenuBar))
dmark = menuBar->IsPopUpMarkerShown(); dmark = menuBar->IsPopUpMarkerShown();
}
data->AddBool("be:dmark", dmark); data->AddBool("be:dmark", dmark);
return ret; return ret;
@@ -854,13 +859,6 @@ void BMenuField::_ReservedMenuField2() {}
void BMenuField::_ReservedMenuField3() {} void BMenuField::_ReservedMenuField3() {}
BMenuField &
BMenuField::operator=(const BMenuField &)
{
return *this;
}
void void
BMenuField::InitObject(const char* label) BMenuField::InitObject(const char* label)
{ {
@@ -957,8 +955,7 @@ BMenuField::InitMenu(BMenu *menu)
} }
/* static */ /*static*/ int32
int32
BMenuField::_thread_entry(void* arg) BMenuField::_thread_entry(void* arg)
{ {
return static_cast<BMenuField*>(arg)->_MenuTask(); return static_cast<BMenuField*>(arg)->_MenuTask();
@@ -1098,7 +1095,7 @@ BMenuField::_ValidateLayoutData()
// TODO: BMenu::MinSize() is using the ResizeMode() to decide the // TODO: BMenu::MinSize() is using the ResizeMode() to decide the
// minimum width. If the mode is B_FOLLOW_LEFT_RIGHT, it will use the // minimum width. If the mode is B_FOLLOW_LEFT_RIGHT, it will use the
// parent's frame width or window's frame width. So at least the returned // parent's frame width or window's frame width. So at least the returned
// size is wrong, but appearantly it doesn't have much bad effect. // size is wrong, but apparantly it doesn't have much bad effect.
fLayoutData->menu_bar_min = fMenuBar->MinSize(); fLayoutData->menu_bar_min = fMenuBar->MinSize();
TRACE("menu bar min width: %.2f\n", fLayoutData->menu_bar_min.width); TRACE("menu bar min width: %.2f\n", fLayoutData->menu_bar_min.width);
@@ -1117,7 +1114,6 @@ BMenuField::_ValidateLayoutData()
fLayoutData->valid = true; fLayoutData->valid = true;
TRACE("width: %.2f, height: %.2f\n", min.width, min.height); TRACE("width: %.2f, height: %.2f\n", min.width, min.height);
} }
+20 -10
View File
@@ -27,7 +27,8 @@ class BMenuScroller : public BView {
BMenuScroller(BRect frame); BMenuScroller(BRect frame);
bool IsEnabled() const; bool IsEnabled() const;
void SetEnabled(const bool &enabled); void SetEnabled(bool enabled);
private: private:
bool fEnabled; bool fEnabled;
}; };
@@ -51,6 +52,7 @@ class BMenuFrame : public BView {
class UpperScroller : public BMenuScroller { class UpperScroller : public BMenuScroller {
public: public:
UpperScroller(BRect frame); UpperScroller(BRect frame);
virtual void Draw(BRect updateRect); virtual void Draw(BRect updateRect);
}; };
@@ -58,6 +60,7 @@ public:
class LowerScroller : public BMenuScroller { class LowerScroller : public BMenuScroller {
public: public:
LowerScroller(BRect frame); LowerScroller(BRect frame);
virtual void Draw(BRect updateRect); virtual void Draw(BRect updateRect);
}; };
@@ -72,7 +75,8 @@ const int kScrollerHeight = 10;
BMenuScroller::BMenuScroller(BRect frame) BMenuScroller::BMenuScroller(BRect frame)
: BView(frame, "menu scroller", 0, B_WILL_DRAW | B_FRAME_EVENTS), :
BView(frame, "menu scroller", 0, B_WILL_DRAW | B_FRAME_EVENTS),
fEnabled(false) fEnabled(false)
{ {
SetViewColor(ui_color(B_MENU_BACKGROUND_COLOR)); SetViewColor(ui_color(B_MENU_BACKGROUND_COLOR));
@@ -87,7 +91,7 @@ BMenuScroller::IsEnabled() const
void void
BMenuScroller::SetEnabled(const bool &enabled) BMenuScroller::SetEnabled(bool enabled)
{ {
fEnabled = enabled; fEnabled = enabled;
} }
@@ -112,9 +116,10 @@ UpperScroller::Draw(BRect updateRect)
// Draw the upper arrow. // Draw the upper arrow.
if (IsEnabled()) if (IsEnabled())
SetHighColor(0, 0, 0); SetHighColor(0, 0, 0);
else else {
SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
B_DARKEN_2_TINT)); B_DARKEN_2_TINT));
}
FillRect(Bounds(), B_SOLID_LOW); FillRect(Bounds(), B_SOLID_LOW);
@@ -143,9 +148,10 @@ LowerScroller::Draw(BRect updateRect)
// Draw the lower arrow. // Draw the lower arrow.
if (IsEnabled()) if (IsEnabled())
SetHighColor(0, 0, 0); SetHighColor(0, 0, 0);
else else {
SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
B_DARKEN_2_TINT)); B_DARKEN_2_TINT));
}
FillRect(frame, B_SOLID_LOW); FillRect(frame, B_SOLID_LOW);
@@ -161,7 +167,8 @@ LowerScroller::Draw(BRect updateRect)
BMenuFrame::BMenuFrame(BMenu *menu) BMenuFrame::BMenuFrame(BMenu *menu)
: BView(BRect(0, 0, 1, 1), "menu frame", B_FOLLOW_ALL_SIDES, B_WILL_DRAW), :
BView(BRect(0, 0, 1, 1), "menu frame", B_FOLLOW_ALL_SIDES, B_WILL_DRAW),
fMenu(menu) fMenu(menu)
{ {
} }
@@ -205,8 +212,8 @@ BMenuFrame::Draw(BRect updateRect)
// TODO: Review this as it's a bit hacky. // TODO: Review this as it's a bit hacky.
// Menu has a size of 0, 0, since there are no items in it. // Menu has a size of 0, 0, since there are no items in it.
// So the BMenuFrame class has to fake it and draw an empty item. // So the BMenuFrame class has to fake it and draw an empty item.
// Note that we can't add a real "empty" item because then we couldn't // Note that we can't add a real "empty" item because then we
// tell if the item was added by us or not. // couldn't tell if the item was added by us or not.
// See also BMenu::UpdateWindowViewSize() // See also BMenu::UpdateWindowViewSize()
SetHighColor(ui_color(B_MENU_BACKGROUND_COLOR)); SetHighColor(ui_color(B_MENU_BACKGROUND_COLOR));
SetLowColor(HighColor()); SetLowColor(HighColor());
@@ -215,8 +222,11 @@ BMenuFrame::Draw(BRect updateRect)
font_height height; font_height height;
GetFontHeight(&height); GetFontHeight(&height);
SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), B_DISABLED_LABEL_TINT)); SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
BPoint where((Bounds().Width() - fMenu->StringWidth(kEmptyMenuLabel)) / 2, ceilf(height.ascent + 1)); B_DISABLED_LABEL_TINT));
BPoint where(
(Bounds().Width() - fMenu->StringWidth(kEmptyMenuLabel)) / 2,
ceilf(height.ascent + 1));
DrawString(kEmptyMenuLabel, where); DrawString(kEmptyMenuLabel, where);
} }