2025-10-16 20:22:32 +02:00
|
|
|
|
2025-10-17 13:41:37 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright (C) Artsiom D.
|
|
|
|
|
* Copyright (C) shit-co.de
|
|
|
|
|
*/
|
2025-10-16 20:22:32 +02:00
|
|
|
|
|
|
|
|
|
2025-10-17 13:41:37 +02:00
|
|
|
|
|
|
|
|
#pragma once
|
2025-10-16 20:22:32 +02:00
|
|
|
|
2025-10-17 13:41:37 +02:00
|
|
|
#include "ui.h"
|
2025-10-16 20:22:32 +02:00
|
|
|
|
|
|
|
|
|
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-16 20:22:32 +02:00
|
|
|
|
2025-10-17 13:41:37 +02:00
|
|
|
struct box {
|
|
|
|
|
enum box_type type;
|
|
|
|
|
enum ui_color color;
|
|
|
|
|
double fills;
|
|
|
|
|
|
|
|
|
|
union {
|
|
|
|
|
/* button */
|
2025-10-17 18:01:57 +02:00
|
|
|
char *name;
|
2025-10-17 13:41:37 +02:00
|
|
|
|
2025-10-17 18:01:57 +02:00
|
|
|
/* chart and vertical/horizontal box */
|
2025-10-17 13:41:37 +02:00
|
|
|
struct {
|
2025-10-17 18:01:57 +02:00
|
|
|
/* chart and vertical/horizontal box */
|
2025-10-17 13:41:37 +02:00
|
|
|
size_t length;
|
2025-10-17 18:01:57 +02:00
|
|
|
|
|
|
|
|
union {
|
|
|
|
|
/* vertical/horizontal box */
|
|
|
|
|
struct box **children;
|
|
|
|
|
|
|
|
|
|
/* chart */
|
|
|
|
|
double *prices;
|
|
|
|
|
};
|
2025-10-17 13:41:37 +02:00
|
|
|
};
|
2025-10-16 20:22:32 +02:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
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);
|