EasyGUI  v0.1
Platform independent GUI Library
Edit text

Single-line edit text widget. More...

Data Structures

struct  GUI_EDITTEXT_t
 GUI EDIT TEXT widget structure. More...
 

Macros

#define GUI_EDITTEXT_FLAG_MULTILINE   ((uint8_t)0x01)
 

Enumerations

enum  GUI_EDITTEXT_COLOR_t { GUI_EDITTEXT_COLOR_BG = 0x00, GUI_EDITTEXT_COLOR_FG, GUI_EDITTEXT_COLOR_BORDER }
 Edit text color list enumeration. More...
 
enum  GUI_EDITTEXT_VALIGN_t { GUI_EDITTEXT_VALIGN_TOP = GUI_VALIGN_TOP, GUI_EDITTEXT_VALIGN_CENTER = GUI_VALIGN_CENTER, GUI_EDITTEXT_VALIGN_BOTTOM = GUI_VALIGN_BOTTOM }
 Vertical align for edit text inside box. More...
 
enum  GUI_EDITTEXT_HALIGN_t { GUI_EDITTEXT_HALIGN_LEFT = GUI_HALIGN_LEFT, GUI_EDITTEXT_HALIGN_CENTER = GUI_HALIGN_CENTER, GUI_EDITTEXT_HALIGN_RIGHT = GUI_HALIGN_RIGHT }
 Horizontal align for edit text inside box. More...
 

Functions

GUI_HANDLE_p gui_edittext_create (GUI_ID_t id, GUI_iDim_t x, GUI_iDim_t y, GUI_Dim_t width, GUI_Dim_t height, GUI_HANDLE_p parent, GUI_WIDGET_CALLBACK_t cb, uint16_t flags)
 Create new edit text widget. More...
 
uint8_t gui_edittext_setcolor (GUI_HANDLE_p h, GUI_EDITTEXT_COLOR_t index, GUI_Color_t color)
 Set color to specific part of widget. More...
 
uint8_t gui_edittext_setmultiline (GUI_HANDLE_p h, uint8_t multiline)
 Set edit text to multi line mode. More...
 
uint8_t gui_edittext_setvalign (GUI_HANDLE_p h, GUI_EDITTEXT_VALIGN_t align)
 Set vertical align for text inside text box. More...
 
uint8_t gui_edittext_sethalign (GUI_HANDLE_p h, GUI_EDITTEXT_HALIGN_t align)
 Set horizontal align for text inside text box. More...
 

Detailed Description

Single-line edit text widget.

Edit text widget can receive keyboard input in unicode format and display text in single line.

image_widget_edittext.png
Text view in focused state ready to accept keyboard entries (unicode)

Example code of image above:

//Create widget and allocate memory for text edit process
handle = gui_edittext_create(1, 10, 10, 400, 40, h, 0, 0);
gui_widget_settext(handle, _GT("Edit text"));

Macro Definition Documentation

#define GUI_EDITTEXT_FLAG_MULTILINE   ((uint8_t)0x01)

Defines widget as multi-line edit

Enumeration Type Documentation

Edit text color list enumeration.

Enumerator
GUI_EDITTEXT_COLOR_BG 

Background color index

GUI_EDITTEXT_COLOR_FG 

Foreground color index

GUI_EDITTEXT_COLOR_BORDER 

Border color index

Horizontal align for edit text inside box.

Enumerator
GUI_EDITTEXT_HALIGN_LEFT 

Horizontal align left, default value

GUI_EDITTEXT_HALIGN_CENTER 

Horizontal align center

GUI_EDITTEXT_HALIGN_RIGHT 

Horizontal align right

Vertical align for edit text inside box.

Enumerator
GUI_EDITTEXT_VALIGN_TOP 

Vertical align top, default value

GUI_EDITTEXT_VALIGN_CENTER 

Vertical align center

GUI_EDITTEXT_VALIGN_BOTTOM 

Vertical align bottom

Function Documentation

GUI_HANDLE_p gui_edittext_create ( GUI_ID_t  id,
GUI_iDim_t  x,
GUI_iDim_t  y,
GUI_Dim_t  width,
GUI_Dim_t  height,
GUI_HANDLE_p  parent,
GUI_WIDGET_CALLBACK_t  cb,
uint16_t  flags 
)

Create new edit text widget.

Parameters
[in]idWidget unique ID to use for identity for callback processing
[in]xWidget X position relative to parent widget
[in]yWidget Y position relative to parent widget
[in]widthWidget width in units of pixels
[in]heightWidget height in uints of pixels
[in]parentParent widget handle. Set to NULL to use current active parent widget
[in]cbPointer to GUI_WIDGET_CALLBACK_t callback function. Set to NULL to use default widget callback
[in]flagsFlags for widget creation
Return values
>0: GUI_HANDLE_p object of created widget
0Widget creation failed
uint8_t gui_edittext_setcolor ( GUI_HANDLE_p  h,
GUI_EDITTEXT_COLOR_t  index,
GUI_Color_t  color 
)

Set color to specific part of widget.

Parameters
[in,out]hWidget handle
[in]indexColor index. This parameter can be a value of GUI_EDITTEXT_COLOR_t enumeration
[in]colorColor value
Return values
1Color was set ok
0Color was not set
uint8_t gui_edittext_sethalign ( GUI_HANDLE_p  h,
GUI_EDITTEXT_HALIGN_t  align 
)

Set horizontal align for text inside text box.

Parameters
[in,out]hWidget handle
[in]alignVertical align. This parameter can be a value of GUI_EDITTEXT_HALIGN_t enumeration
Return values
1Align was set ok
0Align was not set
uint8_t gui_edittext_setmultiline ( GUI_HANDLE_p  h,
uint8_t  multiline 
)

Set edit text to multi line mode.

Note
When multiline is enabled, vertical text alignment is always top positioned
Parameters
[in,out]hWidget handle
[in]multilineSet to 1 to enable multiline or 0 to disable
Return values
1Color was set ok
0Color was not set
uint8_t gui_edittext_setvalign ( GUI_HANDLE_p  h,
GUI_EDITTEXT_VALIGN_t  align 
)

Set vertical align for text inside text box.

Parameters
[in,out]hWidget handle
[in]alignVertical align. This parameter can be a value of GUI_EDITTEXT_VALIGN_t enumeration
Return values
1Align was set ok
0Align was not set