Horizon
part_browser_window.hpp
1 #pragma once
2 #include "common/common.hpp"
3 #include "pool/part.hpp"
4 #include "pool/pool.hpp"
5 #include "util/uuid.hpp"
6 #include "util/window_state_store.hpp"
7 #include <array>
8 #include <gtkmm.h>
9 #include <set>
10 
11 namespace horizon {
12 
13 class PartBrowserWindow : public Gtk::Window {
14 public:
15  PartBrowserWindow(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &x, const std::string &pool_path,
16  std::deque<UUID> &favs);
17  static PartBrowserWindow *create(Gtk::Window *p, const std::string &pool_path, std::deque<UUID> &favs);
18  typedef sigc::signal<void, UUID> type_signal_place_part;
19  type_signal_place_part signal_place_part()
20  {
21  return s_signal_place_part;
22  }
23  void placed_part(const UUID &uu);
24 
25 private:
26  Gtk::Button *add_search_button = nullptr;
27  Gtk::Notebook *notebook = nullptr;
28  Gtk::Button *place_part_button = nullptr;
29  Gtk::ToggleButton *fav_button = nullptr;
30  Gtk::ListBox *lb_favorites = nullptr;
31  Gtk::ListBox *lb_recent = nullptr;
32  Gtk::Paned *paned = nullptr;
33  class PartPreview *preview = nullptr;
34  void handle_add_search();
35  void handle_switch_page(Gtk::Widget *w, guint index);
36  void handle_fav_toggled();
37  void update_favorites();
38  void update_recents();
39  void handle_favorites_selected(Gtk::ListBoxRow *row);
40  void handle_favorites_activated(Gtk::ListBoxRow *row);
41  void handle_place_part();
42  sigc::connection fav_toggled_conn;
43  std::set<Gtk::Widget *> search_views;
44  Pool pool;
45  UUID part_current;
46  void update_part_current();
47  std::deque<UUID> &favorites;
48  std::deque<UUID> recents;
49 
50  type_signal_place_part s_signal_place_part;
51 
52  WindowStateStore state_store;
53 };
54 } // namespace horizon
Definition: part_browser_window.hpp:13
Definition: window_state_store.hpp:20
Definition: part_preview.hpp:9
This class encapsulates a UUID and allows it to be uses as a value type.
Definition: uuid.hpp:16
Stores objects (Unit, Entity, Symbol, Part, etc.) from the pool.
Definition: pool.hpp:18
Definition: block.cpp:7