EasyGUI  Version v1.0
List view

List view object. More...

Data Structures

struct  gui_listview_row_t
 Listview main row item. More...
 
struct  gui_listview_col_t
 Listview column item. More...
 
struct  gui_listview_item_t
 Listview string item object. More...
 
struct  gui_listview_t
 Listview object structure. More...
 

Typedefs

typedef struct gui_listview_row * gui_listview_row_p
 Typedef for row for public usage.
 

Enumerations

enum  gui_listview_color_t {
  GUI_LISTVIEW_COLOR_BG = 0x00, GUI_LISTVIEW_COLOR_TEXT, GUI_LISTVIEW_COLOR_SEL_FOC, GUI_LISTVIEW_COLOR_SEL_NOFOC,
  GUI_LISTVIEW_COLOR_SEL_FOC_BG, GUI_LISTVIEW_COLOR_SEL_NOFOC_BG, GUI_LISTVIEW_COLOR_BORDER
}
 List of listview colors. More...
 

Functions

gui_handle_p gui_listview_create (gui_id_t id, float x, float y, float width, float height, gui_handle_p parent, gui_widget_evt_fn evt_fn, uint16_t flags)
 Create new list view widget. More...
 
uint8_t gui_listview_setcolor (gui_handle_p h, gui_listview_color_t index, gui_color_t color)
 Set color to list view widget. More...
 
uint8_t gui_listview_addcolumn (gui_handle_p h, const gui_char *text, gui_dim_t width)
 Add new column to listview. More...
 
uint8_t gui_listview_setcolumnwidth (gui_handle_p h, uint16_t index, gui_dim_t width)
 Set column width in units of pixels. More...
 
gui_listview_row_p gui_listview_addrow (gui_handle_p h)
 Add new empty row. More...
 
uint8_t gui_listview_removerow (gui_handle_p h, int16_t index)
 Remove row from list view. More...
 
uint8_t gui_listview_removerows (gui_handle_p h)
 Remove all rows from list view. More...
 
uint8_t gui_listview_setitemstring (gui_handle_p h, gui_listview_row_p row, uint16_t col, const gui_char *text)
 Set item string for specific row and column. More...
 
uint8_t gui_listview_setselection (gui_handle_p h, int16_t selection)
 Set selected row number. More...
 
int16_t gui_listview_getselection (gui_handle_p h)
 Get selected row number. More...
 
uint8_t gui_listview_setsliderauto (gui_handle_p h, uint8_t autoMode)
 
uint8_t gui_listview_setslidervisibility (gui_handle_p h, uint8_t visible)
 
uint8_t gui_listview_scroll (gui_handle_p h, int16_t step)
 Scroll list if possible. More...
 
uint8_t gui_listview_getitemvalue (gui_handle_p h, int16_t rindex, uint16_t cindex, gui_char *dst, size_t length)
 Get item text value from row index and column index. More...
 

Detailed Description

List view object.

Listview widget can display multiple columns and multiple rows of data at the same time

image_widget_listview.png
Listview object example

Example code for image above

Enumeration Type Documentation

◆ gui_listview_color_t

List of listview colors.

Enumerator
GUI_LISTVIEW_COLOR_BG 

Background color

GUI_LISTVIEW_COLOR_TEXT 

Text color index

GUI_LISTVIEW_COLOR_SEL_FOC 

Text color of selected item when widget is in focus

GUI_LISTVIEW_COLOR_SEL_NOFOC 

Text color of selected item when widget is not in focus

GUI_LISTVIEW_COLOR_SEL_FOC_BG 

Background color of selected item when widget is in focus

GUI_LISTVIEW_COLOR_SEL_NOFOC_BG 

Background color of selected item when widget is not in focus

GUI_LISTVIEW_COLOR_BORDER 

Border color index for top line when not in 3D mode

Function Documentation

◆ gui_listview_addcolumn()

