1
0
mirror of synced 2025-01-18 00:56:49 +01:00

impr: Better UI for the command palette

This commit is contained in:
WerWolv 2023-11-14 12:15:37 +01:00
parent 1ff4d76ae7
commit 46d3402705
2 changed files with 16 additions and 2 deletions

View File

@ -19,8 +19,8 @@ namespace hex::plugin::builtin {
[[nodiscard]] bool shouldProcess() const override { return true; }
[[nodiscard]] bool hasViewMenuItemEntry() const override { return false; }
[[nodiscard]] ImVec2 getMinSize() const override { return scaled({ 400, 100 }); }
[[nodiscard]] ImVec2 getMaxSize() const override { return scaled({ 400, 100 }); }
[[nodiscard]] ImVec2 getMinSize() const override { return scaled({ 600, 150 }); }
[[nodiscard]] ImVec2 getMaxSize() const override { return scaled({ 600, 150 }); }
private:
enum class MatchType

View File

@ -34,11 +34,23 @@ namespace hex::plugin::builtin {
ImGui::CloseCurrentPopup();
const auto buttonColor = [](float alpha) {
return ImU32(ImColor(ImGui::GetStyleColorVec4(ImGuiCol_ModalWindowDimBg) * ImVec4(1, 1, 1, alpha)));
};
// Draw the main input text box
ImGui::PushItemWidth(-1);
ImGui::PushStyleColor(ImGuiCol_FrameBg, buttonColor(0.5F));
ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, buttonColor(0.7F));
ImGui::PushStyleColor(ImGuiCol_FrameBgActive, buttonColor(0.9F));
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0_scaled);
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 4_scaled);
if (ImGui::InputText("##command_input", this->m_commandBuffer)) {
this->m_lastResults = this->getCommandResults(this->m_commandBuffer);
}
ImGui::PopStyleVar(2);
ImGui::PopStyleColor(3);
ImGui::PopItemWidth();
ImGui::SetItemDefaultFocus();
@ -74,6 +86,8 @@ namespace hex::plugin::builtin {
this->m_justOpened = false;
}
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + ImGui::GetStyle().FramePadding.y);
ImGui::Separator();
// Draw the results