From 1ec6eb88c9c5b8aca580f412c5327304df2d99c3 Mon Sep 17 00:00:00 2001 From: Alessandro Mauri Date: Mon, 27 Oct 2025 11:02:11 +0100 Subject: [PATCH] implemented @popup() macro --- src/widgets/div.c3 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/widgets/div.c3 b/src/widgets/div.c3 index 4d03129..8f3453c 100644 --- a/src/widgets/div.c3 +++ b/src/widgets/div.c3 @@ -172,6 +172,21 @@ fn Id? Ctx.div_end(&ctx) return elem.id; } +<* @param[&inout] state *> +macro Ctx.@popup(&ctx, bool* state, + Point pos, + Size width, Size height, + LayoutDirection dir = ROW, Anchor anchor = TOP_LEFT, + bool scroll_x = false, bool scroll_y = false, + ...; @body()) +{ + if (*state) { + *state = ctx.popup_begin(pos, width, height, dir, anchor, scroll_x, scroll_y)!; + @body(); + ctx.div_end()!; + } +} + macro bool? Ctx.popup_begin(&ctx, Point pos, Size width, Size height, LayoutDirection dir = ROW, Anchor anchor = TOP_LEFT,