Choco OS  V.0.16.9.0
Join to the chocolate world
TGUI - Terminal GUI Module

Handles VT100 pseudo GUI operations. More...

Data Structures

struct  oC_TGUI_Style_t
 stores style of elements More...
 
struct  oC_TGUI_ProgressBarStyle_t
 style for progress bar More...
 
struct  oC_TGUI_TextBoxStyle_t
 style for text box More...
 
struct  oC_TGUI_BoxStyle_t
 style for box More...
 
struct  oC_TGUI_Position_t
 stores cursor position More...
 
struct  oC_TGUI_MenuEntry_t
 Entry in menu. More...
 
struct  oC_TGUI_MenuStyle_t
 Style of the menu. More...
 

Typedefs

typedef int32_t oC_TGUI_EntryIndex_t
 stores index for menu More...
 
typedef uint16_t oC_TGUI_Line_t
 stores line or height of terminal cursor position More...
 
typedef uint16_t oC_TGUI_Column_t
 stores column or width of terminal cursor position More...
 
typedef void(* oC_TGUI_MenuHandler_t) (void *Parameter)
 Menu entry activated function. More...
 
typedef void(* oC_TGUI_DrawListHandler_t) (oC_TGUI_Position_t Position, oC_List_ElementHandle_t ElementHandle, oC_TGUI_Column_t Width)
 Function for drawing list menu element. More...
 
typedef void(* oC_TGUI_SelectListHandler_t) (oC_List_ElementHandle_t ListElement)
 List element selected function. More...
 
typedef void(* oC_TGUI_EditBoxSaveValueHandler_t) (char *Buffer, uint32_t Size, void *Parameter)
 Function for saving value of edit box. More...
 
typedef void(* oC_TGUI_QuickEditBoxSaveValueHandler_t) (char *Buffer, uint32_t Size, void *Parameter)
 Function for saving value of quick edit box. More...
 
typedef bool(* oC_TGUI_PushButtonHandler_t) (void *Parameter)
 Function called when push button is pressed. More...
 
typedef void(* oC_TGUI_SelectionHandler_t) (const char *SelectedValue, uint32_t SelectedIndex, void *Parameter)
 Function called when value is changed. More...
 

Enumerations

Detailed Description

Typedef Documentation

typedef uint16_t oC_TGUI_Column_t

The type for storing number of column or width of cursor position.

Note
This type cannot store 0 value!

Definition at line 368 of file oc_tgui.h.

typedef void(* oC_TGUI_DrawListHandler_t) (oC_TGUI_Position_t Position, oC_List_ElementHandle_t ElementHandle, oC_TGUI_Column_t Width)

The types stores pointer to a function, that draws a list element. It is called by the TGUI module, when element of the list is visible on the screen.

Parameters
PositionPosition of the list element, where it should be drawn
ElementHandleHandler to a list element
WidthMaximum width for the element
See also
oC_TGUI_DrawListMenu
Note
The terminal style is set before call of this function

Definition at line 421 of file oc_tgui.h.

typedef void(* oC_TGUI_EditBoxSaveValueHandler_t) (char *Buffer, uint32_t Size, void *Parameter)

The function is called, when the value in edit box is changed.

Parameters
BufferBuffer with string of EditBox
SizeSize of the Buffer
ParameterOptional Parameter
See also
oC_TGUI_DrawEditBox

Definition at line 451 of file oc_tgui.h.

typedef int32_t oC_TGUI_EntryIndex_t

The type is for storing index of menu entries.

See also
oC_TGUI_DrawMenu

Definition at line 200 of file oc_tgui.h.

typedef uint16_t oC_TGUI_Line_t

The type for storing number of line or height of cursor position.

Note
This type cannot store 0 value!

Definition at line 356 of file oc_tgui.h.

typedef void(* oC_TGUI_MenuHandler_t) (void *Parameter)

The type for storing pointer to a function, that should be called when one of menu entries is activated.

Parameters
ParameterOptional parameter, that can be used by a user
See also
oC_TGUI_DrawMenu oC_TGUI_MenuEntry_t

Definition at line 401 of file oc_tgui.h.

typedef bool(* oC_TGUI_PushButtonHandler_t) (void *Parameter)

Pointer to the function that is called, when the push button is pressed.

Parameters
ParameterOptional parameter
Returns
true if waiting for push button should ends, false if the TGUI should still wait for a key

Definition at line 481 of file oc_tgui.h.

typedef void(* oC_TGUI_QuickEditBoxSaveValueHandler_t) (char *Buffer, uint32_t Size, void *Parameter)

The function is called, when the value in quick edit box is changed.

Parameters
BufferBuffer with string of QuickEditBox
SizeSize of the Buffer
ParameterOptional Parameter
See also
oC_TGUI_DrawQuickEditBox

Definition at line 467 of file oc_tgui.h.

typedef void(* oC_TGUI_SelectionHandler_t) (const char *SelectedValue, uint32_t SelectedIndex, void *Parameter)

Pointer of the function, that is called, when selected value in SelectionBox is changed.

Parameters
SelectedValueString with selected value
SelectedIndexIndex of selected value
ParameterOptional parameter

Definition at line 495 of file oc_tgui.h.

typedef void(* oC_TGUI_SelectListHandler_t) (oC_List_ElementHandle_t ListElement)

