From a7284d1250b3605a471daddb9a214c2fa5978f82 Mon Sep 17 00:00:00 2001 From: Sam Anthony Date: Tue, 29 Apr 2025 13:22:06 -0400 Subject: image widget --- main.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 60781a9..1edaeda 100644 --- a/main.c +++ b/main.c @@ -396,24 +396,18 @@ comp_select(mu_Context *ctx, UI *ui) { static void comp_img(mu_Context *ctx, UI *ui) { + int w, h; mu_Rect r; - const char *data; - int id, w, h; + /* Row that covers the rest of the window. */ r_get_window_size(&w, &h); mu_layout_row(ctx, 1, &w, h); - - data = ui->comps[ui->comp_select.idx].imgfile; - id = mu_get_id(ctx, &data, sizeof(data)); - r = mu_layout_next(ctx); r.w = w - r.x - ctx->style->spacing; r.h = h - r.y - ctx->style->spacing; mu_layout_set_next(ctx, r, 0); - mu_update_control(ctx, id, r, 0); - - mu_draw_icon(ctx, 0, r, (mu_Color) {0, 0, 0, 0}); + w_image(ctx, &ui->comp_img); } static void -- cgit v1.2.3