// // Created by jedi on 11/5/18. // #ifndef MGL_DMXMENU_LAYOUT_H #define MGL_DMXMENU_LAYOUT_H #include "gfx/canvas.h" #include "gfx/screen.h" class layout { class Slot { private: int pos_; int size_; canvas *canvas_ = 0; public: node *content; friend layout; }; private: const int maxwidth_; const int maxheight_; int allocated_; screen& screen_; int allocate_(node *, int); int expand_(int); int pack_(int); public: static const int maxslots = 10; Slot slots[maxslots]; layout(screen& s) : maxwidth_(s.getWidth()), maxheight_(s.getHeight()), screen_(s) { } int apply(node *); void render(); }; #endif //MGL_DMXMENU_LAYOUT_H