pub struct Frame {
pub inner_margin: Margin,
pub outer_margin: Margin,
pub visuals: FrameVisuals,
pub sense: Sense,
pub interactive: bool,
pub selected: bool,
pub fill_width: bool,
}Expand description
A frame around some content: margin, fill ([Fill]), stroke, rounding, shadow.
Same geometry as egui::Frame:
content_size + inner_margin + 2 * stroke.width + outer_margin.
The difference is the fill is a [Fill], so it can be a two-stop gradient,
and state colors live on FrameVisuals like the other widgets.
Stroke width is taken from the idle border at begin. Changing stroke
width on hover after begin does not relayout.
Fields§
§inner_margin: Margin§outer_margin: Margin§visuals: FrameVisuals§sense: Sense§interactive: boolWhen false, paint always uses idle fill / border, even if the
pointer is over the frame. Hover / click fills need Self::interactive.
selected: boolPaint FrameVisuals::bg_selected instead of idle / hover / click.
fill_width: boolStretch the frame to the available width (useful for sidebar rows).
Implementations§
Source§impl Frame
impl Frame
pub const NONE: Self
pub const fn new() -> Self
Sourcepub fn from_egui(frame: Frame) -> Self
pub fn from_egui(frame: Frame) -> Self
Copy margins, idle fill, stroke, radius, and shadow from an egui::Frame.
Hover / click start equal to idle.
pub fn inner_margin(self, inner_margin: impl Into<Margin>) -> Self
pub fn outer_margin(self, outer_margin: impl Into<Margin>) -> Self
Sourcepub fn fill(self, fill: impl Into<Color32>) -> Self
pub fn fill(self, fill: impl Into<Color32>) -> Self
Idle fill. Does not change hover / click unless they were still the old idle fill.
pub fn stroke(self, stroke: impl Into<Stroke>) -> Self
pub fn corner_radius(self, corner_radius: impl Into<CornerRadius>) -> Self
Sourcepub fn square_corners(self) -> Self
pub fn square_corners(self) -> Self
Make the frame square corners.
pub fn shadow(self, shadow: Shadow) -> Self
Sourcepub fn visuals(self, visuals: FrameVisuals) -> Self
pub fn visuals(self, visuals: FrameVisuals) -> Self
Replace fill, stroke, radius, and shadow. Margins and sense are kept.
pub fn sense(self, sense: Sense) -> Self
Sourcepub fn interactive(self, interactive: bool) -> Self
pub fn interactive(self, interactive: bool) -> Self
true → Sense::click and hover / click fills. false → idle chrome
only (pointer hover does not swap fill).
Sourcepub fn selected(self, selected: bool) -> Self
pub fn selected(self, selected: bool) -> Self
Paint FrameVisuals::bg_selected even when not hovered.
Sourcepub fn fill_width(self, fill: bool) -> Self
pub fn fill_width(self, fill: bool) -> Self
Stretch the frame to the available width.
The content Ui also gets that min width, so inner
right-to-left rows (unread counts, timestamps) land on the far edge.
pub fn multiply_with_opacity(self, opacity: f32) -> Self
Sourcepub fn total_margin(&self) -> MarginF32
pub fn total_margin(&self) -> MarginF32
Idle stroke width is part of the margin (same as egui::Frame).
pub fn fill_rect(&self, content_rect: Rect) -> Rect
pub fn widget_rect(&self, content_rect: Rect) -> Rect
pub fn outer_rect(&self, content_rect: Rect) -> Rect
Trait Implementations§
impl Copy for Frame
impl StructuralPartialEq for Frame
Auto Trait Implementations§
impl Freeze for Frame
impl RefUnwindSafe for Frame
impl Send for Frame
impl Sync for Frame
impl Unpin for Frame
impl UnsafeUnpin for Frame
impl UnwindSafe for Frame
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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