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,5 +1,10 @@
|
|||||||
|
#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)
|
: BWindow(BRect(150,150,350,200), "Menu Color Scheme", B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_NOT_RESIZABLE)
|
||||||
@@ -11,7 +16,9 @@
|
|||||||
BView *colView = new BView(BRect(0,0,1000,100), "menuView",
|
BView *colView = new BView(BRect(0,0,1000,100), "menuView",
|
||||||
B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE);
|
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->SetViewColor(219,219,219,255);
|
||||||
colView->AddChild(colorPicker);
|
colView->AddChild(colorPicker);
|
||||||
AddChild(colView);
|
AddChild(colView);
|
||||||
@@ -28,8 +35,6 @@
|
|||||||
colView->AddChild(RevertButton);
|
colView->AddChild(RevertButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
ColorWindow::~ColorWindow()
|
|
||||||
{}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ColorWindow::MessageReceived(BMessage *msg)
|
ColorWindow::MessageReceived(BMessage *msg)
|
||||||
|
|||||||
@@ -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,7 +1,11 @@
|
|||||||
|
#include "FontMenu.h"
|
||||||
|
#include "msg.h"
|
||||||
|
|
||||||
#include "MenuApp.h"
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include <Message.h>
|
||||||
|
#include <MenuItem.h>
|
||||||
|
|
||||||
FontMenu::FontMenu()
|
FontMenu::FontMenu()
|
||||||
: BMenu("Font", B_ITEMS_IN_COLUMN)
|
: BMenu("Font", B_ITEMS_IN_COLUMN)
|
||||||
{
|
{
|
||||||
@@ -10,9 +14,6 @@
|
|||||||
GetFonts();
|
GetFonts();
|
||||||
}
|
}
|
||||||
|
|
||||||
FontMenu::~FontMenu()
|
|
||||||
{ /*nothing to clean up*/}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
FontMenu::GetFonts()
|
FontMenu::GetFonts()
|
||||||
{
|
{
|
||||||
@@ -62,7 +63,6 @@
|
|||||||
SetFont(&font);
|
SetFont(&font);
|
||||||
SetViewColor(info.background_color);
|
SetViewColor(info.background_color);
|
||||||
InvalidateLayout();
|
InvalidateLayout();
|
||||||
|
|
||||||
// font style menus
|
// font style menus
|
||||||
for (int i = 0; i < CountItems(); i++) {
|
for (int i = 0; i < CountItems(); i++) {
|
||||||
ItemAt(i)->Submenu()->SetFont(&font);
|
ItemAt(i)->Submenu()->SetFont(&font);
|
||||||
@@ -80,7 +80,6 @@
|
|||||||
BMenu *styleMenu;
|
BMenu *styleMenu;
|
||||||
|
|
||||||
fontFamilyItem = FindItem(family);
|
fontFamilyItem = FindItem(family);
|
||||||
|
|
||||||
if ((fontFamilyItem != NULL) && (family != NULL))
|
if ((fontFamilyItem != NULL) && (family != NULL))
|
||||||
{
|
{
|
||||||
fontFamilyItem->SetMarked(true);
|
fontFamilyItem->SetMarked(true);
|
||||||
@@ -89,7 +88,6 @@
|
|||||||
if ((styleMenu != NULL) && (style != NULL))
|
if ((styleMenu != NULL) && (style != NULL))
|
||||||
{
|
{
|
||||||
fontStyleItem = styleMenu->FindItem(style);
|
fontStyleItem = styleMenu->FindItem(style);
|
||||||
|
|
||||||
if (fontStyleItem != NULL)
|
if (fontStyleItem != NULL)
|
||||||
{
|
{
|
||||||
fontStyleItem->SetMarked(true);
|
fontStyleItem->SetMarked(true);
|
||||||
@@ -102,10 +100,10 @@
|
|||||||
else
|
else
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
FontMenu::ClearAllMarkedItems()
|
FontMenu::ClearAllMarkedItems()
|
||||||
{
|
{
|
||||||
@@ -118,5 +116,4 @@
|
|||||||
submenu->ItemAt(j)->SetMarked(false);
|
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,5 +1,9 @@
|
|||||||
|
#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)
|
:BMenu("Font Size", B_ITEMS_IN_COLUMN)
|
||||||
@@ -46,8 +50,6 @@
|
|||||||
SetRadioMode(true);
|
SetRadioMode(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
FontSizeMenu::~FontSizeMenu()
|
|
||||||
{ }
|
|
||||||
|
|
||||||
void
|
void
|
||||||
FontSizeMenu::Update()
|
FontSizeMenu::Update()
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ SubDir HAIKU_TOP src preferences menu ;
|
|||||||
|
|
||||||
Preference Menu :
|
Preference Menu :
|
||||||
BitmapMenuItem.cpp
|
BitmapMenuItem.cpp
|
||||||
ColorPicker.cpp
|
|
||||||
ColorWindow.cpp
|
ColorWindow.cpp
|
||||||
FontMenu.cpp
|
FontMenu.cpp
|
||||||
FontSizeMenu.cpp
|
FontSizeMenu.cpp
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
#include "MenuApp.h"
|
#include "MenuApp.h"
|
||||||
|
#include "MenuWindow.h"
|
||||||
|
#include "msg.h"
|
||||||
|
|
||||||
MenuApp::MenuApp()
|
MenuApp::MenuApp()
|
||||||
: BApplication("application/x-vnd.Be-GGUI")
|
: BApplication("application/x-vnd.Be-GGUI")
|
||||||
@@ -11,14 +12,6 @@
|
|||||||
menuWindow->Show();
|
menuWindow->Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuApp::~MenuApp()
|
|
||||||
{/*nothing to clean up*/}
|
|
||||||
|
|
||||||
bool
|
|
||||||
MenuApp::QuitRequested()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MenuApp::Update()
|
MenuApp::Update()
|
||||||
@@ -26,15 +19,10 @@
|
|||||||
menuWindow->Update();
|
menuWindow->Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
new MenuApp();
|
|
||||||
be_app -> Run();
|
|
||||||
delete be_app;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MenuApp::MessageReceived(BMessage *msg){
|
MenuApp::MessageReceived(BMessage *msg)
|
||||||
|
{
|
||||||
switch(msg->what) {
|
switch(msg->what) {
|
||||||
|
|
||||||
//others
|
//others
|
||||||
@@ -49,7 +37,16 @@
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
BMessage(msg);
|
BApplication::MessageReceived(msg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
new MenuApp();
|
||||||
|
be_app->Run();
|
||||||
|
delete be_app;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,130 +1,17 @@
|
|||||||
|
#ifndef __MENU_APP_H
|
||||||
|
#define __MENU_APP_H
|
||||||
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <Button.h>
|
|
||||||
#include <ColorControl.h>
|
|
||||||
#include <Window.h>
|
|
||||||
#include <Box.h>
|
|
||||||
#include <Alert.h>
|
|
||||||
#include <Menu.h>
|
#include <Menu.h>
|
||||||
#include <MenuBar.h>
|
|
||||||
#include <MenuItem.h>
|
|
||||||
|
|
||||||
#include "BitmapMenuItem.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 MenuWindow;
|
||||||
class MenuApp : public BApplication {
|
class MenuApp : public BApplication {
|
||||||
public:
|
public:
|
||||||
MenuApp();
|
MenuApp();
|
||||||
virtual ~MenuApp();
|
|
||||||
virtual void Update();
|
virtual void Update();
|
||||||
virtual void MessageReceived(BMessage *msg);
|
virtual void MessageReceived(BMessage *msg);
|
||||||
virtual bool QuitRequested();
|
|
||||||
|
|
||||||
//main
|
private:
|
||||||
MenuWindow *menuWindow;
|
MenuWindow *menuWindow;
|
||||||
BRect rect;
|
BRect rect;
|
||||||
menu_info info;
|
menu_info info;
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
#include "MenuApp.h"
|
#include "BitmapMenuItem.h"
|
||||||
|
#include "FontMenu.h"
|
||||||
|
#include "MenuBar.h"
|
||||||
|
#include "msg.h"
|
||||||
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <Resources.h>
|
#include <Resources.h>
|
||||||
#include <TranslationUtils.h>
|
#include <TranslationUtils.h>
|
||||||
|
#include <Window.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -85,7 +89,6 @@
|
|||||||
get_menu_info(&info);
|
get_menu_info(&info);
|
||||||
|
|
||||||
alwaysShowTriggersItem->SetMarked(info.triggers_always_shown);
|
alwaysShowTriggersItem->SetMarked(info.triggers_always_shown);
|
||||||
|
|
||||||
clickToOpenItem->SetMarked(info.click_to_open);
|
clickToOpenItem->SetMarked(info.click_to_open);
|
||||||
alwaysShowTriggersItem->SetEnabled(info.click_to_open);
|
alwaysShowTriggersItem->SetEnabled(info.click_to_open);
|
||||||
|
|
||||||
@@ -99,16 +102,15 @@
|
|||||||
free(keys);
|
free(keys);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MenuBar::Update()
|
MenuBar::Update()
|
||||||
{
|
{
|
||||||
// get up-to-date menu info
|
// get up-to-date menu info
|
||||||
get_menu_info(&info);
|
get_menu_info(&info);
|
||||||
|
|
||||||
// update submenus
|
// update submenus
|
||||||
fontMenu->Update();
|
fontMenu->Update();
|
||||||
fontSizeMenu->Update();
|
fontSizeMenu->Update();
|
||||||
|
|
||||||
// this needs to be updated in case the Defaults
|
// this needs to be updated in case the Defaults
|
||||||
// were requested.
|
// were requested.
|
||||||
if (info.separator == 0)
|
if (info.separator == 0)
|
||||||
@@ -117,7 +119,6 @@
|
|||||||
separatorStyleOne->SetMarked(true);
|
separatorStyleOne->SetMarked(true);
|
||||||
else if (info.separator == 2)
|
else if (info.separator == 2)
|
||||||
separatorStyleTwo->SetMarked(true);
|
separatorStyleTwo->SetMarked(true);
|
||||||
|
|
||||||
set_menu();
|
set_menu();
|
||||||
|
|
||||||
BFont font;
|
BFont font;
|
||||||
@@ -132,7 +133,9 @@
|
|||||||
InvalidateLayout();
|
InvalidateLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuBar::FrameResized(float width, float height)
|
|
||||||
|
void
|
||||||
|
MenuBar::FrameResized(float width, float height)
|
||||||
{
|
{
|
||||||
Window()->PostMessage(UPDATE_WINDOW);
|
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,6 +1,16 @@
|
|||||||
|
#include "ColorWindow.h"
|
||||||
#include "MenuApp.h"
|
#include "MenuApp.h"
|
||||||
|
#include "MenuBar.h"
|
||||||
|
#include "MenuWindow.h"
|
||||||
|
#include "msg.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <Alert.h>
|
||||||
|
#include <Box.h>
|
||||||
|
#include <Button.h>
|
||||||
|
#include <MenuItem.h>
|
||||||
#include <Roster.h>
|
#include <Roster.h>
|
||||||
|
|
||||||
MenuWindow::MenuWindow()
|
MenuWindow::MenuWindow()
|
||||||
@@ -12,7 +22,6 @@
|
|||||||
revert = false;
|
revert = false;
|
||||||
|
|
||||||
MoveTo((rect.left += 100),(rect.top += 100));
|
MoveTo((rect.left += 100),(rect.top += 100));
|
||||||
|
|
||||||
menuView = new BBox(Bounds(), "menuView", B_FOLLOW_ALL_SIDES,
|
menuView = new BBox(Bounds(), "menuView", B_FOLLOW_ALL_SIDES,
|
||||||
B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP, B_PLAIN_BORDER);
|
B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP, B_PLAIN_BORDER);
|
||||||
AddChild(menuView);
|
AddChild(menuView);
|
||||||
@@ -34,8 +43,6 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuWindow::~MenuWindow()
|
|
||||||
{/*nothing to delete;*/}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MenuWindow::MessageReceived(BMessage *msg)
|
MenuWindow::MessageReceived(BMessage *msg)
|
||||||
@@ -119,7 +126,6 @@
|
|||||||
set_modifier_key(B_RIGHT_COMMAND_KEY, 0x60);
|
set_modifier_key(B_RIGHT_COMMAND_KEY, 0x60);
|
||||||
set_modifier_key(B_LEFT_CONTROL_KEY, 0x5d);
|
set_modifier_key(B_LEFT_CONTROL_KEY, 0x5d);
|
||||||
set_modifier_key(B_RIGHT_OPTION_KEY, 0x5f);
|
set_modifier_key(B_RIGHT_OPTION_KEY, 0x5f);
|
||||||
|
|
||||||
be_roster->Broadcast(new BMessage(B_MODIFIERS_CHANGED));
|
be_roster->Broadcast(new BMessage(B_MODIFIERS_CHANGED));
|
||||||
Update();
|
Update();
|
||||||
break;
|
break;
|
||||||
@@ -154,13 +160,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
MenuWindow::QuitRequested()
|
MenuWindow::QuitRequested()
|
||||||
{
|
{
|
||||||
be_app->PostMessage(B_QUIT_REQUESTED);
|
be_app->PostMessage(B_QUIT_REQUESTED);
|
||||||
return true;
|
return BWindow::QuitRequested();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MenuWindow::Update()
|
MenuWindow::Update()
|
||||||
{
|
{
|
||||||
@@ -173,6 +181,7 @@
|
|||||||
ResizeTo((menuBar->Frame().right + 35), (menuBar->Frame().bottom + 45));
|
ResizeTo((menuBar->Frame().right + 35), (menuBar->Frame().bottom + 45));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MenuWindow::Defaults()
|
MenuWindow::Defaults()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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