Peoplemon  0.1.0
Peoplemon 3 game source documentation
BehaviorEditor.hpp
Go to the documentation of this file.
1 #ifndef EDITOR_COMPONENTS_HELPERS_BEHAVIOREDITOR_HPP
2 #define EDITOR_COMPONENTS_HELPERS_BEHAVIOREDITOR_HPP
3 
4 #include <BLIB/Interfaces/GUI.hpp>
6 
7 namespace editor
8 {
9 namespace component
10 {
18 public:
19  using OnSetCb = std::function<void()>;
20  using NotifyWindowCb = std::function<void()>;
21 
29  BehaviorEditor(const OnSetCb& cb, const NotifyWindowCb& onOpen, const NotifyWindowCb& onClose);
30 
35  const core::file::Behavior& getValue() const;
36 
42  void pack(bl::gui::Box::Ptr parent);
43 
50  void configure(bl::gui::GUI* parent, const core::file::Behavior& behavior);
51 
56  void hide();
57 
58 private:
59  class PathEditor {
60  public:
61  PathEditor();
62  void pack(bl::gui::Box::Ptr box);
63  void init(const core::file::Behavior::Path& path);
64  const core::file::Behavior::Path& getValue() const;
65 
66  private:
68  bl::gui::ScrollArea::Ptr container;
69  bl::gui::CheckButton::Ptr toggle;
70 
71  void sync();
72  };
73 
74  const OnSetCb onSetCb;
75  const NotifyWindowCb onOpen;
76  const NotifyWindowCb onClose;
78  core::file::Behavior ogValue;
79  bl::gui::GUI* parent;
80  bl::gui::Window::Ptr window;
81  bl::gui::Notebook::Ptr notebook;
82  bl::gui::Label::Ptr typeLabel;
83  bl::gui::ComboBox::Ptr dirBox;
84  bl::gui::ComboBox::Ptr spinBox;
85  bl::gui::TextEntry::Ptr radiusEntry;
86  PathEditor pathEditor;
87 };
88 
89 } // namespace component
90 } // namespace editor
91 
92 #endif
All classes and functionality used for implementing the game editor.
Definition: Tile.hpp:11
Set of behaviors for NPCs and trainers.
Definition: Behavior.hpp:19
Contains data for when the behavior type is following a path.
Definition: Behavior.hpp:70
Inline GUI elements with openable window for editing behaviors.
void pack(bl::gui::Box::Ptr parent)
Packs the GUI elements for the editor into the given container.
const core::file::Behavior & getValue() const
Returns the behavior value.
std::function< void()> OnSetCb
BehaviorEditor(const OnSetCb &cb, const NotifyWindowCb &onOpen, const NotifyWindowCb &onClose)
Construct a new Behavior Editor.
void hide()
Hides the editor window if opened.
std::function< void()> NotifyWindowCb
void configure(bl::gui::GUI *parent, const core::file::Behavior &behavior)
Sets the parent GUI object and current value. Call before using.