Peoplemon  0.1.0
Peoplemon 3 game source documentation
Levels.hpp
Go to the documentation of this file.
1 #ifndef EDITOR_PAGES_SUBPAGES_LEVELS_HPP
2 #define EDITOR_PAGES_SUBPAGES_LEVELS_HPP
3 
4 #include <BLIB/Interfaces/GUI.hpp>
5 
6 namespace editor
7 {
8 namespace page
9 {
16 class Levels {
17 public:
18  using RenderFilterCb = std::function<void(unsigned int level, bool visible)>;
19  using ShiftCb = std::function<void(unsigned int level, bool up)>;
20  using AddCb = std::function<void()>;
21 
30  Levels(const RenderFilterCb& filterCb, const ShiftCb& onShift, const AddCb& addCb);
31 
37  void sync(const std::vector<bool>& filter);
38 
43  bl::gui::Box::Ptr getContent();
44 
49  void pack();
50 
55  void unpack();
56 
57 private:
58  struct Item {
59  bl::gui::Box::Ptr row;
60  bl::gui::Label::Ptr name;
61  bl::gui::CheckButton::Ptr visibleToggle;
62  bl::gui::Button::Ptr upBut;
63  bl::gui::Button::Ptr downBut;
64  bl::gui::Button::Ptr delBut;
65 
66  Item(unsigned int i, unsigned int mi, bool visible, const RenderFilterCb& filterCb,
67  const ShiftCb& shiftCb);
68  };
69 
70  const RenderFilterCb filterCb;
71  const ShiftCb shiftCb;
72 
73  bl::gui::Box::Ptr contentWrapper;
74  bl::gui::Box::Ptr content;
75  bl::gui::ComboBox::Ptr activeSelect;
76  bl::gui::ComboBox::Ptr firstYSortSelect;
77  bl::gui::ComboBox::Ptr firstTopSelect;
78  bl::gui::ScrollArea::Ptr itemArea;
79  std::vector<Item> rows;
80 };
81 
82 } // namespace page
83 } // namespace editor
84 
85 #endif
All classes and functionality used for implementing the game editor.
Definition: Tile.hpp:11
Provides controls to add, move, remove, and toggle visibility for levels.
Definition: Levels.hpp:16
void unpack()
Hides the GUI content. Good for saving space when not active.
Definition: Levels.cpp:32
bl::gui::Box::Ptr getContent()
Returns the GUI content to pack.
Definition: Levels.cpp:28
Levels(const RenderFilterCb &filterCb, const ShiftCb &onShift, const AddCb &addCb)
Construct a new Levels subpage.
Definition: Levels.cpp:9
std::function< void(unsigned int level, bool up)> ShiftCb
Definition: Levels.hpp:19
void pack()
Packs the GUI content.
Definition: Levels.cpp:30
void sync(const std::vector< bool > &filter)
Syncs the number of levels and their visible status.
Definition: Levels.cpp:34
std::function< void()> AddCb
Definition: Levels.hpp:20
std::function< void(unsigned int level, bool visible)> RenderFilterCb
Definition: Levels.hpp:18