Peoplemon  0.1.0
Peoplemon 3 game source documentation
CatchRegionWindow.hpp
Go to the documentation of this file.
1 #ifndef EDITOR_COMPONENTS_CATCHREGIONWINDOW_HPP
2 #define EDITOR_COMPONENTS_CATCHREGIONWINDOW_HPP
3 
4 #include <BLIB/Interfaces/GUI.hpp>
7 
8 namespace editor
9 {
10 namespace component
11 {
19 public:
21  using TriggerCb = std::function<void()>;
22 
28  CatchRegionWindow(const TriggerCb& onSave);
29 
36  void open(bl::gui::GUI* gui, const core::map::CatchRegion& region);
37 
43 
44 private:
45  const TriggerCb onSave;
47 
48  struct Row {
49  using Callback = std::function<void(bl::gui::Element*)>;
50 
51  bl::gui::Box::Ptr row;
52  PeoplemonSelector::Ptr idSelect;
53  bl::gui::TextEntry::Ptr minLevel;
54  bl::gui::TextEntry::Ptr maxLevel;
55  bl::gui::Slider::Ptr freqSlider;
56  bl::gui::Label::Ptr freqLabel;
57  bl::gui::CheckButton::Ptr lockBut;
58  bl::gui::Button::Ptr delBut;
59 
60  Row(const Callback& freqChange, const Callback& del);
61  };
62 
63  bl::gui::Window::Ptr window;
64  bl::gui::TextEntry::Ptr nameEntry;
65  bl::gui::ScrollArea::Ptr peopleScroll;
66  std::vector<Row> rows;
67 
68  void close();
69  void save();
70  void add();
71  void remove(bl::gui::Element* e);
72  void freqChange(bl::gui::Element* e);
73  bool validate() const;
74 };
75 
76 } // namespace component
77 } // namespace editor
78 
79 #endif
All classes and functionality used for implementing the game editor.
Definition: Tile.hpp:11
Represents a class of catchable peoplemon.
Definition: CatchRegion.hpp:18
Window that opens to edit a catch region in maps.
CatchRegionWindow(const TriggerCb &onSave)
Construct a new Catch Region Window.
std::function< void()> TriggerCb
Called when the region is saved.
const core::map::CatchRegion & getValue()
Returns the current region value as inputed by the user.
void open(bl::gui::GUI *gui, const core::map::CatchRegion &region)
Opens the window with the given region value.
std::shared_ptr< PeoplemonSelector > Ptr