[−][src]Struct uniui_layout_linear_layout::LinearLayout
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]
W: Sized + Widget + 'static,
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]
pub fn process_data(
&mut self,
msec_since_app_epoch: i64,
app: &mut dyn Application
)
[src]
&mut self,
msec_since_app_epoch: i64,
app: &mut dyn Application
)
impl Widget for LinearLayout
[src]
pub fn to_native(
&mut self,
widget_generator: &mut dyn WidgetGenerator
) -> Result<NativeWidget, ()>
[src]
&mut self,
widget_generator: &mut dyn WidgetGenerator
) -> Result<NativeWidget, ()>
pub fn draw(&mut self)
[src]
Auto Trait Implementations
impl !RefUnwindSafe for LinearLayout
[src]
impl !Send for LinearLayout
[src]
impl !Sync for LinearLayout
[src]
impl Unpin for LinearLayout
[src]
impl !UnwindSafe for LinearLayout
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,