Added new ChatBox propery to widget files
parent
c221dd7cc3
commit
2b5066c8e2
|
@ -254,14 +254,6 @@ namespace tgui
|
|||
if (node->propertyValuePairs["textcolor"])
|
||||
chatBox->setTextColor(Deserializer::deserialize(ObjectConverter::Type::Color, node->propertyValuePairs["textcolor"]->value).getColor());
|
||||
|
||||
if (node->propertyValuePairs["linesstartfromtop"])
|
||||
{
|
||||
if (parseBoolean(node->propertyValuePairs["linesstartfromtop"]->value))
|
||||
chatBox->setLinesStartFromTop(true);
|
||||
else
|
||||
chatBox->setLinesStartFromTop(false);
|
||||
}
|
||||
|
||||
for (auto& childNode : node->children)
|
||||
{
|
||||
if (toLower(childNode->name) == "scrollbar")
|
||||
|
@ -291,6 +283,13 @@ namespace tgui
|
|||
}
|
||||
REMOVE_CHILD("line");
|
||||
|
||||
if (node->propertyValuePairs["linesstartfromtop"])
|
||||
chatBox->setLinesStartFromTop(parseBoolean(node->propertyValuePairs["linesstartfromtop"]->value));
|
||||
|
||||
// This has to be parsed after the lines have been added
|
||||
if (node->propertyValuePairs["newlinesbelowothers"])
|
||||
chatBox->setNewLinesBelowOthers(parseBoolean(node->propertyValuePairs["newlinesbelowothers"]->value));
|
||||
|
||||
return chatBox;
|
||||
}
|
||||
|
||||
|
|
|
@ -159,6 +159,11 @@ namespace tgui
|
|||
else
|
||||
SET_PROPERTY("LinesStartFromTop", "false");
|
||||
|
||||
if (chatBox->getNewLinesBelowOthers())
|
||||
SET_PROPERTY("NewLinesBelowOthers", "true");
|
||||
else
|
||||
SET_PROPERTY("NewLinesBelowOthers", "false");
|
||||
|
||||
for (std::size_t i = 0; i < chatBox->getLineAmount(); ++i)
|
||||
{
|
||||
unsigned int lineTextSize = chatBox->getLineTextSize(i);
|
||||
|
|
|
@ -240,8 +240,10 @@ TEST_CASE("[ChatBox]") {
|
|||
chatBox->setOpacity(0.8f);
|
||||
chatBox->setTextColor(sf::Color::White);
|
||||
chatBox->setTextSize(34);
|
||||
chatBox->addLine("L4");
|
||||
chatBox->addLine("L2", 32);
|
||||
chatBox->setLinesStartFromTop(true);
|
||||
chatBox->setNewLinesBelowOthers(false);
|
||||
chatBox->addLine("L2");
|
||||
chatBox->addLine("L4", 32);
|
||||
chatBox->addLine("L3", sf::Color::Magenta);
|
||||
chatBox->addLine("L1", sf::Color::Cyan, 36);
|
||||
|
||||
|
@ -254,10 +256,10 @@ TEST_CASE("[ChatBox]") {
|
|||
REQUIRE(compareFiles("WidgetFileChatBox1.txt", "WidgetFileChatBox2.txt"));
|
||||
|
||||
// Make sure that the lines are still in the correct order
|
||||
REQUIRE(chatBox->getLine(0) == "L4");
|
||||
REQUIRE(chatBox->getLine(1) == "L2");
|
||||
REQUIRE(chatBox->getLine(2) == "L3");
|
||||
REQUIRE(chatBox->getLine(3) == "L1");
|
||||
REQUIRE(chatBox->getLine(0) == "L1");
|
||||
REQUIRE(chatBox->getLine(1) == "L3");
|
||||
REQUIRE(chatBox->getLine(2) == "L4");
|
||||
REQUIRE(chatBox->getLine(3) == "L2");
|
||||
|
||||
SECTION("Copying widget") {
|
||||
tgui::ChatBox temp;
|
||||
|
|
Loading…
Reference in New Issue