pub struct Divider { /* private fields */ }Expand description
A rule between two groups of content.
The smallest widget here, and worth having only because everybody draws it
slightly differently otherwise — one pixel or two, Base300 or a faded
BaseContent, inset or full width. It is here so a panel is consistent with
itself.
Not interactive, not focusable, no messages.
§A label only makes sense across
A horizontal divider with a label draws line, gap, text, gap, line. A vertical one ignores its label and draws an unbroken rule, because the text would have to be rotated and there is no rotated text in the rasteriser. Ignoring it is better than drawing horizontal text through a vertical line and calling that a feature.
§About “one pixel”
The thickness comes from Metrics::border,
which is a logical pixel — one at scale factor 1, two under
Metrics::TOUCH, and whatever the application’s scale factor makes of it
on a dense display: a scale-aware application passes
theme.scaled(factor) at construction and this widget’s rule thickens with
everything else. See docs/design.md for the pattern.
Implementations§
Source§impl Divider
impl Divider
Sourcepub fn with_style(self, style: TextStyle) -> Self
pub fn with_style(self, style: TextStyle) -> Self
Sets the label’s font and size.
Sourcepub const fn orientation(&self) -> Orientation
pub const fn orientation(&self) -> Orientation
Which way it runs.
Trait Implementations§
Source§impl Describe for Divider
impl Describe for Divider
Source§const DOC: &'static str = "A line between things, with an optional label in the middle."
const DOC: &'static str = "A line between things, with an optional label in the middle."
Source§const ICON: &'static Icon
const ICON: &'static Icon
Source§const PROPERTIES: &'static [Property]
const PROPERTIES: &'static [Property]
Source§impl<M: 'static> Widget<M> for Divider
impl<M: 'static> Widget<M> for Divider
Source§fn describe(&self) -> Option<&dyn DynDescribe>
fn describe(&self) -> Option<&dyn DynDescribe>
Source§fn describe_mut(&mut self) -> Option<&mut dyn DynDescribe>
fn describe_mut(&mut self) -> Option<&mut dyn DynDescribe>
describe.Source§fn paint(&self, ctx: &mut PaintCtx<'_>, canvas: &mut Pen<'_>)
fn paint(&self, ctx: &mut PaintCtx<'_>, canvas: &mut Pen<'_>)
canvas, which is already clipped to this widget’s bounds
intersected with the damage region being repainted. Read moreSource§fn on_event(&mut self, event: &Event<'_>, ctx: &mut EventCtx<'_, M>) -> Handled
fn on_event(&mut self, event: &Event<'_>, ctx: &mut EventCtx<'_, M>) -> Handled
Source§fn measure(&self, ctx: &mut MeasureCtx<'_>, offered: Offer) -> Measured
fn measure(&self, ctx: &mut MeasureCtx<'_>, offered: Offer) -> Measured
Source§fn accepts_pointer(&self) -> bool
fn accepts_pointer(&self) -> bool
true if the pointer can hit this widget. Read moreSource§fn preserves_focus(&self) -> bool
fn preserves_focus(&self) -> bool
true if a press on this widget should leave focus exactly where
it is. Read moreSource§fn animate(&mut self, now_ms: u64) -> Animation
fn animate(&mut self, now_ms: u64) -> Animation
EventCtx::request_animation — and stops being called
the moment it answers Wake::Never. Read moreAuto Trait Implementations§
impl Freeze for Divider
impl RefUnwindSafe for Divider
impl Send for Divider
impl Sync for Divider
impl Unpin for Divider
impl UnsafeUnpin for Divider
impl UnwindSafe for Divider
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> DynDescribe for Twhere
T: Describe,
impl<T> DynDescribe for Twhere
T: Describe,
Source§fn kind(&self) -> &'static str
fn kind(&self) -> &'static str
Describe::KIND.Source§fn properties(&self) -> &'static [Property]
fn properties(&self) -> &'static [Property]
Describe::PROPERTIES.Source§fn get_property(&self, name: &str) -> Option<Value>
fn get_property(&self, name: &str) -> Option<Value>
Describe::get.Source§fn set_property(
&mut self,
name: &str,
value: Value,
) -> Result<(), PropertyError>
fn set_property( &mut self, name: &str, value: Value, ) -> Result<(), PropertyError>
Describe::set.