aboutsummaryrefslogtreecommitdiff
path: root/graphics/macgui
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/macgui')
-rw-r--r--graphics/macgui/macmenu.cpp20
-rw-r--r--graphics/macgui/macmenu.h2
2 files changed, 20 insertions, 2 deletions
diff --git a/graphics/macgui/macmenu.cpp b/graphics/macgui/macmenu.cpp
index af906aa33a..bbe7415819 100644
--- a/graphics/macgui/macmenu.cpp
+++ b/graphics/macgui/macmenu.cpp
@@ -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;
diff --git a/graphics/macgui/macmenu.h b/graphics/macgui/macmenu.h
index e531be6ead..6cb1e30ad3 100644
--- a/graphics/macgui/macmenu.h
+++ b/graphics/macgui/macmenu.h
@@ -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;