Allow most modal popups to be closed with escape

This commit is contained in:
WerWolv
2021-01-14 17:01:44 +01:00
parent 441f4a9fc7
commit 740619529c
6 changed files with 44 additions and 17 deletions

View File

@@ -279,14 +279,15 @@ namespace hex {
ImGui::Text("Do you want to load it?");
ImGui::NewLine();
if (ImGui::Button("Yes", ImVec2(40, 20))) {
confirmButtons("Yes", "No", [this]{
this->loadPatternFile(this->m_possiblePatternFile.string());
ImGui::CloseCurrentPopup();
}
ImGui::SameLine();
if (ImGui::Button("No", ImVec2(40, 20))) {
}, []{
ImGui::CloseCurrentPopup();
});
if (ImGui::IsKeyDown(ImGui::GetKeyIndex(ImGuiKey_Escape)))
ImGui::CloseCurrentPopup();
}
ImGui::EndPopup();
}