EasyGUI  Version v1.0
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, float x, float y, float width, float 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

◆ GUI_EDITTEXT_FLAG_MULTILINE

#define GUI_EDITTEXT_FLAG_MULTILINE   ((uint8_t)0x01)

Defines widget as multi-line edit

Enumeration Type Documentation

◆ gui_edittext_color_t

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

◆ gui_edittext_halign_t

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

◆ gui_edittext_valign_t

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_edittext_create()

gui_handle_p gui_edittext_create ( gui_id_t  id,
float  x,
float  y,
float  width,
float  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
Returns
gui_handle_p object of created widget on success, NULL otherwise

◆ gui_edittext_setcolor()

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
Returns
1 on success, 0 otherwise

◆ gui_edittext_sethalign()

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
Returns
1 on success, 0 otherwise

◆ gui_edittext_setmultiline()

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
Returns
1 on success, 0 otherwise

◆ gui_edittext_setvalign()

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
Returns
1 on success, 0 otherwise