some other minor stuff
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16636 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
311bcf391f
commit
2d5d385b29
@ -20,6 +20,14 @@ MenuBar::MenuBar()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
MenuBar::AttachedToWindow()
|
||||
{
|
||||
BMenuBar::AttachedToWindow();
|
||||
SetTargetForItems(Window());
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
MenuBar::build_menu()
|
||||
{
|
||||
@ -40,27 +48,24 @@ MenuBar::build_menu()
|
||||
colorSchemeItem = new BMenuItem("Color Scheme...", new BMessage(COLOR_SCHEME_MSG), 0, 0);
|
||||
|
||||
// create the separator menu
|
||||
// TODO: Use B_ITEMS_IN_MATRIX here
|
||||
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("separator0", msg,
|
||||
separatorStyleZero = new BitmapMenuItem(" ", msg,
|
||||
BTranslationUtils::GetBitmap(B_RAW_TYPE, "SEP0"));
|
||||
msg = new BMessage(MENU_SEP_TYPE);
|
||||
msg->AddInt32("sep", 1);
|
||||
separatorStyleOne = new BitmapMenuItem("separator1", msg, BTranslationUtils::GetBitmap(B_RAW_TYPE, "SEP1"));
|
||||
separatorStyleOne = new BitmapMenuItem("", msg, BTranslationUtils::GetBitmap(B_RAW_TYPE, "SEP1"));
|
||||
msg = new BMessage(MENU_SEP_TYPE);
|
||||
msg->AddInt32("sep", 2);
|
||||
separatorStyleTwo = new BitmapMenuItem("separator2", 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);
|
||||
separatorStyleTwo = new BitmapMenuItem("", msg, BTranslationUtils::GetBitmap(B_RAW_TYPE, "SEP2"));
|
||||
|
||||
separatorStyleMenu->AddItem(separatorStyleZero);
|
||||
separatorStyleMenu->AddItem(separatorStyleOne);
|
||||
separatorStyleMenu->AddItem(separatorStyleTwo);
|
||||
separatorStyleMenu->SetRadioMode(true);
|
||||
separatorStyleMenu->SetTargetForItems(Window());
|
||||
|
||||
// Add items to menubar
|
||||
@ -75,7 +80,6 @@ MenuBar::build_menu()
|
||||
AddSeparatorItem();
|
||||
AddItem(ctlAsShortcutItem);
|
||||
AddItem(altAsShortcutItem);
|
||||
SetTargetForItems(Window());
|
||||
}
|
||||
|
||||
void
|
||||
@ -100,6 +104,13 @@ MenuBar::set_menu()
|
||||
|
||||
free(chars);
|
||||
free(keys);
|
||||
|
||||
if (info.separator == 0)
|
||||
separatorStyleZero->SetMarked(true);
|
||||
else if (info.separator == 1)
|
||||
separatorStyleOne->SetMarked(true);
|
||||
else if (info.separator == 2)
|
||||
separatorStyleTwo->SetMarked(true);
|
||||
}
|
||||
|
||||
|
||||
|
@ -10,13 +10,13 @@ class FontSizeMenu;
|
||||
class MenuBar : public BMenuBar {
|
||||
public:
|
||||
MenuBar();
|
||||
virtual void AttachedToWindow();
|
||||
void set_menu();
|
||||
void build_menu();
|
||||
virtual void Update();
|
||||
virtual void FrameResized(float width, float height);
|
||||
|
||||
BRect menu_rect;
|
||||
BRect rect;
|
||||
|
||||
private:
|
||||
menu_info info;
|
||||
|
||||
//seperator submenu
|
||||
|
@ -125,8 +125,6 @@ MenuWindow::MessageReceived(BMessage *msg)
|
||||
|
||||
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);
|
||||
@ -138,8 +136,6 @@ MenuWindow::MessageReceived(BMessage *msg)
|
||||
|
||||
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);
|
||||
|
@ -1,27 +1,31 @@
|
||||
#ifndef __MESSAGES_H
|
||||
#define __MESSAGES_H
|
||||
|
||||
const uint32 MENU_BAR_ARCHIVE = 'mbar';
|
||||
const uint32 MENU_BAR_ARCHIVE = 'mbar';
|
||||
|
||||
//default
|
||||
const uint32 DEFAULT_MSG = 'dmsg';
|
||||
const uint32 MENU_DEFAULT = 'mede';
|
||||
const uint32 MENU_REVERT = 'mere';
|
||||
const uint32 DEFAULT_MSG = 'dmsg';
|
||||
const uint32 MENU_DEFAULT = 'mede';
|
||||
const uint32 MENU_REVERT = 'mere';
|
||||
|
||||
//others
|
||||
const uint32 UPDATE_WINDOW = 'uwin';
|
||||
const uint32 ALLWAYS_TRIGGERS_MSG = 'alti';
|
||||
const uint32 COLOR_SCHEME_MSG = 'cosc';
|
||||
const uint32 CTL_MARKED_MSG = 'ctms';
|
||||
const uint32 ALT_MARKED_MSG = 'alms';
|
||||
const uint32 UPDATE_WINDOW = 'uwin';
|
||||
const uint32 ALLWAYS_TRIGGERS_MSG = 'alti';
|
||||
const uint32 COLOR_SCHEME_MSG = 'cosc';
|
||||
const uint32 CTL_MARKED_MSG = 'ctms';
|
||||
const uint32 ALT_MARKED_MSG = 'alms';
|
||||
|
||||
//color
|
||||
const uint32 MENU_COLOR = 'meco';
|
||||
const uint32 CLICK_OPEN_MSG = 'clop';
|
||||
const uint32 MENU_COLOR_DEFAULT = 'mcod';
|
||||
const uint32 MENU_COLOR = 'meco';
|
||||
const uint32 CLICK_OPEN_MSG = 'clop';
|
||||
const uint32 MENU_COLOR_DEFAULT = 'mcod';
|
||||
|
||||
//font
|
||||
const uint32 MENU_FONT_FAMILY = 'mffm';
|
||||
const uint32 MENU_FONT_STYLE = 'mfst';
|
||||
const uint32 MENU_FONT_SIZE = 'mfsz';
|
||||
const uint32 MENU_FONT_FAMILY = 'mffm';
|
||||
const uint32 MENU_FONT_STYLE = 'mfst';
|
||||
const uint32 MENU_FONT_SIZE = 'mfsz';
|
||||
|
||||
//seperator
|
||||
const uint32 MENU_SEP_TYPE = 'mstp';
|
||||
const uint32 MENU_SEP_TYPE = 'mstp';
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user