Class TermIO
#include <TermIO.h >
bool keybuffering |
true to allow user to type ahead Default value: true |
bool keyecho |
true to print input letters to screen Default value: true |
bool color |
true if colors will be used Default value: true |
Constructor - initialize the terminal
bool keybuffering |
true to allow user to type ahead Default value: true |
bool keyecho |
true to print input letters to screen Default value: true |
bool color |
true if colors will be used Default value: true |
Start terminal I/O. This is automatically called when TermIO
is instantiated. But, you can call it after stop() to restart it.
Stop terminal I/O. This is performed by ~TermIO(), but you
can call it to exit terminal mode early.
bool wait |
true to wait for a keystroke; false to return immediately Default value: true |
Accept an keystroke from the user
Return value: the keystroke; note that keystrokes have #defines, e.g. KEY_LEFT; -1 if no keystroke
int c |
the character to output |
bool refresh |
(internal use) refresh TermIO properties Default value: true |
Output a character to the terminal
Return value: key ASCII value of key; 0 if no key
const string& text |
the text to output |
Output text to the terminal
Return value: true upon success
char c |
character to insert Default value: ' ' |
Insert a character at the cursor and shift the remaining text on the line to the right
Delete the character at the cursor and shift the remaining text on the line to the left
Get the cursor current row. Top is row 0.
Return value: cursor current row
Get the cursor current column. Leftmost is column 0.
Return value: cursor current column
unsigned int newrows |
max # rows; or 0 for max |
unsigned int newcolumns |
max # columns; or 0 for max |
bool scrolling |
true to allow scrolling; false to prevent scrolling Default value: true |
Fix the screen size (ignore user resizes)
Get the total number of current screen rows.
Return value: cursor current row
Get the total number of current screen columns.
Return value: cursor current column
Get the maxiumu number of screen rows.
If a window resize event happens, this will change.
Return value: cursor current row
Get the maxiumu number of screen columns.
If a window resize event happens, this will change.
Return value: cursor current column
int row |
the new current cursor row, from 0 to rows-1. |
Set the current cursor row
Return value: true if success; false if invalid row
int column |
the new current cursor column, from 0 to columns-1. |
Set the current cursor column
Return value: true if success; false if invalid column
int row |
the new current cursor row, from 0 to rows-1. |
int column |
the new current cursor column, from 0 to columns-1. |
Set the current cursor row & column
Return value: true if success; false if invalid column
Clear the screen.
Clear to the end of the line.
Clear to the end of the screen.
Grab the text off the screen.
Spaces to the end of a line are truncated.
Blank lines to the bottom of the screen are truncated.
Return value: A string per line of the screen
int row |
the row, from 0 to rows-1. |
int column |
the column, from 0 to columns-1. |
Grab a character off the screen at a specific location.
The cursor is not moved.
Return value: character found at provided row, column; 0 if invalid location
int row |
the row, from 0 to rows-1. |
int column |
the column, from 0 to columns-1. |
unsigned char c |
the character to display at the location |
Grab a character off the screen at a specific location.
The cursor is not moved.
Return value: character found at provided row, column; 0 if invalid location
bool on |
true to turn mode on; false to turn mode off Default value: true |
Set reverse character display mode
bool on |
true to turn mode on; false to turn mode off Default value: true |
Set bold character display mode
bool on |
true to turn mode on; false to turn mode off Default value: true |
Set blink character display mode
bool on |
true to turn mode on; false to turn mode off Default value: true |
Set invisible character display mode
bool on |
true to turn mode on; false to turn mode off Default value: true |
Set underline character display mode
bool on |
true to turn mode on; false to turn mode off Default value: true |
Set keystroke echo mode
Make an audible beep sound.
bool on |
true to turn mode on; false to turn mode off Default value: true |
Set keystroke (not line) input mode. No key buffering
bool on |
true to turn mode on; false to turn mode off Default value: true |
Set line (not keystroke) input mode. Key buffering
int color |
character color; -1 = default Default value: -1 |
Set character color of the next character to print.
Valid colors: COLOR_BLACK, COLOR_RED, COLOR_GREEN, COLOR_YELLOW, COLOR_BLUE, COLOR_MAGENTA, COLOR_CYAN, COLOR_WHITE
int color |
character color; -1 = default Default value: -1 |
Set background of character color of the next character to print.
Valid colors: COLOR_BLACK, COLOR_RED, COLOR_GREEN, COLOR_YELLOW, COLOR_BLUE, COLOR_MAGENTA, COLOR_CYAN, COLOR_WHITE
int color |
character color; -1 = default Default value: -1 |
Set background color of the screen.
Valid colors: COLOR_BLACK, COLOR_RED, COLOR_GREEN, COLOR_YELLOW, COLOR_BLUE, COLOR_MAGENTA, COLOR_CYAN, COLOR_WHITE
Clear all character display modes
bool show |
true to show the cursor (default) Default value: true |
Show the cursor.
bool hide |
true to hide the cursor (default) Default value: true |
Hide the cursor.
End curses control of tty
int row |
cursor location |
int column |
cursor location |
int rows |
current # rows, columns of screen |
int columns |
current # rows, columns of screen |
int maxrows |
max # rows, columns of screen |
int maxcolumns |
max # rows, columns of screen |
bool resizeOK |
Flag: it's OK for user to resize |
long attribute |
currently active screen attributes |
int colorForeground |
Current foreground color |
int colorBackground |
Current background color |
int colorpair |
currently after color fg/bg NCurses pair |
bool echoKeys |
Flag: user-typed key echo is on |
bool bufKeys |
Flag: user-typed keys buffered (line mode) |
bool scrollable |
Flag: screen is scrollable |
static TermIO* primaryTerminal |
Handles stdscr and resize |
Query the rows & columns of terminal
Setup colors for color screen
Handle a xterm window resize