pub struct Padding {
pub left: f64,
pub right: f64,
pub top: f64,
pub bottom: f64,
}Expand description
The width of padding between a widget’s border and its contents.
Fields§
§left: f64The amount of padding in logical pixels for the left edge.
right: f64The amount of padding in logical pixels for the right edge.
top: f64The amount of padding in logical pixels for the top edge.
bottom: f64The amount of padding in logical pixels for the bottom edge.
Implementations§
Source§impl Padding
impl Padding
Sourcepub const fn all(padding: f64) -> Padding
pub const fn all(padding: f64) -> Padding
Constructs a new Padding with equal amount of padding for all edges.
Sourcepub const fn horizontal(padding: f64) -> Padding
pub const fn horizontal(padding: f64) -> Padding
Constructs a new Padding with the same amount of padding for the horizontal edges,
and zero padding for the vertical edges.
Sourcepub const fn vertical(padding: f64) -> Padding
pub const fn vertical(padding: f64) -> Padding
Constructs a new Padding with the same amount of padding for the vertical edges,
and zero padding for the horizontal edges.
Sourcepub const fn from_vh(vertical: f64, horizontal: f64) -> Padding
pub const fn from_vh(vertical: f64, horizontal: f64) -> Padding
Constructs a new Padding with the same padding from both vertical edges, then both horizontal edges.
Sourcepub const fn top(padding: f64) -> Padding
pub const fn top(padding: f64) -> Padding
Constructs a new Padding with padding only at the top edge and zero padding for all other edges.
Sourcepub const fn bottom(padding: f64) -> Padding
pub const fn bottom(padding: f64) -> Padding
Constructs a new Padding with padding only at the bottom edge and zero padding for all other edges.
Source§impl Padding
impl Padding
Sourcepub fn prop_changed(ctx: &mut UpdateCtx<'_>, property_type: TypeId)
pub fn prop_changed(ctx: &mut UpdateCtx<'_>, property_type: TypeId)
Helper function to be called in Widget::property_changed.
Sourcepub fn layout_down(&self, bc: BoxConstraints) -> BoxConstraints
pub fn layout_down(&self, bc: BoxConstraints) -> BoxConstraints
Shrinks the box constraints by the padding amount.
Helper function to be called in Widget::layout.
Sourcepub fn layout_up(&self, size: Size, baseline: f64) -> (Size, f64)
pub fn layout_up(&self, size: Size, baseline: f64) -> (Size, f64)
Expands the size and raises the baseline by the padding amount.
Helper function to be called in Widget::layout.
Sourcepub fn place_down(&self, pos: Point) -> Point
pub fn place_down(&self, pos: Point) -> Point
Shifts the position by the padding amount.
Helper function to be called in Widget::layout.
Trait Implementations§
impl Copy for Padding
Source§impl Property for Padding
impl Property for Padding
Source§fn static_default() -> &'static Padding
fn static_default() -> &'static Padding
impl StructuralPartialEq for Padding
Auto Trait Implementations§
impl Freeze for Padding
impl RefUnwindSafe for Padding
impl Send for Padding
impl Sync for Padding
impl Unpin for Padding
impl UnsafeUnpin for Padding
impl UnwindSafe for Padding
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> Brush for T
impl<T> CloneAny for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.