51 lines
823 B
C
51 lines
823 B
C
|
|
/*
|
|
* Copyright (C) Artsiom D.
|
|
* Copyright (C) shit-co.de
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#include "chart.h"
|
|
#include "ui.h"
|
|
|
|
|
|
enum box_type {
|
|
BOX_VERTICAL,
|
|
BOX_HORIZONTAL,
|
|
BOX_CHART,
|
|
BOX_BUTTON,
|
|
};
|
|
|
|
struct box {
|
|
enum box_type type;
|
|
enum ui_color color;
|
|
double fills;
|
|
|
|
union {
|
|
/* button */
|
|
char *name;
|
|
|
|
/* chart */
|
|
struct chart *chart;
|
|
|
|
/* vertical/horizontal */
|
|
struct {
|
|
size_t length;
|
|
struct box **children;
|
|
};
|
|
};
|
|
};
|
|
|
|
|
|
struct box *new_button_box(char *name);
|
|
struct box *new_vertical_box(void);
|
|
struct box *new_horizontal_box(void);
|
|
struct box *new_chart_box(struct chart *);
|
|
|
|
void append_box(struct box *parent, struct box *child);
|
|
|
|
void draw_box(struct box *, double x, double y, double width, double height);
|