uint8_t gui_listview_addcolumn ( gui_handle_p  h,
const gui_char text,
gui_dim_t  width 
)

Add new column to listview.

Parameters
[in]hWidget handle
[in]textText to display on top
[in]widthWidth of column in units of pixels
Returns
1 on success, 0 otherwise

◆ gui_listview_addrow()

gui_listview_row_p gui_listview_addrow ( gui_handle_p  h)

Add new empty row.

Parameters
[in]hWidget handle
Returns
Row object handle on success, NULL otherwise

◆ gui_listview_create()

gui_handle_p gui_listview_create ( gui_id_t  id,
float  x,
float  y,
float  width,
float  height,
gui_handle_p  parent,
gui_widget_evt_fn  evt_fn,
uint16_t  flags 
)

Create new list 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 units of pixels
[in]parentParent widget handle. Set to NULL to use current active parent widget
[in]evt_fnCustom widget callback function. Set to NULL to use default callback
[in]flagsflags for widget creation
Returns
Widget handle on success, NULL otherwise

◆ gui_listview_getitemvalue()

uint8_t gui_listview_getitemvalue ( gui_handle_p  h,
int16_t  rindex,
uint16_t  cindex,
gui_char dst,
size_t  length 
)

Get item text value from row index and column index.

Parameters
[in]hWidget handle
[in]rindexRow index
[in]cindexColumn index
[in]dstPointer to gui_char variable to save text to it
[in]lengthLength of destination array
Returns
1 on success, 0 otherwise

◆ gui_listview_getselection()

int16_t gui_listview_getselection ( gui_handle_p  h)

Get selected row number.

Parameters
[in]hWidget handle
Returns
Selection number on success, -1 otherwise

◆ gui_listview_removerow()

uint8_t gui_listview_removerow ( gui_handle_p  h,
int16_t  index 
)

Remove row from list view.

Parameters
[in]hWidget handle
[in]indexRow handle to delete from listview
Returns
1 on success, 0 otherwise

◆ gui_listview_removerows()

uint8_t gui_listview_removerows ( gui_handle_p  h)

Remove all rows from list view.

Parameters
[in]hWidget handle
Returns
1 on success, 0 otherwise

◆ gui_listview_scroll()

uint8_t gui_listview_scroll ( gui_handle_p  h,
int16_t  step 
)

Scroll list if possible.

Parameters
[in]hWidget handle
[in]stepStep to scroll. Positive step will scroll up, negative will scroll down
Returns
1 on success, 0 otherwise

◆ gui_listview_setcolor()

uint8_t gui_listview_setcolor ( gui_handle_p  h,
gui_listview_color_t  index,
gui_color_t  color 
)

Set color to list view widget.

Parameters
[in]hWidget handle
[in]indexColor index
[in]colorColor value
Returns
1 on success, 0 otherwise

◆ gui_listview_setcolumnwidth()

uint8_t gui_listview_setcolumnwidth ( gui_handle_p  h,
uint16_t  index,
gui_dim_t  width 
)

Set column width in units of pixels.

Parameters
[in]hWidget handle
[in]indexIndex for column number. First column has index 0
[in]widthWidth of column in units of pixels
Returns
1 on success, 0 otherwise

◆ gui_listview_setitemstring()

uint8_t gui_listview_setitemstring ( gui_handle_p  h,
gui_listview_row_p  row,
uint16_t  col,
const gui_char text 
)

Set item string for specific row and column.

Parameters
[in]hWidget handle
[in]rowRow object handle, previously returned with gui_listview_addrow function
[in]colColumn number to set. First column is on index = 0
[in]textText to use for item
Returns
1 on success, 0 otherwise

◆ gui_listview_setselection()

uint8_t gui_listview_setselection ( gui_handle_p  h,
int16_t  selection 
)

Set selected row number.

Parameters
[in]hWidget handle
[in]selectionSet to -1 to invalidate selection or 0 - count-1 for specific selection
Returns
1 on success, 0 otherwise