[−][src]Struct druid::widget::Padding
A widget that just adds padding around its child.
Methods
impl<T: Data> Padding<T>
[src]
pub fn uniform(padding: f64, child: impl Widget<T> + 'static) -> Padding<T>
[src]
Deprecated since 0.3.0:
Use Padding::new() instead
Create widget with uniform padding.
pub fn new(
insets: impl Into<Insets>,
child: impl Widget<T> + 'static
) -> Padding<T>
[src]
insets: impl Into<Insets>,
child: impl Widget<T> + 'static
) -> Padding<T>
Create a new widget with the specified padding. This can either be an instance
of kurbo::Insets
, a f64 for uniform padding, a 2-tuple for axis-uniform padding
or 4-tuple with (left, top, right, bottom) values.
Examples
Uniform padding:
use druid::widget::{Label, Padding}; use druid::kurbo::Insets; let _: Padding<()> = Padding::new(10.0, Label::new("uniform!")); let _: Padding<()> = Padding::new(Insets::uniform(10.0), Label::new("uniform!"));
Uniform padding across each axis:
use druid::widget::{Label, Padding}; use druid::kurbo::Insets; let child: Label<()> = Label::new("I need my space!"); let _: Padding<()> = Padding::new((10.0, 20.0), Label::new("more y than x!")); // equivalent: let _: Padding<()> = Padding::new(Insets::uniform_xy(10.0, 20.0), Label::new("ditto :)"));
Trait Implementations
impl<T: Data> Widget<T> for Padding<T>
[src]
fn paint(
&mut self,
paint_ctx: &mut PaintCtx,
_base_state: &BaseState,
data: &T,
env: &Env
)
[src]
&mut self,
paint_ctx: &mut PaintCtx,
_base_state: &BaseState,
data: &T,
env: &Env
)
fn layout(
&mut self,
layout_ctx: &mut LayoutCtx,
bc: &BoxConstraints,
data: &T,
env: &Env
) -> Size
[src]
&mut self,
layout_ctx: &mut LayoutCtx,
bc: &BoxConstraints,
data: &T,
env: &Env
) -> Size
fn event(&mut self, event: &Event, ctx: &mut EventCtx, data: &mut T, env: &Env)
[src]
fn update(
&mut self,
ctx: &mut UpdateCtx,
_old_data: Option<&T>,
data: &T,
env: &Env
)
[src]
&mut self,
ctx: &mut UpdateCtx,
_old_data: Option<&T>,
data: &T,
env: &Env
)
Auto Trait Implementations
impl<T> !Send for Padding<T>
impl<T> !Sync for Padding<T>
impl<T> Unpin for Padding<T> where
T: Unpin,
T: Unpin,
impl<T> !UnwindSafe for Padding<T>
impl<T> !RefUnwindSafe for Padding<T>
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
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>,