| 514 | } |
| 515 | |
| 516 | void WidgetLoader::fillWidgetWithXmlElementAttributes(const tinyxml2::XMLElement* elem, Widget* root, Widget* widget) |
| 517 | { |
| 518 | const char* id = elem->Attribute("id"); |
| 519 | const char* text = elem->Attribute("text"); |
| 520 | const char* tooltip = elem->Attribute("tooltip"); |
| 521 | const char* tooltip_dir = elem->Attribute("tooltip_dir"); |
| 522 | bool selected = bool_attr_is_true(elem, "selected"); |
| 523 | bool disabled = bool_attr_is_true(elem, "disabled"); |
| 524 | bool expansive = bool_attr_is_true(elem, "expansive"); |
| 525 | bool homogeneous = bool_attr_is_true(elem, "homogeneous"); |
| 526 | bool magnet = bool_attr_is_true(elem, "magnet"); |
| 527 | bool noborders = bool_attr_is_true(elem, "noborders"); |
| 528 | const char* width = elem->Attribute("width"); |
| 529 | const char* height = elem->Attribute("height"); |
| 530 | const char* minwidth = elem->Attribute("minwidth"); |
| 531 | const char* minheight = elem->Attribute("minheight"); |
| 532 | const char* maxwidth = elem->Attribute("maxwidth"); |
| 533 | const char* maxheight = elem->Attribute("maxheight"); |
| 534 | const char* border = elem->Attribute("border"); |
| 535 | const char* styleid = elem->Attribute("style"); |
| 536 | const char* childspacing = elem->Attribute("childspacing"); |
| 537 | |
| 538 | if (width) { |
| 539 | if (!minwidth) minwidth = width; |
| 540 | if (!maxwidth) maxwidth = width; |
| 541 | } |
| 542 | |
| 543 | if (height) { |
| 544 | if (!minheight) minheight = height; |
| 545 | if (!maxheight) maxheight = height; |
| 546 | } |
| 547 | |
| 548 | if (id != NULL) |
| 549 | widget->setId(id); |
| 550 | |
| 551 | if (text) { |
| 552 | widget->setText(text); |
| 553 | widget->setI18N(); |
| 554 | } |
| 555 | |
| 556 | if (tooltip && root) { |
| 557 | if (!m_tooltipManager) { |
| 558 | m_tooltipManager = new ui::TooltipManager(); |
| 559 | root->addChild(m_tooltipManager); |
| 560 | } |
| 561 | |
| 562 | int dir = LEFT; |
| 563 | if (tooltip_dir) { |
| 564 | if (strcmp(tooltip_dir, "top") == 0) dir = TOP; |
| 565 | else if (strcmp(tooltip_dir, "bottom") == 0) dir = BOTTOM; |
| 566 | else if (strcmp(tooltip_dir, "left") == 0) dir = LEFT; |
| 567 | else if (strcmp(tooltip_dir, "right") == 0) dir = RIGHT; |
| 568 | } |
| 569 | m_tooltipManager->addTooltipFor(widget, tooltip, dir); |
| 570 | } |
| 571 | |
| 572 | if (selected) |
| 573 | widget->setSelected(selected); |
nothing calls this directly
no test coverage detected