Implemented _DrawControlChar() - for some reason, though, they get still not
drawn (glyph cache returns character 0 for them), even though FontInspector under Dano shows those arrows in the fonts used... need to check under R5 as well. This fixes the BMenuItem part of bug #158. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17003 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
4b1da1ce9a
commit
bd780d9935
|
@ -93,7 +93,7 @@ private:
|
|||
void DrawMarkSymbol(rgb_color bgColor);
|
||||
void DrawShortcutSymbol();
|
||||
void DrawSubmenuSymbol(rgb_color bgColor);
|
||||
void DrawControlChar(const char *control);
|
||||
void _DrawControlChar(char shortcut, BPoint where);
|
||||
void SetSysTrigger(char ch);
|
||||
|
||||
char *fLabel;
|
||||
|
|
|
@ -85,6 +85,7 @@ const unsigned char kShiftBits [] = {
|
|||
|
||||
const float kLightBGTint = (B_LIGHTEN_1_TINT + B_LIGHTEN_1_TINT + B_NO_TINT) / 3.0;
|
||||
|
||||
|
||||
BMenuItem::BMenuItem(const char *label, BMessage *message, char shortcut,
|
||||
uint32 modifiers)
|
||||
{
|
||||
|
@ -707,10 +708,19 @@ BMenuItem::DrawShortcutSymbol()
|
|||
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()
|
||||
switch (fShortcutChar) {
|
||||
case B_DOWN_ARROW:
|
||||
case B_UP_ARROW:
|
||||
case B_LEFT_ARROW:
|
||||
case B_RIGHT_ARROW:
|
||||
case B_ENTER:
|
||||
_DrawControlChar(fShortcutChar, where + BPoint(0, fSuper->fAscent));
|
||||
break;
|
||||
|
||||
default:
|
||||
fSuper->DrawChar(fShortcutChar, where + BPoint(0, fSuper->fAscent));
|
||||
break;
|
||||
}
|
||||
|
||||
where -= BPoint(20, -1);
|
||||
|
||||
|
@ -782,9 +792,31 @@ BMenuItem::DrawSubmenuSymbol(rgb_color bgColor)
|
|||
|
||||
|
||||
void
|
||||
BMenuItem::DrawControlChar(const char *control)
|
||||
BMenuItem::_DrawControlChar(char shortcut, BPoint where)
|
||||
{
|
||||
// TODO: Implement
|
||||
const char* symbol = " ";
|
||||
|
||||
switch (shortcut) {
|
||||
case B_DOWN_ARROW:
|
||||
symbol = "\xe2\x86\x93";
|
||||
break;
|
||||
case B_UP_ARROW:
|
||||
symbol = "\xe2\x86\x91";
|
||||
break;
|
||||
case B_LEFT_ARROW:
|
||||
symbol = "\xe2\x86\x90";
|
||||
break;
|
||||
case B_RIGHT_ARROW:
|
||||
symbol = "\xe2\x86\x92";
|
||||
break;
|
||||
case B_ENTER:
|
||||
// TODO: find a better one for this!
|
||||
// If needed, take another font for the control characters
|
||||
symbol = "\xe2\x86\x99";
|
||||
break;
|
||||
}
|
||||
|
||||
fSuper->DrawString(symbol, where);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue