diff options
author | Marvin Borner | 2021-07-01 14:43:53 +0200 |
---|---|---|
committer | Marvin Borner | 2021-07-01 14:43:53 +0200 |
commit | 340e841772eb13d9087235b8707c1cfeff8710cb (patch) | |
tree | 5f4c3328105a3ab194deef9f05fd05ff3c26b7dc /libs/libgui/gui.c | |
parent | 73a7db5b48eab615a0f6258e0196a1260a88cbbb (diff) |
Math improvements and basic plotting
Diffstat (limited to 'libs/libgui/gui.c')
-rw-r--r-- | libs/libgui/gui.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/libs/libgui/gui.c b/libs/libgui/gui.c index 56457e8..2dae302 100644 --- a/libs/libgui/gui.c +++ b/libs/libgui/gui.c @@ -486,9 +486,25 @@ vec2 gui_window_size(u32 win_id) } /** - * Window data setters + * Widget data getters/setters */ +vec2 gui_widget_size(u32 win_id, u32 widget_id) +{ + struct gui_widget *widget = gui_widget_by_id(win_id, widget_id); + if (!widget) + gui_error(ENOENT); + return widget->bg.size; +} + +struct gfx_context *gui_widget_context(u32 win_id, u32 widget_id, enum gui_layer layer) +{ + struct gui_widget *widget = gui_widget_by_id(win_id, widget_id); + if (!widget) + gui_error(ENOENT); + return layer == GUI_LAYER_BG ? &widget->bg : &widget->fg; +} + void gui_widget_margin(u32 win_id, u32 widget_id, vec2 margin) { struct gui_widget *widget = gui_widget_by_id(win_id, widget_id); |