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

Method populateUILabList

game/ui/base/researchscreen.cpp:293–314  ·  view source on GitHub ↗

* Populating the UI lab list. * @listName - listbox's name in the form * @listLabs - list of existing labs */

Source from the content-addressed store, hash-verified

291 * @listLabs - list of existing labs
292 */
293void ResearchScreen::populateUILabList(const UString &listName, std::list<sp<Facility>> &listLabs)
294{
295 auto uiListLabs = form->findControlTyped<ListBox>(listName);
296 uiListLabs->clear();
297
298 sp<Control> selectedItem = nullptr;
299 for (auto &facility : listLabs)
300 {
301 auto item = ControlGenerator::createLabControl(state, facility);
302 item->setData(facility);
303
304 auto label = std::static_pointer_cast<Label>(item->Controls[0]);
305 label->setText(format("%d", facility->lab->assigned_agents.size()));
306
307 uiListLabs->addItem(item);
308 if (facility == viewFacility)
309 {
310 selectedItem = item;
311 }
312 }
313 uiListLabs->setSelected(selectedItem);
314}
315
316void ResearchScreen::setCurrentLabInfo()
317{

Callers

nothing calls this directly

Calls 7

formatFunction · 0.85
setDataMethod · 0.80
clearMethod · 0.45
setTextMethod · 0.45
sizeMethod · 0.45
addItemMethod · 0.45
setSelectedMethod · 0.45

Tested by

no test coverage detected