Misc cleanups

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13219 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2005-06-21 09:40:01 +00:00
parent 66967bcb04
commit e6629a65a2
2 changed files with 13 additions and 22 deletions
+10 -17
View File
@@ -136,13 +136,11 @@ void
BMenuBar::Draw(BRect updateRect) BMenuBar::Draw(BRect updateRect)
{ {
// TODO: implement additional border styles // TODO: implement additional border styles
if (IsEnabled()) { if (IsEnabled()) {
BRect bounds(Bounds());
PushState(); PushState();
// Restore the background color in case a menuitem BRect bounds(Bounds());
// was selected. // Restore the background of the previously selected menuitem
DrawBackground(bounds & updateRect); DrawBackground(bounds & updateRect);
SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), B_LIGHTEN_2_TINT)); SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), B_LIGHTEN_2_TINT));
@@ -369,17 +367,18 @@ BMenuBar::TrackTask(void *arg)
receive_data(&id, &data, sizeof(data)); receive_data(&id, &data, sizeof(data));
BMenuBar *menuBar = data.menuBar; BMenuBar *menuBar = data.menuBar;
BWindow *window = menuBar->Window();
menuBar->SetStickyMode(data.sticky); menuBar->SetStickyMode(data.sticky);
int32 action; int32 action;
menuBar->Track(&action, data.menuIndex, data.showMenu); menuBar->Track(&action, data.menuIndex, data.showMenu);
menuBar->fTracking = false;
// Sends a _MENUS_DONE_ message to the BWindow. // Sends a _MENUS_DONE_ message to the BWindow.
// Weird: There is a _MENUS_DONE_ message but not a // Weird: There is a _MENUS_DONE_ message but not a
// _MENUS_BEGINNING_ message, in fact the MenusBeginning() // _MENUS_BEGINNING_ message, in fact the MenusBeginning()
// hook function is called directly. // hook function is called directly.
BWindow *window = menuBar->Window();
window->PostMessage(_MENUS_DONE_); window->PostMessage(_MENUS_DONE_);
_set_menu_sem_(window, B_BAD_SEM_ID); _set_menu_sem_(window, B_BAD_SEM_ID);
@@ -441,15 +440,10 @@ BMenuBar::Track(int32 *action, int32 startIndex, bool showMenu)
} while (true); } while (true);
if (fSelected != NULL) { if (window->Lock()) {
window->Lock();
SelectItem(NULL); SelectItem(NULL);
window->Unlock(); if (resultItem != NULL)
} resultItem->Invoke();
if (resultItem != NULL) {
window->Lock();
resultItem->Invoke();
window->Unlock(); window->Unlock();
} }
@@ -491,7 +485,6 @@ BMenuBar::RestoreFocus()
} }
} }
void void
BMenuBar::InitData(menu_layout layout) BMenuBar::InitData(menu_layout layout)
{ {
+3 -5
View File
@@ -88,12 +88,12 @@ BSeparatorItem::Draw()
return; return;
BRect bounds = Frame(); BRect bounds = Frame();
rgb_color oldColor = menu->HighColor();
menu_info menuInfo; menu_info menuInfo;
get_menu_info(&menuInfo); get_menu_info(&menuInfo);
switch (menuInfo.separator) { switch (menuInfo.separator) {
case 0: case 0:
// TODO: Check if drawing is pixel perfect
menu->SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), menu->SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
B_DARKEN_1_TINT)); B_DARKEN_1_TINT));
menu->StrokeLine(BPoint(bounds.left + 1.0f, bounds.top + 4.0f), menu->StrokeLine(BPoint(bounds.left + 1.0f, bounds.top + 4.0f),
@@ -102,11 +102,9 @@ BSeparatorItem::Draw()
B_LIGHTEN_2_TINT)); B_LIGHTEN_2_TINT));
menu->StrokeLine(BPoint(bounds.left + 1.0f, bounds.top + 5.0f), menu->StrokeLine(BPoint(bounds.left + 1.0f, bounds.top + 5.0f),
BPoint(bounds.right - 1.0f, bounds.top + 5.0f)); BPoint(bounds.right - 1.0f, bounds.top + 5.0f));
menu->SetHighColor(0, 0, 0);
break; break;
case 1: case 1:
// TODO: Check if drawing is pixel perfect
menu->SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), menu->SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
B_DARKEN_1_TINT)); B_DARKEN_1_TINT));
menu->StrokeLine(BPoint(bounds.left + 9.0f, bounds.top + 4.0f), menu->StrokeLine(BPoint(bounds.left + 9.0f, bounds.top + 4.0f),
@@ -115,7 +113,6 @@ BSeparatorItem::Draw()
B_LIGHTEN_2_TINT)); B_LIGHTEN_2_TINT));
menu->StrokeLine(BPoint(bounds.left + 9.0f, bounds.top + 5.0f), menu->StrokeLine(BPoint(bounds.left + 9.0f, bounds.top + 5.0f),
BPoint(bounds.right - 9.0f, bounds.top + 5.0f)); BPoint(bounds.right - 9.0f, bounds.top + 5.0f));
menu->SetHighColor(0, 0, 0);
break; break;
case 2: case 2:
@@ -129,12 +126,13 @@ BSeparatorItem::Draw()
B_LIGHTEN_2_TINT)); B_LIGHTEN_2_TINT));
menu->StrokeLine(BPoint(bounds.left + 11.0f, bounds.top + 6.0f), menu->StrokeLine(BPoint(bounds.left + 11.0f, bounds.top + 6.0f),
BPoint(bounds.right - 11.0f, bounds.top + 6.0f)); BPoint(bounds.right - 11.0f, bounds.top + 6.0f));
menu->SetHighColor(0, 0, 0);
break; break;
default: default:
break; break;
} }
menu->SetHighColor(oldColor);
} }