Struct native_windows_gui::FlexboxLayout
source · [−]pub struct FlexboxLayout { /* private fields */ }
Expand description
A flexbox layout that organizes the children control in a parent control. Flexbox uses the stretch library internally ( https://github.com/vislyhq/stretch ).
FlexboxLayout requires the flexbox
feature.
Implementations
sourceimpl FlexboxLayout
impl FlexboxLayout
pub fn builder() -> FlexboxLayoutBuilder
sourcepub fn style(&self) -> Style
pub fn style(&self) -> Style
Returns the style of the parent control
Panic:
- The layout must have been successfully built otherwise this function will panic.
sourcepub fn set_style(&self, style: Style)
pub fn set_style(&self, style: Style)
Sets the style of the layout parent control
Panic:
- The layout must have been successfully built otherwise this function will panic.
sourcepub fn add_child<W: Into<ControlHandle>>(
&self,
c: W,
style: Style
) -> Result<(), Error>
pub fn add_child<W: Into<ControlHandle>>(
&self,
c: W,
style: Style
) -> Result<(), Error>
Add a new children in the layout with the stretch style.
Panic:
- If the control is not a window-like control
- If the layout was not initialized
sourcepub fn remove_child<W: Into<ControlHandle>>(&self, c: W)
pub fn remove_child<W: Into<ControlHandle>>(&self, c: W)
Remove a children from the layout
Panic:
- If the control is not a window-like control
- If the control is not in the layout (see
has_child
) - If the layout was not initialized
sourcepub fn has_child<W: Into<ControlHandle>>(&self, c: W) -> bool
pub fn has_child<W: Into<ControlHandle>>(&self, c: W) -> bool
Check if the selected control is a children in the layout. Does not check in the sublayouts
Panic:
- If the control is not a window-like control.
- If the layout was not initialized
sourcepub fn children(&self) -> FlexboxLayoutChildren<'_>
pub fn children(&self) -> FlexboxLayoutChildren<'_>
Borrow the inner value of the flexbox layout. While the returned value lives, calling other method
of the the flexbox layout that modify the inner state will cause a panic. Simple looktup (ex: has_child
) will still work.
Panic:
- The layout must have been successfully built otherwise this function will panic.
sourcepub fn children_mut(&self) -> FlexboxLayoutChildrenMut<'_>
pub fn children_mut(&self) -> FlexboxLayoutChildrenMut<'_>
Borrow the inner value of the flexbox layout as mutable. While the returned value lives, calling other method of the the flexbox layout will cause a panic.
If the children of the layout were modified, call fit
to update the layout after FlexboxLayoutChildrenMut
is dropped.
Panic:
- The layout must have been successfully built otherwise this function will panic.
Trait Implementations
sourceimpl Clone for FlexboxLayout
impl Clone for FlexboxLayout
sourcefn clone(&self) -> FlexboxLayout
fn clone(&self) -> FlexboxLayout
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Default for FlexboxLayout
impl Default for FlexboxLayout
sourcefn default() -> FlexboxLayout
fn default() -> FlexboxLayout
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl !RefUnwindSafe for FlexboxLayout
impl !Send for FlexboxLayout
impl !Sync for FlexboxLayout
impl Unpin for FlexboxLayout
impl !UnwindSafe for FlexboxLayout
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more