mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-26 04:35:16 +00:00
GRAPHICS: MACGUI: Code for drawing nested submenu arrows
This commit is contained in:
parent
3c0d84b0b2
commit
8357725bc2
@ -66,6 +66,10 @@ enum {
|
||||
kEndMenu = 128
|
||||
};
|
||||
|
||||
struct MacMenuSubItem;
|
||||
|
||||
typedef Common::Array<MacMenuSubItem *> SubItemArray;
|
||||
|
||||
struct MacMenuSubItem {
|
||||
Common::String text;
|
||||
Common::U32String unicodeText;
|
||||
@ -76,12 +80,12 @@ struct MacMenuSubItem {
|
||||
bool enabled;
|
||||
Common::Rect bbox;
|
||||
|
||||
SubItemArray subitems;
|
||||
|
||||
MacMenuSubItem(const Common::String &t, int a, int s = 0, char sh = 0, bool e = true) : text(t), unicode(false), action(a), style(s), shortcut(sh), enabled(e) {}
|
||||
MacMenuSubItem(const Common::U32String &t, int a, int s = 0, char sh = 0, bool e = true) : unicodeText(t), unicode(true), action(a), style(s), shortcut(sh), enabled(e) {}
|
||||
};
|
||||
|
||||
typedef Common::Array<MacMenuSubItem *> SubItemArray;
|
||||
|
||||
struct MacMenuItem {
|
||||
Common::String name;
|
||||
Common::U32String unicodeName;
|
||||
@ -575,6 +579,7 @@ void MacMenu::renderSubmenu(MacMenuItem *menu) {
|
||||
// add unicode accelerator
|
||||
|
||||
int accelX = r->right - 25;
|
||||
int arrowX = r->right - 14;
|
||||
|
||||
int color = _wm->_colorBlack;
|
||||
if (i == (uint)_activeSubItem && (!text.empty() || !unicodeText.empty()) && menu->subitems[i]->enabled) {
|
||||
@ -605,6 +610,9 @@ void MacMenu::renderSubmenu(MacMenuItem *menu) {
|
||||
if (!acceleratorText.empty())
|
||||
_font->drawString(s, acceleratorText, accelX, ty, r->width(), color);
|
||||
|
||||
if (menu->subitems[i]->subitems.size())
|
||||
drawSubMenuArrow(s, arrowX, ty, color);
|
||||
|
||||
if (!menu->subitems[i]->enabled) {
|
||||
// I am lazy to extend drawString() with plotProc as a parameter, so
|
||||
// fake it here
|
||||
@ -636,6 +644,14 @@ void MacMenu::renderSubmenu(MacMenuItem *menu) {
|
||||
//g_system->copyRectToScreen(_screen.getBasePtr(r->left, r->top), _screen.pitch, r->left, r->top, r->width() + 2, r->height() + 2);
|
||||
}
|
||||
|
||||
void MacMenu::drawSubMenuArrow(ManagedSurface *dst, int x, int y, int color) {
|
||||
int height = 11;
|
||||
for (int col = 0; col < 6; col++) {
|
||||
dst->vLine(x + col, y + col + 1, y + col + height + 1, color);
|
||||
height -= 2;
|
||||
}
|
||||
}
|
||||
|
||||
bool MacMenu::processEvent(Common::Event &event) {
|
||||
if (!_isVisible)
|
||||
return false;
|
||||
|
@ -101,6 +101,8 @@ private:
|
||||
|
||||
bool processMenuShortCut(byte flags, uint16 ascii);
|
||||
|
||||
void drawSubMenuArrow(ManagedSurface *dst, int x, int y, int color);
|
||||
|
||||
Common::Array<MacMenuItem *> _items;
|
||||
|
||||
const Font *_font;
|
||||
|
Loading…
x
Reference in New Issue
Block a user