Xterminal Home Page Main page

class XTerminal

Class that abstractize the input/output operations with the terminal

Public Methods

virtual void Beep()
Sounds an audible alarm on the terminal
virtual void Clear()
Clears all terminal's screen content
virtual void ColorWindow(XRect __r, unsigned __f, unsigned __b)
Fills a area with a specified color, clearing it's content
virtual void ColorWindowContent(XRect __r, unsigned __f, unsigned __b)
Change the color of a specified area, without altering it's content
virtual void DrawBorder(XRect __r, char *__frame)
Draws a box using some specified characters for it's margins
virtual void FillWindow(XRect __r, chtype __c)
Fills a area with a specified character
virtual void GetColor(unsigned *__f, unsigned *__b)
Gets the current foreground and background color, respectively
virtual XPoint GetCursorPosition()
Returns the current cursor position
virtual XEvent* GetEvent()
Returns the first available event
virtual unsigned GetInputState(unsigned long __Mask)
Returns the value of the terminal input state
virtual int GetInputTimeout()
Returns the current timeout used for special codes receiving
virtual unsigned GetOutputState(unsigned long __Mask)
Returns the value of the terminal output state
unsigned GetPalEntry(char *__Pal, unsigned __Len, unsigned __Index)
Returns the correct palette entry
virtual XPoint GetSize()
Returns the terminal's size
virtual unsigned GetState(unsigned long __Mask)
Returns the terminal general state
virtual void GetWindow(XRect __r, chtype *__buff)
Save the visual content of a specified area into a memory area
virtual void MoveCursor(XPoint __p)
Moves the cursor to a specified location
virtual void Print(XPoint __p, char *__fmt, ...)
Prints something to the terminal
virtual void PrintChar(XPoint __p, chtype __c)
Prints a single character to the terminal
virtual void PutWindow(XRect __r, chtype *__buff)
Copies a previous saved screen area to the terminal
virtual void Refresh()
Effectively dumps the current terminal contents to the screen
virtual void Resume()
Restores a previous suspended terminal
virtual void SetColor(unsigned __f, unsigned __b)
Sets the current terminal color
virtual void SetInputState(unsigned long __Mask, unsigned __BoolValue)
Sets the state of the specified terminal input state
virtual void SetOutputState(unsigned long __Mask, unsigned __BoolValue)
Sets the state of the specified terminal output state
virtual void SetState(unsigned long __Mask, unsigned __BoolValue)
Sets the state of the specified terminal general state
virtual void Suspend()
Saves the current terminal state and falls back to startup state
XTerminal()
Initialize the terminal
virtual ~XTerminal()
Deinitialize the terminal

Protected Fields

XPoint Cursor
Current cursor position
int EscTimeout
Timeout for receiving ESC codes
unsigned ForegroundColor
Current foreground, respectively background color
unsigned long InputState
Current input, output and respectively general properties of the terminal
int InputTimeout
Timeout for receiving special codes (e.g. for function keys)
XPoint Size
Terminal size
unsigned UseFunctionKeys
True if generating events on function keys pressing (normally set)

Protected Methods

virtual void Done()
Called by destructor
virtual void Init()
Called by constructor

Documentation

Class that abstractize the input/output operations with the terminal
XTerminal()
Initialize the terminal

virtual ~XTerminal()
Deinitialize the terminal

virtual void Beep()
Sounds an audible alarm on the terminal

virtual void Clear()
Clears all terminal's screen content

virtual void ColorWindow(XRect __r, unsigned __f, unsigned __b)
Fills a area with a specified color, clearing it's content
Parameters:
__r - area to fill
__f - desired foreground color
__b - desired background color

virtual void ColorWindowContent(XRect __r, unsigned __f, unsigned __b)
Change the color of a specified area, without altering it's content
Parameters:
__r - area to fill
__f - desired foreground color
__b - desired background color

virtual void DrawBorder(XRect __r, char *__frame)
Draws a box using some specified characters for it's margins
Parameters:
__r - box coordinates
__frame - margins type, with the following contents:

__frame[0] - the upper-left corner character

__frame[1] - the upper horizontal line character

__frame[2] - the upper-right corner character

__frame[3] - the left vertical line character

__frame[4] - the right vertical line character

__frame[5] - the lower-left corner character

__frame[6] - the lower horizontal line character

__frame[7] - the lower-right corner character

Predefined values:

FS_SINGLEFRAME - single-line frame

FS_DOUBLEFRAME - double-line frame

FS_FULLFRAME - full-filled frame

virtual void FillWindow(XRect __r, chtype __c)
Fills a area with a specified character
Parameters:
__r - area to fill
__c - desired filling character

virtual void GetColor(unsigned *__f, unsigned *__b)
Gets the current foreground and background color, respectively

virtual XPoint GetCursorPosition()
Returns the current cursor position

virtual XEvent* GetEvent()
Returns the first available event. This method have the following behaviour:

