Community-based box design. Remaking ReactJS, Vue, Angular, etc.
This commit is contained in:
54
box.h
Normal file
54
box.h
Normal file
@@ -0,0 +1,54 @@
|
||||
#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 *);
|
||||
Reference in New Issue
Block a user