pub struct Grid {
pub cursor: Option<(u16, u16)>,
pub caret: Option<Bounds>,
pub paint: Vec<Paint>,
pub bands: Vec<u16>,
pub edge: Option<Rgb>,
pub roomy: bool,
pub foot: u16,
pub row_bands: Option<(u16, Vec<u16>)>,
pub turn: Option<u8>,
pub spinning: bool,
/* private fields */
}Fields§
§cursor: Option<(u16, u16)>§caret: Option<Bounds>The caret’s exact place on the pixel tiers, when text isn’t on whole cells.
paint: Vec<Paint>Drawn over the cells on the pixel tiers, in order.
bands: Vec<u16>Columns where a new band starts, in order. Each band of a row is its own tile, so text that scrolls isn’t tied to whatever the sidebar or minimap shows at that height.
edge: Option<Rgb>The colour past the grid’s right edge, where a terminal lets a row’s picture run on over the window’s padding. Unset, it’s the colour of the row’s last cell.
roomy: boolWhether a row here is tall enough for a control to stand in it with its words in its middle: rows of Cellix’s own, well taller than the terminal’s line. What draws into the grid says so. Where it’s not, a button’s words are raised a pixel for their tails.
foot: u16How many rows at the grid’s foot are bars under the sheets: one, unless what draws says there are two, as where the workspaces have a row of their own under the status bar. A backend that fills the window under its last row stands them evenly in what’s there.
row_bands: Option<(u16, Vec<u16>)>A row cut into bands of its own, in place of bands, as (the row, where each band
after the first starts): the status bar, where a spinner is a tile by itself, so its
steps don’t send the rest of the bar again, nor the bar’s other changes the spinner.
turn: Option<u8>The step of its turn every spinner drawn here stands at, from the clock in
spinner, or none where motion is off: a spinner is then a still dot.
spinning: boolWhether anything drawn here is turning, so whatever shows the grid draws it again at the next step. Nothing turning, nothing asks for a frame.
Implementations§
Source§impl Grid
impl Grid
Sourcepub fn scroll_rows(&mut self, top: u16, bottom: u16, by: i32)
pub fn scroll_rows(&mut self, top: u16, bottom: u16, by: i32)
Moves rows top..=bottom up by by rows, or down if negative, across the whole width,
as a terminal’s scroll region does. The rows left behind hold nothing any real cell
matches, so the next diff draws them.
pub fn new(width: u16, height: u16, style: Style) -> Self
Sourcepub fn spinner(&mut self, x: f32, y: u16, size: f32, color: Rgb, style: Style)
pub fn spinner(&mut self, x: f32, y: u16, size: f32, color: Rgb, style: Style)
Something under way, in the colour of what it means: a faint ring with a quarter of it
turning where there are pictures, a turning braille letter on cells, and with motion
off a still dot. Its box is size rows of the terminal’s line square, as an icon’s
is, starting at x and standing in the middle of row y; on cells it’s the one
letter at x.
Sourcepub fn spinner_in(
&mut self,
(x, cell): (f32, u16),
y: u16,
size: f32,
color: Rgb,
style: Style,
)
pub fn spinner_in( &mut self, (x, cell): (f32, u16), y: u16, size: f32, color: Rgb, style: Style, )
The same, its letter on the cell tier in column cell rather than the one its paint
starts in: where painted words are narrower than their letters, the cells keep what
they can of the words before it.
Sourcepub fn turn_to(&mut self, step: u8)
pub fn turn_to(&mut self, step: u8)
Takes every spinner on the grid to step of its turn, as drawing it again at that step
would: when nothing else has changed, a step is this and not the whole interface laid
out again. Still ones stay still.
Sourcepub fn dot(&mut self, x: f32, y: u16, size: f32, color: Rgb, style: Style)
pub fn dot(&mut self, x: f32, y: u16, size: f32, color: Rgb, style: Style)
A still dot in the colour of what it means, sized and placed as a spinner is: a state that wants seeing, as an agent that needs you or one that’s done.
Sourcepub fn dot_in(
&mut self,
(x, cell): (f32, u16),
y: u16,
size: f32,
color: Rgb,
style: Style,
)
pub fn dot_in( &mut self, (x, cell): (f32, u16), y: u16, size: f32, color: Rgb, style: Style, )
The same, its letter on the cell tier in column cell, as spinner_in’s.
Sourcepub fn label(
&mut self,
x: u16,
y: u16,
text: &str,
style: Style,
max_x: u16,
) -> u16
pub fn label( &mut self, x: u16, y: u16, text: &str, style: Style, max_x: u16, ) -> u16
Text in the interface font on the pixel tiers, and ordinary cells on the cell tier.
Sourcepub fn clear_paint_in(&mut self, area: Rect)
pub fn clear_paint_in(&mut self, area: Rect)
Takes away what was painted that starts inside area, for a surface of cells laid over
it: paint can’t go under text, so cells can’t cover it, and it would show through.
Sourcepub fn painted_so_far(&self) -> usize
pub fn painted_so_far(&self) -> usize
How much has been painted so far, to lift_since later.
Sourcepub fn keep_to_rows(&mut self, from: usize, top: u16, bottom: u16)
pub fn keep_to_rows(&mut self, from: usize, top: u16, bottom: u16)
Keeps what was painted since from to the rows from top up to bottom: on any other
row none of it is drawn, however far it reaches.
Sourcepub fn insert_paint(&mut self, index: usize, paint: Paint)
pub fn insert_paint(&mut self, index: usize, paint: Paint)
Puts paint in under what’s already painted from index on, as a mark under words is.
Sourcepub fn lift_since(&mut self, from: usize, rows: f32)
pub fn lift_since(&mut self, from: usize, rows: f32)
Moves what was painted since from up by rows, which only the pixel tiers can show:
the cells under it stay in their rows, and so does where a click lands.
Sourcepub fn nudge_since(&mut self, from: usize, columns: f32)
pub fn nudge_since(&mut self, from: usize, columns: f32)
Moves what was painted since from right by columns, which only the pixel tiers can
show: the cells under it stay in their columns, and so does where a click lands.
Sourcepub fn label_at(
&mut self,
x_px: f32,
x: u16,
y: u16,
text: &str,
style: Style,
max_x: u16,
size: u8,
) -> u16
pub fn label_at( &mut self, x_px: f32, x: u16, y: u16, text: &str, style: Style, max_x: u16, size: u8, ) -> u16
A label starting between cells, at a size relative to the interface font.
Sourcepub fn text_run(
&mut self,
(x, y): (f32, f32),
max_x: f32,
text: &str,
(color, underline): (Rgb, bool),
font: Font,
)
pub fn text_run( &mut self, (x, y): (f32, f32), max_x: f32, text: &str, (color, underline): (Rgb, bool), font: Font, )
Paints a run of text with no cells behind it, at a place in cells and rows.
Sourcepub fn set_caret(&mut self, x: f32, y: u16, height: f32)
pub fn set_caret(&mut self, x: f32, y: u16, height: f32)
Puts the caret at a place between cells, height rows tall and centred on y.
Sourcepub fn label_right(
&mut self,
right: u16,
y: u16,
text: &str,
style: Style,
size: u8,
)
pub fn label_right( &mut self, right: u16, y: u16, text: &str, style: Style, size: u8, )
A label whose right edge sits at right, since proportional text is narrower than
its cells and would otherwise leave a gap at the end.
Sourcepub fn field(&mut self, rect: Rect, behind: Rgb, fill: Rgb, border: Rgb)
pub fn field(&mut self, rect: Rect, behind: Rgb, fill: Rgb, border: Rgb)
A rounded box inside rect, with square corners cleaned up behind it.
A rounded button in a row of its own. The cell tier shows cells, which may be
wider than the label.
A button at the end of a row that’s washed under the pointer, or in a row of its own between lines. Where a row has room, it’s the height it has on the terminal’s line, 32 px, 9 px clear of a row of 50 and inside a pointed row’s wash: as tall as the wash, the two read as one shape with a step in it, and taller, as a button too big for its row. Its words are raised a step, so their ink, tails and all, stands in its middle: at 27 px a “p”’s tail ended on its foot. On the terminal’s line a button and the wash have the row between them and nothing to spare, and it’s a button like any other.
Sourcepub fn exact_fill(&mut self, bounds: Bounds, color: Rgb)
pub fn exact_fill(&mut self, bounds: Bounds, color: Rgb)
A fill of color exactly where bounds is. A panel shorter than a row is stood as a
control is on a taller row (raster::stood), grown or shrunk about its middle, which
a surface reaching part way into a row mustn’t be: peek’s card reaching into the
pane’s last row stood 4 px clear of its own cells.
Sourcepub fn chip(&mut self, x: f32, y: u16, wide: f32, fill: Rgb)
pub fn chip(&mut self, x: f32, y: u16, wide: f32, fill: Rgb)
A button’s chip by itself, as wide as asked and not a whole number of cells, for one whose words and marks are placed by what draws it.
A button that stands past its row, for where there’s air around it.
A large button centred between y and the row below it.
A button’s words by themselves, centred on middle in row y and raised in it as a
button’s are, for a control that paints its own chip.
Sourcepub fn centred_text(&mut self, x: f32, y: f32, text: &str, color: Rgb, size: u8)
pub fn centred_text(&mut self, x: f32, y: f32, text: &str, color: Rgb, size: u8)
Paints text centred on x, at a place in rows.
pub fn panel( &mut self, bounds: Bounds, radius: u8, fill: Option<Rgb>, border: Option<Rgb>, )
Sourcepub fn dashed_panel(
&mut self,
bounds: Bounds,
radius: u8,
fill: Option<Rgb>,
border: Rgb,
)
pub fn dashed_panel( &mut self, bounds: Bounds, radius: u8, fill: Option<Rgb>, border: Rgb, )
A panel with its border in dashes, for something offered rather than settled.
Sourcepub fn popup(&mut self, bounds: Bounds, radius: u8, fill: Rgb, border: Rgb)
pub fn popup(&mut self, bounds: Bounds, radius: u8, fill: Rgb, border: Rgb)
A panel floating above the page, with a soft shadow.
Sourcepub fn wash(
&mut self,
bounds: Bounds,
radius: u8,
(color, alpha): (Rgb, u8),
border: Option<Rgb>,
)
pub fn wash( &mut self, bounds: Bounds, radius: u8, (color, alpha): (Rgb, u8), border: Option<Rgb>, )
A see-through wash of color over bounds, alpha out of 255, with a border.
pub fn hairline(&mut self, bounds: Bounds, color: Rgb)
Sourcepub fn glyph(
&mut self,
x: f32,
y: u16,
icon: Icon,
color: Rgb,
fallback: &str,
style: Style,
)
pub fn glyph( &mut self, x: f32, y: u16, icon: Icon, color: Rgb, fallback: &str, style: Style, )
A small icon in the row, 16 pt in a terminal set to 14 pt, as VS Code’s are beside a
name. It stands about x: its middle is where it was when it was a sixth smaller, so
what’s placed after it needn’t move. fallback is what the cell tier shows there.
Sourcepub fn glyph_in(
&mut self,
(x, cell): (f32, u16),
y: u16,
(icon, color): (Icon, Rgb),
fallback: &str,
style: Style,
)
pub fn glyph_in( &mut self, (x, cell): (f32, u16), y: u16, (icon, color): (Icon, Rgb), fallback: &str, style: Style, )
The same, fallback on the cell tier in column cell, as spinner_in’s letter.
Sourcepub fn small_glyph(
&mut self,
x: f32,
y: u16,
icon: Icon,
color: Rgb,
fallback: &str,
style: Style,
)
pub fn small_glyph( &mut self, x: f32, y: u16, icon: Icon, color: Rgb, fallback: &str, style: Style, )
The same icon at SMALL_GLYPH, for inside a text box or a chip, its left edge at x.
Sourcepub fn corners(&mut self, bounds: Bounds, radius: u8, color: Rgb, which: u8)
pub fn corners(&mut self, bounds: Bounds, radius: u8, color: Rgb, which: u8)
Paint that touches row y, in drawing order.
pub fn paint_on_row(&self, y: u16) -> impl Iterator<Item = &Paint>
pub fn width(&self) -> u16
pub fn height(&self) -> u16
pub fn area(&self) -> Rect
pub fn cell(&self, x: u16, y: u16) -> &Cell
pub fn row(&self, y: u16) -> &[Cell]
pub fn fill(&mut self, rect: Rect, style: Style)
Sourcepub fn put_str(
&mut self,
x: u16,
y: u16,
text: &str,
style: Style,
max_x: u16,
) -> u16
pub fn put_str( &mut self, x: u16, y: u16, text: &str, style: Style, max_x: u16, ) -> u16
Writes text stopping before max_x, and returns the column after it. A wide
character that doesn’t fit becomes a space.
Sourcepub fn put_icon(
&mut self,
x: u16,
y: u16,
icon: Icon,
size: (u8, u8),
style: Style,
)
pub fn put_icon( &mut self, x: u16, y: u16, icon: Icon, size: (u8, u8), style: Style, )
Places a multi-cell icon with its top-left corner at x, y.
Sourcepub fn set_style(&mut self, rect: Rect, f: impl Fn(Style) -> Style)
pub fn set_style(&mut self, rect: Rect, f: impl Fn(Style) -> Style)
Overrides the style of existing cells, keeping their text.