MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / createDoubleListControl

Method createDoubleListControl

game/ui/components/controlgenerator.cpp:620–645  ·  view source on GitHub ↗

* Control containing two MultilistBox for assignment state. * @controlLength - length of the control */

Source from the content-addressed store, hash-verified

618 * @controlLength - length of the control
619 */
620sp<Control> ControlGenerator::createDoubleListControl(const int controlLength)
621{
622 auto rubberItem = mksp<Control>();
623 rubberItem->Size = Vec2<int>{controlLength, 1};
624 rubberItem->setFuncPreRender(
625 [](sp<Control> control)
626 {
627 int sizeY = 1;
628 for (auto &c : control->Controls)
629 {
630 if (!c->isVisible())
631 continue;
632 sizeY = std::max(sizeY, c->Location.y + c->Size.y);
633 }
634 control->Size.y = sizeY;
635 });
636
637 auto leftList = rubberItem->createChild<MultilistBox>();
638 leftList->Name = LEFT_LIST_NAME;
639
640 auto rightList = rubberItem->createChild<MultilistBox>();
641 rightList->Location = Vec2<int>{controlLength / 2, 0};
642 rightList->Name = RIGHT_LIST_NAME;
643
644 return rubberItem;
645}
646
647OrganisationInfo ControlGenerator::createOrganisationInfo(GameState &state, sp<Organisation> org)
648{

Callers

nothing calls this directly

Calls 2

setFuncPreRenderMethod · 0.80
isVisibleMethod · 0.45

Tested by

no test coverage detected