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)
{
// TODO: implement additional border styles
if (IsEnabled()) {
BRect bounds(Bounds());
if (IsEnabled()) {
PushState();
// Restore the background color in case a menuitem
// was selected.
BRect bounds(Bounds());
// Restore the background of the previously selected menuitem
DrawBackground(bounds & updateRect);
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));
BMenuBar *menuBar = data.menuBar;
BWindow *window = menuBar->Window();
menuBar->SetStickyMode(data.sticky);
int32 action;
menuBar->Track(&action, data.menuIndex, data.showMenu);
menuBar->fTracking = false;
// Sends a _MENUS_DONE_ message to the BWindow.
// Weird: There is a _MENUS_DONE_ message but not a
// _MENUS_BEGINNING_ message, in fact the MenusBeginning()
// hook function is called directly.
BWindow *window = menuBar->Window();
window->PostMessage(_MENUS_DONE_);
_set_menu_sem_(window, B_BAD_SEM_ID);
@@ -441,15 +440,10 @@ BMenuBar::Track(int32 *action, int32 startIndex, bool showMenu)
} while (true);
if (fSelected != NULL) {
window->Lock();
if (window->Lock()) {
SelectItem(NULL);
window->Unlock();
}
if (resultItem != NULL) {
window->Lock();
resultItem->Invoke();
if (resultItem != NULL)
resultItem->Invoke();
window->Unlock();
}
@@ -491,7 +485,6 @@ BMenuBar::RestoreFocus()
}
}
void
BMenuBar::InitData(menu_layout layout)
{
+3 -5
View File
@@ -88,12 +88,12 @@ BSeparatorItem::Draw()
return;
BRect bounds = Frame();
rgb_color oldColor = menu->HighColor();
menu_info menuInfo;
get_menu_info(&menuInfo);
switch (menuInfo.separator) {
case 0:
// TODO: Check if drawing is pixel perfect
menu->SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
B_DARKEN_1_TINT));
menu->StrokeLine(BPoint(bounds.left + 1.0f, bounds.top + 4.0f),
@@ -102,11 +102,9 @@ BSeparatorItem::Draw()
B_LIGHTEN_2_TINT));
menu->StrokeLine(BPoint(bounds.left + 1.0f, bounds.top + 5.0f),
BPoint(bounds.right - 1.0f, bounds.top + 5.0f));
menu->SetHighColor(0, 0, 0);
break;
case 1:
// TODO: Check if drawing is pixel perfect
menu->SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
B_DARKEN_1_TINT));
menu->StrokeLine(BPoint(bounds.left + 9.0f, bounds.top + 4.0f),
@@ -115,7 +113,6 @@ BSeparatorItem::Draw()
B_LIGHTEN_2_TINT));
menu->StrokeLine(BPoint(bounds.left + 9.0f, bounds.top + 5.0f),
BPoint(bounds.right - 9.0f, bounds.top + 5.0f));
menu->SetHighColor(0, 0, 0);
break;
case 2:
@@ -129,12 +126,13 @@ BSeparatorItem::Draw()
B_LIGHTEN_2_TINT));
menu->StrokeLine(BPoint(bounds.left + 11.0f, bounds.top + 6.0f),
BPoint(bounds.right - 11.0f, bounds.top + 6.0f));
menu->SetHighColor(0, 0, 0);
break;
default:
break;
}
menu->SetHighColor(oldColor);
}