impr: Add close button to toolbar

This commit is contained in:
WerWolv
2023-12-07 11:53:16 +01:00
parent 5f8c813aa7
commit f5cbcce112
2 changed files with 7 additions and 1 deletions

View File

@@ -569,6 +569,12 @@ namespace hex {
ImGui::SameLine();
}
if (auto provider = ImHexApi::Provider::get(); provider != nullptr) {
if (ImGui::CloseButton(ImGui::GetID("ProviderCloseButton"), ImGui::GetCursorScreenPos() + ImVec2(ImGui::GetContentRegionAvail().x - 17_scaled, 3_scaled))) {
ImHexApi::Provider::remove(provider);
}
}
ImGui::EndMenuBar();
}

View File

@@ -11,7 +11,7 @@ namespace hex::plugin::builtin {
EventManager::subscribe<EventProviderOpened>([this](auto *newProvider) {
if (newProvider == this)
return;
ImHexApi::Provider::remove(this, true);
});
}