Patch by barber which actually make menu color changes work, plus some other changes. Note that this shows some problems in how BMenuItems are drawn (wrong colors)

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16963 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2006-04-02 08:11:53 +00:00
parent 9deb82dfc0
commit 265242ecfa
3 changed files with 9 additions and 6 deletions
+1 -1
View File
@@ -61,7 +61,7 @@ ColorWindow::MessageReceived(BMessage *msg)
get_menu_info(&info); get_menu_info(&info);
info.background_color = colorPicker->ValueAsColor(); info.background_color = colorPicker->ValueAsColor();
set_menu_info(&info); set_menu_info(&info);
be_app->PostMessage(UPDATE_WINDOW); be_app->PostMessage(MENU_COLOR);
break; break;
default: default:
+2
View File
@@ -17,6 +17,7 @@ MenuBar::MenuBar()
get_menu_info(&info); get_menu_info(&info);
build_menu(); build_menu();
set_menu(); set_menu();
SetItemMargins(14.0, 2.0, 20.0, 0.0);
} }
@@ -149,5 +150,6 @@ MenuBar::Update()
void void
MenuBar::FrameResized(float width, float height) MenuBar::FrameResized(float width, float height)
{ {
Window()->ResizeTo(width + 80, height + 55);
Window()->PostMessage(UPDATE_WINDOW); Window()->PostMessage(UPDATE_WINDOW);
} }
+6 -5
View File
@@ -30,18 +30,18 @@ MenuWindow::MenuWindow(BRect rect)
menuView->AddChild(menuBar); menuView->AddChild(menuBar);
// resize the window according to the size of menuBar // resize the window according to the size of menuBar
ResizeTo((menuBar->Frame().right + 35), (menuBar->Frame().bottom + 45)); ResizeTo((menuBar->Frame().right + 40), (menuBar->Frame().bottom + 45));
BRect menuBarFrame = menuBar->Frame(); BRect menuBarFrame = menuBar->Frame();
BRect buttonFrame(menuBarFrame.left, menuBarFrame.bottom + 10, menuBarFrame.left + 75, menuBarFrame.bottom + 30); BRect buttonFrame(menuBarFrame.left, menuBarFrame.bottom + 10, menuBarFrame.left + 75, menuBarFrame.bottom + 30);
defaultButton = new BButton(buttonFrame, "Default", "Defaults", new BMessage(MENU_DEFAULT), defaultButton = new BButton(buttonFrame, "Default", "Defaults", new BMessage(MENU_DEFAULT),
B_FOLLOW_LEFT | B_FOLLOW_BOTTOM, B_WILL_DRAW | B_NAVIGABLE); B_FOLLOW_H_CENTER | B_FOLLOW_BOTTOM, B_WILL_DRAW | B_NAVIGABLE);
menuView->AddChild(defaultButton); menuView->AddChild(defaultButton);
buttonFrame.OffsetBy(buttonFrame.Width() + 20, 0); buttonFrame.OffsetBy(buttonFrame.Width() + 20, 0);
revertButton = new BButton(buttonFrame, "Revert", "Revert", new BMessage(MENU_REVERT), revertButton = new BButton(buttonFrame, "Revert", "Revert", new BMessage(MENU_REVERT),
B_FOLLOW_LEFT | B_FOLLOW_BOTTOM, B_WILL_DRAW | B_NAVIGABLE); B_FOLLOW_H_CENTER | B_FOLLOW_BOTTOM, B_WILL_DRAW | B_NAVIGABLE);
revertButton->SetEnabled(false); revertButton->SetEnabled(false);
menuView->AddChild(revertButton); menuView->AddChild(revertButton);
@@ -152,8 +152,9 @@ MenuWindow::MessageReceived(BMessage *msg)
break; break;
case MENU_COLOR: case MENU_COLOR:
set_menu_info(&info); get_menu_info(&info);
(new BAlert("test","we made it","cool"))->Go(); revert = true;
Update();
break; break;
default: default: