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

The file with interface for the GPIO driver. More...

#include <oc_tgui.h>
#include <oc_stdlib.h>
#include <oc_null.h>
#include <oc_object.h>
#include <oc_stdio.h>
#include <oc_kprint.h>
#include <string.h>
#include <oc_math.h>
#include <ctype.h>
#include <oc_struct.h>
#include <oc_string.h>
#include <oc_debug.h>
#include <oc_process.h>

Go to the source code of this file.

Data Structures

struct  ProgressBar_t
 

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 *TextInside, 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.c.

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 468 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 1684 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 770 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 941 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.