Trait FloatingRow
pub trait FloatingRow {
type Columns: Default;
// Required methods
fn height(&self, metrics: &FloatingMetrics) -> f64;
fn pickable(&self) -> bool;
fn paint(
&self,
ctx: &mut PaintCtx<'_>,
row: Rect,
state: RowState<'_, Self::Columns>,
) -> Option<f64>
where Self: Sized;
// Provided methods
fn same(&self, _other: &Self) -> bool { ... }
fn alone_row(&self) -> bool { ... }
fn reveals_lead(&self) -> bool { ... }
fn busy(&self) -> bool { ... }
fn two_line(&self) -> bool { ... }
fn cell_count(&self) -> usize { ... }
fn rows_inset(metrics: &FloatingMetrics, _panel: Rect) -> Vec2 { ... }
fn content_width(
&self,
_metrics: &FloatingMetrics,
_role: TextRole,
_text: &mut TextRenderer,
_theme: &Theme,
) -> f64 { ... }
fn columns(_rows: &[Self]) -> Self::Columns
where Self: Sized { ... }
}Expand description
What the list needs to know about a row it lays out; the owner paints it.
Required Associated Types§
Required Methods§
fn height(&self, metrics: &FloatingMetrics) -> f64
fn height(&self, metrics: &FloatingMetrics) -> f64
This row’s height in metrics.
Provided Methods§
fn same(&self, _other: &Self) -> bool
fn same(&self, _other: &Self) -> bool
Whether self and other are the same row: replacing rows with the
same ones then leaves the list scrolled where the person left it. Rows
of plain data compare; a row carrying actions always replaces.
fn alone_row(&self) -> bool
fn alone_row(&self) -> bool
Whether a panel holding only this row rounds itself concentric with
it (floating_surface::single_row_radius): a menu’s action rows do,
a suggestion list’s rows keep the panel’s radius.
fn reveals_lead(&self) -> bool
fn reveals_lead(&self) -> bool
Whether revealing this row brings the unpickable rows above it (its headings) into view too, as a results list’s first row under a header does.
fn two_line(&self) -> bool
fn two_line(&self) -> bool
Whether it holds a caption line under its label: a list with one gives every row two lines.
fn cell_count(&self) -> usize
fn cell_count(&self) -> usize
How many cells it offers side by side (an emoji bar), 0 for none.
fn rows_inset(metrics: &FloatingMetrics, _panel: Rect) -> Vec2
fn rows_inset(metrics: &FloatingMetrics, _panel: Rect) -> Vec2
The air between the panel’s edge and the rows, across and down. A list of suggestions keeps its inset on every side; a menu’s rows run the panel’s full width, as every menu’s do, and a panel shorter than its own inset keeps a quarter of its height so one row still shows.
fn content_width(
&self,
_metrics: &FloatingMetrics,
_role: TextRole,
_text: &mut TextRenderer,
_theme: &Theme,
) -> f64
fn content_width( &self, _metrics: &FloatingMetrics, _role: TextRole, _text: &mut TextRenderer, _theme: &Theme, ) -> f64
What the row needs across, for a list that sizes itself to its rows.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.