GUI: Add cursor type attribute to theme cursor element

Add optional 'type' attribute to the <cursor> XML element to allow themes to define different cursor types (normal, index).
This commit is contained in:
Marwane ElBaraka
2026-03-26 18:08:45 +01:00
committed by Eugene Sandulenko
parent 6dc02783fe
commit 9135819221
2 changed files with 18 additions and 1 deletions
+17 -1
View File
@@ -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;
+1
View File
@@ -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)