Support underlined text in DialogXML
This commit is contained in:
@@ -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"/>
|
||||
|
@@ -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){
|
||||
|
@@ -52,5 +52,6 @@ private:
|
||||
sf::Color color;
|
||||
std::vector<boost::optional<std::string>> keyRefs;
|
||||
std::string fromList;
|
||||
bool underlined = false;
|
||||
};
|
||||
#endif
|
||||
|
@@ -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.
|
||||
|
||||
|
Reference in New Issue
Block a user