| 52 | UfopaediaCategoryView::~UfopaediaCategoryView() = default; |
| 53 | |
| 54 | void 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); |
no test coverage detected