feat: Added context menu with right-clicking on file provider (#1084)

Co-authored-by: Nik <werwolv98@gmail.com>
This commit is contained in:
iTrooz
2023-05-21 13:21:53 +02:00
committed by GitHub
parent 047c39e2c7
commit 5666a5c5fb
8 changed files with 107 additions and 0 deletions

View File

@@ -224,6 +224,20 @@ namespace hex::plugin::builtin {
ImHexApi::Provider::remove(providers[i]);
break;
}
std::string popupID = std::string("ProviderMenu.") + std::to_string(tabProvider->getID());
if (ImGui::IsMouseReleased(1) && ImGui::IsItemHovered()) {
ImGui::OpenPopup(popupID.c_str());
}
if (ImGui::BeginPopup(popupID.c_str())) {
for (auto p : tabProvider->getMenuEntries()) {
if (ImGui::MenuItem(p.first.c_str())) {
p.second();
}
}
ImGui::EndPopup();
}
}
ImGui::EndTabBar();
}