[][src]Struct druid::widget::SizedBox

pub struct SizedBox<T> { /* fields omitted */ }

A widget with predefined size.

If given a child, this widget forces its child to have a specific width and/or height (assuming values are permitted by this widget's parent). If either the width or height is not set, this widget will size itself to match the child's size in that dimension.

If not given a child, SizedBox will try to size itself as close to the specified height and width as possible given the parent's constraints. If height or width is not set, it will be treated as zero.

Implementations

impl<T> SizedBox<T>[src]

pub fn new(inner: impl Widget<T> + 'static) -> Self[src]

Construct container with child, and both width and height not set.

pub fn empty() -> Self[src]

Construct container without child, and both width and height not set.

pub fn width(self, width: f64) -> Self[src]

Set container's width.

pub fn height(self, height: f64) -> Self[src]

Set container's height.

pub fn expand(self) -> Self[src]

Expand container to fit the parent.

Only call this method if you want your widget to occupy all available space. If you only care about expanding in one of width or height, use expand_width or expand_height instead.

pub fn expand_width(self) -> Self[src]

Expand the container on the x-axis.

This will force the child to have maximum width.

pub fn expand_height(self) -> Self[src]

Expand the container on the y-axis.

This will force the child to have maximum height.

impl<T: Data> SizedBox<T>[src]

pub fn fix_width(self, width: f64) -> SizedBox<T>[src]

pub fn fix_height(self, height: f64) -> SizedBox<T>[src]

Trait Implementations

impl<T: Data> Widget<T> for SizedBox<T>[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for SizedBox<T>

impl<T> !Send for SizedBox<T>

impl<T> !Sync for SizedBox<T>

impl<T> Unpin for SizedBox<T>

impl<T> !UnwindSafe for SizedBox<T>

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> RoundFrom<T> for T

impl<T, U> RoundInto<U> for T where
    U: RoundFrom<T>, 

impl<T> Same<T> for T

type Output = T

Should always be Self

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.