api: Moved menu item adding to a new registry-type API

This commit is contained in:
WerWolv
2022-01-23 02:28:38 +01:00
parent 6c6fe8ad5c
commit 714d421334
48 changed files with 364 additions and 417 deletions

View File

@@ -11,6 +11,7 @@
#include <csignal>
#include <iostream>
#include <numeric>
#include <set>
#include <thread>
#include <assert.h>
@@ -437,8 +438,16 @@ namespace hex {
}
}
for (auto &[name, view] : ContentRegistry::Views::getEntries()) {
view->drawMenu();
std::set<std::string> encounteredMenus;
for (auto &[priority, menuItem] : ContentRegistry::Interface::getMenuItems()) {
if (ImGui::BeginMenu(LangEntry(menuItem.unlocalizedName))) {
auto [iter, inserted] = encounteredMenus.insert(menuItem.unlocalizedName);
if (!inserted)
ImGui::Separator();
menuItem.callback();
ImGui::EndMenu();
}
}
this->drawTitleBar();