coastline 0.0.4
Loading...
Searching...
No Matches
coastline::TextGrid Class Reference

The cells of the screen and the place of the text cursor. More...

#include <textgrid.h>

Collaboration diagram for coastline::TextGrid:

Public Member Functions

TextCell & At (int column, int row)
const TextCell & At (int column, int row) const
void Fill (int column, int row, int width, int height, std::uint8_t glyph, CgaColor foreground, CgaColor background)
 Fill a rectangle of cells with one character in two colours.
void Write (int column, int row, std::u32string_view text, CgaColor foreground, CgaColor background, int width=-1)
 Write text along a row, a cell for each code point, cut at width cells.
void WriteUtf8 (int column, int row, std::string_view text, CgaColor foreground, CgaColor background, int width=-1)
 Write UTF-8 text along a row, as Write() writes code points.
void Box (int column, int row, int width, int height, CgaColor foreground, CgaColor background, bool doubled)
 Draw the frame of a box with the lines of code page 437 and fill its inside.
void Shadow (int column, int row, int width, int height)
 Darken the cells one row below and two columns right of a box, as the shadow of a dialog of the QBASIC editor darkens the screen under it.

Public Attributes

std::optional< std::array< int, 2 > > cursor
 The cell the text cursor blinks in, or none when it does not show.

Detailed Description

The cells of the screen and the place of the text cursor.

Member Function Documentation

◆ At() [1/2]

TextCell & coastline::TextGrid::At ( int column,
int row )
Parameters
columnThe column, from 0 at the left.
rowThe row, from 0 at the top.
Returns
The cell, or a scratch cell outside the grid.

◆ At() [2/2]

const TextCell & coastline::TextGrid::At ( int column,
int row ) const
Parameters
columnThe column, from 0 at the left.
rowThe row, from 0 at the top.
Returns
The cell, or a blank cell outside the grid.

◆ Fill()

void coastline::TextGrid::Fill ( int column,
int row,
int width,
int height,
std::uint8_t glyph,
CgaColor foreground,
CgaColor background )

Fill a rectangle of cells with one character in two colours.

Parameters
columnThe left column.
rowThe top row.
widthThe columns.
heightThe rows.
glyphThe character, in code page 437.
foregroundThe colour of the character.
backgroundThe colour behind it.

◆ Write()

void coastline::TextGrid::Write ( int column,
int row,
std::u32string_view text,
CgaColor foreground,
CgaColor background,
int width = -1 )

Write text along a row, a cell for each code point, cut at width cells.

Parameters
columnThe first column.
rowThe row.
textThe text, in code points.
foregroundThe colour of the characters.
backgroundThe colour behind them.
widthThe most cells written, or below 0 for no limit.

◆ WriteUtf8()

void coastline::TextGrid::WriteUtf8 ( int column,
int row,
std::string_view text,
CgaColor foreground,
CgaColor background,
int width = -1 )

Write UTF-8 text along a row, as Write() writes code points.

Parameters
columnThe first column.
rowThe row.
textThe text, in UTF-8.
foregroundThe colour of the characters.
backgroundThe colour behind them.
widthThe most cells written, or below 0 for no limit.

◆ Box()

void coastline::TextGrid::Box ( int column,
int row,
int width,
int height,
CgaColor foreground,
CgaColor background,
bool doubled )

Draw the frame of a box with the lines of code page 437 and fill its inside.

Parameters
columnThe left column of the frame.
rowThe top row of the frame.
widthThe columns of the box, the frame included.
heightThe rows of the box, the frame included.
foregroundThe colour of the lines.
backgroundThe colour of the box.
doubledWhether the lines are double.

◆ Shadow()

void coastline::TextGrid::Shadow ( int column,
int row,
int width,
int height )

Darken the cells one row below and two columns right of a box, as the shadow of a dialog of the QBASIC editor darkens the screen under it.

Parameters
columnThe left column of the box.
rowThe top row of the box.
widthThe columns of the box.
heightThe rows of the box.

Member Data Documentation

◆ cursor

std::optional<std::array<int, 2> > coastline::TextGrid::cursor

The cell the text cursor blinks in, or none when it does not show.


The documentation for this class was generated from the following file: