| 23 | { |
| 24 | |
| 25 | ResearchScreen::ResearchScreen(sp<GameState> state, sp<Facility> selected_lab) : BaseStage(state) |
| 26 | { |
| 27 | form = ui().getForm("researchscreen"); |
| 28 | arrow = form->findControlTyped<Graphic>("MAGIC_ARROW"); |
| 29 | viewHighlight = BaseGraphics::FacilityHighlight::Labs; |
| 30 | if (selected_lab) |
| 31 | { |
| 32 | state->current_base->selectedLab = viewFacility = selected_lab; |
| 33 | } |
| 34 | else |
| 35 | { |
| 36 | viewFacility = state->current_base->selectedLab.lock(); |
| 37 | } |
| 38 | |
| 39 | auto uiListSmallLabs = form->findControlTyped<ListBox>("LIST_SMALL_LABS"); |
| 40 | auto uiListLargeLabs = form->findControlTyped<ListBox>("LIST_LARGE_LABS"); |
| 41 | uiListSmallLabs->scroller->setVisible(false); |
| 42 | uiListLargeLabs->scroller->setVisible(false); |
| 43 | |
| 44 | uiListSmallLabs->addCallback(FormEventType::ListBoxChangeSelected, [this](FormsEvent *e) { |
| 45 | form->findControlTyped<ListBox>("LIST_LARGE_LABS")->setSelected(nullptr); |
| 46 | viewFacility = |
| 47 | std::static_pointer_cast<ListBox>(e->forms().RaisedBy)->getSelectedData<Facility>(); |
| 48 | setCurrentLabInfo(); |
| 49 | }); |
| 50 | uiListLargeLabs->addCallback(FormEventType::ListBoxChangeSelected, [this](FormsEvent *e) { |
| 51 | form->findControlTyped<ListBox>("LIST_SMALL_LABS")->setSelected(nullptr); |
| 52 | viewFacility = |
| 53 | std::static_pointer_cast<ListBox>(e->forms().RaisedBy)->getSelectedData<Facility>(); |
| 54 | setCurrentLabInfo(); |
| 55 | }); |
| 56 | } |
| 57 | |
| 58 | ResearchScreen::~ResearchScreen() = default; |
| 59 |
nothing calls this directly
no test coverage detected