version 2.8
Console

Detailed Description

Console widget that can be used similar a terminal on a computer.

GWIN allows it to create a console/terminal like window. You can simply use chprintf() to print to the terminal.

Precondition
GFX_USE_GWIN must be set to TRUE in your gfxconf.h
GWIN_NEED_CONSOLE must be set to TRUE in your gfxconf.h

Functions

GHandle gwinGConsoleCreate (GDisplay *g, GConsoleObject *gc, const GWindowInit *pInit)
 Create a console window. More...
 
void gwinPutChar (GHandle gh, char c)
 Put a character at the cursor position in the window. More...
 
void gwinPutString (GHandle gh, const char *str)
 Put a string at the cursor position in the window. It will wrap lines as required. More...
 
void gwinPutCharArray (GHandle gh, const char *str, size_t n)
 Put the character array at the cursor position in the window. It will wrap lines as required. More...
 
void gwinPrintf (GHandle gh, const char *fmt,...)
 Print a formatted string at the cursor position in the window. It will wrap lines as required. More...
 

Function Documentation

GHandle gwinGConsoleCreate ( GDisplay *  g,
GConsoleObject *  gc,
const GWindowInit pInit 
)

Create a console window.

A console window allows text to be written.

Note
Text in a console window supports newlines and will wrap text as required.
Returns
NULL if there is no resultant drawing area, otherwise a window handle.
Parameters
[in]gThe GDisplay to display this window on
[in]gcThe GConsoleObject structure to initialise. If this is NULL the structure is dynamically allocated.
[in]pInitThe initialization parameters to use
Note
The drawing color and the background color get set to the current defaults. If you haven't called gwinSetDefaultColor() or gwinSetDefaultBgColor() then these are White and Black respectively.
The font gets set to the current default font. If you haven't called gwinSetDefaultFont() then there is no default font and text drawing operations will no nothing.
On creation even if the window is visible it is not automatically cleared. You may do that by calling gwinClear() (possibly after changing your background color)
A console does not save the drawing state. It is not automatically redrawn if the window is moved or its visibility state is changed.
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinPrintf ( GHandle  gh,
const char *  fmt,
  ... 
)

Print a formatted string at the cursor position in the window. It will wrap lines as required.

This function implements a minimal printf() like functionality The general parameters format is: %[-][width|*][.precision|*][l|L]p. The following parameter types (p) are supported:

  • x hexadecimal integer.
  • X hexadecimal long.
  • o octal integer.
  • O octal long.
  • d decimal signed integer.
  • D decimal signed long.
  • u decimal unsigned integer.
  • U decimal unsigned long.
  • c character.
  • s string.
    Note
    Uses the current foreground color to draw the string and fills the background using the background drawing color
    Parameters
    [in]ghThe window handle (must be a console window)
    [in]fmtThe format string (as per printf)
    [in]...The format string arguments.
    Function Class:
    Normal API, this function can be invoked by regular system threads.
void gwinPutChar ( GHandle  gh,
char  c 
)

Put a character at the cursor position in the window.

Note
Uses the current foreground color to draw the character and fills the background using the background drawing color
Parameters
[in]ghThe window handle (must be a console window)
[in]cThe character to draw
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinPutCharArray ( GHandle  gh,
const char *  str,
size_t  n 
)

Put the character array at the cursor position in the window. It will wrap lines as required.

Note
Uses the current foreground color to draw the string and fills the background using the background drawing color
Parameters
[in]ghThe window handle (must be a console window)
[in]strThe string to draw
[in]nThe number of characters to draw
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinPutString ( GHandle  gh,
const char *  str 
)

Put a string at the cursor position in the window. It will wrap lines as required.

Note
Uses the current foreground color to draw the string and fills the background using the background drawing color
Parameters
[in]ghThe window handle (must be a console window)
[in]strThe string to draw
Function Class:
Normal API, this function can be invoked by regular system threads.