diff options
| author | Federico Angelilli <code@fedang.net> | 2024-07-09 14:29:54 +0200 |
|---|---|---|
| committer | Federico Angelilli <code@fedang.net> | 2024-07-09 14:29:54 +0200 |
| commit | 28adc6b395d2fb7545189636cec3651b9c2a5f73 (patch) | |
| tree | 8b7124f6534beab94ba1ea163bfc86b8ff7aec41 /src/block.h | |
| parent | 748613db7a794be69def5f008e2e2eea428d8541 (diff) | |
Add layouts
Diffstat (limited to 'src/block.h')
| -rw-r--r-- | src/block.h | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/src/block.h b/src/block.h index 3df760b..2179348 100644 --- a/src/block.h +++ b/src/block.h @@ -5,6 +5,8 @@ #include <stdbool.h> #include <time.h> +#include "event.h" + // Color representation normalized to [0, 1] // typedef struct { @@ -36,37 +38,33 @@ typedef void (*block_event_t)(block_t *block, event_t *event); // typedef void (*block_update_t)(block_t *block); -// Generic block type +// Block struct // -typedef struct block { - block_type_t type; +struct block { bool hidden; color_t color; color_t line_color; int line_width; int x_padding, y_padding; int min_width, max_width; - block_event_t event_cb; -}; - -// Block text type -// -typedef struct { - block_t block; - const char *text; - color_t text_color; - align_t text_align; - int text_width; int update_interval; struct timespec update_last; block_update_t update_cb; -} block_text_t; - -// Block group type -// -typedef struct block_group { - block_t block; - struct block_group *next; -} block_group_t; + block_event_t event_cb; + block_type_t type; + union { + struct { + const char *text; + color_t text_color; + align_t text_align; + int text_size; + } text; + struct { + int spacing; + int n_children; + struct block *children; + } group; + }; +}; #endif |
