1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
//! Panel layout widget.
//!
//! The [`Panel!`](struct@Panel) widget allows widgets to
//!
//! ```
//! use zng::prelude::*;
//! # let _scope = APP.defaults();
//!
//! let layouts = [
//! (
//! "Stack!",
//! wgt_fn!(|args: zng::panel::PanelArgs| {
//! Stack! {
//! direction = StackDirection::top_to_bottom();
//! spacing = 5;
//! children = args.children;
//! }
//! }),
//! ),
//! (
//! "Wrap!",
//! wgt_fn!(|args: zng::panel::PanelArgs| {
//! Wrap! {
//! spacing = 5;
//! children = args.children;
//! }
//! }),
//! ),
//! (
//! "Grid!",
//! wgt_fn!(|args: zng::panel::PanelArgs| {
//! Grid! {
//! columns = ui_vec![grid::Column!(100.pct())];
//! auto_grow_fn = wgt_fn!(|_| grid::Row!(1.lft()));
//! spacing = 5;
//! cells = args.children;
//! }
//! }),
//! ),
//! ];
//! let selected_layout = var(0usize);
//!
//! # let _ =
//! zng::panel::Panel! {
//! children = layouts.iter().enumerate().map(|(i, (name, _))| {
//! Toggle! {
//! value::<usize> = i;
//! child = Text!(*name);
//! grid::cell::at = grid::cell::AT_AUTO;
//! }
//! }).collect::<UiVec>();
//! toggle::selector = toggle::Selector::single(selected_layout.clone());
//!
//! panel_fn = selected_layout.map(move |&i| layouts[i].1.clone());
//! }
//! # ;
//! ```
//!
//! # Full API
//!
//! See [`zng_wgt_panel`] for the full widget API.
pub use zng_wgt_panel::{node, panel_fn, Panel, PanelArgs};