From 913581922161da5037e10ed6098f773e5a99f01e Mon Sep 17 00:00:00 2001 From: Marwane ElBaraka Date: Thu, 26 Mar 2026 18:08:45 +0100 Subject: [PATCH] GUI: Add cursor type attribute to theme cursor element Add optional 'type' attribute to the XML element to allow themes to define different cursor types (normal, index). --- gui/ThemeParser.cpp | 18 +++++++++++++++++- gui/ThemeParser.h | 1 + 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/gui/ThemeParser.cpp b/gui/ThemeParser.cpp index 97e43b502a9..4c32cb54899 100644 --- a/gui/ThemeParser.cpp +++ b/gui/ThemeParser.cpp @@ -78,6 +78,11 @@ static const TextColorDataInfo kTextColorDefaults[] = { { kTextColorButtonDisabled, "color_button_disabled" } }; +enum CursorType { + kCursorNormal, + kCursorIndex +}; + static TextColor parseTextColorId(const Common::String &name) { for (int i = 0; i < kTextColorMAX; ++i) if (name.compareToIgnoreCase(kTextColorDefaults[i].name) == 0) @@ -346,7 +351,18 @@ bool ThemeParser::parserCallback_cursor(ParserNode *node) { if (!parseList(node->values["hotspot"], 2, &spotx, &spoty)) return parserError("Error parsing cursor Hot Spot coordinates."); - if (!_theme->createCursor(node->values["file"], spotx, spoty)) + ThemeEngine::CursorType cursorType = ThemeEngine::kCursorNormal; + if (node->values.contains("type")) { + Common::String t = node->values["type"]; + t.toLowercase(); + if (t == "index") { + cursorType = ThemeEngine::kCursorIndex; + } else if (t != "normal") { + return parserError(Common::String::format("Invalid cursor type '%s'", t.c_str())); + } + } + + if (!_theme->createCursor(node->values["file"], spotx, spoty, cursorType)) return parserError("Error creating Bitmap Cursor."); return true; diff --git a/gui/ThemeParser.h b/gui/ThemeParser.h index c23be58582d..0ffbc0c1e10 100644 --- a/gui/ThemeParser.h +++ b/gui/ThemeParser.h @@ -100,6 +100,7 @@ protected: XML_PROP(file, true) XML_PROP(hotspot, true) XML_PROP(resolution, false) + XML_PROP(type, false) KEY_END() XML_KEY(defaults)