EasyGUI  v0.1
Platform independent GUI Library
Text view

Text view widget. More...

Data Structures

struct  GUI_TEXTVIEW_t
 Dropdown object structure. More...
 

Enumerations

enum  GUI_TEXTVIEW_COLOR_t { GUI_TEXTVIEW_COLOR_BG = 0x00, GUI_TEXTVIEW_COLOR_TEXT }
 List of text view colors. More...
 
enum  GUI_TEXTVIEW_VALIGN_t { GUI_TEXTVIEW_VALIGN_TOP = GUI_VALIGN_TOP, GUI_TEXTVIEW_VALIGN_CENTER = GUI_VALIGN_CENTER, GUI_TEXTVIEW_VALIGN_BOTTOM = GUI_VALIGN_BOTTOM }
 Vertical align for text view inside box. More...
 
enum  GUI_TEXTVIEW_HALIGN_t { GUI_TEXTVIEW_HALIGN_LEFT = GUI_HALIGN_LEFT, GUI_TEXTVIEW_HALIGN_CENTER = GUI_HALIGN_CENTER, GUI_TEXTVIEW_HALIGN_RIGHT = GUI_HALIGN_RIGHT }
 Horizontal align for text view inside box. More...
 

Functions

GUI_HANDLE_p gui_textview_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 text view widget. More...
 
uint8_t gui_textview_setcolor (GUI_HANDLE_p h, GUI_TEXTVIEW_COLOR_t index, GUI_Color_t color)
 Set color to specific part of widget. More...
 
uint8_t gui_textview_setvalign (GUI_HANDLE_p h, GUI_TEXTVIEW_VALIGN_t align)
 Set vertical align for text inside text box. More...
 
uint8_t gui_textview_sethalign (GUI_HANDLE_p h, GUI_TEXTVIEW_HALIGN_t align)
 Set horizontal align for text inside text box. More...
 

Detailed Description

Text view widget.

Text view widget can only display text assigned to its memory

image_widget_textview.png
Text view widget in different alignments

Example code of image above:

size_t i = 0;
static const GUI_Char* texts[] = {
_GT("Text view with top left alignment on screen"),
_GT("Text view with top center alignment on screen"),
_GT("Text view with top right alignment on screen"),
_GT("Text view with middle left alignment on screen"),
_GT("Text view with middle center alignment on screen"),
_GT("Text view with middle right alignment on screen"),
_GT("Text view with bottom left alignment on screen"),
_GT("Text view with bottom center alignment on screen"),
_GT("Text view with bottom right alignment on screen"),
};
for (i = 0; i < 9; i++) {
handle = gui_textview_create(0, 1, 1, 1, 1, 0, 0, 0);
gui_widget_setsizepercent(handle, 30, 30);
gui_widget_setpositionpercent(handle, 3 + (i % 3) * 33, 3 + (i / 3) * 33);
gui_widget_settext(handle, texts[i]);
gui_widget_setfont(handle, &GUI_Font_Roboto_Italic_14);
switch (i % 4) {
}
switch (i % 3) {
}
switch (i / 3) {
}
}

Enumeration Type Documentation

List of text view colors.

Enumerator
GUI_TEXTVIEW_COLOR_BG 

Background color

GUI_TEXTVIEW_COLOR_TEXT 

Default text color

Horizontal align for text view inside box.

Enumerator
GUI_TEXTVIEW_HALIGN_LEFT 

Horizontal align left, default value

GUI_TEXTVIEW_HALIGN_CENTER 

Horizontal align center

GUI_TEXTVIEW_HALIGN_RIGHT 

Horizontal align right

Vertical align for text view inside box.

Enumerator
GUI_TEXTVIEW_VALIGN_TOP 

Vertical align top, default value

GUI_TEXTVIEW_VALIGN_CENTER 

Vertical align center

GUI_TEXTVIEW_VALIGN_BOTTOM 

Vertical align bottom

Function Documentation

GUI_HANDLE_p gui_textview_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 text view 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_textview_setcolor ( GUI_HANDLE_p  h,
GUI_TEXTVIEW_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_TEXTVIEW_COLOR_t enumeration
[in]colorColor value
Return values
1Color was set ok
0Color was not set
uint8_t gui_textview_sethalign ( GUI_HANDLE_p  h,
GUI_TEXTVIEW_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_TEXTVIEW_HALIGN_t enumeration
Return values
1Align was set ok
0Align was not set
uint8_t gui_textview_setvalign ( GUI_HANDLE_p  h,
GUI_TEXTVIEW_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_TEXTVIEW_VALIGN_t enumeration
Return values
1Align was set ok
0Align was not set