Debian Codegraph @

src/pool-prj-mgr/pool-mgr/editors/entity_editor.hpp

raw
1 #pragma once
2 #include <gtkmm.h>
3 #include "common/common.hpp"
4 #include "editor_base.hpp"
5 #include "util/sort_helper.hpp"
6 #include "pool/entity.hpp"
7
8 namespace horizon {
9
10 class EntityEditor : public Gtk::Box, public PoolEditorBase {
11 friend class GateEditor;
12
13 public:
14 EntityEditor(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &x, const std::string &filename,
15 class IPool &p);
16 static EntityEditor *create(const std::string &filename, class IPool &p);
17 void reload() override;
18
19 void save_as(const std::string &fn) override;
20 std::string get_name() const override;
21 const UUID &get_uuid() const override;
22 RulesCheckResult run_checks() const override;
23 const FileVersion &get_version() const override;
24 ObjectType get_type() const override;
25
26 virtual ~EntityEditor(){};
27
28 private:
29 class Entity entity;
30
31 void load();
32
33 Gtk::Entry *name_entry = nullptr;
34 Gtk::Entry *manufacturer_entry = nullptr;
35 Gtk::Entry *prefix_entry = nullptr;
36 class TagEntry *tag_entry = nullptr;
37
38 Gtk::ListBox *gates_listbox = nullptr;
39 Gtk::ToolButton *add_button = nullptr;
40 Gtk::ToolButton *delete_button = nullptr;
41
42 Glib::RefPtr<Gtk::SizeGroup> sg_name;
43 Glib::RefPtr<Gtk::SizeGroup> sg_suffix;
44 Glib::RefPtr<Gtk::SizeGroup> sg_swap_group;
45 Glib::RefPtr<Gtk::SizeGroup> sg_unit;
46
47 void handle_add();
48 void handle_delete();
49
50 void sort();
51 SortHelper sort_helper;
52
53 void bind_entry(Gtk::Entry *e, std::string &s);
54
55 std::unique_ptr<HistoryManager::HistoryItem> make_history_item(const std::string &comment) override;
56 void history_load(const HistoryManager::HistoryItem &it) override;
57 };
58 } // namespace horizon