The type stores handler to the function, that is called, when the list element is selected.

See also
oC_TGUI_DrawListMenu
Parameters
ListElementSelected element

Definition at line 435 of file oc_tgui.h.

Enumeration Type Documentation

This is the type for storing terminal colors. You can use functions #oC_TGUI_SetBackgroundColor to set background color and #oC_TGUI_SetForegroundColor to set foreground color. Look at the oC_TGUI_Style_t type to see how to set them all with one function.

Here is a list of available combinations of terminal colors:

terminal_colors.png
Terminal Colors
See also
oC_TGUI_GetColorFromName oC_TGUI_GetNameFromColor

List of available color definitions:

Enumerator
oC_TGUI_Color_Default 

Default

oC_TGUI_Color_Black 

Black

oC_TGUI_Color_Red 

Red

oC_TGUI_Color_Green 

Green

oC_TGUI_Color_Yellow 

Yellow

oC_TGUI_Color_Blue 

Blue

oC_TGUI_Color_Magenda 

Magenda

oC_TGUI_Color_Cyan 

Cyan

oC_TGUI_Color_LightGray 

Light Gray

oC_TGUI_Color_DarkGray 

Dark Gray

oC_TGUI_Color_LightRed 

Light Red

oC_TGUI_Color_LightGreen 

Light Green

oC_TGUI_Color_LightYellow 

Light Yellow

oC_TGUI_Color_LightBlue 

Light Blue

oC_TGUI_Color_LightMagenda 

Light Magenda

oC_TGUI_Color_LightCyan 

Light Cyan

oC_TGUI_Color_White 

White

Definition at line 140 of file oc_tgui.h.

This is the type for storing keys. Special keys are defined as enumeration values (for example oC_TGUI_Key_Enter). All other characters are represented with their ASCII code.

When you need to detect some key pressed with CTRL key, you should expect value: 'ASCII' - oC_TGUI_Key_Control . For example:

oC_TGUI_WaitForKeyPress(&key);
if(key == ( 'd' - oC_TGUI_Key_Control ))
{
printf("You pressed Ctrl+D!\n");
}
else if(key == ( 'c' - oC_TGUI_Key_Control ))
{
printf("You pressed Ctrl+C!\n");
}

List of predefined keys:

Enumerator
oC_TGUI_Key_Enter 

ENTER key.

oC_TGUI_Key_Backspace 

Backspace key.

oC_TGUI_Key_Tab 

Tab key.

oC_TGUI_Key_Control 

Special value for detecting CTRL.

oC_TGUI_Key_ControlC 

Ctrl+C keys.

oC_TGUI_Key_SpecialKeysId 

Special value - minimum ID for special keys.

oC_TGUI_Key_ESC 

ESC key.

oC_TGUI_Key_ArrowUp 

Arrow UP key.

oC_TGUI_Key_ArrowDown 

Arrow DOWN key.

oC_TGUI_Key_ArrowRight 

Arrow RIGHT key.

oC_TGUI_Key_ArrowLeft 

Arrow LEFT key.

oC_TGUI_Key_F1 

F1 key.

oC_TGUI_Key_F2 

F2 key.

oC_TGUI_Key_F3 

F3 key.

oC_TGUI_Key_F4 

F4 key.

oC_TGUI_Key_F5 

F5 key.

oC_TGUI_Key_F6 

F6 key.

oC_TGUI_Key_F7 

F7 key.

oC_TGUI_Key_F8 

F8 key.

oC_TGUI_Key_F9 

F9 key.

oC_TGUI_Key_F10 

F10 key.

oC_TGUI_Key_F11 

F11 key.

oC_TGUI_Key_F12 

F12 key.

Definition at line 96 of file oc_tgui.h.

The type for storing style of the text. If you want default style, set it as 0 or oC_TGUI_TextStyle_Default. Attributes can be joined by 'OR'.

Note
Not all attributes are supported by all terminals. For example in PuTTY, blinking text must be enabled in the configuration before.

To set text style use function #oC_TGUI_SetTextStyle

List of defined attributes:

Enumerator
oC_TGUI_TextStyle_Default 

Default style for a text.

oC_TGUI_TextStyle_Bold 

Text will be bold

oC_TGUI_TextStyle_Dim 

Foreground and background will be lighter.

oC_TGUI_TextStyle_Underline 

Text will be underlined.

oC_TGUI_TextStyle_Blink 

Text will blink.

oC_TGUI_TextStyle_Inverted 

Invert foreground with background colors.

oC_TGUI_TextStyle_Hidden 

Text will be hidden.

Definition at line 178 of file oc_tgui.h.

See also
oC_TGUI_Property_t
Enumerator
oC_TGUI_ValueType_UINT 

Value of type oC_UInt_t.

oC_TGUI_ValueType_U32 

Value of type uint32_t.

oC_TGUI_ValueType_U64 

Value of type uint64_t.

oC_TGUI_ValueType_I32 

Value of type int32_t.

oC_TGUI_ValueType_I64 

Value of type int64_t.

oC_TGUI_ValueType_ValueFloat 

Value of type float.

oC_TGUI_ValueType_ValueDouble 

Value of type double.

oC_TGUI_ValueType_ValueChar 

Value of type char.

oC_TGUI_ValueType_ValueString 

Value of type string.

Definition at line 545 of file oc_tgui.h.