pub struct Grid {Show 14 fields
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 row_air: u16,
pub foot: u16,
pub row_bands: Option<(u16, Vec<u16>)>,
pub turn: Option<u8>,
pub spinning: bool,
pub cursor_shape: CursorShape,
pub cursor_blinks: bool,
pub term_cursors: Vec<TermCursor>,
/* 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 is, a button on a row’s wash stands inside the wash.
row_air: u16How tall one of these rows is in hundredths of the terminal’s line, which words are sized for: 100 unless Cellix lays out rows taller than that line. What draws into the grid says so.
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.
cursor_shape: CursorShapeThe shape of the terminal’s own cursor where the cell tier shows it at cursor.
cursor_blinks: boolWhether the caret or cursor shown here blinks: on the cell tier the terminal is asked
to blink its own cursor (DECSCUSR), and on the pixel tiers whatever shows the grid
takes it through its two halves (blink_to). What draws says so.
term_cursors: Vec<TermCursor>The terminal panes’ cursors drawn, for what draws to place as its tier shows them.
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 blink_cell(&mut self, x: u16, y: u16, off: Cell)
pub fn blink_cell(&mut self, x: u16, y: u16, off: Cell)
Has a cell show off in the half of a blink the caret is away, while it still shows
what it does now: a terminal pane’s cursor, its cell inverted, on the pixel tiers.
Sourcepub fn blinks(&self) -> bool
pub fn blinks(&self) -> bool
Whether anything shown here comes and goes with the blink: a caret, a cursor’s cell, or a cell with another look for it.
Sourcepub fn caret_shown(&self) -> bool
pub fn caret_shown(&self) -> bool
Whether the blink is in the half that shows the caret.
Sourcepub fn blink_to(&mut self, shown: bool)
pub fn blink_to(&mut self, shown: bool)
Takes the caret to one half of its blink, as drawing it again in that half would: away, there’s no caret and no cursor’s cell, and a terminal’s cursor shows its cell’s own look; shown, they’re back. A cell something drawn later stands in keeps that. A tile is a hash of its row, so once both halves of a row are in the terminal, a blink sends nothing but its placement. Nothing that doesn’t blink changes.
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 pictures_again_in(&mut self, before: usize, area: Rect)
pub fn pictures_again_in(&mut self, before: usize, area: Rect)
Paints again, clipped to area, the pictures painted before before that reach into
it, for a surface that hides its edge rows’ cells whole, so no words show half covered,
though its panel covers only part of their pixels: painted over that ground, a picture
shows whole up to the surface’s line, and the panel painted next hides what it covers.
The Ask card’s last row hid 29 px of an equation under the card’s foot (the release
review of 0.12.0, q4-ask-follow-up). Fills (exact_fill) aren’t pictures and stay hidden
with the words, and a picture kept to some rows (keep_to_rows) stays on them.
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 label_right_at(
&mut self,
right: f32,
cell: u16,
y: u16,
text: &str,
style: Style,
size: u8,
)
pub fn label_right_at( &mut self, right: f32, cell: u16, y: u16, text: &str, style: Style, size: u8, )
The same, its painted words ending at right, between cells, and its letters in the
cells ending at cell.
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 of words, which may be washed under the pointer. Where a
row has room, it’s the height it has on the terminal’s line, 32 px in 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’ span, a capital’s top to
a tail’s foot, stands in its middle as every button’s does (at 27 px a “p”’s tail ended
on its foot), and it goes down with its words onto the row’s baseline (beside_words).
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 row_chip(&mut self, (left, right): (f32, f32), y: u16, fill: Rgb)
pub fn row_chip(&mut self, (left, right): (f32, f32), y: u16, fill: Rgb)
The chip of a button at a row’s end, from left to right between cells, behind words
its caller sets where they stand with the row at rest: as tall as row_button‘s and in
the middle of the row, so in the middle of a pointed row’s wash, where a row has room.
Gone down onto the words’ baseline, as a row_button goes, it stood 10 px under the
wash’s top and 8 over its foot.
Sourcepub fn beside_words(&mut self, from: usize)
pub fn beside_words(&mut self, from: usize)
Moves a button painted since from down onto the baseline of the words beside it in
its row, chip and words together (WORDS_BASELINE), where a row has room. On the
terminal’s line a button has the row to itself and nothing to spare.
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 exact_fill_under(&mut self, index: usize, bounds: Bounds, color: Rgb)
pub fn exact_fill_under(&mut self, index: usize, bounds: Bounds, color: Rgb)
exact_fill, put in under what’s been painted from index on.
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 standing in it as a
button’s do, for a control that paints its own chip.
Words centred on x that stand in the middle of the row starting at y as a button’s
do: their font’s span, a capital’s top to a tail’s foot, in its middle, whatever their
letters, so a row of buttons has one baseline. The font’s line in the row’s middle put
“Show Source” 5 px under its button’s top and 10 over its foot, and the tails of “Accept
Rewrite” 6 px over its foot with its capitals 9 under its top.
Sourcepub fn centre_span_since(&mut self, from: usize)
pub fn centre_span_since(&mut self, from: usize)
Has the words painted since from stand as a button’s words do (button_label), for a
button that places its own words.
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 exact_popup(
&mut self,
bounds: Bounds,
radius: u8,
fill: Rgb,
border: Rgb,
)
pub fn exact_popup( &mut self, bounds: Bounds, radius: u8, fill: Rgb, border: Rgb, )
A panel floating above the page drawn exactly over bounds, however much shorter than
its row: popup‘s is stood as a control is on a taller row (raster::stood), grown or
shrunk about its middle, and a tip’s box sized for its words’ ink mustn’t be.
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>
Sourcepub fn spans(&self, y: u16) -> Vec<(u16, u16)>
pub fn spans(&self, y: u16) -> Vec<(u16, u16)>
The bands of row y, as (first column, column past the last), each a tile of its own:
bands, or row_bands on its own row. The last row is the status bar, which nothing
scrolls in, and is one.
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.