pub trait ChangePainter: 'static {
// Required method
fn paint(
&self,
change: &CellChange,
palette: &ChangePalette,
style: &mut CellStyle,
);
}Expand description
Paints a highlighted change into a cell’s default style, before the
delegate’s cell_style adjusts it.
Called in prepaint for every hot visible cell, every frame: it must not
allocate or lock. CellChange::column_ix tells which column the cell is
in, so a painter can flash some columns and not others:
use gpui_kit_grid::{
CellChange, CellStyle, ChangePainter, ChangePalette, ColumnIx, RowChange, UniformChanges,
};
/// Stage 1's colours on the price only; inserts and removals whole.
struct PriceOnly(ColumnIx);
impl ChangePainter for PriceOnly {
fn paint(&self, change: &CellChange, palette: &ChangePalette, style: &mut CellStyle) {
if change.change() != RowChange::Updated || change.column_ix() == Some(self.0) {
UniformChanges.paint(change, palette, style);
}
}
}Required Methods§
Sourcefn paint(
&self,
change: &CellChange,
palette: &ChangePalette,
style: &mut CellStyle,
)
fn paint( &self, change: &CellChange, palette: &ChangePalette, style: &mut CellStyle, )
Paints change into style.