micromenu/inc/gfx/layout.h

51 lines
750 B
C
Raw Normal View History

2018-11-05 20:09:01 +00:00
//
// 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_;
2018-11-06 15:06:05 +00:00
const int maxheight_;
2018-11-05 20:09:01 +00:00
int allocated_;
2018-11-06 15:06:05 +00:00
screen& screen_;
2018-11-05 20:09:01 +00:00
int allocate_(node *, int);
int expand_(int);
int pack_(int);
public:
static const int maxslots = 10;
Slot slots[maxslots];
2018-11-06 15:06:05 +00:00
layout(screen& s) : maxwidth_(s.getWidth()), maxheight_(s.getHeight()), screen_(s) {
2018-11-05 20:09:01 +00:00
}
int apply(node *);
void render();
};
#endif //MGL_DMXMENU_LAYOUT_H