From 340e841772eb13d9087235b8707c1cfeff8710cb Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Thu, 1 Jul 2021 14:43:53 +0200 Subject: Math improvements and basic plotting --- libs/libgui/gui.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'libs/libgui/gui.c') 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); -- cgit v1.2.3