Skip to main content

SlotViews

Trait SlotViews 

pub trait SlotViews {
    // Required methods
    fn len(&self) -> usize;
    fn view_mut(&mut self, index: usize) -> Option<&mut Box<dyn Widget>>;
    fn insert(&mut self, index: usize, view: Box<dyn Widget>);
    fn remove(&mut self, index: usize);
    fn move_view(&mut self, from: usize, to: usize);
    fn replace(&mut self, index: usize, view: Box<dyn Widget>);

    // Provided method
    fn is_empty(&self) -> bool { ... }
}
Expand description

The views in one slot of a widget, which a host inserts, removes, moves and replaces by key: a change of a slot’s content costs what changed, and is described to the window (crate::widget::StructureChange::Described) rather than rebuilding the widget.

Required Methods§

fn len(&self) -> usize

How many views the slot holds.

fn view_mut(&mut self, index: usize) -> Option<&mut Box<dyn Widget>>

fn insert(&mut self, index: usize, view: Box<dyn Widget>)

fn remove(&mut self, index: usize)

fn move_view(&mut self, from: usize, to: usize)

fn replace(&mut self, index: usize, view: Box<dyn Widget>)

Provided Methods§

fn is_empty(&self) -> bool

Implementors§

§

impl SlotViews for Row

The row’s children are its slot: a component that holds a row takes the views it is given where they stand, and the row lays them out again.

§

impl SlotViews for Scrollable

The content of the scroll: one view, or none.

§

impl SlotViews for NavShell

The views of the slot the shell is changing: a column’s body, or a header’s actions.

§

impl SlotViews for Section

The items under a section’s header.

§

impl SlotViews for ChromeBody

The body the chrome holds: one view, which changes where it stands.

§

impl SlotViews for DeclaredPanel

The view of the header or footer being changed: one, or none.

§

impl SlotViews for Docked

The view of the slot being changed: the content, or the foot.

§

impl SlotViews for DragRun

The view of the item a host is changing, where the item stands: the view in the slot its run gave it, so a part of the bar changes what it shows without the bar being built again.

§

impl SlotViews for Map

The pins of a map: one view each. Once the map is built the widgets live in its region, so a change here reaches the region’s children; before that, in the map’s own store. Either way the pins’ keys and places stay in self.pins, which the next layout lays out afresh.

§

impl SlotViews for PageSlide

The page, the slot’s one view, which changes where it stands.

§

impl SlotViews for WindowFrame

The view of the slot being changed: the controls, the tabs, or the content.

§

impl<L> SlotViews for Arranged<L>
where L: Layout + 'static,