Choco OS  V.0.16.9.0
Join to the chocolate world
oc_tgui.h File Reference

The file with interface for TGUI. More...

#include <oc_stdtypes.h>
#include <stdbool.h>
#include <oc_stdlib.h>
#include <oc_vt100.h>
#include <oc_list.h>
#include <oc_null.h>
#include <oc_string.h>

Go to the source code of this file.

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...
 
struct  oC_TGUI_Property_t
 
struct  oC_TGUI_PropertyStyle_t
 
struct  oC_TGUI_DrawPropertyConfig_t
 
struct  oC_TGUI_DrawListMenuConfig_t
 
struct  oC_TGUI_EditBoxStyle_t
 
struct  oC_TGUI_QuickEditBoxStyle_t
 
struct  oC_TGUI_EditBox_t
 
struct  oC_TGUI_QuickEditBox_t
 
struct  oC_TGUI_PushButtonStyle_t
 
struct  oC_TGUI_PushButton_t
 
struct  oC_TGUI_SelectionBoxStyle_t
 
struct  oC_TGUI_SelectionBox_t
 
struct  oC_TGUI_ActiveObject_t
 
struct  oC_TGUI_Spiner_t
 
struct  oC_TGUI_ColorData_t
 

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

Functions

bool oC_TGUI_ResetDevice (void)
 function for reseting a terminal More...
 
bool oC_TGUI_ClearPartOfScreen (oC_TGUI_Position_t StartPosition, oC_TGUI_Column_t Width, oC_TGUI_Line_t Height, oC_TGUI_Color_t Color)
 clears selected part of the screen More...
 
bool oC_TGUI_DrawBox (const char *Title, const char *InsideText, oC_TGUI_Position_t TopLeft, oC_TGUI_Column_t Width, oC_TGUI_Line_t Height, const oC_TGUI_BoxStyle_t *Style)
 draws a box More...
 
oC_TGUI_EntryIndex_t oC_TGUI_DrawMenu (oC_TGUI_Position_t TopLeft, oC_TGUI_Column_t Width, oC_TGUI_Line_t Height, const oC_TGUI_MenuEntry_t *MenuEntries, oC_TGUI_EntryIndex_t NumberOfEntries, const oC_TGUI_MenuStyle_t *Style)
 draws a menu More...
 
bool oC_TGUI_DrawActiveObjects (oC_TGUI_ActiveObject_t *ActiveObjects, uint32_t NumberOfObjects)
 draws array of active objects and handles it More...
 

Detailed Description


Author
Patryk Kubiak
Note
Copyright (C) 2016 Patryk Kubiak patry.nosp@m.k.ku.nosp@m.biak9.nosp@m.0@gm.nosp@m.ail.c.nosp@m.om

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

Definition in file oc_tgui.h.

Function Documentation

bool oC_TGUI_ClearPartOfScreen ( oC_TGUI_Position_t  StartPosition,
oC_TGUI_Column_t  Width,
oC_TGUI_Line_t  Height,
oC_TGUI_Color_t  Color 
)

The function is for quickly clear part of the screen by using the given background color.

Parameters
StartPositionPosition of the top left corner to clear
WidthWidth of part of screen to clear
HeightHeight of part of screen to clear
ColorBackground color to use for clearing
Returns
true if success

Definition at line 527 of file oc_tgui.c.

bool oC_TGUI_DrawActiveObjects ( oC_TGUI_ActiveObject_t ActiveObjects,
uint32_t  NumberOfObjects 
)

The function is for drawing and handling array of active objects. The function ends, when the pressed key is ESCAPE or when function arguments are not correct.

Parameters
ActiveObjectsPointer to array with active objects
NumberOfObjectsNumber of elements in the ActiveObjects array
Returns
true if success

Definition at line 1745 of file oc_tgui.c.

bool oC_TGUI_DrawBox ( const char *  Title,
const char *  TextInside,
oC_TGUI_Position_t  TopLeft,
oC_TGUI_Column_t  Width,
oC_TGUI_Line_t  Height,
const oC_TGUI_BoxStyle_t Style 
)

The function is for drawing a box - it is a rectangle with title, text inside and shadow. The example you can see below:

box_tgui_example.png
Box Example
Parameters
TitlePointer to the string with title
TextInsidePointer to the string with text that should be placed in the box, or NULL if it is not required
TopLeftPosition of the top left box corner
WidthWidth of the box (including 1 column for the shadow)
HeightHeight of the box (including 1 line for the shadow)
StylePointer to the style of the box.
Returns
true if success

Definition at line 829 of file oc_tgui.c.

oC_TGUI_EntryIndex_t oC_TGUI_DrawMenu ( oC_TGUI_Position_t  TopLeft,
oC_TGUI_Column_t  Width,
oC_TGUI_Line_t  Height,
const oC_TGUI_MenuEntry_t MenuEntries,
oC_TGUI_EntryIndex_t  NumberOfEntries,
const oC_TGUI_MenuStyle_t Style 
)

The function is for drawing menu. It returns index of the lately selected entry or -1 if there was an error. The function ends, when the selected item has not assigned a correct Handler. If the selected item has a valid Handler pointer, the function calls it and waits for the press of the key. You can use it for example as the Exit menu entry.

Note
The ESCAPE key closes the menu.
Parameters
TopLeftPosition of the top left menu corner
WidthWidth including shadow
HeightHeight including shadow
MenuEntriesArray with menu entries
NumberOfEntriesNumber of menu entries in the array
StylePointer to the menu style
Returns
Index of the selected menu entry.

Definition at line 1002 of file oc_tgui.c.

bool oC_TGUI_ResetDevice ( void  )

The function is for reseting terminal device. It restores default text attributes, background and foreground colors, and sets the cursor position to the top left corner.

Returns
true if success

Definition at line 152 of file oc_tgui.c.