From b820da1a251c67beffe318783b811563ddabddc7 Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Mon, 6 Mar 2006 17:15:16 +0000 Subject: [PATCH] Restyled Menu preflet, it's still very ugly but at least I can understand where's things. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16611 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/preferences/menu/ColorPicker.cpp | 20 -- src/preferences/menu/ColorWindow.cpp | 131 ++++----- src/preferences/menu/ColorWindow.h | 21 ++ src/preferences/menu/FontMenu.cpp | 209 +++++++------- src/preferences/menu/FontMenu.h | 37 +++ src/preferences/menu/FontSizeMenu.cpp | 132 ++++----- src/preferences/menu/Jamfile | 1 - src/preferences/menu/MenuApp.cpp | 71 +++-- src/preferences/menu/MenuApp.h | 151 ++-------- src/preferences/menu/MenuBar.cpp | 257 ++++++++--------- src/preferences/menu/MenuBar.h | 39 +++ src/preferences/menu/MenuWindow.cpp | 387 +++++++++++++------------- src/preferences/menu/MenuWindow.h | 34 +++ 13 files changed, 750 insertions(+), 740 deletions(-) delete mode 100644 src/preferences/menu/ColorPicker.cpp create mode 100644 src/preferences/menu/ColorWindow.h create mode 100644 src/preferences/menu/FontMenu.h create mode 100644 src/preferences/menu/MenuBar.h create mode 100644 src/preferences/menu/MenuWindow.h diff --git a/src/preferences/menu/ColorPicker.cpp b/src/preferences/menu/ColorPicker.cpp deleted file mode 100644 index 617c39dc08..0000000000 --- a/src/preferences/menu/ColorPicker.cpp +++ /dev/null @@ -1,20 +0,0 @@ - - #include "MenuApp.h" - - ColorPicker::ColorPicker() - :BColorControl(BPoint(10,10), B_CELLS_32x8, - 9, "COLOR", new BMessage(MENU_COLOR), true) - { - menu_info info; - get_menu_info(&info); - SetValue(info.background_color); - } - - ColorPicker::~ColorPicker() - {} - - void - ColorPicker::MessageReceived(BMessage *msg){ - switch(msg->what) { - } - } diff --git a/src/preferences/menu/ColorWindow.cpp b/src/preferences/menu/ColorWindow.cpp index dd4d2beac4..87623e1d60 100644 --- a/src/preferences/menu/ColorWindow.cpp +++ b/src/preferences/menu/ColorWindow.cpp @@ -1,68 +1,73 @@ +#include +#include +#include +#include - #include "MenuApp.h" +#include "ColorWindow.h" +#include "msg.h" + +ColorWindow::ColorWindow() + : BWindow(BRect(150,150,350,200), "Menu Color Scheme", B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_NOT_RESIZABLE) +{ + // Set and collect the variables for revert + get_menu_info(&info); + get_menu_info(&revert_info); + + BView *colView = new BView(BRect(0,0,1000,100), "menuView", + B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE); - ColorWindow::ColorWindow() - : BWindow(BRect(150,150,350,200), "Menu Color Scheme", B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_NOT_RESIZABLE) - { - // Set and collect the variables for revert + colorPicker = new BColorControl(BPoint(10,10), B_CELLS_32x8, + 9, "COLOR", new BMessage(MENU_COLOR), true); + colorPicker->SetValue(info.background_color); + colView->SetViewColor(219,219,219,255); + colView->AddChild(colorPicker); + AddChild(colView); + + ResizeTo(383,130); + + // Create the buttons and add them to the view + DefaultButton = new BButton(BRect(10,100,85,110), "Default", "Default", + new BMessage(MENU_COLOR_DEFAULT), B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE); + RevertButton = new BButton(BRect(95,100,175,20), "REVERT", "Revert", + new BMessage(MENU_REVERT), B_FOLLOW_LEFT | B_FOLLOW_BOTTOM, B_WILL_DRAW | B_NAVIGABLE); + + colView->AddChild(DefaultButton); + colView->AddChild(RevertButton); +} + + +void +ColorWindow::MessageReceived(BMessage *msg) +{ + switch(msg->what) { + + case MENU_REVERT: + colorPicker->SetValue(revert_info.background_color); + info.background_color = colorPicker->ValueAsColor(); + set_menu_info(&info); + be_app->PostMessage(UPDATE_WINDOW); + break; + + case MENU_COLOR_DEFAULT: + // change to system color for system wide + // compatability + rgb_color color; + color.red = 219; + color.blue = 219; + color.green = 219; + color.alpha = 255; + colorPicker->SetValue(color); + + case MENU_COLOR:{ get_menu_info(&info); - get_menu_info(&revert_info); - - BView *colView = new BView(BRect(0,0,1000,100), "menuView", - B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE); - - colorPicker = new ColorPicker(); - colView->SetViewColor(219,219,219,255); - colView->AddChild(colorPicker); - AddChild(colView); - - ResizeTo(383,130); - - // Create the buttons and add them to the view - DefaultButton = new BButton(BRect(10,100,85,110), "Default", "Default", - new BMessage(MENU_COLOR_DEFAULT), B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE); - RevertButton = new BButton(BRect(95,100,175,20), "REVERT", "Revert", - new BMessage(MENU_REVERT), B_FOLLOW_LEFT | B_FOLLOW_BOTTOM, B_WILL_DRAW | B_NAVIGABLE); - - colView->AddChild(DefaultButton); - colView->AddChild(RevertButton); - } + info.background_color = colorPicker->ValueAsColor(); + set_menu_info(&info); + be_app->PostMessage(UPDATE_WINDOW); + break;} - ColorWindow::~ColorWindow() - {} - - void - ColorWindow::MessageReceived(BMessage *msg) - { - switch(msg->what) { - - case MENU_REVERT: - colorPicker->SetValue(revert_info.background_color); - info.background_color = colorPicker->ValueAsColor(); - set_menu_info(&info); - be_app->PostMessage(UPDATE_WINDOW); - break; - - case MENU_COLOR_DEFAULT: - // change to system color for system wide - // compatability - rgb_color color; - color.red = 219; - color.blue = 219; - color.green = 219; - color.alpha = 255; - colorPicker->SetValue(color); - - case MENU_COLOR:{ - get_menu_info(&info); - info.background_color = colorPicker->ValueAsColor(); - set_menu_info(&info); - be_app->PostMessage(UPDATE_WINDOW); - break;} - - default: - be_app->PostMessage(UPDATE_WINDOW); - BMessage(msg); - break; - } + default: + be_app->PostMessage(UPDATE_WINDOW); + BMessage(msg); + break; } +} diff --git a/src/preferences/menu/ColorWindow.h b/src/preferences/menu/ColorWindow.h new file mode 100644 index 0000000000..c7a686e73d --- /dev/null +++ b/src/preferences/menu/ColorWindow.h @@ -0,0 +1,21 @@ +#ifndef __COLORWINDOW_H +#define __COLORWINDOW_H + +#include +#include + +class BColorControl; +class BButton; +class ColorWindow : public BWindow { + public: + ColorWindow(); + virtual void MessageReceived(BMessage *msg); + + BColorControl *colorPicker; + BButton *DefaultButton; + BButton *RevertButton; + menu_info revert_info; + menu_info info; +}; + +#endif diff --git a/src/preferences/menu/FontMenu.cpp b/src/preferences/menu/FontMenu.cpp index dede142472..79497bcebb 100644 --- a/src/preferences/menu/FontMenu.cpp +++ b/src/preferences/menu/FontMenu.cpp @@ -1,122 +1,119 @@ +#include "FontMenu.h" +#include "msg.h" - #include "MenuApp.h" - #include +#include + +#include +#include + +FontMenu::FontMenu() + : BMenu("Font", B_ITEMS_IN_COLUMN) +{ + get_menu_info(&info); + SetRadioMode(true); + GetFonts(); +} - FontMenu::FontMenu() - : BMenu("Font", B_ITEMS_IN_COLUMN) - { - get_menu_info(&info); - SetRadioMode(true); - GetFonts(); - } - - FontMenu::~FontMenu() - { /*nothing to clean up*/} - - void - FontMenu::GetFonts() - { - int32 numFamilies = count_font_families(); - for ( int32 i = 0; i < numFamilies; i++ ) { - font_family *family = (font_family*)malloc(sizeof(font_family)); - uint32 flags; - if ( get_font_family(i, family, &flags) == B_OK ) { - fontStyleMenu = new BMenu(*family, B_ITEMS_IN_COLUMN); - fontStyleMenu->SetRadioMode(true); - int32 numStyles = count_font_styles(*family); - for ( int32 j = 0; j < numStyles; j++ ) { - font_style *style = (font_style*)malloc(sizeof(font_style)); - if ( get_font_style(*family, j, style, &flags) == B_OK ) { - BMessage *msg = new BMessage(MENU_FONT_STYLE); - msg->AddPointer("family", family); - msg->AddPointer("style", style); - fontStyleItem = new BMenuItem(*style, msg, 0, 0); - fontStyleMenu->AddItem(fontStyleItem); - } - } - BMessage *msg = new BMessage(MENU_FONT_FAMILY); - msg->AddPointer("family", family); +void +FontMenu::GetFonts() +{ + int32 numFamilies = count_font_families(); + for ( int32 i = 0; i < numFamilies; i++ ) { + font_family *family = (font_family*)malloc(sizeof(font_family)); + uint32 flags; + if ( get_font_family(i, family, &flags) == B_OK ) { + fontStyleMenu = new BMenu(*family, B_ITEMS_IN_COLUMN); + fontStyleMenu->SetRadioMode(true); + int32 numStyles = count_font_styles(*family); + for ( int32 j = 0; j < numStyles; j++ ) { font_style *style = (font_style*)malloc(sizeof(font_style)); - // if font family selected, we need to change style to - // first style - if ( get_font_style(*family, 0, style, &flags) == B_OK ) + if ( get_font_style(*family, j, style, &flags) == B_OK ) { + BMessage *msg = new BMessage(MENU_FONT_STYLE); + msg->AddPointer("family", family); msg->AddPointer("style", style); - fontFamily = new BMenuItem(fontStyleMenu, msg); - AddItem(fontFamily); + fontStyleItem = new BMenuItem(*style, msg, 0, 0); + fontStyleMenu->AddItem(fontStyleItem); + } } + BMessage *msg = new BMessage(MENU_FONT_FAMILY); + msg->AddPointer("family", family); + font_style *style = (font_style*)malloc(sizeof(font_style)); + // if font family selected, we need to change style to + // first style + if ( get_font_style(*family, 0, style, &flags) == B_OK ) + msg->AddPointer("style", style); + fontFamily = new BMenuItem(fontStyleMenu, msg); + AddItem(fontFamily); } } - - void - FontMenu::Update() - { - // it may be better to pull all menu prefs - // related stuff out of the FontMenu class - // so it can be easily reused in other apps - get_menu_info(&info); - - // font menu - BFont font; - font.SetFamilyAndStyle(info.f_family, info.f_style); - font.SetSize(info.font_size); - SetFont(&font); - SetViewColor(info.background_color); - InvalidateLayout(); +} - // font style menus - for (int i = 0; i < CountItems(); i++) { - ItemAt(i)->Submenu()->SetFont(&font); - } - - ClearAllMarkedItems(); - PlaceCheckMarkOnFont(info.f_family, info.f_style); - } - - status_t - FontMenu::PlaceCheckMarkOnFont(font_family family, font_style style) - { - BMenuItem *fontFamilyItem; - BMenuItem *fontStyleItem; - BMenu *styleMenu; - - fontFamilyItem = FindItem(family); - - if ((fontFamilyItem != NULL) && (family != NULL)) - { - fontFamilyItem->SetMarked(true); - styleMenu = fontFamilyItem->Submenu(); +void +FontMenu::Update() +{ + // it may be better to pull all menu prefs + // related stuff out of the FontMenu class + // so it can be easily reused in other apps + get_menu_info(&info); - if ((styleMenu != NULL) && (style != NULL)) - { - fontStyleItem = styleMenu->FindItem(style); + // font menu + BFont font; + font.SetFamilyAndStyle(info.f_family, info.f_style); + font.SetSize(info.font_size); + SetFont(&font); + SetViewColor(info.background_color); + InvalidateLayout(); + // font style menus + for (int i = 0; i < CountItems(); i++) { + ItemAt(i)->Submenu()->SetFont(&font); + } + + ClearAllMarkedItems(); + PlaceCheckMarkOnFont(info.f_family, info.f_style); +} - if (fontStyleItem != NULL) - { - fontStyleItem->SetMarked(true); - } - +status_t +FontMenu::PlaceCheckMarkOnFont(font_family family, font_style style) +{ + BMenuItem *fontFamilyItem; + BMenuItem *fontStyleItem; + BMenu *styleMenu; + + fontFamilyItem = FindItem(family); + if ((fontFamilyItem != NULL) && (family != NULL)) + { + fontFamilyItem->SetMarked(true); + styleMenu = fontFamilyItem->Submenu(); + + if ((styleMenu != NULL) && (style != NULL)) + { + fontStyleItem = styleMenu->FindItem(style); + if (fontStyleItem != NULL) + { + fontStyleItem->SetMarked(true); } - else - return B_ERROR; + } else return B_ERROR; - - - return B_OK; } - - void - FontMenu::ClearAllMarkedItems() - { - // we need to clear all menuitems and submenuitems - for (int i = 0; i < CountItems(); i++) { - ItemAt(i)->SetMarked(false); - - BMenu *submenu = ItemAt(i)->Submenu(); - for (int j = 0; j < submenu->CountItems(); j++) { - submenu->ItemAt(j)->SetMarked(false); - } - } + else + return B_ERROR; - } + return B_OK; +} + + +void +FontMenu::ClearAllMarkedItems() +{ + // we need to clear all menuitems and submenuitems + for (int i = 0; i < CountItems(); i++) { + ItemAt(i)->SetMarked(false); + + BMenu *submenu = ItemAt(i)->Submenu(); + for (int j = 0; j < submenu->CountItems(); j++) { + submenu->ItemAt(j)->SetMarked(false); + } + } +} diff --git a/src/preferences/menu/FontMenu.h b/src/preferences/menu/FontMenu.h new file mode 100644 index 0000000000..f4930e9224 --- /dev/null +++ b/src/preferences/menu/FontMenu.h @@ -0,0 +1,37 @@ +#ifndef __FONTMENU_H +#define __FONTMENU_H + +#include + +class FontSizeMenu : public BMenu { +public: + FontSizeMenu(); + virtual void Update(); + +private: + menu_info info; + BMenuItem *fontSizeNine; + BMenuItem *fontSizeTen; + BMenuItem *fontSizeEleven; + BMenuItem *fontSizeTwelve; + BMenuItem *fontSizeFourteen; + BMenuItem *fontSizeEighteen; +}; + + +class FontMenu : public BMenu { +public: + FontMenu(); + virtual void GetFonts(); + virtual void Update(); + virtual status_t PlaceCheckMarkOnFont(font_family family, font_style style); + virtual void ClearAllMarkedItems(); + +private: + menu_info info; + BMenuItem *fontFamily; + BMenu *fontStyleMenu; + BMenuItem *fontStyleItem; +}; + +#endif diff --git a/src/preferences/menu/FontSizeMenu.cpp b/src/preferences/menu/FontSizeMenu.cpp index ff297906cf..86b5827f63 100644 --- a/src/preferences/menu/FontSizeMenu.cpp +++ b/src/preferences/menu/FontSizeMenu.cpp @@ -1,69 +1,71 @@ +#include "FontMenu.h" +#include "msg.h" - #include "MenuApp.h" +#include +#include +#include + +FontSizeMenu::FontSizeMenu() + :BMenu("Font Size", B_ITEMS_IN_COLUMN) +{ + get_menu_info(&info); - FontSizeMenu::FontSizeMenu() - :BMenu("Font Size", B_ITEMS_IN_COLUMN) - { - get_menu_info(&info); - - BMessage *msg = new BMessage(MENU_FONT_SIZE); - msg->AddFloat("size", 9); - fontSizeNine = new BMenuItem("9", msg, 0, 0); - AddItem(fontSizeNine); - if(info.font_size == 9){fontSizeNine->SetMarked(true);} - - msg = new BMessage(MENU_FONT_SIZE); - msg->AddFloat("size", 10); - fontSizeTen = new BMenuItem("10", msg, 0, 0); - AddItem(fontSizeTen); - if(info.font_size == 10){fontSizeTen->SetMarked(true);} - - msg = new BMessage(MENU_FONT_SIZE); - msg->AddFloat("size", 11); - fontSizeEleven = new BMenuItem("11", msg, 0, 0); - AddItem(fontSizeEleven); - if(info.font_size == 11){fontSizeEleven->SetMarked(true);} - - msg = new BMessage(MENU_FONT_SIZE); - msg->AddFloat("size", 12); - fontSizeTwelve = new BMenuItem("12", msg, 0, 0); - AddItem(fontSizeTwelve); - if(info.font_size == 12){fontSizeTwelve->SetMarked(true);} - - msg = new BMessage(MENU_FONT_SIZE); - msg->AddFloat("size", 14); - fontSizeFourteen = new BMenuItem("14", msg, 0, 0); - AddItem(fontSizeFourteen); - if(info.font_size == 14){fontSizeFourteen->SetMarked(true);} - - msg = new BMessage(MENU_FONT_SIZE); - msg->AddFloat("size", 18); - fontSizeEighteen = new BMenuItem("18", msg, 0, 0); - AddItem(fontSizeEighteen); - if(info.font_size == 18){fontSizeEighteen->SetMarked(true);} - - SetTargetForItems(Window()); - SetRadioMode(true); - } + BMessage *msg = new BMessage(MENU_FONT_SIZE); + msg->AddFloat("size", 9); + fontSizeNine = new BMenuItem("9", msg, 0, 0); + AddItem(fontSizeNine); + if(info.font_size == 9){fontSizeNine->SetMarked(true);} - FontSizeMenu::~FontSizeMenu() - { } + msg = new BMessage(MENU_FONT_SIZE); + msg->AddFloat("size", 10); + fontSizeTen = new BMenuItem("10", msg, 0, 0); + AddItem(fontSizeTen); + if(info.font_size == 10){fontSizeTen->SetMarked(true);} - void - FontSizeMenu::Update() - { - get_menu_info(&info); - BFont font; - - Supermenu()->Window()->Lock(); - font.SetFamilyAndStyle(info.f_family, info.f_style); - font.SetSize(info.font_size); - SetFont(&font); - SetViewColor(info.background_color); - Supermenu()->Window()->Unlock(); - set_menu_info(&info); - - InvalidateLayout(); - Invalidate(); - SetEnabled(true); - } + msg = new BMessage(MENU_FONT_SIZE); + msg->AddFloat("size", 11); + fontSizeEleven = new BMenuItem("11", msg, 0, 0); + AddItem(fontSizeEleven); + if(info.font_size == 11){fontSizeEleven->SetMarked(true);} + + msg = new BMessage(MENU_FONT_SIZE); + msg->AddFloat("size", 12); + fontSizeTwelve = new BMenuItem("12", msg, 0, 0); + AddItem(fontSizeTwelve); + if(info.font_size == 12){fontSizeTwelve->SetMarked(true);} + + msg = new BMessage(MENU_FONT_SIZE); + msg->AddFloat("size", 14); + fontSizeFourteen = new BMenuItem("14", msg, 0, 0); + AddItem(fontSizeFourteen); + if(info.font_size == 14){fontSizeFourteen->SetMarked(true);} + + msg = new BMessage(MENU_FONT_SIZE); + msg->AddFloat("size", 18); + fontSizeEighteen = new BMenuItem("18", msg, 0, 0); + AddItem(fontSizeEighteen); + if(info.font_size == 18){fontSizeEighteen->SetMarked(true);} + + SetTargetForItems(Window()); + SetRadioMode(true); +} + + +void +FontSizeMenu::Update() +{ + get_menu_info(&info); + BFont font; + + Supermenu()->Window()->Lock(); + font.SetFamilyAndStyle(info.f_family, info.f_style); + font.SetSize(info.font_size); + SetFont(&font); + SetViewColor(info.background_color); + Supermenu()->Window()->Unlock(); + set_menu_info(&info); + + InvalidateLayout(); + Invalidate(); + SetEnabled(true); +} diff --git a/src/preferences/menu/Jamfile b/src/preferences/menu/Jamfile index bb3321391d..7f959fce1e 100644 --- a/src/preferences/menu/Jamfile +++ b/src/preferences/menu/Jamfile @@ -2,7 +2,6 @@ SubDir HAIKU_TOP src preferences menu ; Preference Menu : BitmapMenuItem.cpp - ColorPicker.cpp ColorWindow.cpp FontMenu.cpp FontSizeMenu.cpp diff --git a/src/preferences/menu/MenuApp.cpp b/src/preferences/menu/MenuApp.cpp index 860d2e5922..f9c4ff7f6c 100644 --- a/src/preferences/menu/MenuApp.cpp +++ b/src/preferences/menu/MenuApp.cpp @@ -1,42 +1,30 @@ +#include "MenuApp.h" +#include "MenuWindow.h" +#include "msg.h" - #include "MenuApp.h" +MenuApp::MenuApp() + : BApplication("application/x-vnd.Be-GGUI") +{ + get_menu_info(&info); - MenuApp::MenuApp() - : BApplication("application/x-vnd.Be-GGUI") - { - get_menu_info(&info); - - menuWindow = new MenuWindow(); - Update(); - menuWindow->Show(); - } - - MenuApp::~MenuApp() - {/*nothing to clean up*/} - - bool - MenuApp::QuitRequested() - { - return true; - } + menuWindow = new MenuWindow(); + Update(); + menuWindow->Show(); +} - void - MenuApp::Update() - { - menuWindow->Update(); - } + +void +MenuApp::Update() +{ + menuWindow->Update(); +} - int main() - { - new MenuApp(); - be_app -> Run(); - delete be_app; - } - void - MenuApp::MessageReceived(BMessage *msg){ - switch(msg->what) { - +void +MenuApp::MessageReceived(BMessage *msg) +{ + switch(msg->what) { + //others case UPDATE_WINDOW: case CLICK_OPEN_MSG: @@ -47,9 +35,18 @@ case MENU_COLOR: menuWindow->PostMessage(msg); break; - + default: - BMessage(msg); + BApplication::MessageReceived(msg); break; - } } +} + + +int main() +{ + new MenuApp(); + be_app->Run(); + delete be_app; +} + diff --git a/src/preferences/menu/MenuApp.h b/src/preferences/menu/MenuApp.h index adb53e2c71..a1069e7647 100644 --- a/src/preferences/menu/MenuApp.h +++ b/src/preferences/menu/MenuApp.h @@ -1,134 +1,21 @@ - #include - #include - #include - #include - #include - #include - #include - #include - #include +#ifndef __MENU_APP_H +#define __MENU_APP_H + +#include +#include + +class MenuWindow; +class MenuApp : public BApplication { +public: + MenuApp(); + virtual void Update(); + virtual void MessageReceived(BMessage *msg); - #include "BitmapMenuItem.h" +private: + MenuWindow *menuWindow; + BRect rect; + menu_info info; + BMenu *menu; +}; - #ifndef MENU_H - #define MENU_H - - #include "msg.h" - - class FontSizeMenu : public BMenu { - public: - FontSizeMenu(); - virtual ~FontSizeMenu(); - virtual void Update(); - - menu_info info; - BMenuItem *fontSizeNine; - BMenuItem *fontSizeTen; - BMenuItem *fontSizeEleven; - BMenuItem *fontSizeTwelve; - BMenuItem *fontSizeFourteen; - BMenuItem *fontSizeEighteen; - }; - - class FontMenu : public BMenu { - public: - FontMenu(); - virtual ~FontMenu(); - virtual void GetFonts(); - virtual void Update(); - virtual status_t PlaceCheckMarkOnFont(font_family family, font_style style); - virtual void ClearAllMarkedItems(); - - menu_info info; - BMenuItem *fontFamily; - BMenu *fontStyleMenu; - BMenuItem *fontStyleItem; - }; - - class MenuBar : public BMenuBar { - public: - MenuBar(); - void set_menu(); - void build_menu(); - virtual void Update(); - virtual void FrameResized(float width, float height); - - BRect menu_rect; - BRect rect; - menu_info info; - - //seperator submenu - BMenu *separatorStyleMenu; - BMenuItem *separatorStyleZero; - BMenuItem *separatorStyleOne; - BMenuItem *separatorStyleTwo; - - //others - FontMenu *fontMenu; - FontSizeMenu *fontSizeMenu; - BMenuItem *clickToOpenItem; - BMenuItem *alwaysShowTriggersItem; - BMenuItem *colorSchemeItem; - BMenuItem *separatorStyleItem; - BMenuItem *ctlAsShortcutItem; - BMenuItem *altAsShortcutItem; - }; - - class ColorPicker : public BColorControl { - public: - ColorPicker(); - virtual ~ColorPicker(); - virtual void MessageReceived(BMessage *msg); - }; - - class ColorWindow : public BWindow { - public: - ColorWindow(); - virtual ~ColorWindow(); - virtual void MessageReceived(BMessage *msg); - - ColorPicker *colorPicker; - BButton *DefaultButton; - BButton *RevertButton; - menu_info revert_info; - menu_info info; - }; - - class MenuWindow : public BWindow { - public: - MenuWindow(); - virtual ~MenuWindow(); - virtual void MessageReceived(BMessage *msg); - virtual bool QuitRequested(); - virtual void Update(); - void Defaults(); - - bool revert; - ColorWindow *colorWindow; - BMenuItem *toggleItem; - menu_info info; - menu_info revert_info; - BRect rect; - BMenu *menu; - MenuBar *menuBar; - BBox *menuView; - BButton *revertButton; - BButton *defaultButton; - }; - - class MenuApp : public BApplication { - public: - MenuApp(); - virtual ~MenuApp(); - virtual void Update(); - virtual void MessageReceived(BMessage *msg); - virtual bool QuitRequested(); - - //main - MenuWindow *menuWindow; - BRect rect; - menu_info info; - BMenu *menu; - }; - - #endif +#endif diff --git a/src/preferences/menu/MenuBar.cpp b/src/preferences/menu/MenuBar.cpp index e5f202ca8b..492a7d7cd8 100644 --- a/src/preferences/menu/MenuBar.cpp +++ b/src/preferences/menu/MenuBar.cpp @@ -1,138 +1,141 @@ - #include "MenuApp.h" +#include "BitmapMenuItem.h" +#include "FontMenu.h" +#include "MenuBar.h" +#include "msg.h" - #include - #include - #include +#include +#include +#include +#include - #include - #include +#include +#include - MenuBar::MenuBar() - :BMenuBar(BRect(40,10,10,10), "menu", B_FOLLOW_TOP|B_FRAME_EVENTS, B_ITEMS_IN_COLUMN, true) - { - get_menu_info(&info); - build_menu(); - set_menu(); - } - - - void - MenuBar::build_menu() - { - // font and font size menus - fontMenu = new FontMenu(); - fontSizeMenu = new FontSizeMenu(); - - // create the menu items - clickToOpenItem = new BMenuItem("Click To Open", new BMessage(CLICK_OPEN_MSG), 0, 0); - alwaysShowTriggersItem = new BMenuItem("Always Show Triggers", new BMessage(ALLWAYS_TRIGGERS_MSG), 0, 0); - separatorStyleItem = new BMenuItem("Separator Style", new BMessage(DEFAULT_MSG), 0, 0); - ctlAsShortcutItem = new BitmapMenuItem("as Shortcut Key", - new BMessage(CTL_MARKED_MSG), BTranslationUtils::GetBitmap(B_RAW_TYPE, "CTL")); - altAsShortcutItem = new BitmapMenuItem("as Shortcut Key", - new BMessage(ALT_MARKED_MSG), BTranslationUtils::GetBitmap(B_RAW_TYPE, "ALT")); - - // color menu - colorSchemeItem = new BMenuItem("Color Scheme...", new BMessage(COLOR_SCHEME_MSG), 0, 0); - - // create the separator menu - separatorStyleMenu = new BMenu("Separator Style", B_ITEMS_IN_COLUMN); - separatorStyleMenu->SetRadioMode(true); - BMessage *msg = new BMessage(MENU_SEP_TYPE); - msg->AddInt32("sep", 0); - separatorStyleZero = new BitmapMenuItem(" ", msg, - BTranslationUtils::GetBitmap(B_RAW_TYPE, "SEP0")); - msg = new BMessage(MENU_SEP_TYPE); - msg->AddInt32("sep", 1); - separatorStyleOne = new BitmapMenuItem("", msg, BTranslationUtils::GetBitmap(B_RAW_TYPE, "SEP1")); - msg = new BMessage(MENU_SEP_TYPE); - msg->AddInt32("sep", 2); - separatorStyleTwo = new BitmapMenuItem("", msg, BTranslationUtils::GetBitmap(B_RAW_TYPE, "SEP2")); - if (info.separator == 0) - separatorStyleZero->SetMarked(true); - if (info.separator == 1) - separatorStyleOne->SetMarked(true); - if (info.separator == 2) - separatorStyleTwo->SetMarked(true); - separatorStyleMenu->AddItem(separatorStyleZero); - separatorStyleMenu->AddItem(separatorStyleOne); - separatorStyleMenu->AddItem(separatorStyleTwo); - separatorStyleMenu->SetTargetForItems(Window()); - - // Add items to menubar - AddItem(fontMenu, 0); - AddItem(fontSizeMenu, 1); - AddSeparatorItem(); - AddItem(clickToOpenItem); - AddItem(alwaysShowTriggersItem); - AddSeparatorItem(); - AddItem(colorSchemeItem); - AddItem(separatorStyleMenu); - AddSeparatorItem(); - AddItem(ctlAsShortcutItem); - AddItem(altAsShortcutItem); - SetTargetForItems(Window()); - } - - void - MenuBar::set_menu() - { - key_map *keys; - char *chars; - bool altAsShortcut; - - // get up-to-date menu info - get_menu_info(&info); - - alwaysShowTriggersItem->SetMarked(info.triggers_always_shown); +MenuBar::MenuBar() + :BMenuBar(BRect(40,10,10,10), "menu", B_FOLLOW_TOP|B_FRAME_EVENTS, B_ITEMS_IN_COLUMN, true) +{ + get_menu_info(&info); + build_menu(); + set_menu(); +} + +void +MenuBar::build_menu() +{ + // font and font size menus + fontMenu = new FontMenu(); + fontSizeMenu = new FontSizeMenu(); + + // create the menu items + clickToOpenItem = new BMenuItem("Click To Open", new BMessage(CLICK_OPEN_MSG), 0, 0); + alwaysShowTriggersItem = new BMenuItem("Always Show Triggers", new BMessage(ALLWAYS_TRIGGERS_MSG), 0, 0); + separatorStyleItem = new BMenuItem("Separator Style", new BMessage(DEFAULT_MSG), 0, 0); + ctlAsShortcutItem = new BitmapMenuItem("as Shortcut Key", + new BMessage(CTL_MARKED_MSG), BTranslationUtils::GetBitmap(B_RAW_TYPE, "CTL")); + altAsShortcutItem = new BitmapMenuItem("as Shortcut Key", + new BMessage(ALT_MARKED_MSG), BTranslationUtils::GetBitmap(B_RAW_TYPE, "ALT")); + + // color menu + colorSchemeItem = new BMenuItem("Color Scheme...", new BMessage(COLOR_SCHEME_MSG), 0, 0); + + // create the separator menu + separatorStyleMenu = new BMenu("Separator Style", B_ITEMS_IN_COLUMN); + separatorStyleMenu->SetRadioMode(true); + BMessage *msg = new BMessage(MENU_SEP_TYPE); + msg->AddInt32("sep", 0); + separatorStyleZero = new BitmapMenuItem(" ", msg, + BTranslationUtils::GetBitmap(B_RAW_TYPE, "SEP0")); + msg = new BMessage(MENU_SEP_TYPE); + msg->AddInt32("sep", 1); + separatorStyleOne = new BitmapMenuItem("", msg, BTranslationUtils::GetBitmap(B_RAW_TYPE, "SEP1")); + msg = new BMessage(MENU_SEP_TYPE); + msg->AddInt32("sep", 2); + separatorStyleTwo = new BitmapMenuItem("", msg, BTranslationUtils::GetBitmap(B_RAW_TYPE, "SEP2")); + if (info.separator == 0) + separatorStyleZero->SetMarked(true); + if (info.separator == 1) + separatorStyleOne->SetMarked(true); + if (info.separator == 2) + separatorStyleTwo->SetMarked(true); + separatorStyleMenu->AddItem(separatorStyleZero); + separatorStyleMenu->AddItem(separatorStyleOne); + separatorStyleMenu->AddItem(separatorStyleTwo); + separatorStyleMenu->SetTargetForItems(Window()); + + // Add items to menubar + AddItem(fontMenu, 0); + AddItem(fontSizeMenu, 1); + AddSeparatorItem(); + AddItem(clickToOpenItem); + AddItem(alwaysShowTriggersItem); + AddSeparatorItem(); + AddItem(colorSchemeItem); + AddItem(separatorStyleMenu); + AddSeparatorItem(); + AddItem(ctlAsShortcutItem); + AddItem(altAsShortcutItem); + SetTargetForItems(Window()); +} + +void +MenuBar::set_menu() +{ + key_map *keys; + char *chars; + bool altAsShortcut; + + // get up-to-date menu info + get_menu_info(&info); + + alwaysShowTriggersItem->SetMarked(info.triggers_always_shown); clickToOpenItem->SetMarked(info.click_to_open); - alwaysShowTriggersItem->SetEnabled(info.click_to_open); - - get_key_map(&keys, &chars); - - altAsShortcut = (keys->left_command_key == 0x5d) && (keys->right_command_key == 0x5f); - altAsShortcutItem->SetMarked(altAsShortcut); - ctlAsShortcutItem->SetMarked(!altAsShortcut); - - free(chars); - free(keys); - } + alwaysShowTriggersItem->SetEnabled(info.click_to_open); - void - MenuBar::Update() - { - // get up-to-date menu info - get_menu_info(&info); + get_key_map(&keys, &chars); + + altAsShortcut = (keys->left_command_key == 0x5d) && (keys->right_command_key == 0x5f); + altAsShortcutItem->SetMarked(altAsShortcut); + ctlAsShortcutItem->SetMarked(!altAsShortcut); + + free(chars); + free(keys); +} + +void +MenuBar::Update() +{ + // get up-to-date menu info + get_menu_info(&info); // update submenus - fontMenu->Update(); - fontSizeMenu->Update(); - + fontMenu->Update(); + fontSizeMenu->Update(); // this needs to be updated in case the Defaults - // were requested. - if (info.separator == 0) - separatorStyleZero->SetMarked(true); - else if (info.separator == 1) - separatorStyleOne->SetMarked(true); - else if (info.separator == 2) - separatorStyleTwo->SetMarked(true); - + // were requested. + if (info.separator == 0) + separatorStyleZero->SetMarked(true); + else if (info.separator == 1) + separatorStyleOne->SetMarked(true); + else if (info.separator == 2) + separatorStyleTwo->SetMarked(true); set_menu(); - - BFont font; - Window()->Lock(); - font.SetFamilyAndStyle(info.f_family, info.f_style); - font.SetSize(info.font_size); - SetFont(&font); - SetViewColor(info.background_color); - Window()->Unlock(); - // force the menu to redraw - InvalidateLayout(); - } - - void MenuBar::FrameResized(float width, float height) - { - Window()->PostMessage(UPDATE_WINDOW); - } + BFont font; + Window()->Lock(); + font.SetFamilyAndStyle(info.f_family, info.f_style); + font.SetSize(info.font_size); + SetFont(&font); + SetViewColor(info.background_color); + Window()->Unlock(); + + // force the menu to redraw + InvalidateLayout(); +} + + +void +MenuBar::FrameResized(float width, float height) +{ + Window()->PostMessage(UPDATE_WINDOW); +} diff --git a/src/preferences/menu/MenuBar.h b/src/preferences/menu/MenuBar.h new file mode 100644 index 0000000000..801af9896d --- /dev/null +++ b/src/preferences/menu/MenuBar.h @@ -0,0 +1,39 @@ +#ifndef __BARMENU_H +#define __BARMENU_H + +#include + +class BMenuItem; +class FontMenu; +class FontSizeMenu; + +class MenuBar : public BMenuBar { +public: + MenuBar(); + void set_menu(); + void build_menu(); + virtual void Update(); + virtual void FrameResized(float width, float height); + + BRect menu_rect; + BRect rect; + menu_info info; + + //seperator submenu + BMenu *separatorStyleMenu; + BMenuItem *separatorStyleZero; + BMenuItem *separatorStyleOne; + BMenuItem *separatorStyleTwo; + + //others + FontMenu *fontMenu; + FontSizeMenu *fontSizeMenu; + BMenuItem *clickToOpenItem; + BMenuItem *alwaysShowTriggersItem; + BMenuItem *colorSchemeItem; + BMenuItem *separatorStyleItem; + BMenuItem *ctlAsShortcutItem; + BMenuItem *altAsShortcutItem; +}; + +#endif diff --git a/src/preferences/menu/MenuWindow.cpp b/src/preferences/menu/MenuWindow.cpp index 9db2abffb8..86acd969b5 100644 --- a/src/preferences/menu/MenuWindow.cpp +++ b/src/preferences/menu/MenuWindow.cpp @@ -1,200 +1,209 @@ - #include "MenuApp.h" - #include - #include - #include - - MenuWindow::MenuWindow() - : BWindow(rect, "Menu", B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_NOT_RESIZABLE) - { - get_menu_info(&revert_info); - get_menu_info(&info); - - revert = false; - - MoveTo((rect.left += 100),(rect.top += 100)); +#include "ColorWindow.h" +#include "MenuApp.h" +#include "MenuBar.h" +#include "MenuWindow.h" +#include "msg.h" +#include +#include + +#include +#include +#include +#include +#include + +MenuWindow::MenuWindow() + : BWindow(rect, "Menu", B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_NOT_RESIZABLE) +{ + get_menu_info(&revert_info); + get_menu_info(&info); + + revert = false; + + MoveTo((rect.left += 100),(rect.top += 100)); menuView = new BBox(Bounds(), "menuView", B_FOLLOW_ALL_SIDES, - B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP, B_PLAIN_BORDER); - AddChild(menuView); - - menuBar = new MenuBar(); - menuView->AddChild(menuBar); - defaultButton = new BButton(BRect(10,0,85,20), "Default", "Defaults", - new BMessage(MENU_DEFAULT), B_FOLLOW_LEFT | B_FOLLOW_BOTTOM, B_WILL_DRAW | B_NAVIGABLE); - revertButton = new BButton(BRect(95,0,175,20), "Revert", "Revert", - new BMessage(MENU_REVERT), B_FOLLOW_LEFT | B_FOLLOW_BOTTOM, B_WILL_DRAW | B_NAVIGABLE); - revertButton->SetEnabled(false); - - menuView->AddChild(defaultButton); - menuView->AddChild(revertButton); - - menuView->MakeFocus(); - - Update(); - - } + B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP, B_PLAIN_BORDER); + AddChild(menuView); - MenuWindow::~MenuWindow() - {/*nothing to delete;*/} + menuBar = new MenuBar(); + menuView->AddChild(menuBar); + defaultButton = new BButton(BRect(10,0,85,20), "Default", "Defaults", + new BMessage(MENU_DEFAULT), B_FOLLOW_LEFT | B_FOLLOW_BOTTOM, B_WILL_DRAW | B_NAVIGABLE); + revertButton = new BButton(BRect(95,0,175,20), "Revert", "Revert", + new BMessage(MENU_REVERT), B_FOLLOW_LEFT | B_FOLLOW_BOTTOM, B_WILL_DRAW | B_NAVIGABLE); + revertButton->SetEnabled(false); - void - MenuWindow::MessageReceived(BMessage *msg) - { - switch(msg->what) { + menuView->AddChild(defaultButton); + menuView->AddChild(revertButton); + + menuView->MakeFocus(); - case MENU_REVERT: - set_menu_info(&revert_info); - revert = false; - Update(); - break; - - case MENU_DEFAULT: - Defaults(); - break; - - case UPDATE_WINDOW: - Update(); - break; - - case MENU_FONT_FAMILY: - case MENU_FONT_STYLE: - { - font_family *family; - msg->FindPointer("family", (void**)&family); - font_style *style; - msg->FindPointer("style", (void**)&style); - memcpy(info.f_family, family, sizeof(info.f_family)); - memcpy(info.f_style, style, sizeof(info.f_style)); - set_menu_info(&info); - Update(); - break; - } - - case MENU_FONT_SIZE: - revert = true; - float f; - msg->FindFloat("size", &f); - info.font_size = f; - set_menu_info(&info); - Update(); - break; - - case MENU_SEP_TYPE: - revert = true; - int32 i; - msg->FindInt32("sep", &i); - info.separator = i; - set_menu_info(&info); - Update(); - break; - - case CLICK_OPEN_MSG: - revert = true; - if (info.click_to_open != true) - info.click_to_open = true; - else - info.click_to_open = false; - set_menu_info(&info); - menuBar->set_menu(); - Update(); - break; - - case ALLWAYS_TRIGGERS_MSG: - revert = true; - if (info.triggers_always_shown != true) - info.triggers_always_shown = true; - else - info.triggers_always_shown = false; - set_menu_info(&info); - menuBar->set_menu(); - Update(); - break; - - case CTL_MARKED_MSG: - revert = true; - menuBar->ctlAsShortcutItem->SetMarked(true); - menuBar->altAsShortcutItem->SetMarked(false); - // This might not be the same for all keyboards - set_modifier_key(B_LEFT_COMMAND_KEY, 0x5c); - set_modifier_key(B_RIGHT_COMMAND_KEY, 0x60); - set_modifier_key(B_LEFT_CONTROL_KEY, 0x5d); - set_modifier_key(B_RIGHT_OPTION_KEY, 0x5f); + Update(); + +} - be_roster->Broadcast(new BMessage(B_MODIFIERS_CHANGED)); - Update(); - break; - - case ALT_MARKED_MSG: - revert = true; - menuBar->altAsShortcutItem->SetMarked(true); - menuBar->ctlAsShortcutItem->SetMarked(false); - // This might not be the same for all keyboards - set_modifier_key(B_LEFT_COMMAND_KEY, 0x5d); - set_modifier_key(B_RIGHT_COMMAND_KEY, 0x5f); - set_modifier_key(B_LEFT_CONTROL_KEY, 0x5c); - set_modifier_key(B_RIGHT_OPTION_KEY, 0x60); - - be_roster->Broadcast(new BMessage(B_MODIFIERS_CHANGED)); - Update(); - break; - - case COLOR_SCHEME_MSG: - colorWindow = new ColorWindow(); - colorWindow->Show(); - break; - - case MENU_COLOR: - set_menu_info(&info); - (new BAlert("test","we made it","cool"))->Go(); - break; - - default: - BMessage(msg); - break; - } - } + +void +MenuWindow::MessageReceived(BMessage *msg) +{ + switch(msg->what) { - bool - MenuWindow::QuitRequested() + case MENU_REVERT: + set_menu_info(&revert_info); + revert = false; + Update(); + break; + + case MENU_DEFAULT: + Defaults(); + break; + + case UPDATE_WINDOW: + Update(); + break; + + case MENU_FONT_FAMILY: + case MENU_FONT_STYLE: { - be_app->PostMessage(B_QUIT_REQUESTED); - return true; - } - - void - MenuWindow::Update() - { - revertButton->SetEnabled(revert); - - // alert the rest of the application to update - menuBar->Update(); - - // resize the window according to the size of menuBar - ResizeTo((menuBar->Frame().right + 35), (menuBar->Frame().bottom + 45)); - } - - void - MenuWindow::Defaults() - { - // to set the default color. this should be changed - // to the system color for system wide compatability. - rgb_color color; - color.red = 219; - color.blue = 219; - color.green = 219; - color.alpha = 255; - - // the default settings. possibly a call to the app_server - // would provide and execute this information, as it does - // for get_menu_info and set_menu_info (or is this information - // coming from libbe.so? or else where?). - info.font_size = 12; - //info.f_family = "test"; - //info.f_style = "test"; - info.background_color = color; - info.separator = 0; - info.click_to_open = true; - info.triggers_always_shown = false; + font_family *family; + msg->FindPointer("family", (void**)&family); + font_style *style; + msg->FindPointer("style", (void**)&style); + memcpy(info.f_family, family, sizeof(info.f_family)); + memcpy(info.f_style, style, sizeof(info.f_style)); set_menu_info(&info); Update(); + break; } + + case MENU_FONT_SIZE: + revert = true; + float f; + msg->FindFloat("size", &f); + info.font_size = f; + set_menu_info(&info); + Update(); + break; + + case MENU_SEP_TYPE: + revert = true; + int32 i; + msg->FindInt32("sep", &i); + info.separator = i; + set_menu_info(&info); + Update(); + break; + + case CLICK_OPEN_MSG: + revert = true; + if (info.click_to_open != true) + info.click_to_open = true; + else + info.click_to_open = false; + set_menu_info(&info); + menuBar->set_menu(); + Update(); + break; + + case ALLWAYS_TRIGGERS_MSG: + revert = true; + if (info.triggers_always_shown != true) + info.triggers_always_shown = true; + else + info.triggers_always_shown = false; + set_menu_info(&info); + menuBar->set_menu(); + Update(); + break; + + case CTL_MARKED_MSG: + revert = true; + menuBar->ctlAsShortcutItem->SetMarked(true); + menuBar->altAsShortcutItem->SetMarked(false); + // This might not be the same for all keyboards + set_modifier_key(B_LEFT_COMMAND_KEY, 0x5c); + set_modifier_key(B_RIGHT_COMMAND_KEY, 0x60); + set_modifier_key(B_LEFT_CONTROL_KEY, 0x5d); + set_modifier_key(B_RIGHT_OPTION_KEY, 0x5f); + be_roster->Broadcast(new BMessage(B_MODIFIERS_CHANGED)); + Update(); + break; + + case ALT_MARKED_MSG: + revert = true; + menuBar->altAsShortcutItem->SetMarked(true); + menuBar->ctlAsShortcutItem->SetMarked(false); + // This might not be the same for all keyboards + set_modifier_key(B_LEFT_COMMAND_KEY, 0x5d); + set_modifier_key(B_RIGHT_COMMAND_KEY, 0x5f); + set_modifier_key(B_LEFT_CONTROL_KEY, 0x5c); + set_modifier_key(B_RIGHT_OPTION_KEY, 0x60); + + be_roster->Broadcast(new BMessage(B_MODIFIERS_CHANGED)); + Update(); + break; + + case COLOR_SCHEME_MSG: + colorWindow = new ColorWindow(); + colorWindow->Show(); + break; + + case MENU_COLOR: + set_menu_info(&info); + (new BAlert("test","we made it","cool"))->Go(); + break; + + default: + BMessage(msg); + break; + } +} + + +bool +MenuWindow::QuitRequested() +{ + be_app->PostMessage(B_QUIT_REQUESTED); + return BWindow::QuitRequested(); +} + + +void +MenuWindow::Update() +{ + revertButton->SetEnabled(revert); + + // alert the rest of the application to update + menuBar->Update(); + + // resize the window according to the size of menuBar + ResizeTo((menuBar->Frame().right + 35), (menuBar->Frame().bottom + 45)); +} + + +void +MenuWindow::Defaults() +{ + // to set the default color. this should be changed + // to the system color for system wide compatability. + rgb_color color; + color.red = 219; + color.blue = 219; + color.green = 219; + color.alpha = 255; + + // the default settings. possibly a call to the app_server + // would provide and execute this information, as it does + // for get_menu_info and set_menu_info (or is this information + // coming from libbe.so? or else where?). + info.font_size = 12; + //info.f_family = "test"; + //info.f_style = "test"; + info.background_color = color; + info.separator = 0; + info.click_to_open = true; + info.triggers_always_shown = false; + set_menu_info(&info); + Update(); +} diff --git a/src/preferences/menu/MenuWindow.h b/src/preferences/menu/MenuWindow.h new file mode 100644 index 0000000000..d2c49d42c7 --- /dev/null +++ b/src/preferences/menu/MenuWindow.h @@ -0,0 +1,34 @@ +#ifndef __MENU_WINDOW_H +#define __MENU_WINDOW_H + +#include + +class ColorWindow; +class BMenuItem; +class BMenu; +class BBox; +class BButton; +class MenuBar; +class MenuWindow : public BWindow { +public: + MenuWindow(); + virtual void MessageReceived(BMessage *msg); + virtual bool QuitRequested(); + virtual void Update(); + void Defaults(); + +private: + bool revert; + ColorWindow *colorWindow; + BMenuItem *toggleItem; + menu_info info; + menu_info revert_info; + BRect rect; + BMenu *menu; + MenuBar *menuBar; + BBox *menuView; + BButton *revertButton; + BButton *defaultButton; +}; + +#endif