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

Method ResearchScreen

game/ui/base/researchscreen.cpp:25–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23{
24
25ResearchScreen::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
58ResearchScreen::~ResearchScreen() = default;
59

Callers

nothing calls this directly

Calls 4

addCallbackMethod · 0.80
getFormMethod · 0.45
setVisibleMethod · 0.45
setSelectedMethod · 0.45

Tested by

no test coverage detected