impr: Allow more popups to be closed with Escape
This commit is contained in:
parent
92043a3d23
commit
346f1362c6
@ -176,6 +176,9 @@ namespace hex {
|
|||||||
|
|
||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Escape)))
|
||||||
|
this->getWindowOpenState() = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -68,6 +68,9 @@ namespace hex::plugin::builtin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
|
|
||||||
|
if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Escape)))
|
||||||
|
this->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] ImGuiWindowFlags getFlags() const override {
|
[[nodiscard]] ImGuiWindowFlags getFlags() const override {
|
||||||
|
@ -87,6 +87,9 @@ namespace hex::plugin::builtin {
|
|||||||
Popup::close();
|
Popup::close();
|
||||||
}, {}, this->m_multiple);
|
}, {}, this->m_multiple);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Escape)))
|
||||||
|
this->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] ImGuiWindowFlags getFlags() const override {
|
[[nodiscard]] ImGuiWindowFlags getFlags() const override {
|
||||||
|
@ -27,6 +27,9 @@ namespace hex::plugin::builtin {
|
|||||||
this->m_function();
|
this->m_function();
|
||||||
|
|
||||||
ImGui::SetWindowPos((ImHexApi::System::getMainWindowSize() - ImGui::GetWindowSize()) / 2, ImGuiCond_Appearing);
|
ImGui::SetWindowPos((ImHexApi::System::getMainWindowSize() - ImGui::GetWindowSize()) / 2, ImGuiCond_Appearing);
|
||||||
|
|
||||||
|
if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Escape)))
|
||||||
|
this->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] ImGuiWindowFlags getFlags() const override {
|
[[nodiscard]] ImGuiWindowFlags getFlags() const override {
|
||||||
|
@ -40,7 +40,7 @@ namespace hex::plugin::builtin {
|
|||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::SetCursorPosX(width / 9 * 5);
|
ImGui::SetCursorPosX(width / 9 * 5);
|
||||||
if (ImGui::Button("hex.builtin.common.no"_lang, ImVec2(width / 3, 0))) {
|
if (ImGui::Button("hex.builtin.common.no"_lang, ImVec2(width / 3, 0)) || ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Escape))) {
|
||||||
this->m_noFunction();
|
this->m_noFunction();
|
||||||
this->close();
|
this->close();
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ namespace hex::plugin::builtin {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
if (ImGui::IsKeyPressed(ImGuiKey_Escape))
|
if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Escape)))
|
||||||
this->close();
|
this->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,6 +65,9 @@ namespace hex::plugin::builtin::recent {
|
|||||||
|
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Escape)))
|
||||||
|
this->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] ImGuiWindowFlags getFlags() const override {
|
[[nodiscard]] ImGuiWindowFlags getFlags() const override {
|
||||||
|
@ -36,6 +36,9 @@ namespace hex::plugin::builtin {
|
|||||||
ImGui::NewLine();
|
ImGui::NewLine();
|
||||||
ImGui::InputText("##result", this->m_result, ImGuiInputTextFlags_ReadOnly);
|
ImGui::InputText("##result", this->m_result, ImGuiInputTextFlags_ReadOnly);
|
||||||
ImGui::PopItemWidth();
|
ImGui::PopItemWidth();
|
||||||
|
|
||||||
|
if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Escape)))
|
||||||
|
this->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] ImGuiWindowFlags getFlags() const override {
|
[[nodiscard]] ImGuiWindowFlags getFlags() const override {
|
||||||
|
@ -106,7 +106,7 @@ namespace hex::plugin::builtin {
|
|||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::SetCursorPosX(width / 9 * 5);
|
ImGui::SetCursorPosX(width / 9 * 5);
|
||||||
if (ImGui::Button("hex.builtin.popup.safety_backup.delete"_lang, ImVec2(width / 3, 0))) {
|
if (ImGui::Button("hex.builtin.popup.safety_backup.delete"_lang, ImVec2(width / 3, 0)) || ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Escape))) {
|
||||||
this->m_deleteCallback();
|
this->m_deleteCallback();
|
||||||
|
|
||||||
this->close();
|
this->close();
|
||||||
@ -131,7 +131,7 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
ImGui::SameLine((ImGui::GetMainViewport()->Size / 3 - ImGui::CalcTextSize("hex.builtin.common.close"_lang) - ImGui::GetStyle().FramePadding).x);
|
ImGui::SameLine((ImGui::GetMainViewport()->Size / 3 - ImGui::CalcTextSize("hex.builtin.common.close"_lang) - ImGui::GetStyle().FramePadding).x);
|
||||||
|
|
||||||
if (ImGui::Button("hex.builtin.common.close"_lang))
|
if (ImGui::Button("hex.builtin.common.close"_lang) || ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Escape)))
|
||||||
Popup::close();
|
Popup::close();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -34,7 +34,7 @@ public:
|
|||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::SetCursorPosX(width / 9 * 5);
|
ImGui::SetCursorPosX(width / 9 * 5);
|
||||||
if (ImGui::Button("hex.builtin.common.no"_lang, ImVec2(width / 3, 0))) {
|
if (ImGui::Button("hex.builtin.common.no"_lang, ImVec2(width / 3, 0)) || ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Escape))) {
|
||||||
s_yesNoQuestionBoxResult = false;
|
s_yesNoQuestionBoxResult = false;
|
||||||
this->close();
|
this->close();
|
||||||
}
|
}
|
||||||
@ -87,7 +87,7 @@ public:
|
|||||||
ImGui::EndDisabled();
|
ImGui::EndDisabled();
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::SetCursorPosX(width / 9 * 5);
|
ImGui::SetCursorPosX(width / 9 * 5);
|
||||||
if (ImGui::Button("hex.builtin.common.cancel"_lang, ImVec2(width / 3, 0))) {
|
if (ImGui::Button("hex.builtin.common.cancel"_lang, ImVec2(width / 3, 0)) || ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Escape))) {
|
||||||
s_inputTextBoxResult = "";
|
s_inputTextBoxResult = "";
|
||||||
this->close();
|
this->close();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user