#pragma once #include #include #include #include #include #include #include namespace hex { namespace prv { class Provider; } class ViewCommandPalette : public View { public: ViewCommandPalette(); ~ViewCommandPalette() override; void drawContent() override; void drawMenu() override; bool isAvailable() override { return true; } bool shouldProcess() override { return true; } bool handleShortcut(bool keys[512], bool ctrl, bool shift, bool alt) override; bool hasViewMenuItemEntry() override { return false; } ImVec2 getMinSize() override { return ImVec2(400, 100); } ImVec2 getMaxSize() override { return ImVec2(400, 100); } private: enum class MatchType { NoMatch, InfoMatch, PartialMatch, PerfectMatch }; struct CommandResult { std::string displayResult; std::string matchedCommand; std::function executeCallback; }; bool m_commandPaletteOpen = false; bool m_justOpened = false; bool m_focusInputTextBox = false; std::vector m_commandBuffer; std::vector m_lastResults; std::string m_exactResult; void focusInputTextBox() { this->m_focusInputTextBox = true; } std::vector getCommandResults(std::string_view command); }; }