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

Method begin

game/ui/ufopaedia/ufopaediacategoryview.cpp:54–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52UfopaediaCategoryView::~UfopaediaCategoryView() = default;
53
54void UfopaediaCategoryView::begin()
55{
56 auto infoLabel = menuform->findControlTyped<Label>("TEXT_INFO");
57 auto entryList = menuform->findControlTyped<ListBox>("LISTBOX_SHORTCUTS");
58 entryList->clear();
59 entryList->ItemSize = infoLabel->getFont()->getFontHeight() + 2;
60 for (auto &pair : this->category->entries)
61 {
62 auto entry = pair.second;
63 // Skip non-visible entries
64 if (!entry->isVisible())
65 {
66 continue;
67 }
68
69 auto entryControl = mksp<TextButton>(tr(entry->title), infoLabel->getFont());
70 entryControl->Name = "ENTRY_SHORTCUT";
71 entryControl->RenderStyle = TextButton::ButtonRenderStyle::Flat;
72 entryControl->TextHAlign = HorizontalAlignment::Left;
73 entryControl->TextVAlign = VerticalAlignment::Centre;
74 entryControl->setData(entry);
75 entryList->addItem(entryControl);
76 }
77 baseY = infoLabel->Location.y;
78 baseH = infoLabel->Size.y;
79 for (int i = 0; i < 9; i++)
80 {
81 auto labelName = format("LABEL_%d", i + 1);
82 auto label = menuform->findControlTyped<Label>(labelName);
83 if (!label)
84 {
85 LogError("Failed to find UI control matching \"%s\"", labelName);
86 }
87 label->setText("");
88 statsLabels.push_back(label);
89
90 auto valueName = format("VALUE_%d", i + 1);
91 auto value = menuform->findControlTyped<Label>(valueName);
92 if (!value)
93 {
94 LogError("Failed to find UI control matching \"%s\"", valueName);
95 }
96 value->setText("");
97 statsValues.push_back(value);
98 }
99 for (int i = 0; i < 4; i++)
100 {
101 auto labelName = format("ORG_LABEL_%d", i + 1);
102 auto label = menuform->findControlTyped<Label>(labelName);
103 if (!label)
104 {
105 LogError("Failed to find UI control matching \"%s\"", labelName);
106 }
107 label->setText("");
108 orgLabels.push_back(label);
109
110 auto valueName = format("ORG_VALUE_%d", i + 1);
111 auto value = menuform->findControlTyped<Label>(valueName);

Callers 7

UfopaediaCategoryViewMethod · 0.45
eventOccurredMethod · 0.45
setFormStatsMethod · 0.45
setNextTopicMethod · 0.45
setPreviousTopicMethod · 0.45
setNextSectionMethod · 0.45
setPreviousSectionMethod · 0.45

Calls 10

setFormDataMethod · 0.95
trFunction · 0.85
formatFunction · 0.85
setDataMethod · 0.80
clearMethod · 0.45
getFontHeightMethod · 0.45
getFontMethod · 0.45
isVisibleMethod · 0.45
addItemMethod · 0.45
setTextMethod · 0.45

Tested by

no test coverage detected