implement a convenient macro to start and end a div

This commit is contained in:
Alessandro Mauri 2025-08-14 22:16:54 +02:00
parent e8bb35811a
commit be00c87c6a
2 changed files with 48 additions and 41 deletions

View file

@ -23,6 +23,15 @@ struct ElemDiv {
Point origin_r, origin_c;
}
// useful macro to start and end a div, capturing the trailing block
macro Ctx.@div(&ctx, Rect size, bool scroll_x = false, bool scroll_y = false, ...; @body())
{
ctx.div_begin(size, scroll_x, scroll_y, $vasplat)!;
@body();
ctx.div_end()!;
}
// begin a widget container, or div, the size determines the offset (x,y) width and height.
// if the width or height are zero the width or height are set to the maximum available.
// if the width or height are negative the width or height will be calculated based on the children size