Support underlined text in DialogXML

This commit is contained in:
2020-02-26 01:20:03 -05:00
parent 7d8fc7fe09
commit 7f12c6eea4
4 changed files with 10 additions and 0 deletions

View File

@@ -162,6 +162,7 @@
<xs:attribute name="name" type="xs:token"/>
<xs:attributeGroup ref="frame"/>
<xs:attributeGroup ref="font"/>
<xs:attribute name="underline" type="bool"/>
<xs:attribute ref="def-key"/>
<xs:attribute name="fromlist" default="none" type="xs:string"/>
<xs:attributeGroup ref="rect-size"/>

View File

@@ -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){

View File

@@ -52,5 +52,6 @@ private:
sf::Color color;
std::vector<boost::optional<std::string>> keyRefs;
std::string fromList;
bool underlined = false;
};
#endif

View File

@@ -90,6 +90,7 @@ The `<text>` 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.