mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-25 06:35:30 +00:00
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.
This commit is contained in:
parent
c3d02c0b41
commit
02730af391
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -124,6 +124,28 @@
|
||||
</BasisSkin>
|
||||
</Resource>
|
||||
|
||||
<Resource type="ResourceSkin" name="MW_ListLine_Specific" size="5 5">
|
||||
<Property key="FontName" value="Default"/>
|
||||
<Property key="TextAlign" value="Left VCenter"/>
|
||||
|
||||
<BasisSkin type="SimpleText" offset="2 0 1 5" align="Stretch">
|
||||
<State name="normal" colour="#{fontcolour=link}"/>
|
||||
<State name="highlighted" colour="#{fontcolour=link_over}"/>
|
||||
<State name="pushed" colour="#{fontcolour=link_pressed}"/>
|
||||
</BasisSkin>
|
||||
</Resource>
|
||||
|
||||
<Resource type="ResourceSkin" name="MW_ListLine_Exhausted" size="5 5">
|
||||
<Property key="FontName" value="Default"/>
|
||||
<Property key="TextAlign" value="Left VCenter"/>
|
||||
|
||||
<BasisSkin type="SimpleText" offset="2 0 1 5" align="Stretch">
|
||||
<State name="normal" colour="#525252"/>
|
||||
<State name="highlighted" colour="#666666"/>
|
||||
<State name="pushed" colour="#3D3D3D"/>
|
||||
</BasisSkin>
|
||||
</Resource>
|
||||
|
||||
<Resource type="ResourceLayout" name="MW_List" size="516 516" align="Left Top">
|
||||
<Widget type="Widget" position="0 0 516 516" name="Root">
|
||||
<Property key="NeedKey" value="true"/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user