[−][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.
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]
fn event(&mut self, ctx: &mut EventCtx, event: &Event, data: &mut T, env: &Env)
[src]
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
)
fn update(&mut self, ctx: &mut UpdateCtx, old_data: &T, data: &T, env: &Env)
[src]
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
fn paint(&mut self, ctx: &mut PaintCtx, data: &T, env: &Env)
[src]
fn id(&self) -> Option<WidgetId>
[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]
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,
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
fn round_from(x: T) -> T
impl<T, U> RoundInto<U> for T where
U: RoundFrom<T>,
U: RoundFrom<T>,
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.
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>,