31 #ifndef SYSTEM_CORE_SRC_GUI_OC_TGUI_H_ 32 #define SYSTEM_CORE_SRC_GUI_OC_TGUI_H_ 36 #include <oc_stdlib.h> 47 #define _________________________________________MACROS_SECTION_____________________________________________________________________________ 49 #define oC_TGUI_Color_IsCorrect(Color) ( (Color) <= (oC_TGUI_Color_White) && (Color) >= (oC_TGUI_Color_Black) ) 50 #define oC_TGUI_Position_IsCorrect(Pos) ( (Pos.Line > 0) && (Pos.Column > 0) ) 51 #define oC_TGUI_Position_AreEqual(P1,P2) ( oC_TGUI_Position_Compare(P1,P2) == 0 ) 52 #define oC_TGUI_Position_IsSmaller(P1,P2) ( oC_TGUI_Position_Compare(P1,P2) < 0 ) 53 #define oC_TGUI_Position_IsGreater(P1,P2) ( oC_TGUI_Position_Compare(P1,P2) > 0 ) 54 #define oC_TGUI_Position_IsLower(P1,P2) ( (P1.Line > P2.Line) ) 55 #define oC_TGUI_Position_IsHigher(P1,P2) ( (P1.Line < P2.Line) ) 57 #define oC_TGUI_DefaultScreenWidth 80 58 #define oC_TGUI_DefaultScreenHeight 24 60 #undef _________________________________________MACROS_SECTION_____________________________________________________________________________ 68 #define _________________________________________TYPES_SECTION______________________________________________________________________________ 560 const char * Description;
562 oC_TGUI_ValueType_t Type;
573 const char * ValueString;
586 oC_TGUI_Column_t Width;
587 oC_TGUI_Line_t Height;
588 oC_TGUI_Column_t DescriptionWidth;
590 oC_TGUI_EntryIndex_t NumberOfProperties;
597 oC_TGUI_Column_t Width;
598 oC_TGUI_Line_t Height;
602 void * SelectHandlerParameter;
608 oC_TGUI_InputType_Disabled = 0 ,
609 oC_TGUI_InputType_Password = (1<<0),
610 oC_TGUI_InputType_Digits = (1<<1),
611 oC_TGUI_InputType_Characters = (1<<2),
612 oC_TGUI_InputType_SpecialChars = (1<<3),
613 oC_TGUI_InputType_Default = oC_TGUI_InputType_Digits |
614 oC_TGUI_InputType_Characters |
615 oC_TGUI_InputType_SpecialChars ,
616 } oC_TGUI_InputType_t;
638 oC_TGUI_InputType_t InputType;
640 void * SaveParameter;
648 oC_TGUI_InputType_t InputType;
650 void * SaveParameter;
656 oC_TGUI_ActiveObjecType_EditBox ,
657 oC_TGUI_ActiveObjecType_PushButton ,
658 oC_TGUI_ActiveObjecType_QuickEdit ,
659 oC_TGUI_ActiveObjecType_SelectionBox ,
660 } oC_TGUI_ActiveObjecType_t;
673 void * PressParameter;
686 uint32_t* SelectedIndex;
687 const oC_String_t* Options;
688 uint32_t NumberOfOptions;
691 void * OnChangeParameter;
696 oC_TGUI_ActiveObjecType_t Type;
698 oC_TGUI_Column_t Width;
699 oC_TGUI_Line_t Height;
701 const char * LabelText;
702 oC_TGUI_Column_t LabelWidth;
724 #undef _________________________________________TYPES_SECTION______________________________________________________________________________ 731 #define _________________________________________VARIABLES_SECTION__________________________________________________________________________ 753 #undef _________________________________________VARIABLES_SECTION__________________________________________________________________________ 761 #define _________________________________________FUNCTIONS_SECTION__________________________________________________________________________ 764 extern const char * oC_TGUI_GetNameFromColor (
oC_TGUI_Color_t Color );
766 extern bool oC_TGUI_ClearScreen (
void );
774 extern bool oC_TGUI_SaveAttributes (
void );
775 extern bool oC_TGUI_RestoreAttributes (
void );
782 extern bool oC_TGUI_DrawAtPosition (
oC_TGUI_Position_t StartPosition ,
const char * String );
783 extern bool oC_TGUI_DrawAtPositionWithSize (
oC_TGUI_Position_t StartPosition ,
const char * String ,
int Size );
785 extern bool oC_TGUI_DrawNCharAtPosition (
oC_TGUI_Position_t StartPosition ,
char C ,
int N );
789 extern bool oC_TGUI_DrawFormatAtPosition (
oC_TGUI_Position_t StartPosition ,
const char * Format , ... );
790 extern bool oC_TGUI_FindPositionInBuffer (
oC_TGUI_Position_t TopLeft ,
oC_TGUI_Position_t * Position ,oC_TGUI_Column_t Width , oC_TGUI_Line_t Height ,
const char * String , uint32_t * outIndex );
808 extern bool oC_TGUI_WaitForKeyPress (
oC_TGUI_Key_t * outKey );
809 extern bool oC_TGUI_CheckKeyPressed (
oC_TGUI_Key_t * outKey );
811 #undef _________________________________________FUNCTIONS_SECTION__________________________________________________________________________
oC_TGUI_Color_t NonActiveColor
Color of the not filled part of progress bar.
oC_TGUI_Style_t TextStyle
Style of the text inside the box.
Default style for a text.
char Name[30]
Name of the screen - useful for screen identification.
oC_TGUI_Line_t Line
Number of line.
Special value for detecting CTRL.
void(* oC_TGUI_QuickEditBoxSaveValueHandler_t)(char *Buffer, uint32_t Size, void *Parameter)
Function for saving value of quick edit box.
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
Special value - minimum ID for special keys.
bool oC_TGUI_DrawActiveObjects(oC_TGUI_ActiveObject_t *ActiveObjects, uint32_t NumberOfObjects)
draws array of active objects and handles it
The file with interface for VT100 terminal standard.
bool oC_TGUI_ResetDevice(void)
function for reseting a terminal
oC_TGUI_Style_t InsideStyle
Style of text inside.
oC_TGUI_Style_t BorderStyle
Style of the border.
Foreground and background will be lighter.
bool DontDraw
Additional field for TGUI functions.
oC_TGUI_Color_t Background
Color of the background.
oC_TGUI_Style_t BorderStyle
Style of the border (set DontDraw to true if you do not want it)
oC_TGUI_Style_t ShadowStyle
Shadow (right down and right bottom)
oC_TGUI_Color_t
stores terminal colors
oC_TGUI_TextStyle_t
text attributes
Invert foreground with background colors.
oC_TGUI_Color_t ActiveColor
Color of the filled part of progress bar.
oC_TGUI_Color_t Foreground
Color of the foreground.
The file with list library.
oC_TGUI_Style_t BorderStyle
Style of the box border.
oC_TGUI_TextStyle_t TextStyle
Text attributes (bold/underline,etc)
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
void(* oC_TGUI_MenuHandler_t)(void *Parameter)
Menu entry activated function.
int32_t oC_TGUI_EntryIndex_t
stores index for menu
The file with interface for string library.
Definition of the null pointer.
void(* oC_TGUI_SelectListHandler_t)(oC_List_ElementHandle_t ListElement)
List element selected function.
void(* oC_TGUI_EditBoxSaveValueHandler_t)(char *Buffer, uint32_t Size, void *Parameter)
Function for saving value of edit box.
oC_TGUI_Style_t TitleStyle
Title style.
uint16_t oC_TGUI_Column_t
stores column or width of terminal cursor position
oC_TGUI_Key_t
stores pressed key
void(* oC_TGUI_SelectionHandler_t)(const char *SelectedValue, uint32_t SelectedIndex, void *Parameter)
Function called when value is changed.
void * Config
Pointer to the screen configuration.
oC_TGUI_ValueType_t
stores type of property value
oC_TGUI_Column_t Column
Number of column.
uint16_t oC_TGUI_Line_t
stores line or height of terminal cursor position
bool(* oC_TGUI_PushButtonHandler_t)(void *Parameter)
Function called when push button is pressed.
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
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.