EasyGUI  v0.1
Platform independent GUI Library
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...
 

Macros

#define GUI_FLAG_LISTVIEW_SLIDER_ON   0x01
 
#define GUI_FLAG_LISTVIEW_SLIDER_AUTO   0x02
 
#define __GLR(x)
 Listview row object.
 

Typedefs

typedef void * 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, 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 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_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)
 Set auto mode for slider. More...
 
uint8_t gui_listview_setslidervisibility (GUI_HANDLE_p h, uint8_t visible)
 Set manual visibility for slider. More...
 
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, uint16_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

size_t len;
//Create widget
handle = gui_listview_create(0, 10, 10, 100, 40, 0, 0, 0);
//Create columns
gui_listview_addcolumn(handle, _GT("Name"), 120);
gui_listview_addcolumn(handle, _GT("LastName"), 150);
gui_listview_addcolumn(handle, _GT("Email"), 220);
gui_listview_addcolumn(handle, _GT("Phone"), 160);
//Create rows and add values for columns
for (len = 0; len < 10; len++) {
row = gui_listview_addrow(handle);
gui_listview_setitemstring(handle, row, 0, _GT("Name 1"));
gui_listview_setitemstring(handle, row, 1, _GT("Last name 2"));
gui_listview_setitemstring(handle, row, 2, _GT("info@example.com"));
gui_listview_setitemstring(handle, row, 3, _GT("0123456789"));
}

Macro Definition Documentation

#define GUI_FLAG_LISTVIEW_SLIDER_AUTO   0x02

Show right slider automatically when required, otherwise, manual mode is used

#define GUI_FLAG_LISTVIEW_SLIDER_ON   0x01

Slider is currently active

Enumeration Type Documentation

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

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
Return values
1Column was added
0Column was not added
GUI_LISTVIEW_ROW_p gui_listview_addrow ( GUI_HANDLE_p  h)

Add new empty row.

Parameters
[in]hWidget handle
Return values
Rowobject handle
GUI_HANDLE_p gui_listview_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 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 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_listview_getitemvalue ( GUI_HANDLE_p  h,
uint16_t  rindex,
uint16_t  cindex,
GUI_Char dst,
size_t  length 
)

Get item text value from row index and column index.

Parameters
[in,out]hWidget handle
[in]rindexRow index
[in]cindexColumn index
[in]*dstPointer to GUI_Char variable to save text to it
[in]lengthLength of destination array
Return values
1Text was found and copied
0Text was not found
int16_t gui_listview_getselection ( GUI_HANDLE_p  h)

Get selected row number.

Parameters
[in,out]hWidget handle
Return values
Selectionnumber or -1 if no selection
uint8_t gui_listview_scroll ( GUI_HANDLE_p  h,
int16_t  step 
)

Scroll list if possible.

Parameters
[in,out]hWidget handle
[in]stepStep to scroll. Positive step will scroll up, negative will scroll down
Return values
1Scroll successful
0Scroll not successful
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,out]hWidget handle
[in]indexIndex in array of colors. This parameter can be a value of GUI_LISTVIEW_COLOR_t enumeration
[in]colorActual color code to set
Return values
1Color was set ok
0Color was not set
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
Return values
1Column was added
0Column was not added
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
Return values
1Item string was set ok
0Item string was not set
uint8_t gui_listview_setselection ( GUI_HANDLE_p  h,
int16_t  selection 
)

Set selected row number.

Parameters
[in,out]hWidget handle
[in]selectionSet to -1 to invalidate selection or 0 - count-1 for specific selection
Return values
1Selection changed
0Selection not changed
uint8_t gui_listview_setsliderauto ( GUI_HANDLE_p  h,
uint8_t  autoMode 
)

Set auto mode for slider.

Note
When it is enabled, slider will only appear if needed to show more entries on list
Parameters
[in,out]hWidget handle
[in]autoModeAuto mode status. Set to 1 for auto mode or 0 for manual mode
Return values
1Set OK
0Set ERROR
See also
gui_listview_setslidervisibility
uint8_t gui_listview_setslidervisibility ( GUI_HANDLE_p  h,
uint8_t  visible 
)

Set manual visibility for slider.

Note
Slider must be in manual mode in order to get this to work
Parameters
[in,out]hWidget handle
[in]visibleSlider visible status, 1 or 0
Return values
1Set to desired value
0Not set to desired value
See also
gui_listview_setsliderauto