From 02730af391922f37663f1c39e8a4df42cb8ddc42 Mon Sep 17 00:00:00 2001 From: Kagernac Date: Sun, 19 May 2024 14:43:41 -0700 Subject: [PATCH] Changing the skin of the widget seems to be the easiest way to have the choices in the list react to specific conditions and interactions. Seems that changing the skin modifies some size properties so they had to be reset. Needed to create a specific skin in order to prevent modifying unintended text. The exhausted color is not referenced by the settings.cfg, the user will need to modify the color in the skin file. Edit: Fixed the coding convention issues and converted the tabs into spaces in the .xml. Closed the previous merge request out of confusion, sorry new to Git. --- apps/openmw/mwgui/dialogue.cpp | 19 +++++++++++++++---- files/data/mygui/openmw_list.skin.xml | 22 ++++++++++++++++++++++ 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwgui/dialogue.cpp b/apps/openmw/mwgui/dialogue.cpp index 56f69eb906..ba40fa92e1 100644 --- a/apps/openmw/mwgui/dialogue.cpp +++ b/apps/openmw/mwgui/dialogue.cpp @@ -794,18 +794,29 @@ namespace MWGui if (!Settings::gui().mColorTopicEnable) return; - const MyGUI::Colour& specialColour = Settings::gui().mColorTopicSpecific; - const MyGUI::Colour& oldColour = Settings::gui().mColorTopicExhausted; + std::string specificSkin = "MW_ListLine_Specific"; + std::string exhaustedSkin = "MW_ListLine_Exhausted"; for (const std::string& keyword : mKeywords) { int flag = MWBase::Environment::get().getDialogueManager()->getTopicFlag(ESM::RefId::stringRefId(keyword)); MyGUI::Button* button = mTopicsList->getItemWidget(keyword); + const auto holdCaption = button->getCaption(); if (flag & MWBase::DialogueManager::TopicType::Specific) - button->getSubWidgetText()->setTextColour(specialColour); + { + button->changeWidgetSkin(specificSkin); + button->setCaption(holdCaption); + int height = button->getTextSize().height; + button->setSize(MyGUI::IntSize(button->getSize().width, height)); + } else if (flag & MWBase::DialogueManager::TopicType::Exhausted) - button->getSubWidgetText()->setTextColour(oldColour); + { + button->changeWidgetSkin(exhaustedSkin); + button->setCaption(holdCaption); + int height = button->getTextSize().height; + button->setSize(MyGUI::IntSize(button->getSize().width, height)); + } } } diff --git a/files/data/mygui/openmw_list.skin.xml b/files/data/mygui/openmw_list.skin.xml index 75f4b9e850..877c827833 100644 --- a/files/data/mygui/openmw_list.skin.xml +++ b/files/data/mygui/openmw_list.skin.xml @@ -124,6 +124,28 @@ + + + + + + + + + + + + + + + + + + + + + +