Horizon
parts_window.hpp
1 #pragma once
2 #include <set>
3 #include <gtkmm.h>
4 #include "util/uuid.hpp"
5 #include "util/window_state_store.hpp"
6 #include "nlohmann/json_fwd.hpp"
7 
8 namespace horizon {
9 using json = nlohmann::json;
10 
11 class PartsWindow : public Gtk::Window {
12 public:
13  PartsWindow(const class Board &brd);
14  void update();
15 
16  typedef sigc::signal<void, std::set<UUID>> type_signal_selected;
17  type_signal_selected signal_selected()
18  {
19  return s_signal_selected;
20  }
21 
22  json serialize() const;
23  void load_from_json(const json &j);
24 
25 
26 private:
27  const Board &board;
28 
29  class ListColumns : public Gtk::TreeModelColumnRecord {
30  public:
31  ListColumns()
32  {
33  Gtk::TreeModelColumnRecord::add(MPN);
34  Gtk::TreeModelColumnRecord::add(value);
35  Gtk::TreeModelColumnRecord::add(refdes);
36  Gtk::TreeModelColumnRecord::add(qty);
37  Gtk::TreeModelColumnRecord::add(components);
38  Gtk::TreeModelColumnRecord::add(placed);
39  Gtk::TreeModelColumnRecord::add(part);
40  }
41  Gtk::TreeModelColumn<Glib::ustring> MPN;
42  Gtk::TreeModelColumn<Glib::ustring> value;
43  Gtk::TreeModelColumn<Glib::ustring> refdes;
44  Gtk::TreeModelColumn<unsigned int> qty;
45  Gtk::TreeModelColumn<std::set<UUID>> components;
46  Gtk::TreeModelColumn<bool> placed;
47  Gtk::TreeModelColumn<UUID> part;
48  };
49  ListColumns list_columns;
50 
51  Glib::RefPtr<Gtk::ListStore> store;
52  Gtk::TreeView *tree_view = nullptr;
53 
54  WindowStateStore state_store;
55 
56  type_signal_selected s_signal_selected;
57 };
58 } // namespace horizon
Definition: board.hpp:42
Definition: parts_window.hpp:11
Definition: window_state_store.hpp:20
a class to store JSON values
Definition: json.hpp:166
basic_json<> json
default JSON class
Definition: json_fwd.hpp:61