| 7 | namespace Star { |
| 8 | |
| 9 | PanePtr SimpleTooltipBuilder::buildTooltip(String const& text) { |
| 10 | PanePtr tooltip = make_shared<Pane>(); |
| 11 | tooltip->removeAllChildren(); |
| 12 | GuiReader reader; |
| 13 | reader.construct(Root::singleton().assets()->json("/interface/tooltips/simpletooltip.tooltip"), tooltip.get()); |
| 14 | tooltip->setLabel("contentLabel", text); |
| 15 | |
| 16 | auto stretchBackground = tooltip->fetchChild<Widget>("stretchBackground"); |
| 17 | stretchBackground->setSize(Vec2I{tooltip->fetchChild<Widget>("contentLabel")->size()[0] + 8, stretchBackground->size()[1]}); |
| 18 | tooltip->setSize(stretchBackground->size()); |
| 19 | |
| 20 | return tooltip; |
| 21 | } |
| 22 | |
| 23 | } |