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