| 277 | } |
| 278 | |
| 279 | void TextEdit::configureSelfFromXml(pugi::xml_node *node) |
| 280 | { |
| 281 | Control::configureSelfFromXml(node); |
| 282 | |
| 283 | if (node->attribute("text")) |
| 284 | { |
| 285 | text = to_u32string(tr(node->attribute("text").as_string())); |
| 286 | } |
| 287 | auto fontNode = node->child("font"); |
| 288 | if (fontNode) |
| 289 | { |
| 290 | font = ui().getFont(fontNode.text().get()); |
| 291 | } |
| 292 | auto alignmentNode = node->child("alignment"); |
| 293 | if (alignmentNode) |
| 294 | { |
| 295 | UString hAlign = alignmentNode.attribute("horizontal").as_string(); |
| 296 | if (hAlign == "left") |
| 297 | { |
| 298 | TextHAlign = HorizontalAlignment::Left; |
| 299 | } |
| 300 | else if (hAlign == "centre") |
| 301 | { |
| 302 | TextHAlign = HorizontalAlignment::Centre; |
| 303 | } |
| 304 | else if (hAlign == "right") |
| 305 | { |
| 306 | TextHAlign = HorizontalAlignment::Right; |
| 307 | } |
| 308 | UString vAlign = alignmentNode.attribute("vertical").as_string(); |
| 309 | if (vAlign == "top") |
| 310 | { |
| 311 | TextVAlign = VerticalAlignment::Top; |
| 312 | } |
| 313 | else if (vAlign == "centre") |
| 314 | { |
| 315 | TextVAlign = VerticalAlignment::Centre; |
| 316 | } |
| 317 | else if (vAlign == "bottom") |
| 318 | { |
| 319 | TextVAlign = VerticalAlignment::Bottom; |
| 320 | } |
| 321 | } |
| 322 | } |
| 323 | }; // namespace OpenApoc |
nothing calls this directly
no test coverage detected