BMenuItem draws the various elements in a more correct position, i.e. it doesn't draw the shortcut char over the submenu arrow. Fixes bug 206
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16504 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -708,6 +708,18 @@ BMenuItem::DrawMarkSymbol()
|
|||||||
void
|
void
|
||||||
BMenuItem::DrawShortcutSymbol()
|
BMenuItem::DrawShortcutSymbol()
|
||||||
{
|
{
|
||||||
|
// TODO: Review this
|
||||||
|
BPoint where(ContentLocation() + BPoint(fBounds.Width() - 32.0f, fBounds.Height() - 4.0f));
|
||||||
|
if (fSubmenu)
|
||||||
|
where.x -= 12;
|
||||||
|
|
||||||
|
// TODO: If the shortcut is one of B_DOWN_ARROW, B_UP_ARROW, B_ENTER, etc.
|
||||||
|
// we can't just use DrawString(), as those aren't valid ascii/UTF8 charachters.
|
||||||
|
// In that case we need to build a BBitmap for the given shortcut and draw it using DrawBitmap()
|
||||||
|
fSuper->DrawChar(fShortcutChar, where);
|
||||||
|
|
||||||
|
where -= BPoint(20, 10);
|
||||||
|
|
||||||
if (fModifiers & B_COMMAND_KEY) {
|
if (fModifiers & B_COMMAND_KEY) {
|
||||||
key_map *keys;
|
key_map *keys;
|
||||||
char *chars;
|
char *chars;
|
||||||
@@ -718,9 +730,10 @@ BMenuItem::DrawShortcutSymbol()
|
|||||||
control.SetBits(kAltBits, kAltLength, 0, B_COLOR_8_BIT);
|
control.SetBits(kAltBits, kAltLength, 0, B_COLOR_8_BIT);
|
||||||
else
|
else
|
||||||
control.SetBits(kCtrlBits, kCtrlLength, 0, B_COLOR_8_BIT);
|
control.SetBits(kCtrlBits, kCtrlLength, 0, B_COLOR_8_BIT);
|
||||||
fSuper->DrawBitmap(&control, rect, rect.OffsetByCopy(ContentLocation() +
|
fSuper->DrawBitmap(&control, where);
|
||||||
BPoint(fBounds.Width() - 52.0f, fBounds.Height() - 4.0f - rect.Height())));
|
|
||||||
|
where.x -= rect.Width();
|
||||||
|
|
||||||
free(chars);
|
free(chars);
|
||||||
free(keys);
|
free(keys);
|
||||||
}
|
}
|
||||||
@@ -728,15 +741,8 @@ BMenuItem::DrawShortcutSymbol()
|
|||||||
BRect rect(0,0,21,10);
|
BRect rect(0,0,21,10);
|
||||||
BBitmap shift(rect, B_COLOR_8_BIT);
|
BBitmap shift(rect, B_COLOR_8_BIT);
|
||||||
shift.SetBits(kShiftBits, kShiftLength, 0, B_COLOR_8_BIT);
|
shift.SetBits(kShiftBits, kShiftLength, 0, B_COLOR_8_BIT);
|
||||||
fSuper->DrawBitmap(&shift, rect, rect.OffsetByCopy(ContentLocation() +
|
fSuper->DrawBitmap(&shift, where - BPoint(6, 0));
|
||||||
BPoint(fBounds.Width() - 74.0f, fBounds.Height() - 4.0f - rect.Height())));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: If the shortcut is one of B_DOWN_ARROW, B_UP_ARROW, B_ENTER, etc.
|
|
||||||
// we can't just use DrawString(), as those aren't valid ascii/UTF8 charachters.
|
|
||||||
// In that case we need to build a BBitmap for the given shortcut and draw it using DrawBitmap()
|
|
||||||
fSuper->DrawChar(fShortcutChar, ContentLocation() +
|
|
||||||
BPoint(fBounds.Width() - 32.0f, fBounds.Height() - 4.0f));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user