class XTerminal

Class that abstractize the input/output operations with the terminal

Inheritance:

XTerminal


Public Methods

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

Protected Fields

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

Protected Methods

[more]virtual void Init()
Called by constructor
[more]virtual void Done()
Called by destructor

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

virtual char* GetName()
Returns the current terminal's name

virtual 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 bool 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_HAVE_MOUSE indicates that the terminal have mouse support

Returns:
true 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 bool IsValid(XPoint __p)
Checks if a point have valid coordinates
Parameters:
__p - point to check

virtual bool IsValid(XRect __r)
Checks if a rectangle have valid coordinates
Parameters:
__r - rectangle to check

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 Resize()
Resizes the terminal using current values

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, bool __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, bool __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, bool __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

char* Name
Terminal name

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-99 Dragos Acostachioaie
Last update on March 9, 1999

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