EasyGUI  v0.1
Platform independent GUI Library

Text and font management functions. More...

Functions

uint32_t gui_widget_alloctextmemory (GUI_HANDLE_p h, uint32_t size)
 Allocate memory for text operations if text will be dynamic. More...
 
uint8_t gui_widget_freetextmemory (GUI_HANDLE_p h)
 Frees memory previously allocated for text. More...
 
uint8_t gui_widget_settext (GUI_HANDLE_p h, const GUI_Char *text)
 Set text to widget. More...
 
const GUI_Chargui_widget_gettext (GUI_HANDLE_p h)
 Get text from widget. More...
 
const GUI_Chargui_widget_gettextcopy (GUI_HANDLE_p h, GUI_Char *dst, uint32_t len)
 Get text from widget. More...
 
uint8_t gui_widget_setfont (GUI_HANDLE_p h, const GUI_FONT_t *font)
 Set widget font for drawing operations. More...
 
const GUI_FONT_tgui_widget_getfont (GUI_HANDLE_p h)
 Get font from widget. More...
 
uint8_t gui_widget_setfontdefault (const GUI_FONT_t *font)
 Set default font for widgets used on widget creation. More...
 

Detailed Description

Text and font management functions.

Function Documentation

uint32_t gui_widget_alloctextmemory ( GUI_HANDLE_p  h,
uint32_t  size 
)

Allocate memory for text operations if text will be dynamic.

Widget text management

Note
When unicode feature is enabled, memory should be 4x required characters because unicode can store up to 4 bytes for single character
Parameters
[in,out]hWidget handle
[in]sizeNumber of bytes to allocate
Return values
Numberof bytes allocated
See also
gui_widget_freetextmemory
uint8_t gui_widget_freetextmemory ( GUI_HANDLE_p  h)

Frees memory previously allocated for text.

Parameters
[in,out]hWidget handle to free memory on
Return values
1Free was ok
0Free was not ok
See also
gui_widget_alloctextmemory
const GUI_FONT_t* gui_widget_getfont ( GUI_HANDLE_p  h)

Get font from widget.

Note
Since this function is private, it can only be used by user inside GUI library
Parameters
[in,out]hWidget handle
Return values
Pointerto font used for widget
const GUI_Char* gui_widget_gettext ( GUI_HANDLE_p  h)

Get text from widget.

Note
It will return pointer to text which cannot be modified directly.
Parameters
[in,out]hWidget handle
Return values
Pointerto text from widget
See also
gui_widget_settext, gui_widget_gettextcopy
const GUI_Char* gui_widget_gettextcopy ( GUI_HANDLE_p  h,
GUI_Char dst,
uint32_t  len 
)

Get text from widget.

Note
Text from widget is copied to input pointer
Parameters
[in,out]hWidget handle
[out]*dstDestination pointer
[in]lenSize of output buffer in units of GUI_Char
Return values
Pointerto text from widget
See also
gui_widget_settext, gui_widget_gettext
uint8_t gui_widget_setfont ( GUI_HANDLE_p  h,
const GUI_FONT_t font 
)

Set widget font for drawing operations.

Parameters
[in,out]hWidget handle
[in]*fontPointer to GUI_FONT_t object for font
Return values
1Font was set ok
0Font was not set
See also
gui_widget_settext, gui_widget_gettext
uint8_t gui_widget_setfontdefault ( const GUI_FONT_t font)

Set default font for widgets used on widget creation.

Parameters
[in]*fontPointer to GUI_FONT_t with font
Return values
1Font was set ok
0Font was not set
uint8_t gui_widget_settext ( GUI_HANDLE_p  h,
const GUI_Char text 
)

Set text to widget.

Note
If dynamic memory allocation was used then content will be copied to allocated memory otherwise only pointer to input text will be used and each further change of input pointer text will affect to output
Parameters
[in,out]hWidget handle
[in]*textPointer to text to set to widget
Return values
1Text was set ok
0Text was not set
See also
gui_widget_alloctextmemory, gui_widget_freetextmemory, gui_widget_setfont, gui_widget_gettext, gui_widget_gettextcopy