-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdoc.h
More file actions
55 lines (41 loc) · 1.31 KB
/
doc.h
File metadata and controls
55 lines (41 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#pragma once
#include "data/struct/linked_list.h"
#include "string/slice.h"
#include "draw/draw.h"
typedef enum {
leading,
horizontal_center,
trailing,
} horizontal_alignment;
typedef enum {
top,
bottom,
vertical_center,
} vertical_alignment;
typedef enum { doc_text_none, doc_text_body, doc_text_title, doc_text_subtitle, doc_text_heading, doc_text_subheading, doc_text_footnote, doc_text_caption } doc_text_size;
typedef enum { doc_layout_none, doc_layout_vertical, doc_layout_horizontal, doc_layout_depth } doc_layout_types;
typedef enum { doc_gen_type_none, doc_gen_text, doc_gen_layout } doc_gen_type;
typedef enum { size_none, size_fit, size_fill, size_relative } size_rule;
typedef struct {
int type;
doc_gen_type general_type;
color bg_color;
color fg_color;
size_rule sizing_rule;
gpu_rect rect;
u32 padding;
float percentage;
horizontal_alignment horiz_alignment;
vertical_alignment vert_alignment;
} node_info;
typedef struct {
node_info info;
linked_list_t *children;
string_slice content;
} document_node;
typedef struct {
document_node *root;
} document_data;
void layout_document(gpu_rect canvas, document_data doc);
void render_document(draw_ctx *ctx, document_data doc);
void debug_document(document_data doc);