Horizon
tool_popover.hpp
1 #pragma once
2 #include "core/core.hpp"
3 #include "action.hpp"
4 #include "action_catalog.hpp"
5 #include <gtkmm.h>
6 
7 namespace horizon {
8 
9 class ToolPopover : public Gtk::Popover {
10 public:
11  ToolPopover(Gtk::Widget *parent, ActionCatalogItem::Availability av);
12  typedef sigc::signal<void, ActionID, ToolID> type_signal_action_activated;
13  type_signal_action_activated signal_action_activated()
14  {
15  return s_signal_action_activated;
16  }
17  void set_can_begin(const std::map<std::pair<ActionID, ToolID>, bool> &can_begin);
18  void set_key_sequences(std::pair<ActionID, ToolID> action_id, const std::vector<KeySequence> &seqs);
19 
20 private:
21  Gtk::SearchEntry *search_entry;
22  class ListColumns : public Gtk::TreeModelColumnRecord {
23  public:
24  ListColumns()
25  {
26  Gtk::TreeModelColumnRecord::add(name);
27  Gtk::TreeModelColumnRecord::add(action_id);
28  Gtk::TreeModelColumnRecord::add(tool_id);
29  Gtk::TreeModelColumnRecord::add(can_begin);
30  Gtk::TreeModelColumnRecord::add(keys);
31  }
32  Gtk::TreeModelColumn<Glib::ustring> name;
33  Gtk::TreeModelColumn<ActionID> action_id;
34  Gtk::TreeModelColumn<ToolID> tool_id;
35  Gtk::TreeModelColumn<bool> can_begin;
36  Gtk::TreeModelColumn<Glib::ustring> keys;
37  };
38  ListColumns list_columns;
39 
40  class ListColumnsGroup : public Gtk::TreeModelColumnRecord {
41  public:
42  ListColumnsGroup()
43  {
44  Gtk::TreeModelColumnRecord::add(name);
45  Gtk::TreeModelColumnRecord::add(group);
46  }
47  Gtk::TreeModelColumn<Glib::ustring> name;
48  Gtk::TreeModelColumn<ActionGroup> group;
49  };
50  ListColumnsGroup list_columns_group;
51  Gtk::TreeView *view;
52  Glib::RefPtr<Gtk::ListStore> store;
53  Glib::RefPtr<Gtk::TreeModelFilter> store_filtered;
54 
55 
56  Gtk::TreeView *view_group;
57  Glib::RefPtr<Gtk::ListStore> store_group;
58  Gtk::Revealer *revealer = nullptr;
59 
60  void emit_tool_activated();
61  type_signal_action_activated s_signal_action_activated;
62  void on_show() override;
63  std::unique_ptr<Glib::PatternSpec> pattern;
64  ActionGroup selected_group = ActionGroup::ALL;
65 };
66 } // namespace horizon
horizon::ToolPopover
Definition: tool_popover.hpp:9