Skip to main content

ListRowFace

Struct ListRowFace 

pub struct ListRowFace<'a> { /* private fields */ }
Expand description

Immediate-mode list row. Build one per row per frame, measure it for its height, then paint it into the rect you laid out: the row’s outer rect, the list’s content edge grown by row_bleed on both sides.

Implementations§

§

impl<'a> ListRowFace<'a>

pub fn new(title: &'a str) -> ListRowFace<'a>

pub fn two_line_title(self) -> ListRowFace<'a>

Let the title wrap to two lines before it is elided (a long name in a narrow list).

pub fn title_family(self, family: &'a FontChoice) -> ListRowFace<'a>

Set the title in family: only for a list of fonts, where the title is its own sample.

pub fn subtitle(self, text: &'a str) -> ListRowFace<'a>

A Body line between the title and the secondary text (a message’s subject under its sender).

pub fn secondary(self, text: &'a str) -> ListRowFace<'a>

The secondary line under the title (a preview, an address, a path), elided to one line.

pub fn two_line_secondary(self) -> ListRowFace<'a>

Let the secondary text wrap to two lines before it is elided (a message preview).

pub fn meta(self, text: &'a str) -> ListRowFace<'a>

A timestamp, size or count, right-aligned in tabular figures on the title’s line. It narrows only the title’s line.

pub fn meta_spans(self, spans: &'a [(&'a str, Tone)]) -> ListRowFace<'a>

A meta made of toned figures (+2.4% in success, −0.8% in danger), each made legible on the row’s ground and on its lift.

pub fn value(self, text: &'a str) -> ListRowFace<'a>

A figure at the trailing edge (a time, a code, a temperature) that hover actions never replace.

pub fn title_value(self, text: &'a str) -> ListRowFace<'a>

Self::value as the row’s main figure, in Title.

pub fn mark(self, icon: Icon) -> ListRowFace<'a>

A mark after the title in tertiary ink (starred, pinned, shared, has attachments). Each call adds one more, in order, up to MAX_MARKS; later ones are ignored. Star, pin and bookmark are filled.

pub fn swatch_mark(self, color: AlphaColor<Srgb>) -> ListRowFace<'a>

A colour the item carries (its project, its calendar), as a small swatch among the marks after the title. It counts as one of the MAX_MARKS.

pub fn tags(self, tags: &'a [(&'a str, ChipStyle)]) -> ListRowFace<'a>

Tags after the title, each a small pill in its style.

pub fn count(self, count: usize) -> ListRowFace<'a>

How many items the row stands for (the messages in a thread), in a quiet pill at the trailing edge of the line under the title.

pub fn leading(self, leading: RowLeading<'a>) -> ListRowFace<'a>

pub fn leading_column(self, width: f64) -> ListRowFace<'a>

The width every row of this list reserves for its leading column, from badge_column_width. Any kind of leading content centres in a column at least this wide.

pub fn status(self, status: RowStatus<'a>) -> ListRowFace<'a>

pub fn disclosure(self) -> ListRowFace<'a>

A trailing chevron: activating the row opens a page.

pub fn checked(self, checked: bool) -> ListRowFace<'a>

One choice of a single-choice list: a trailing check on the chosen row. Every row of the list reserves the check’s slot.

pub fn emphasized(self, emphasized: bool) -> ListRowFace<'a>

Unread or otherwise new: the title takes the strong weight.

pub fn selected(self, selected: bool) -> ListRowFace<'a>

pub fn joined(self, join: RowJoin) -> ListRowFace<'a>

Which neighbours are selected with this row: a run of selected rows is one lift with no notch.

pub fn separator(self, next_selected: bool) -> ListRowFace<'a>

Draw the inset separator along the bottom edge. It hides when this row or next_selected (the row below) is selected.

pub fn actions(self, actions: &'a [RowAction<'a>]) -> ListRowFace<'a>

Actions shown in place of the meta while the row is hovered or focused. Hit-test them with Self::action_rects.

pub fn hovered_action(self, index: Option<usize>) -> ListRowFace<'a>

Which action the pointer (or the keyboard) is on.

pub fn reveal_actions(self, reveal: bool) -> ListRowFace<'a>

Show the actions without hover: a selected row under a touch pointer, which has no hover.

pub fn swiped(self, action: SwipeAction<'a>, offset: f64) -> ListRowFace<'a>

The row slid offset logical pixels toward its leading edge, revealing action behind its trailing edge.

pub fn trailing_width(self, width: f64) -> ListRowFace<'a>

Reserve width at the trailing edge for one persistent control (a switch, a button, a small progress ring) the host lays out itself in Self::trailing_rect. Separators keep their full width.

pub fn interaction(self, interaction: Interaction) -> ListRowFace<'a>

pub fn enabled(self, enabled: bool) -> ListRowFace<'a>

A disabled row: dimmed, no hover, no actions.

pub fn height(&self, text: &mut TextRenderer, theme: &Theme) -> f64

The row’s height at this text scale.

pub fn action_rects(&self, rect: Rect, theme: &Theme) -> Vec<Rect>

Where each hover action sits in rect, in order. Empty unless the row is hovered, focused or revealing its actions.

pub fn trailing_rect( &self, rect: Rect, text: &mut TextRenderer, theme: &Theme, ) -> Option<Rect>

The slot Self::trailing_width reserved in rect, as tall as the row; centre the control in it.

pub fn leading_rect( &self, rect: Rect, text: &mut TextRenderer, theme: &Theme, ) -> Rect

The leading column’s rect in rect: the checkbox’s hit target, or the badge a tooltip explains.

pub fn paint(&self, ctx: &mut PaintCtx<'_>, rect: Rect)

Paint the row into rect, its outer rect.

pub fn title_elided( &self, rect: Rect, text: &mut TextRenderer, theme: &Theme, ) -> bool

Whether the title, painted in rect, is cut short with an ellipsis. A row shows such a title in full in its tooltip.

pub fn accessibility( &self, rect: Rect, action_target: impl Into<String>, ) -> AccessNode

The row’s accessibility node: a list item named by its badge and title, with the subtitle, secondary line, meta, value, count, tags and status as its value, and one button child per action.

Trait Implementations§

§

impl<'a> Clone for ListRowFace<'a>

§

fn clone(&self) -> ListRowFace<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<'a> Debug for ListRowFace<'a>

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for ListRowFace<'a>

§

impl<'a> !RefUnwindSafe for ListRowFace<'a>

§

impl<'a> !Send for ListRowFace<'a>

§

impl<'a> !Sync for ListRowFace<'a>

§

impl<'a> Unpin for ListRowFace<'a>

§

impl<'a> UnsafeUnpin for ListRowFace<'a>

§

impl<'a> !UnwindSafe for ListRowFace<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(_simd: S, value: T) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,