class XTerminal

Class that abstractize the input/output operations with the terminal

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
o XTerminal()
Initialize the terminal

ovirtual ~XTerminal()
Deinitialize the terminal

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

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

ovirtual 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

ovirtual 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

ovirtual 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

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

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

ovirtual XPoint GetCursorPosition()
Returns the current cursor position

ovirtual 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

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

TI_BLOCKING_INPUT indicates that GetEvent 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

TI_INSERT_MODE indicates that pressing a letter inserts it into the text being edited

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

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

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

ovirtual 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)

ovirtual 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

ovirtual XPoint GetSize()
Returns the terminal's size

ovirtual 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_CAN_RESIZE indicates that the terminal window can be resized

TM_HAVE_MOUSE indicates that the terminal have mouse support

TM_HAVE_GPM_MOUSE indicates that the GPM mouse support is activated

Returns:
true if bit set
Parameters:
__Mask - state mask

ovirtual 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

ovirtual bool IsValid(XPoint __p)
Checks if a point have valid coordinates
Parameters:
__p - point to check

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

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

ovirtual 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

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

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

ovirtual void Resize()
Resizes the terminal using current values

ovirtual void Resume()
Restores a previous suspended terminal

ovirtual 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

ovirtual 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

ovirtual 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

ovirtual 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

ovirtual 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

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

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

oXPoint Cursor
Current cursor position

oXPoint Size
Terminal size

ochar* Name
Terminal name

ounsigned ForegroundColor
Current foreground, respectively background color

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

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

oint EscTimeout
Timeout for receiving ESC codes

ovirtual void Init()
Called by constructor

ovirtual void Done()
Called by destructor


This class has no child classes.

Go to the
hierarchy of classes.


Copyright ©1998-2001 Dragos Acostachioaie
Last update on October 27, 2001

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