Struct FlexItem

Source
pub struct FlexItem<'a> { /* private fields */ }
Expand description

Configuration for a flex item.

Implementations§

Source§

impl<'a> FlexItem<'a>

Source

pub fn new() -> Self

Create a new flex item. You can also use the item function.

Source

pub fn grow(self, grow: f32) -> Self

How much should this item grow compared to the other items.

By default items don’t grow.

Source

pub fn basis(self, basis: f32) -> Self

Set the default size of the item, before it grows. If this is not set, the items “intrinsic size” will be used.

Source

pub fn align_self(self, align_self: FlexAlign) -> Self

How do we align the item in the cross axis?

Default is stretch.

Source

pub fn align_self_content(self, align_self_content: Align2) -> Self

If align_self is stretch, how do we align the content?

Default is center.

Source

pub fn shrink(self) -> Self

Shrink this item if there isn’t enough space.

Note: You may only ever set this on a single item in a flex container.

Source

pub fn enabled(self, enabled: bool) -> Self

Set the enabled state of the item.

See egui::UiBuilder::disabled.

Source

pub fn disabled(self) -> Self

Disable the item.

Equivalent to self.enabled(false).

Source

pub fn frame(self, frame: Frame) -> Self

Set the frame of the item.

Source

pub fn transform(self, transform: TSTransform) -> Self

Set the visual transform of the item.

Source

pub fn frame_builder( self, frame_builder: impl FnOnce(&Ui, &Response) -> (Frame, TSTransform) + 'a, ) -> Self

Set the frame of the item using a builder function.

Source

pub fn content_id(self, content_id: Id) -> Self

Egui flex can’t always know when the content size of a widget changes (e.g. when a Label or Button is truncated). If the content id changes, this will force a remeasure of the widget.

Source

pub fn sense(self, sense: Sense) -> Self

Set a sense for the FlexItem. The response will be passed to the FrameBuilder closure.

Source

pub fn min_size(self, min_size: impl Into<Vec2>) -> Self

Set the minimum outer (including Frame margin) size of the item in points (pixels).

Source

pub fn min_width(self, min_width: impl Into<Option<f32>>) -> Self

Set the minimum outer (including Frame margin) width of the item in points (pixels).

Source

pub fn min_height(self, min_height: impl Into<Option<f32>>) -> Self

Set the minimum outer (including Frame margin) height of the item in points (pixels).

Trait Implementations§

Source§

impl<'a> Default for FlexItem<'a>

Source§

fn default() -> FlexItem<'a>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for FlexItem<'a>

§

impl<'a> !RefUnwindSafe for FlexItem<'a>

§

impl<'a> !Send for FlexItem<'a>

§

impl<'a> !Sync for FlexItem<'a>

§

impl<'a> Unpin for FlexItem<'a>

§

impl<'a> !UnwindSafe for FlexItem<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.