Peoplemon  0.1.0
Peoplemon 3 game source documentation
ItemEditorWindow.hpp
Go to the documentation of this file.
1 #ifndef EDITOR_COMPONENTS_ITEMEDITORWINDOW_HPP
2 #define EDITOR_COMPONENTS_ITEMEDITORWINDOW_HPP
3 
4 #include <BLIB/Interfaces/GUI.hpp>
5 #include <Core/Files/ItemDB.hpp>
6 #include <Core/Items/Item.hpp>
7 #include <functional>
8 
9 namespace editor
10 {
11 namespace component
12 {
20 public:
22  using OnChange = std::function<void()>;
23 
30  ItemEditorWindow(core::file::ItemDB& db, const OnChange& onChange);
31 
38  void open(bl::gui::GUI* parent, core::item::Id item);
39 
40 private:
41  core::file::ItemDB& itemDb;
42  const OnChange onChange;
43  bool doingNewItem;
44 
45  bl::gui::Window::Ptr window;
46  bl::gui::TextEntry::Ptr idEntry;
47  bl::gui::TextEntry::Ptr nameEntry;
48  bl::gui::TextEntry::Ptr descEntry;
49  bl::gui::TextEntry::Ptr valueEntry;
50 
51  core::item::Id openId;
52  bool dirty;
53  bl::gui::Button::Ptr applyBut;
54 
55  void makeDirty();
56  void onCancel();
57  void onSave();
58  void close();
59 };
60 
61 } // namespace component
62 } // namespace editor
63 
64 #endif
Id
Represents an item in its simplist form.
Definition: Id.hpp:24
All classes and functionality used for implementing the game editor.
Definition: Tile.hpp:11
Loads and stores metadata surrounding items in the game.
Definition: ItemDB.hpp:24
Window for editing an individual item in the item database.
void open(bl::gui::GUI *parent, core::item::Id item)
Open the editor window.
std::function< void()> OnChange
Callback signature for when an item is modified.
ItemEditorWindow(core::file::ItemDB &db, const OnChange &onChange)
Construct a new Item Editor Window.