Peoplemon  0.1.0
Peoplemon 3 game source documentation
ConversationWindow.hpp
Go to the documentation of this file.
1 #ifndef EDITOR_COMPONENTS_CONVERSATIONWINDOW_HPP
2 #define EDITOR_COMPONENTS_CONVERSATIONWINDOW_HPP
3 
4 #include <BLIB/Interfaces/GUI.hpp>
8 
9 namespace editor
10 {
11 namespace component
12 {
19 public:
21  using SelectCb = std::function<void(const std::string&)>;
22 
24  using CancelCb = std::function<void()>;
25 
32  ConversationWindow(const SelectCb& onSelect, const CancelCb& onCancel);
33 
40  void open(bl::gui::GUI* parent, const std::string& current);
41 
42 private:
43  enum struct FilePickerMode { MakeNew, OpenExisting, SetFile } filePickerMode;
44 
45  const SelectCb selectCb;
46  const CancelCb cancelCb;
48  unsigned int currentNode;
49 
50  bl::gui::GUI* parent;
51  bl::gui::Window::Ptr window;
52  bl::gui::Box::Ptr nodeBox;
53  ConversationTree::Ptr treeComponent;
54  ConversationNode nodeComponent;
55  bl::gui::FilePicker filePicker;
56  bool dirty;
57 
58  bl::gui::Label::Ptr fileLabel;
59  bl::gui::Button::Ptr saveBut;
60 
61  void makeDirty();
62  void makeClean();
63  void sync();
64  bool validate() const;
65  bool confirmDiscard() const;
66  void setSelected(unsigned int i);
67 };
68 
69 } // namespace component
70 } // namespace editor
71 
72 #endif
All classes and functionality used for implementing the game editor.
Definition: Tile.hpp:11
Stores a conversation that an NPC or trainer can have with the player.
Helper component for editing individual conversation nodes.
std::shared_ptr< ConversationTree > Ptr
A window for choosing and editing conversations.
std::function< void(const std::string &)> SelectCb
Callback for when a conversation is chosen.
std::function< void()> CancelCb
Callback for when the window is closed with no choice made.
ConversationWindow(const SelectCb &onSelect, const CancelCb &onCancel)
Initialize a new conversation window.
void open(bl::gui::GUI *parent, const std::string &current)
Actually opens the window and initializes with a conversation.