[][src]Trait pushrod::render::layout::Layout

pub trait Layout {
    fn insert_widget(
        &mut self,
        _widget_id: i32,
        _widget_position: LayoutPosition
    );
fn append_widget(&mut self, _widget_id: i32);
fn set_padding(&mut self, padding: PaddingConstraint);
fn get_padding(&self) -> PaddingConstraint;
fn do_layout(&mut self, _widgets: &[WidgetContainer]);
fn needs_layout(&self) -> bool; }

This is a Layout trait that is used by the Engine service, which stores a list of Widgets, their positions (based on matrix coordinates), and an entry point to trigger the layout compute action.

Required methods

fn insert_widget(&mut self, _widget_id: i32, _widget_position: LayoutPosition)

Adds a Widget by ID to the Layout manager, given its LayoutPosition, as a position marker in the manager.

fn append_widget(&mut self, _widget_id: i32)

Adds a Widget by ID to the Layout manager, automatically adding it to the next available LayoutPosition. Use this as a way to add a widget if you don't need to specify a LayoutPosition.

fn set_padding(&mut self, padding: PaddingConstraint)

Changes the PaddingConstraint for this Layout.

fn get_padding(&self) -> PaddingConstraint

Retrieves the current PaddingConstraint.

fn do_layout(&mut self, _widgets: &[WidgetContainer])

Performs a layout, applying the WidgetContainer list at the time, so that referenced Widgets can be adjusted as necessary.

fn needs_layout(&self) -> bool

Indicates whether or not the Layout needs to have do_layout re-run. This is generally needed when the LayoutPosition changes, or when PaddingConstraints change.

Loading content...

Implementors

impl Layout for GridLayout[src]

This is the Layout implementation for the GridLayout manager. This Layout manager will not reposition any objects within the bounds of the Layout until at least 2 objects have been added to the bounds of the Layout.

fn insert_widget(&mut self, _widget_id: i32, _widget_position: LayoutPosition)[src]

Adds a widget to the HorizontalLayout managed stack.

fn append_widget(&mut self, _widget_id: i32)[src]

Appends a widget to the HorizontalLayout managed stack.

fn do_layout(&mut self, _widgets: &[WidgetContainer])[src]

Adjusts the layout of the Widgets managed by this Layout manager. Currently only obeys the spacing in the object. The rest of the padding is not (yet) honored.

impl Layout for HorizontalLayout[src]

This is the Layout implementation for the HorizontalLayout manager. This Layout manager will not reposition any objects within the bounds of the Layout until at least 2 objects have been added to the bounds of the Layout.

fn insert_widget(&mut self, widget_id: i32, widget_position: LayoutPosition)[src]

Adds a widget to the HorizontalLayout managed stack.

fn append_widget(&mut self, widget_id: i32)[src]

Appends a widget to the HorizontalLayout managed stack.

fn do_layout(&mut self, _widgets: &[WidgetContainer])[src]

Adjusts the layout of the Widgets managed by this Layout manager. Currently only obeys the spacing in the object. The rest of the padding is not (yet) honored.

impl Layout for VerticalLayout[src]

This is the Layout implementation for the VerticalLayout manager. This Layout manager will not reposition any objects within the bounds of the Layout until at least 2 objects have been added to the bounds of the Layout.

fn insert_widget(&mut self, widget_id: i32, widget_position: LayoutPosition)[src]

Adds a widget to the VerticalLayout managed stack.

fn append_widget(&mut self, widget_id: i32)[src]

Appends a widget to the VerticalLayout managed stack.

fn do_layout(&mut self, _widgets: &[WidgetContainer])[src]

Adjusts the layout of the Widgets managed by this Layout manager. Currently only obeys the spacing in the object. The rest of the padding is not (yet) honored.

Loading content...