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

Method loadList

game/ui/general/ingameoptions.cpp:140–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138}
139
140void InGameOptions::loadList(int id)
141{
142 saveList();
143 curId = id;
144 menuform->findControlTyped<Label>("LIST_NAME")->setText(listNames[curId]);
145 std::list<std::pair<UString, UString>> *notificationList = nullptr;
146 switch (curId)
147 {
148 case 0:
149 notificationList =
150 state->current_battle ? &battleNotificationList : &cityNotificationList;
151 break;
152 case 1:
153 notificationList = &openApocList;
154 break;
155 }
156 auto listControl = menuform->findControlTyped<ListBox>("NOTIFICATIONS_LIST");
157 listControl->clear();
158 auto font = ui().getFont("smalfont");
159 for (auto &p : *notificationList)
160 {
161 auto checkBox = mksp<CheckBox>(fw().data->loadImage("BUTTON_CHECKBOX_TRUE"),
162 fw().data->loadImage("BUTTON_CHECKBOX_FALSE"));
163 checkBox->Size = {240, listControl->ItemSize};
164 UString full_name = p.first + "." + p.second;
165 checkBox->setData(mksp<UString>(full_name));
166 checkBox->setChecked(config().getBool(full_name));
167 auto label = checkBox->createChild<Label>(tr(config().describe(p.first, p.second)), font);
168 label->Size = {216, listControl->ItemSize};
169 label->Location = {24, 0};
170 label->ToolTipText = tr(config().describe(p.first, p.second));
171 label->ToolTipFont = font;
172 listControl->addItem(checkBox);
173 }
174}
175
176void InGameOptions::loadNextList()
177{

Callers

nothing calls this directly

Calls 10

trFunction · 0.85
setDataMethod · 0.80
getBoolMethod · 0.80
setTextMethod · 0.45
clearMethod · 0.45
getFontMethod · 0.45
loadImageMethod · 0.45
setCheckedMethod · 0.45
describeMethod · 0.45
addItemMethod · 0.45

Tested by

no test coverage detected