Files
gambling-curses/box.h

55 lines
956 B
C
Raw Normal View History

2025-10-17 13:41:37 +02:00
/*
* Copyright (C) Artsiom D.
* Copyright (C) shit-co.de
*/
2025-10-17 13:41:37 +02:00
#pragma once
2025-10-17 13:41:37 +02:00
#include "ui.h"
2025-10-17 13:41:37 +02:00
enum box_type {
BOX_VERTICAL,
BOX_HORIZONTAL,
2025-10-17 18:01:57 +02:00
BOX_CHART,
2025-10-17 13:41:37 +02:00
BOX_BUTTON,
};
2025-10-17 13:41:37 +02:00
struct box {
enum box_type type;
enum ui_color color;
double fills;
union {
/* button */
char *name;
/* chart and vertical/horizontal box */
struct {
/* chart and vertical/horizontal box */
size_t length;
union {
/* vertical/horizontal box */
struct box **children;
/* chart */
double *prices;
};
};
};
};
2025-10-17 13:41:37 +02:00
struct box *new_button_box(char *name);
struct box *new_vertical_box(void);
struct box *new_horizontal_box(void);
2025-10-17 18:01:57 +02:00
struct box *new_chart_box(void);
void append_box(struct box *parent, struct box *child);
2025-10-17 13:41:37 +02:00
2025-10-17 18:01:57 +02:00
void draw_box(struct box *, double x, double y, double width, double height);