CommandPalette.h 973 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibGUI/Dialog.h>
  8. #include <LibGUI/FilteringProxyModel.h>
  9. namespace GUI {
  10. class CommandPalette final : public GUI::Dialog {
  11. C_OBJECT(CommandPalette);
  12. public:
  13. GUI::Action* selected_action() { return m_selected_action; }
  14. GUI::Action const* selected_action() const { return m_selected_action; }
  15. private:
  16. explicit CommandPalette(GUI::Window& parent_window, ScreenPosition screen_position = CenterWithinParent);
  17. virtual ~CommandPalette() override;
  18. void collect_actions(GUI::Window& parent_window);
  19. void finish_with_index(GUI::ModelIndex const&);
  20. RefPtr<GUI::Action> m_selected_action;
  21. Vector<NonnullRefPtr<GUI::Action>> m_actions;
  22. RefPtr<GUI::TextBox> m_text_box;
  23. RefPtr<GUI::TableView> m_table_view;
  24. RefPtr<GUI::Model> m_model;
  25. RefPtr<GUI::FilteringProxyModel> m_filter_model;
  26. };
  27. }