- if TI_BLOCKING_INPUT is set, the function waits until an event coming from keyboard or mouse arrise, and then returns it

- if TI_BLOCKING_INPUT is not set, the function returns the first available event coming from keyboard or mouse, if any. If nothing is available, the function returns zero

virtual unsigned GetInputState(unsigned long __Mask)
Returns the value of the terminal input state. The common used states are:

- TI_BLOCKING_INPUT indicates that GetEvent() method waits until an event from keyboard or mouse arrise

- TI_USE_FUNCTION_KEYS indicates that pressing the function keys will generate a keyboard event; this flag should normally be set

Returns:
non-zero if bit set
Parameters:
__Mask - state mask

virtual int GetInputTimeout()
Returns the current timeout used for special codes receiving

unsigned GetPalEntry(char *__Pal, unsigned __Len, unsigned __Index)
Returns the correct palette entry
Parameters:
__Pal - object's palette
__Len - object's palette length
__Index - color position into the palette (1 = first)

virtual unsigned GetOutputState(unsigned long __Mask)
Returns the value of the terminal output state. The common used states:

- TO_HAVE_COLORS indicates that the terminal can display colors

- TO_CURSOR_VISIBLE indicates that the cursor is visible

- TO_CURSOR_VERY_VISIBLE indicates that the cursor is very visible

Returns:
non-zero if bit set
Parameters:
__Mask - state mask

virtual XPoint GetSize()
Returns the terminal's size

virtual unsigned GetState(unsigned long __Mask)
Returns the terminal general state. The common used states are:

- TM_IS_PC_CONSOLE indicates that the terminal is a PC console

- TM_IS_CONSOLE indicates that the terminal is a system console

- TM_HAVE_MOUSE indicates that the terminal recognizes the mouse

Returns:
non-zero if bit set
Parameters:
__Mask - state mask

virtual void GetWindow(XRect __r, chtype *__buff)
Save the visual content of a specified area into a memory area. This method does NOT allocate memory space for the saved area content, instead it assumes that at least (__r.b.x - __r.a.x + 1) * (__r.b.y - __r.b.x + 1) * sizeof(chtype) bytes are already allocated
Parameters:
__r - area to save
__buff - pointer to the beggining of memory area

virtual void MoveCursor(XPoint __p)
Moves the cursor to a specified location
Parameters:
__p - desired new cursor location

virtual void Print(XPoint __p, char *__fmt, ...)
Prints something to the terminal. This function is analog to printf, and performs the output using a variable argument list
Parameters:
__p - location to start

virtual void PrintChar(XPoint __p, chtype __c)
Prints a single character to the terminal
Parameters:
__p - location to start
__c - character to output

virtual void Refresh()
Effectively dumps the current terminal contents to the screen. You must understand that all the output methods inside the XTerminal class does not implies screen actualization. The drawing is done only when calling this function

virtual void Resume()
Restores a previous suspended terminal

virtual void PutWindow(XRect __r, chtype *__buff)
Copies a previous saved screen area to the terminal
Parameters:
__r - area to copy
__buff - pointer to the beggining of memory area

virtual void SetColor(unsigned __f, unsigned __b)
Sets the current terminal color. Different attributes can be ORed with the __f parameter

TA_UNDERLINE underlining

TA_REVERSE reverse video

TA_BLINK blinking

TA_BOLD extra bright

TA_HALF_BRIGHT half bright

Parameters:
__f - desired foreground color
__b - desired background color

virtual void SetInputState(unsigned long __Mask, unsigned __BoolValue)
Sets the state of the specified terminal input state. Please see GetInputState() for details
Parameters:
__Mask - state mask
__BoolValue - set bit if non-zero, otherwise clear it

virtual void SetOutputState(unsigned long __Mask, unsigned __BoolValue)
Sets the state of the specified terminal output state. Please see GetOutputState() for details
Parameters:
__Mask - state mask
__BoolValue - set bit if non-zero, otherwise clear it

virtual void SetState(unsigned long __Mask, unsigned __BoolValue)
Sets the state of the specified terminal general state. Please see GetState() for details
Parameters:
__Mask - state mask
__BoolValue - set bit if non-zero, otherwise clear it

virtual void Suspend()
Saves the current terminal state and falls back to startup state

unsigned long InputState
Current input, output and respectively general properties of the terminal

XPoint Cursor
Current cursor position

XPoint Size
Terminal size

unsigned ForegroundColor
Current foreground, respectively background color

unsigned UseFunctionKeys
True if generating events on function keys pressing (normally set)

int InputTimeout
Timeout for receiving special codes (e.g. for function keys)

int EscTimeout
Timeout for receiving ESC codes

virtual void Init()
Called by constructor

virtual void Done()
Called by destructor


This class has no child classes.

Go to the
hierarchy of classes.


Copyright ©1998 Dragos Acostachioaie
Last update on June 15, 1998

This page was generated with the help of doc++.