✨ Also save/load ExpandDirection from ComboBox to text file
parent
635517e1c3
commit
4d51472523
|
@ -486,6 +486,16 @@ namespace tgui
|
||||||
if (node->propertyValuePairs["maximumitems"])
|
if (node->propertyValuePairs["maximumitems"])
|
||||||
comboBox->setMaximumItems(tgui::stoi(node->propertyValuePairs["maximumitems"]->value));
|
comboBox->setMaximumItems(tgui::stoi(node->propertyValuePairs["maximumitems"]->value));
|
||||||
|
|
||||||
|
if (node->propertyValuePairs["expanddirection"])
|
||||||
|
{
|
||||||
|
if (toLower(node->propertyValuePairs["expanddirection"]->value) == "up")
|
||||||
|
comboBox->setExpandDirection(ComboBox::ExpandDirection::Up);
|
||||||
|
else if (toLower(node->propertyValuePairs["expanddirection"]->value) == "down")
|
||||||
|
comboBox->setExpandDirection(ComboBox::ExpandDirection::Down);
|
||||||
|
else
|
||||||
|
throw Exception{"Failed to parse ExpandDirection property. Only the values Up and Down are correct."};
|
||||||
|
}
|
||||||
|
|
||||||
return comboBox;
|
return comboBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -378,6 +378,9 @@ namespace tgui
|
||||||
SET_PROPERTY("TextSize", to_string(comboBox->getTextSize()));
|
SET_PROPERTY("TextSize", to_string(comboBox->getTextSize()));
|
||||||
SET_PROPERTY("MaximumItems", to_string(comboBox->getMaximumItems()));
|
SET_PROPERTY("MaximumItems", to_string(comboBox->getMaximumItems()));
|
||||||
|
|
||||||
|
if (comboBox->getExpandDirection() != ComboBox::ExpandDirection::Down)
|
||||||
|
SET_PROPERTY("ExpandDirection", "Up");
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -362,6 +362,7 @@ TEST_CASE("[ComboBox]")
|
||||||
comboBox->addItem("Item 3", "3");
|
comboBox->addItem("Item 3", "3");
|
||||||
comboBox->setItemsToDisplay(3);
|
comboBox->setItemsToDisplay(3);
|
||||||
comboBox->setMaximumItems(5);
|
comboBox->setMaximumItems(5);
|
||||||
|
comboBox->setExpandDirection(tgui::ComboBox::ExpandDirection::Up);
|
||||||
|
|
||||||
testSavingWidget("ComboBox", comboBox);
|
testSavingWidget("ComboBox", comboBox);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue