Files
gambling-curses/box.h

51 lines
823 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
#include "chart.h"
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 */
struct chart *chart;
/* vertical/horizontal */
struct {
size_t length;
struct box **children;
};
};
};
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);
struct box *new_chart_box(struct chart *);
2025-10-17 18:01:57 +02:00
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);