Peoplemon  0.1.0
Peoplemon 3 game source documentation
ScriptSelector.hpp
Go to the documentation of this file.
1 #ifndef EDITOR_COMPONENTS_SCRIPTSELECTOR_HPP
2 #define EDITOR_COMPONENTS_SCRIPTSELECTOR_HPP
3 
4 #include <BLIB/Interfaces/GUI.hpp>
5 #include <functional>
6 
7 namespace editor
8 {
9 namespace component
10 {
18 public:
20  using OnSelect = std::function<void(const std::string&)>;
21 
23  using OnCancel = std::function<void()>;
24 
31  ScriptSelector(const OnSelect& onSelect, const OnCancel& onCancel);
32 
39  void open(bl::gui::GUI* parent, const std::string& value = {});
40 
41 private:
42  const OnSelect onSelect;
43  const OnCancel onCancel;
44  bl::gui::Window::Ptr window;
45  bl::gui::TextEntry::Ptr scriptInput;
46  bl::gui::Label::Ptr errorLabel;
47 
48  bl::gui::FilePicker picker;
49  bl::gui::GUI* parent;
50  void onPick(const std::string& s);
51 
52  void checkSyntax();
53 };
54 
55 } // namespace component
56 } // namespace editor
57 
58 #endif
All classes and functionality used for implementing the game editor.
Definition: Tile.hpp:11
GUI component for selecting or writing scripts. Performs syntax validation as well.
std::function< void()> OnCancel
Called when the window is closed without a selection.
void open(bl::gui::GUI *parent, const std::string &value={})
Opens the dialog to select a script.
std::function< void(const std::string &)> OnSelect
Callback type for when a script is chosen.
ScriptSelector(const OnSelect &onSelect, const OnCancel &onCancel)
Construct a new Script Selector dialog.