[Scummvm-git-logs] scummvm master -> 8357725bc220d36150d91e3ef14af4db371fd5ee

sev- sev at scummvm.org
Tue Oct 1 00:58:47 CEST 2019


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
8357725bc2 GRAPHICS: MACGUI: Code for drawing nested submenu arrows


Commit: 8357725bc220d36150d91e3ef14af4db371fd5ee
    https://github.com/scummvm/scummvm/commit/8357725bc220d36150d91e3ef14af4db371fd5ee
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-10-01T00:58:16+02:00

Commit Message:
GRAPHICS: MACGUI: Code for drawing nested submenu arrows

Changed paths:
    graphics/macgui/macmenu.cpp
    graphics/macgui/macmenu.h


diff --git a/graphics/macgui/macmenu.cpp b/graphics/macgui/macmenu.cpp
index af906aa..bbe7415 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 e531be6..6cb1e30 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;





More information about the Scummvm-git-logs mailing list