impr: Better UI for the command palette
This commit is contained in:
parent
1ff4d76ae7
commit
46d3402705
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user