Module wrap

Module wrap 

Source
Expand description

Wrap layout widget and properties.

The Wrap! widget implements inline layout. The example below demonstrates a rich text composed of multiple Wrap! and Text! widgets.

use zng::prelude::*;

Wrap!(ui_vec![
    Text!("Some text that "),
    text::Strong!("wraps"),
    Text!(" together."),
    Wrap! {
        text::font_color = colors::GREEN;
        children = ui_vec![
            Text!(" Nested Wrap panels can be used to set "),
            text::Em!("contextual"),
            Text!(" properties for a sequence of widgets.")
        ];
    },
    Text!(" The nested Wrap panel content items "),
    text::Strong!("wrap"),
    Text!(" with the parent items."),
])

Note that only some widgets and properties support inline layout, see the layout module documentation for more details.

§Full API

See zng_wgt_wrap for the full view API.

Structs§

Wrap
W Wrapping inline layout.

Traits§

WidgetInfoWrapExt
Extension methods for WidgetInfo that may represent a Wrap! instance.

Functions§

get_index
P Get the child index in the parent wrap.
get_index_len
P Get the child index and number of children.
get_rev_index
P Get the child index, starting from the last child at 0.
is_even
P If the child index is even.
is_first
P If the child is the first.
is_last
P If the child is the last.
is_odd
P If the child index is odd.
lazy_sample
Create a node that estimates the size of wrap panel children.
lazy_size
Create a node that estimates the size of wrap panel children.
node
Wrap node.