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
This commit is contained in:
@@ -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) {
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,14 @@
|
||||
#include <Application.h>
|
||||
#include <Button.h>
|
||||
#include <ColorControl.h>
|
||||
#include <Menu.h>
|
||||
|
||||
#include "MenuApp.h"
|
||||
#include "ColorWindow.h"
|
||||
#include "msg.h"
|
||||
|
||||
ColorWindow::ColorWindow()
|
||||
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);
|
||||
@@ -11,7 +16,9 @@
|
||||
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();
|
||||
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);
|
||||
@@ -26,14 +33,12 @@
|
||||
|
||||
colView->AddChild(DefaultButton);
|
||||
colView->AddChild(RevertButton);
|
||||
}
|
||||
}
|
||||
|
||||
ColorWindow::~ColorWindow()
|
||||
{}
|
||||
|
||||
void
|
||||
ColorWindow::MessageReceived(BMessage *msg)
|
||||
{
|
||||
void
|
||||
ColorWindow::MessageReceived(BMessage *msg)
|
||||
{
|
||||
switch(msg->what) {
|
||||
|
||||
case MENU_REVERT:
|
||||
@@ -65,4 +70,4 @@
|
||||
BMessage(msg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
#ifndef __COLORWINDOW_H
|
||||
#define __COLORWINDOW_H
|
||||
|
||||
#include <Menu.h>
|
||||
#include <Window.h>
|
||||
|
||||
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
|
||||
@@ -1,21 +1,22 @@
|
||||
#include "FontMenu.h"
|
||||
#include "msg.h"
|
||||
|
||||
#include "MenuApp.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
FontMenu::FontMenu()
|
||||
#include <Message.h>
|
||||
#include <MenuItem.h>
|
||||
|
||||
FontMenu::FontMenu()
|
||||
: BMenu("Font", B_ITEMS_IN_COLUMN)
|
||||
{
|
||||
{
|
||||
get_menu_info(&info);
|
||||
SetRadioMode(true);
|
||||
GetFonts();
|
||||
}
|
||||
}
|
||||
|
||||
FontMenu::~FontMenu()
|
||||
{ /*nothing to clean up*/}
|
||||
|
||||
void
|
||||
FontMenu::GetFonts()
|
||||
{
|
||||
void
|
||||
FontMenu::GetFonts()
|
||||
{
|
||||
int32 numFamilies = count_font_families();
|
||||
for ( int32 i = 0; i < numFamilies; i++ ) {
|
||||
font_family *family = (font_family*)malloc(sizeof(font_family));
|
||||
@@ -45,11 +46,11 @@
|
||||
AddItem(fontFamily);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
FontMenu::Update()
|
||||
{
|
||||
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
|
||||
@@ -62,7 +63,6 @@
|
||||
SetFont(&font);
|
||||
SetViewColor(info.background_color);
|
||||
InvalidateLayout();
|
||||
|
||||
// font style menus
|
||||
for (int i = 0; i < CountItems(); i++) {
|
||||
ItemAt(i)->Submenu()->SetFont(&font);
|
||||
@@ -70,17 +70,16 @@
|
||||
|
||||
ClearAllMarkedItems();
|
||||
PlaceCheckMarkOnFont(info.f_family, info.f_style);
|
||||
}
|
||||
}
|
||||
|
||||
status_t
|
||||
FontMenu::PlaceCheckMarkOnFont(font_family family, font_style 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);
|
||||
@@ -89,7 +88,6 @@
|
||||
if ((styleMenu != NULL) && (style != NULL))
|
||||
{
|
||||
fontStyleItem = styleMenu->FindItem(style);
|
||||
|
||||
if (fontStyleItem != NULL)
|
||||
{
|
||||
fontStyleItem->SetMarked(true);
|
||||
@@ -102,13 +100,13 @@
|
||||
else
|
||||
return B_ERROR;
|
||||
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
FontMenu::ClearAllMarkedItems()
|
||||
{
|
||||
|
||||
void
|
||||
FontMenu::ClearAllMarkedItems()
|
||||
{
|
||||
// we need to clear all menuitems and submenuitems
|
||||
for (int i = 0; i < CountItems(); i++) {
|
||||
ItemAt(i)->SetMarked(false);
|
||||
@@ -118,5 +116,4 @@
|
||||
submenu->ItemAt(j)->SetMarked(false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
#ifndef __FONTMENU_H
|
||||
#define __FONTMENU_H
|
||||
|
||||
#include <Menu.h>
|
||||
|
||||
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
|
||||
@@ -1,9 +1,13 @@
|
||||
#include "FontMenu.h"
|
||||
#include "msg.h"
|
||||
|
||||
#include "MenuApp.h"
|
||||
#include <Message.h>
|
||||
#include <MenuItem.h>
|
||||
#include <Window.h>
|
||||
|
||||
FontSizeMenu::FontSizeMenu()
|
||||
FontSizeMenu::FontSizeMenu()
|
||||
:BMenu("Font Size", B_ITEMS_IN_COLUMN)
|
||||
{
|
||||
{
|
||||
get_menu_info(&info);
|
||||
|
||||
BMessage *msg = new BMessage(MENU_FONT_SIZE);
|
||||
@@ -44,14 +48,12 @@
|
||||
|
||||
SetTargetForItems(Window());
|
||||
SetRadioMode(true);
|
||||
}
|
||||
}
|
||||
|
||||
FontSizeMenu::~FontSizeMenu()
|
||||
{ }
|
||||
|
||||
void
|
||||
FontSizeMenu::Update()
|
||||
{
|
||||
void
|
||||
FontSizeMenu::Update()
|
||||
{
|
||||
get_menu_info(&info);
|
||||
BFont font;
|
||||
|
||||
@@ -66,4 +68,4 @@
|
||||
InvalidateLayout();
|
||||
Invalidate();
|
||||
SetEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ SubDir HAIKU_TOP src preferences menu ;
|
||||
|
||||
Preference Menu :
|
||||
BitmapMenuItem.cpp
|
||||
ColorPicker.cpp
|
||||
ColorWindow.cpp
|
||||
FontMenu.cpp
|
||||
FontSizeMenu.cpp
|
||||
|
||||
@@ -1,40 +1,28 @@
|
||||
#include "MenuApp.h"
|
||||
#include "MenuWindow.h"
|
||||
#include "msg.h"
|
||||
|
||||
#include "MenuApp.h"
|
||||
|
||||
MenuApp::MenuApp()
|
||||
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;
|
||||
}
|
||||
|
||||
void
|
||||
MenuApp::Update()
|
||||
{
|
||||
void
|
||||
MenuApp::Update()
|
||||
{
|
||||
menuWindow->Update();
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
new MenuApp();
|
||||
be_app -> Run();
|
||||
delete be_app;
|
||||
}
|
||||
|
||||
void
|
||||
MenuApp::MessageReceived(BMessage *msg){
|
||||
void
|
||||
MenuApp::MessageReceived(BMessage *msg)
|
||||
{
|
||||
switch(msg->what) {
|
||||
|
||||
//others
|
||||
@@ -49,7 +37,16 @@
|
||||
break;
|
||||
|
||||
default:
|
||||
BMessage(msg);
|
||||
BApplication::MessageReceived(msg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
new MenuApp();
|
||||
be_app->Run();
|
||||
delete be_app;
|
||||
}
|
||||
|
||||
|
||||
+10
-123
@@ -1,134 +1,21 @@
|
||||
#include <Application.h>
|
||||
#include <Button.h>
|
||||
#include <ColorControl.h>
|
||||
#include <Window.h>
|
||||
#include <Box.h>
|
||||
#include <Alert.h>
|
||||
#include <Menu.h>
|
||||
#include <MenuBar.h>
|
||||
#include <MenuItem.h>
|
||||
#ifndef __MENU_APP_H
|
||||
#define __MENU_APP_H
|
||||
|
||||
#include "BitmapMenuItem.h"
|
||||
#include <Application.h>
|
||||
#include <Menu.h>
|
||||
|
||||
#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:
|
||||
class MenuWindow;
|
||||
class MenuApp : public BApplication {
|
||||
public:
|
||||
MenuApp();
|
||||
virtual ~MenuApp();
|
||||
virtual void Update();
|
||||
virtual void MessageReceived(BMessage *msg);
|
||||
virtual bool QuitRequested();
|
||||
|
||||
//main
|
||||
private:
|
||||
MenuWindow *menuWindow;
|
||||
BRect rect;
|
||||
menu_info info;
|
||||
BMenu *menu;
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1,24 +1,28 @@
|
||||
#include "MenuApp.h"
|
||||
#include "BitmapMenuItem.h"
|
||||
#include "FontMenu.h"
|
||||
#include "MenuBar.h"
|
||||
#include "msg.h"
|
||||
|
||||
#include <Application.h>
|
||||
#include <Resources.h>
|
||||
#include <TranslationUtils.h>
|
||||
#include <Application.h>
|
||||
#include <Resources.h>
|
||||
#include <TranslationUtils.h>
|
||||
#include <Window.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
MenuBar::MenuBar()
|
||||
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()
|
||||
{
|
||||
void
|
||||
MenuBar::build_menu()
|
||||
{
|
||||
// font and font size menus
|
||||
fontMenu = new FontMenu();
|
||||
fontSizeMenu = new FontSizeMenu();
|
||||
@@ -72,11 +76,11 @@
|
||||
AddItem(ctlAsShortcutItem);
|
||||
AddItem(altAsShortcutItem);
|
||||
SetTargetForItems(Window());
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MenuBar::set_menu()
|
||||
{
|
||||
void
|
||||
MenuBar::set_menu()
|
||||
{
|
||||
key_map *keys;
|
||||
char *chars;
|
||||
bool altAsShortcut;
|
||||
@@ -85,7 +89,6 @@
|
||||
get_menu_info(&info);
|
||||
|
||||
alwaysShowTriggersItem->SetMarked(info.triggers_always_shown);
|
||||
|
||||
clickToOpenItem->SetMarked(info.click_to_open);
|
||||
alwaysShowTriggersItem->SetEnabled(info.click_to_open);
|
||||
|
||||
@@ -97,18 +100,17 @@
|
||||
|
||||
free(chars);
|
||||
free(keys);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MenuBar::Update()
|
||||
{
|
||||
|
||||
void
|
||||
MenuBar::Update()
|
||||
{
|
||||
// get up-to-date menu info
|
||||
get_menu_info(&info);
|
||||
|
||||
// update submenus
|
||||
fontMenu->Update();
|
||||
fontSizeMenu->Update();
|
||||
|
||||
// this needs to be updated in case the Defaults
|
||||
// were requested.
|
||||
if (info.separator == 0)
|
||||
@@ -117,7 +119,6 @@
|
||||
separatorStyleOne->SetMarked(true);
|
||||
else if (info.separator == 2)
|
||||
separatorStyleTwo->SetMarked(true);
|
||||
|
||||
set_menu();
|
||||
|
||||
BFont font;
|
||||
@@ -130,9 +131,11 @@
|
||||
|
||||
// force the menu to redraw
|
||||
InvalidateLayout();
|
||||
}
|
||||
}
|
||||
|
||||
void MenuBar::FrameResized(float width, float height)
|
||||
{
|
||||
|
||||
void
|
||||
MenuBar::FrameResized(float width, float height)
|
||||
{
|
||||
Window()->PostMessage(UPDATE_WINDOW);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
#ifndef __BARMENU_H
|
||||
#define __BARMENU_H
|
||||
|
||||
#include <MenuBar.h>
|
||||
|
||||
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
|
||||
@@ -1,18 +1,27 @@
|
||||
#include "MenuApp.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <Roster.h>
|
||||
#include "ColorWindow.h"
|
||||
#include "MenuApp.h"
|
||||
#include "MenuBar.h"
|
||||
#include "MenuWindow.h"
|
||||
#include "msg.h"
|
||||
|
||||
MenuWindow::MenuWindow()
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <Alert.h>
|
||||
#include <Box.h>
|
||||
#include <Button.h>
|
||||
#include <MenuItem.h>
|
||||
#include <Roster.h>
|
||||
|
||||
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);
|
||||
@@ -32,14 +41,12 @@
|
||||
|
||||
Update();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
MenuWindow::~MenuWindow()
|
||||
{/*nothing to delete;*/}
|
||||
|
||||
void
|
||||
MenuWindow::MessageReceived(BMessage *msg)
|
||||
{
|
||||
void
|
||||
MenuWindow::MessageReceived(BMessage *msg)
|
||||
{
|
||||
switch(msg->what) {
|
||||
|
||||
case MENU_REVERT:
|
||||
@@ -119,7 +126,6 @@
|
||||
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;
|
||||
@@ -152,18 +158,20 @@
|
||||
BMessage(msg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
MenuWindow::QuitRequested()
|
||||
{
|
||||
|
||||
bool
|
||||
MenuWindow::QuitRequested()
|
||||
{
|
||||
be_app->PostMessage(B_QUIT_REQUESTED);
|
||||
return true;
|
||||
}
|
||||
return BWindow::QuitRequested();
|
||||
}
|
||||
|
||||
void
|
||||
MenuWindow::Update()
|
||||
{
|
||||
|
||||
void
|
||||
MenuWindow::Update()
|
||||
{
|
||||
revertButton->SetEnabled(revert);
|
||||
|
||||
// alert the rest of the application to update
|
||||
@@ -171,11 +179,12 @@
|
||||
|
||||
// resize the window according to the size of menuBar
|
||||
ResizeTo((menuBar->Frame().right + 35), (menuBar->Frame().bottom + 45));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MenuWindow::Defaults()
|
||||
{
|
||||
|
||||
void
|
||||
MenuWindow::Defaults()
|
||||
{
|
||||
// to set the default color. this should be changed
|
||||
// to the system color for system wide compatability.
|
||||
rgb_color color;
|
||||
@@ -197,4 +206,4 @@
|
||||
info.triggers_always_shown = false;
|
||||
set_menu_info(&info);
|
||||
Update();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
#ifndef __MENU_WINDOW_H
|
||||
#define __MENU_WINDOW_H
|
||||
|
||||
#include <Window.h>
|
||||
|
||||
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
|
||||
Reference in New Issue
Block a user