[][src]Struct uniui_layout_linear_layout::LinearLayout

pub struct LinearLayout { /* fields omitted */ }

LinearLayout places widgets one after another verically or horizontally.

The space will be equally distributed beetween widgets. You can modify it by using [uniui_wrapper_stretchfactor].

Example (without macros, see better example with macros below):

use uniui_widget_button::Button;
use uniui_layout_linear_layout::LinearLayout;

let button1 = Button::new("Button1".to_owned());
let button2 = Button::new("Button2".to_owned());

let mut linear_layout = LinearLayout::new(Orientation::Horizontal);
linear_layout.push_widget(button1);
linear_layout.push_widget(button2);

Macros

You may be interested in u_linear_layout! macros to simplify LinearLayout creation. Better example with macros:

use uniui_layout_linear_layout::prelude::*;

let linear_layout = u_linear_layout! {
    orientation: Orientation::Vertical,
    widgets: {
        Button::new("Button1".to_owned()),
        Button::new("Button2".to_owned()),
    }
};

Implementations

impl LinearLayout[src]

pub fn new(orientation: Orientation) -> LinearLayout[src]

Creates new LinearLayout with predefined Orientation

use uniui_gui::Orientation;
use uniui_layout_linear_layout::LinearLayout;

let linear_layout = LinearLayout::new(Orientation::Horizontal);

pub fn push_widget<W>(&mut self, widget: W) where
    W: Sized + Widget + 'static, 
[src]

Moves widget into layout

Since widget itself will be moved into layout so the widget have to be configured before push_widget will be called.

use uniui_gui::Orientation;
use uniui_layout_linear_layout::LinearLayout;
use uniui_widget_button::Button;

let mut linear_layout = LinearLayout::new(Orientation::Horizontal);

let button = Button::new("Button".to_owned());
linear_layout.push_widget(button);

pub fn slot_alignment_horizontal(&self) -> &dyn Slot<AlignmentHorizontal>[src]

pub fn slot_alignment_vertical(&self) -> &dyn Slot<AlignmentVertical>[src]

pub fn slot_set_items_alignment(&self) -> &dyn Slot<ItemsAlignment>[src]

pub fn slot_set_wrap(&self) -> &dyn Slot<Wrap>[src]

Trait Implementations

impl DataProcessor for LinearLayout[src]

impl Widget for LinearLayout[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.