| 457 | } |
| 458 | |
| 459 | void Control::configureChildrenFromXml(pugi::xml_node *parent) |
| 460 | { |
| 461 | UString nodename; |
| 462 | UString attribvalue; |
| 463 | for (auto node = parent->first_child(); node; node = node.next_sibling()) |
| 464 | { |
| 465 | nodename = node.name(); |
| 466 | |
| 467 | // Child controls |
| 468 | if (nodename == "control") |
| 469 | { |
| 470 | auto c = this->createChild<Control>(); |
| 471 | c->configureFromXml(&node); |
| 472 | } |
| 473 | else if (nodename == "label") |
| 474 | { |
| 475 | sp<ScrollBar> sb = nullptr; |
| 476 | UString scrollBarID = node.attribute("scrollbarid").as_string(); |
| 477 | |
| 478 | if (!scrollBarID.empty()) |
| 479 | { |
| 480 | sb = this->findControlTyped<ScrollBar>(scrollBarID); |
| 481 | } |
| 482 | auto l = this->createChild<Label>(); |
| 483 | l->configureFromXml(&node); |
| 484 | l->scroller = sb; |
| 485 | } |
| 486 | else if (nodename == "graphic") |
| 487 | { |
| 488 | auto g = this->createChild<Graphic>(); |
| 489 | g->configureFromXml(&node); |
| 490 | } |
| 491 | else if (nodename == "textbutton") |
| 492 | { |
| 493 | auto tb = this->createChild<TextButton>(); |
| 494 | tb->configureFromXml(&node); |
| 495 | } |
| 496 | else if (nodename == "graphicbutton") |
| 497 | { |
| 498 | auto gb = this->createChild<GraphicButton>(); |
| 499 | gb->configureFromXml(&node); |
| 500 | UString scrollPrev = node.attribute("scrollprev").as_string(); |
| 501 | if (!scrollPrev.empty()) |
| 502 | { |
| 503 | gb->ScrollBarPrev = this->findControlTyped<ScrollBar>(scrollPrev); |
| 504 | } |
| 505 | UString scrollNext = node.attribute("scrollnext").as_string(); |
| 506 | if (!scrollNext.empty()) |
| 507 | { |
| 508 | gb->ScrollBarNext = this->findControlTyped<ScrollBar>(scrollNext); |
| 509 | } |
| 510 | } |
| 511 | else if (nodename == "checkbox") |
| 512 | { |
| 513 | auto cb = this->createChild<CheckBox>(); |
| 514 | cb->configureFromXml(&node); |
| 515 | } |
| 516 | else if (nodename == "tristatebox") |
nothing calls this directly
no test coverage detected