Files
gambling-curses/box.h

55 lines
812 B
C
Raw Normal View History

#pragma once
#include "chart.h"
enum box_type {
BOX_VERTICAL,
BOX_HORIZONTAL,
BOX_CHART,
BOX_BUTTON,
};
enum length_type {
LENGTH_FILL,
LENGTH_PIXEL,
};
struct length {
enum length_type type;
union {
double fill;
double pixel;
};
};
struct box {
enum box_type;
size_t width;
size_t height;
enum color color;
union {
struct chart *chart;
/* button */
struct {
char *name;
};
/* container boxes */
struct {
struct box *children;
size_t length;
};
};
};
box *new_chart_box(struct box *, size_t width, size_t height);
box *new_button_box(struct button *, size_t width, size_t height);
box *new_vertical_box(size_t width, size_t height);
box *new_horizontal_box(size_t width, size_t height);
void draw_box(struct box *);