50 lines
697 B
C
50 lines
697 B
C
|
//
|
||
|
// 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_;
|
||
|
int allocated_;
|
||
|
screen screen_;
|
||
|
|
||
|
int allocate_(node *, int);
|
||
|
|
||
|
int expand_(int);
|
||
|
|
||
|
int pack_(int);
|
||
|
|
||
|
|
||
|
public:
|
||
|
static const int maxslots = 10;
|
||
|
Slot slots[maxslots];
|
||
|
|
||
|
layout(int width) : maxwidth_(width), screen_(width, 32) {
|
||
|
|
||
|
}
|
||
|
|
||
|
int apply(node *);
|
||
|
|
||
|
void render();
|
||
|
};
|
||
|
|
||
|
|
||
|
|
||
|
#endif //MGL_DMXMENU_LAYOUT_H
|