kas-gui / kas

Another GUI toolkit
Apache License 2.0
893 stars 27 forks source link

New layout macro syntax incl. stand-alone mode #390

Closed dhardy closed 1 year ago

dhardy commented 1 year ago

Another extract from #387: new layout syntax (row![a, b, c] instead of row: [a, b, c]), including support as stand-alone macros.

Stand-alone usage is mostly useless for now since there's currently no way to integrate event handling, but it is used in examples/layout.rs:

    let ui = kas::grid! {
        (1, 0) => "Layout demo",
        (2, 0) => CheckBox::default(),
        (0..3, 1) => ScrollLabel::new(LIPSUM),
        (0, 2) => align!(center, "abc אבג def"),
        (1..3, 3) => align!(stretch, ScrollLabel::new(CRASIT)),
        (0, 3) => EditBox::new("A small\nsample\nof text")
            .with_multi_line(true),
    };