BMenuItem didn't draw the modifier indicator for B_OPTION_KEY. Fixes ticket #3887

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30661 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2009-05-07 19:45:42 +00:00
parent 943b557055
commit a48d16a026
2 changed files with 28 additions and 3 deletions

View File

@ -2025,7 +2025,7 @@ BMenu::_ComputeColumnLayout(int32 index, bool bestFit, bool moveItems,
bool command = false;
bool control = false;
bool shift = false;
bool option = false;
if (index > 0)
frame = ItemAt(index - 1)->Frame();
else
@ -2045,6 +2045,8 @@ BMenu::_ComputeColumnLayout(int32 index, bool bestFit, bool moveItems,
control = true;
if (item->fModifiers & B_SHIFT_KEY)
shift = true;
if (item->fModifiers & B_OPTION_KEY)
option = true;
}
item->fBounds.left = 0.0f;
@ -2063,6 +2065,8 @@ BMenu::_ComputeColumnLayout(int32 index, bool bestFit, bool moveItems,
frame.right += 17;
if (control)
frame.right += 17;
if (option)
frame.right += 17;
if (shift)
frame.right += 22;

View File

@ -56,6 +56,21 @@ const unsigned char kAltBits[] = {
};
const unsigned char kOptBits[] = {
0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x14,
0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
0x1d,0x1a,0x1a,0x13,0x04,0x04,0x13,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x1a,0x04,0x04,0x04,0x1a,0x17,0x14,
0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x17,0x14,
0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
0x1d,0x1a,0x1a,0x13,0x04,0x04,0x13,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
0x1d,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x14,
0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14
};
const unsigned char kShiftBits[] = {
0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x14,
0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
@ -158,7 +173,6 @@ BMenuItem::BMenuItem(BMessage *data)
if (data->HasMessage("_msg")) {
BMessage *msg = new BMessage;
data->FindMessage("_msg", msg);
SetMessage(msg);
}
@ -213,7 +227,6 @@ BMenuItem::Archive(BMessage *data, bool deep) const
if (ret == B_OK && deep && fSubmenu) {
BMessage submenu;
if (fSubmenu->Archive(&submenu, true) == B_OK)
ret = data->AddMessage("_submenu", &submenu);
}
@ -803,6 +816,14 @@ BMenuItem::_DrawShortcutSymbol()
fSuper->DrawBitmap(&control, where);
}
if (fModifiers & B_OPTION_KEY) {
BRect rect(0,0,16,10);
BBitmap option(rect, B_CMAP8);
option.ImportBits(kOptBits, sizeof(kOptBits), 17, 0, B_CMAP8);
where.x -= rect.Width() + 1;
fSuper->DrawBitmap(&option, where);
}
if (fModifiers & B_SHIFT_KEY) {
BRect rect(0,0,21,10);
BBitmap shift(rect, B_CMAP8);