From 7f12c6eea4fff4e75eadfc5506be3e95c0cd6938 Mon Sep 17 00:00:00 2001 From: Celtic Minstrel Date: Wed, 26 Feb 2020 01:20:03 -0500 Subject: [PATCH] Support underlined text in DialogXML --- rsrc/schemas/dialog.xsd | 1 + src/dialogxml/widgets/message.cpp | 7 +++++++ src/dialogxml/widgets/message.hpp | 1 + src/doxy/mainpage.md | 1 + 4 files changed, 10 insertions(+) diff --git a/rsrc/schemas/dialog.xsd b/rsrc/schemas/dialog.xsd index 0e7ca500..2ed069b2 100644 --- a/rsrc/schemas/dialog.xsd +++ b/rsrc/schemas/dialog.xsd @@ -162,6 +162,7 @@ + diff --git a/src/dialogxml/widgets/message.cpp b/src/dialogxml/widgets/message.cpp index b058d286..778b5492 100644 --- a/src/dialogxml/widgets/message.cpp +++ b/src/dialogxml/widgets/message.cpp @@ -52,6 +52,12 @@ bool cTextMsg::parseAttribute(ticpp::Attribute& attr, std::string tagName, std:: throw xBadVal(tagName, attr.Name(), val, attr.Row(), attr.Column(), fname); } return true; + } else if(attr.Name() == "underline") { + std::string val = attr.Value(); + if(val == "true") underlined = true; + else if(val == "false") underlined = false; + else throw xBadVal(tagName, attr.Name(), val, attr.Row(), attr.Column(), fname); + return true; } return cControl::parseAttribute(attr, tagName, fname); } @@ -120,6 +126,7 @@ void cTextMsg::draw(){ TextStyle style; style.font = textFont; style.pointSize = textSize; + style.underline = underlined; drawFrame(2, frameStyle); sf::Color draw_color = color; if(depressed){ diff --git a/src/dialogxml/widgets/message.hpp b/src/dialogxml/widgets/message.hpp index 34e13977..b2f5448b 100644 --- a/src/dialogxml/widgets/message.hpp +++ b/src/dialogxml/widgets/message.hpp @@ -52,5 +52,6 @@ private: sf::Color color; std::vector> keyRefs; std::string fromList; + bool underlined = false; }; #endif diff --git a/src/doxy/mainpage.md b/src/doxy/mainpage.md index 7879cfe7..e904ea5f 100644 --- a/src/doxy/mainpage.md +++ b/src/doxy/mainpage.md @@ -90,6 +90,7 @@ The `` tag accepts the following attributes: * `framed` - See **Common Attributes** above. Defaults to `false`. * `outline` - See **Common Attributes** above. +* `underline` - If true, the text will be underlined. * `fromlist`, `font`, `size`, `color`, `colour`, `def-key` - See **Common Attributes** above.