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

@@ -9,6 +9,19 @@
namespace hex::plugin::builtin {
ViewHelp::ViewHelp() : View("hex.builtin.view.help.about.name") {
ContentRegistry::Interface::addMenuItem("hex.builtin.menu.help", 1000, [&, this] {
if (ImGui::MenuItem("hex.builtin.view.help.about.name"_lang, "")) {
View::doLater([] { ImGui::OpenPopup(View::toWindowName("hex.builtin.view.help.about.name").c_str()); });
this->m_aboutWindowOpen = true;
this->getWindowOpenState() = true;
}
if (ImGui::MenuItem("hex.builtin.view.help.documentation"_lang, "")) {
hex::openWebpage("https://imhex.werwolv.net/docs");
}
});
}
ViewHelp::~ViewHelp() {
@@ -171,18 +184,4 @@ namespace hex::plugin::builtin {
this->drawAboutPopup();
}
void ViewHelp::drawMenu() {
if (ImGui::BeginMenu("hex.builtin.menu.help"_lang)) {
if (ImGui::MenuItem("hex.builtin.view.help.about.name"_lang, "")) {
View::doLater([] { ImGui::OpenPopup(View::toWindowName("hex.builtin.view.help.about.name").c_str()); });
this->m_aboutWindowOpen = true;
this->getWindowOpenState() = true;
}
if (ImGui::MenuItem("hex.builtin.view.help.documentation"_lang, "")) {
hex::openWebpage("https://imhex.werwolv.net/docs");
}
ImGui::EndMenu();
}
}
}