Module zng::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§

  • W Wrapping inline layout.

Traits§

Functions§

  • P Get the child index in the parent wrap.
  • P Get the child index and number of children.
  • P Get the child index, starting from the last child at 0.
  • P If the child index is even.
  • P If the child is the first.
  • P If the child is the last.
  • P If the child index is odd.
  • Create a node that estimates the size of wrap panel children.
  • Create a node that estimates the size of wrap panel children.
  • Wrap node.