KSM edits to RA8875

Dependents:   Liz_Test_Code

Embed: (wiki syntax)

« Back to documentation index

TextDisplay Class Reference

A text display class that supports character based presentation. More...

#include <TextDisplay.h>

Inherited by GraphicsDisplay.

Public Member Functions

 TextDisplay (const char *name=NULL)
 Create a TextDisplay interface.
virtual int character (int x, int y, int c)=0
 destructor to clean up
virtual int rows ()=0
 return number of rows on TextDisplay
virtual int columns ()=0
 return number if columns on TextDisplay
virtual bool claim (FILE *stream)
 redirect output from a stream (stoud, sterr) to display
virtual RetCode_t cls (uint16_t layers=0)=0
 clear screen
virtual RetCode_t locate (textloc_t column, textloc_t row)=0
 locate the cursor at a character position.
virtual RetCode_t foreground (color_t color)=0
 set the foreground color
virtual RetCode_t background (color_t color)=0
 set the background color

Protected Member Functions

virtual int _putc (int value)
 a method to put a character to the display.
virtual int _getc ()
 a method to get a character from the stdin

Protected Attributes

uint16_t _column
 character column location
uint16_t _row
 character row location
color_t _foreground
 presently set foreground color
color_t _background
 presently set background color
char * _path
 stream name when redirecting stdio

Detailed Description

A text display class that supports character based presentation.

Definition at line 27 of file TextDisplay.h.


Constructor & Destructor Documentation

TextDisplay ( const char *  name = NULL )

Create a TextDisplay interface.

Parameters:
nameThe name used in the path to access the display through the stdio stream.

Definition at line 21 of file TextDisplay.cpp.


Member Function Documentation

int _getc (  ) [protected, virtual]

a method to get a character from the stdin

Returns:
the fetched character.

Definition at line 81 of file TextDisplay.cpp.

int _putc ( int  value ) [protected, virtual]

a method to put a character to the display.

Parameters:
valueis the character value to send to the display
Returns:
the character that was sent.

Reimplemented in RA8875.

Definition at line 39 of file TextDisplay.cpp.

virtual RetCode_t background ( color_t  color ) [pure virtual]

set the background color

Note:
this method may be overridden in a derived class.
Parameters:
[in]coloris color to use for background drawing.
Returns:
RetCode_t value.

Implemented in RA8875.

virtual int character ( int  x,
int  y,
int  c 
) [pure virtual]

destructor to clean up

output a character at the given position

Note:
this method may be overridden in a derived class.
Parameters:
[in]xposition in pixels
[in]yposition in pixels
[in]cthe character to be written to the TextDisplay
Returns:
number of pixels to advance the cursor which could be the cell width for non-proportional characters, or the actual character width for proportional characters.

Implemented in GraphicsDisplay.

bool claim ( FILE *  stream ) [virtual]

redirect output from a stream (stoud, sterr) to display

Note:
this method may be overridden in a derived class.
Parameters:
[in]streamthat shall be redirected to the TextDisplay
Returns:
true if the claim succeeded.

Definition at line 100 of file TextDisplay.cpp.

RetCode_t cls ( uint16_t  layers = 0 ) [pure virtual]

clear screen

Note:
this method may be overridden in a derived class.
Parameters:
[in]layersis ignored, but supports maintaining the same API for the graphics layer.
Returns:
RetCode_t value.

Implemented in GraphicsDisplay, and RA8875.

Definition at line 63 of file TextDisplay.cpp.

virtual int columns (  ) [pure virtual]

return number if columns on TextDisplay

Note:
this method may be overridden in a derived class.
Returns:
number of text rows for the display for the currently active font.

Implemented in GraphicsDisplay, and RA8875.

virtual RetCode_t foreground ( color_t  color ) [pure virtual]

set the foreground color

Note:
this method may be overridden in a derived class.
Parameters:
[in]coloris color to use for foreground drawing.
Returns:
RetCode_t value.

Implemented in RA8875.

RetCode_t locate ( textloc_t  column,
textloc_t  row 
) [pure virtual]

locate the cursor at a character position.

Based on the currently active font, locate the cursor on screen.

Note:
this method may be overridden in a derived class.
Parameters:
[in]columnis the horizontal offset from the left side.
[in]rowis the vertical offset from the top.
Returns:
RetCode_t value.

Implemented in RA8875.

Definition at line 73 of file TextDisplay.cpp.

virtual int rows (  ) [pure virtual]

return number of rows on TextDisplay

Note:
this method may be overridden in a derived class.
Returns:
number of text rows for the display for the currently active font.

Implemented in GraphicsDisplay, and RA8875.


Field Documentation

color_t _background [protected]

presently set background color

Definition at line 146 of file TextDisplay.h.

uint16_t _column [protected]

character column location

Definition at line 141 of file TextDisplay.h.

color_t _foreground [protected]

presently set foreground color

Definition at line 145 of file TextDisplay.h.

char* _path [protected]

stream name when redirecting stdio

Definition at line 147 of file TextDisplay.h.

uint16_t _row [protected]

character row location

Definition at line 142 of file TextDisplay.h.