52 lines
		
	
	
		
			857 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			52 lines
		
	
	
		
			857 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;
 | |
|     unsigned int 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 *, unsigned int x, unsigned int y, unsigned int width,
 | |
|     unsigned int height);
 |