pub struct ItemStyle {Show 27 fields
pub w: Option<Length>,
pub h: Option<Length>,
pub min_w: Option<Length>,
pub min_h: Option<Length>,
pub max_w: Option<Length>,
pub max_h: Option<Length>,
pub grow: Option<f32>,
pub shrink: Option<f32>,
pub basis: Option<Length>,
pub align_self: Option<AlignSelf>,
pub m: Option<Length>,
pub mx: Option<Length>,
pub my: Option<Length>,
pub mt: Option<Length>,
pub mr: Option<Length>,
pub mb: Option<Length>,
pub ml: Option<Length>,
pub p: Option<Length>,
pub px: Option<Length>,
pub py: Option<Length>,
pub pt: Option<Length>,
pub pr: Option<Length>,
pub pb: Option<Length>,
pub pl: Option<Length>,
pub col_span: Option<u16>,
pub row_span: Option<u16>,
pub paint: PaintStyle,
}Expand description
The layout attributes every element accepts, as a flex/grid item.
Every setter takes impl Into<Length>, so .w(120.0), .w("50%") and
.w(Length::Auto) all work; rsx! passes literals straight through.
It carries the item’s PaintStyle too, reached through setters of the
same names (.bg(..), .border(..)), so one prop is the whole vocabulary.
Fields§
§w: Option<Length>width.
h: Option<Length>height.
min_w: Option<Length>min-width.
min_h: Option<Length>min-height.
max_w: Option<Length>max-width.
max_h: Option<Length>max-height.
grow: Option<f32>flex-grow.
shrink: Option<f32>flex-shrink.
basis: Option<Length>flex-basis.
align_self: Option<AlignSelf>align-self.
m: Option<Length>margin (all sides).
mx: Option<Length>margin-inline.
my: Option<Length>margin-block.
mt: Option<Length>margin-top.
mr: Option<Length>margin-right.
mb: Option<Length>margin-bottom.
ml: Option<Length>margin-left.
p: Option<Length>padding (all sides).
px: Option<Length>padding-inline.
py: Option<Length>padding-block.
pt: Option<Length>padding-top.
pr: Option<Length>padding-right.
pb: Option<Length>padding-bottom.
pl: Option<Length>padding-left.
col_span: Option<u16>grid-column: span N.
row_span: Option<u16>grid-row: span N.
paint: PaintStyleHow the box looks: background, border, radius, shadow, opacity.
Implementations§
Source§impl ItemStyle
impl ItemStyle
Sourcepub fn align_self(self, v: impl Into<AlignSelf>) -> Self
pub fn align_self(self, v: impl Into<AlignSelf>) -> Self
Set align-self.
Sourcepub fn bg(self, v: impl Into<Color32>) -> Self
pub fn bg(self, v: impl Into<Color32>) -> Self
Set the background colour. See PaintStyle::bg.
Sourcepub fn border(self, v: impl Into<Stroke>) -> Self
pub fn border(self, v: impl Into<Stroke>) -> Self
Set the border stroke. See PaintStyle::border.
Sourcepub fn radius(self, v: f32) -> Self
pub fn radius(self, v: f32) -> Self
Set the corner radius. See PaintStyle::radius.
Sourcepub fn shadow(self, v: bool) -> Self
pub fn shadow(self, v: bool) -> Self
Cast the theme’s window shadow. See PaintStyle::shadow.
Sourcepub fn custom_shadow(self, v: Shadow) -> Self
pub fn custom_shadow(self, v: Shadow) -> Self
Cast a shadow of your own. See PaintStyle::custom_shadow.
Sourcepub fn opacity(self, v: f32) -> Self
pub fn opacity(self, v: f32) -> Self
Multiply the opacity of this node. See PaintStyle::opacity.
Sourcepub fn padding_px(&self) -> Option<[f32; 4]>
pub fn padding_px(&self) -> Option<[f32; 4]>
The padding this item asks for, in points, if it asked for any.
[top, right, bottom, left], resolved most-specific-wins exactly as
ItemStyle::to_taffy resolves it. None when no padding prop is set
— there is nothing to take over — and when any side is a percentage or
auto, because those need the containing block, which only the layout
has.
This is for an element that hands its padding to the widget rather than
to the layout: <Button> does, so that the hover frame and the click
area cover the whole box, and <Frame> does outside a tree, where there
is no layout to hold it.
Sourcepub fn without_padding(self) -> Self
pub fn without_padding(self) -> Self
This style with every padding prop cleared.
The other half of ItemStyle::padding_px: an element that took the
padding over passes this to cx.leaf, so the layout does not reserve
the same points a second time.
Trait Implementations§
impl Copy for ItemStyle
impl StructuralPartialEq for ItemStyle
Auto Trait Implementations§
impl Freeze for ItemStyle
impl RefUnwindSafe for ItemStyle
impl Send for ItemStyle
impl Sync for ItemStyle
impl Unpin for ItemStyle
impl UnsafeUnpin for ItemStyle
impl UnwindSafe for ItemStyle
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more