[−][src]Struct druid::widget::SizedBox
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.
Trait Implementations
impl<T: Data> Widget<T> for SizedBox<T>
[src]
pub fn event(
&mut self,
ctx: &mut EventCtx<'_, '_>,
event: &Event,
data: &mut T,
env: &Env
)
[src]
&mut self,
ctx: &mut EventCtx<'_, '_>,
event: &Event,
data: &mut T,
env: &Env
)
pub fn lifecycle(
&mut self,
ctx: &mut LifeCycleCtx<'_, '_>,
event: &LifeCycle,
data: &T,
env: &Env
)
[src]
&mut self,
ctx: &mut LifeCycleCtx<'_, '_>,
event: &LifeCycle,
data: &T,
env: &Env
)
pub fn update(
&mut self,
ctx: &mut UpdateCtx<'_, '_>,
old_data: &T,
data: &T,
env: &Env
)
[src]
&mut self,
ctx: &mut UpdateCtx<'_, '_>,
old_data: &T,
data: &T,
env: &Env
)
pub fn layout(
&mut self,
ctx: &mut LayoutCtx<'_, '_>,
bc: &BoxConstraints,
data: &T,
env: &Env
) -> Size
[src]
&mut self,
ctx: &mut LayoutCtx<'_, '_>,
bc: &BoxConstraints,
data: &T,
env: &Env
) -> Size
pub fn paint(&mut self, ctx: &mut PaintCtx<'_, '_, '_>, data: &T, env: &Env)
[src]
pub fn id(&self) -> Option<WidgetId>
[src]
Auto Trait Implementations
impl<T> !RefUnwindSafe for SizedBox<T>
[src]
impl<T> !Send for SizedBox<T>
[src]
impl<T> !Sync for SizedBox<T>
[src]
impl<T> Unpin for SizedBox<T>
[src]
impl<T> !UnwindSafe for SizedBox<T>
[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> RoundFrom<T> for T
pub fn round_from(x: T) -> T
impl<T, U> RoundInto<U> for T where
U: RoundFrom<T>,
U: RoundFrom<T>,
pub fn round_into(self) -> U
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]
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>,