aboutsummaryrefslogtreecommitdiff
path: root/libs/libgui/gui.h
blob: f4c213b124cdd96f086d08b30287557a99359801 (plain) (blame)
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
// MIT License, Copyright (c) 2021 Marvin Borner

#ifndef GUI_H
#define GUI_H

#include <def.h>
#include <errno.h>
#include <libgui/gfx.h>
#include <vec.h>

enum gui_listener {
	GUI_LISTEN_MOUSEMOVE,
	GUI_LISTEN_MOUSECLICK,
};

enum gui_layer {
	GUI_LAYER_BG,
	GUI_LAYER_FG,
};

res gui_new_window(void);
res gui_redraw_window(u32 id);

res gui_fill(u32 win_id, u32 widget_id, enum gui_layer layer, u32 c);
res gui_load_image(u32 win_id, u32 widget_id, enum gui_layer layer, vec2 pos, vec2 size,
		   const char *path) NONNULL;
res gui_load_image_filter(u32 win_id, u32 widget_id, enum gui_layer layer, vec2 pos, vec2 size,
			  enum gfx_filter filter, const char *path) NONNULL;

res gui_add_widget(u32 win_id, u32 widget_id, vec2 size, vec2 pos);
res gui_new_widget(u32 win_id, vec2 size, vec2 pos);
res gui_listen_widget(u32 win_id, u32 widget_id, enum gui_listener listener, u32 func);
res gui_redraw_widget(u32 win_id, u32 widget_id);

vec2 gui_window_size(u32 win_id);

void gui_loop(void);

#endif