--- a/ui/common/types.c Sun Jun 08 23:47:00 2025 +0200 +++ b/ui/common/types.c Mon Jun 09 08:41:16 2025 +0200 @@ -36,6 +36,7 @@ #include "../ui/tree.h" #include "types.h" #include "context.h" +#include "../ui/image.h" @@ -395,6 +396,28 @@ } } +void ui_image_set(UiGeneric *g, void *img) { + // TODO: ref? + if(g->set) { + g->set(g, img, UI_IMAGE_OBJECT_TYPE); + } else { + g->value = img; + g->type = UI_IMAGE_OBJECT_TYPE; + } +} + +void* ui_image_get(UiGeneric *g) { + if(g->type) { + if(!strcmp(g->type, UI_IMAGE_OBJECT_TYPE)) { + return g->value; + } else { + return NULL; + } + } + return g->value; +} + + char* ui_text_get(UiText* s) { if (s) { return s->get ? s->get(s) : s->value.ptr;