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
|
void
|
||||||
MenuBar::build_menu()
|
MenuBar::build_menu()
|
||||||
{
|
{
|
||||||
@ -40,27 +48,24 @@ MenuBar::build_menu()
|
|||||||
colorSchemeItem = new BMenuItem("Color Scheme...", new BMessage(COLOR_SCHEME_MSG), 0, 0);
|
colorSchemeItem = new BMenuItem("Color Scheme...", new BMessage(COLOR_SCHEME_MSG), 0, 0);
|
||||||
|
|
||||||
// create the separator menu
|
// create the separator menu
|
||||||
|
// TODO: Use B_ITEMS_IN_MATRIX here
|
||||||
separatorStyleMenu = new BMenu("Separator Style", B_ITEMS_IN_COLUMN);
|
separatorStyleMenu = new BMenu("Separator Style", B_ITEMS_IN_COLUMN);
|
||||||
separatorStyleMenu->SetRadioMode(true);
|
separatorStyleMenu->SetRadioMode(true);
|
||||||
BMessage *msg = new BMessage(MENU_SEP_TYPE);
|
BMessage *msg = new BMessage(MENU_SEP_TYPE);
|
||||||
msg->AddInt32("sep", 0);
|
msg->AddInt32("sep", 0);
|
||||||
separatorStyleZero = new BitmapMenuItem("separator0", msg,
|
separatorStyleZero = new BitmapMenuItem(" ", msg,
|
||||||
BTranslationUtils::GetBitmap(B_RAW_TYPE, "SEP0"));
|
BTranslationUtils::GetBitmap(B_RAW_TYPE, "SEP0"));
|
||||||
msg = new BMessage(MENU_SEP_TYPE);
|
msg = new BMessage(MENU_SEP_TYPE);
|
||||||
msg->AddInt32("sep", 1);
|
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 = new BMessage(MENU_SEP_TYPE);
|
||||||
msg->AddInt32("sep", 2);
|
msg->AddInt32("sep", 2);
|
||||||
separatorStyleTwo = new BitmapMenuItem("separator2", msg, BTranslationUtils::GetBitmap(B_RAW_TYPE, "SEP2"));
|
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(separatorStyleZero);
|
||||||
separatorStyleMenu->AddItem(separatorStyleOne);
|
separatorStyleMenu->AddItem(separatorStyleOne);
|
||||||
separatorStyleMenu->AddItem(separatorStyleTwo);
|
separatorStyleMenu->AddItem(separatorStyleTwo);
|
||||||
|
separatorStyleMenu->SetRadioMode(true);
|
||||||
separatorStyleMenu->SetTargetForItems(Window());
|
separatorStyleMenu->SetTargetForItems(Window());
|
||||||
|
|
||||||
// Add items to menubar
|
// Add items to menubar
|
||||||
@ -75,7 +80,6 @@ MenuBar::build_menu()
|
|||||||
AddSeparatorItem();
|
AddSeparatorItem();
|
||||||
AddItem(ctlAsShortcutItem);
|
AddItem(ctlAsShortcutItem);
|
||||||
AddItem(altAsShortcutItem);
|
AddItem(altAsShortcutItem);
|
||||||
SetTargetForItems(Window());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -100,6 +104,13 @@ MenuBar::set_menu()
|
|||||||
|
|
||||||
free(chars);
|
free(chars);
|
||||||
free(keys);
|
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 {
|
class MenuBar : public BMenuBar {
|
||||||
public:
|
public:
|
||||||
MenuBar();
|
MenuBar();
|
||||||
|
virtual void AttachedToWindow();
|
||||||
void set_menu();
|
void set_menu();
|
||||||
void build_menu();
|
void build_menu();
|
||||||
virtual void Update();
|
virtual void Update();
|
||||||
virtual void FrameResized(float width, float height);
|
virtual void FrameResized(float width, float height);
|
||||||
|
|
||||||
BRect menu_rect;
|
private:
|
||||||
BRect rect;
|
|
||||||
menu_info info;
|
menu_info info;
|
||||||
|
|
||||||
//seperator submenu
|
//seperator submenu
|
||||||
|
@ -125,8 +125,6 @@ MenuWindow::MessageReceived(BMessage *msg)
|
|||||||
|
|
||||||
case CTL_MARKED_MSG:
|
case CTL_MARKED_MSG:
|
||||||
revert = true;
|
revert = true;
|
||||||
menuBar->ctlAsShortcutItem->SetMarked(true);
|
|
||||||
menuBar->altAsShortcutItem->SetMarked(false);
|
|
||||||
// This might not be the same for all keyboards
|
// This might not be the same for all keyboards
|
||||||
set_modifier_key(B_LEFT_COMMAND_KEY, 0x5c);
|
set_modifier_key(B_LEFT_COMMAND_KEY, 0x5c);
|
||||||
set_modifier_key(B_RIGHT_COMMAND_KEY, 0x60);
|
set_modifier_key(B_RIGHT_COMMAND_KEY, 0x60);
|
||||||
@ -138,8 +136,6 @@ MenuWindow::MessageReceived(BMessage *msg)
|
|||||||
|
|
||||||
case ALT_MARKED_MSG:
|
case ALT_MARKED_MSG:
|
||||||
revert = true;
|
revert = true;
|
||||||
menuBar->altAsShortcutItem->SetMarked(true);
|
|
||||||
menuBar->ctlAsShortcutItem->SetMarked(false);
|
|
||||||
// This might not be the same for all keyboards
|
// This might not be the same for all keyboards
|
||||||
set_modifier_key(B_LEFT_COMMAND_KEY, 0x5d);
|
set_modifier_key(B_LEFT_COMMAND_KEY, 0x5d);
|
||||||
set_modifier_key(B_RIGHT_COMMAND_KEY, 0x5f);
|
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
|
//default
|
||||||
const uint32 DEFAULT_MSG = 'dmsg';
|
const uint32 DEFAULT_MSG = 'dmsg';
|
||||||
const uint32 MENU_DEFAULT = 'mede';
|
const uint32 MENU_DEFAULT = 'mede';
|
||||||
const uint32 MENU_REVERT = 'mere';
|
const uint32 MENU_REVERT = 'mere';
|
||||||
|
|
||||||
//others
|
//others
|
||||||
const uint32 UPDATE_WINDOW = 'uwin';
|
const uint32 UPDATE_WINDOW = 'uwin';
|
||||||
const uint32 ALLWAYS_TRIGGERS_MSG = 'alti';
|
const uint32 ALLWAYS_TRIGGERS_MSG = 'alti';
|
||||||
const uint32 COLOR_SCHEME_MSG = 'cosc';
|
const uint32 COLOR_SCHEME_MSG = 'cosc';
|
||||||
const uint32 CTL_MARKED_MSG = 'ctms';
|
const uint32 CTL_MARKED_MSG = 'ctms';
|
||||||
const uint32 ALT_MARKED_MSG = 'alms';
|
const uint32 ALT_MARKED_MSG = 'alms';
|
||||||
|
|
||||||
//color
|
//color
|
||||||
const uint32 MENU_COLOR = 'meco';
|
const uint32 MENU_COLOR = 'meco';
|
||||||
const uint32 CLICK_OPEN_MSG = 'clop';
|
const uint32 CLICK_OPEN_MSG = 'clop';
|
||||||
const uint32 MENU_COLOR_DEFAULT = 'mcod';
|
const uint32 MENU_COLOR_DEFAULT = 'mcod';
|
||||||
|
|
||||||
//font
|
//font
|
||||||
const uint32 MENU_FONT_FAMILY = 'mffm';
|
const uint32 MENU_FONT_FAMILY = 'mffm';
|
||||||
const uint32 MENU_FONT_STYLE = 'mfst';
|
const uint32 MENU_FONT_STYLE = 'mfst';
|
||||||
const uint32 MENU_FONT_SIZE = 'mfsz';
|
const uint32 MENU_FONT_SIZE = 'mfsz';
|
||||||
|
|
||||||
//seperator
|
//seperator
|
||||||
const uint32 MENU_SEP_TYPE = 'mstp';
|
const uint32 MENU_SEP_TYPE = 'mstp';
|
||||||
|
|
||||||
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user