![]() |
µGFX
2.9
version 2.9
|
List Widget. Used to display lists of items.
Provides advanced features such as multi-selection, smooth scrolling and item icons.
Data Structures | |
struct | GEventGWinList |
A list event. More... | |
struct | ListItem |
The internal list item structure. More... | |
Modules | |
Renderings | |
Built-in rendering functions for the list widget. | |
Functions | |
GHandle | gwinGListCreate (GDisplay *g, GListObject *widget, GWidgetInit *pInit, gBool multiselect) |
Create a list widget. More... | |
void | gwinListEnableRender (GHandle gh, gBool ena) |
Enable or disable the rendering of the list. More... | |
void | gwinListSetScroll (GHandle gh, scroll_t flag) |
Change the behaviour of the scroll bar. More... | |
int | gwinListAddItem (GHandle gh, const char *text, gBool useAlloc) |
Add an item to the list. More... | |
void | gwinListItemSetText (GHandle gh, int item, const char *text, gBool useAlloc) |
Set the custom parameter of an item with a given ID. More... | |
const char * | gwinListItemGetText (GHandle gh, int item) |
Get the name behind an item with a given ID. More... | |
int | gwinListFindText (GHandle gh, const char *text) |
Get the ID of an item with a given name. More... | |
void | gwinListItemSetParam (GHandle gh, int item, gU16 param) |
Set the custom parameter of an item with a given ID. More... | |
gU16 | gwinListItemGetParam (GHandle gh, int item) |
Get the custom parameter of an item with a given ID. More... | |
void | gwinListDeleteAll (GHandle gh) |
Delete all the items of the list. More... | |
void | gwinListItemDelete (GHandle gh, int item) |
Delete an item from the list. More... | |
int | gwinListItemCount (GHandle gh) |
Get the amount of items within the list. More... | |
gBool | gwinListItemIsSelected (GHandle gh, int item) |
Check if an item with a given ID is selected. More... | |
int | gwinListGetSelected (GHandle gh) |
Get the ID of the selected item. More... | |
const char * | gwinListGetSelectedText (GHandle gh) |
Get the text of the selected item. More... | |
void | gwinListSetSelected (GHandle gh, int item, gBool doSelect) |
Set whether a specific item is selected or not. More... | |
void | gwinListViewItem (GHandle gh, int item) |
Scroll the list so the specified item is in view. More... | |
void | gwinListItemSetImage (GHandle gh, int item, gImage *pimg) |
Set the image for a list item. More... | |
#define | GLIST_FLG_MULTISELECT 0x01 |
The internal list object flags. More... | |
Macros | |
#define | GEVENT_GWIN_LIST (GEVENT_GWIN_CTRL_FIRST+4) |
The event type for a list event. More... | |
Typedefs | |
typedef struct GEventGWinList | GEventGWinList |
A list event. More... | |
typedef enum scroll_t | scroll_t |
Enum to change the behaviour of the scroll bar. More... | |
typedef struct ListItem | ListItem |
The internal list item structure. More... | |
Enumerations | |
enum | scroll_t |
Enum to change the behaviour of the scroll bar. More... | |
GHandle gwinGListCreate | ( | GDisplay * | g, |
GListObject * | widget, | ||
GWidgetInit * | pInit, | ||
gBool | multiselect | ||
) |
Create a list widget.
gwinSetDefaultColor()
or gwinSetDefaultBgColor()
then these are GFX_BLACK and GFX_WHITE. gwinSetDefaultFont()
then there is no default font and text drawing operations will not display anything. [in] | g | The GDisplay to display this window on |
[in] | widget | The GListObject structure to initialize. If this is NULL, the structure is dynamically allocated. |
[in] | pInit | The initialization parameters to use |
[in] | multiselect | If gTrue the list is multi-select instead of single-select. |
int gwinListAddItem | ( | GHandle | gh, |
const char * | text, | ||
gBool | useAlloc | ||
) |
Add an item to the list.
[in] | gh | The widget handle (must be a list handle) |
[in] | text | The string which shall be displayed in the list afterwards |
[in] | useAlloc | If set to gTrue, the string will be dynamically allocated. A static buffer must be passed otherwise |
void gwinListDeleteAll | ( | GHandle | gh | ) |
Delete all the items of the list.
[in] | gh | The widget handle (must be a list handle) |
void gwinListEnableRender | ( | GHandle | gh, |
gBool | ena | ||
) |
Enable or disable the rendering of the list.
Usually the list is being re-rendered when an item is added to the list. This can cause flickering and performance issues when many items are added at once. This can be prevented by temporarely disabling the render using this function.
[in] | gh | The widget handle (must be a list handle) |
[in] | ena | gTrue or gFalse |
int gwinListFindText | ( | GHandle | gh, |
const char * | text | ||
) |
Get the ID of an item with a given name.
[in] | gh | The widget handle (must be a list handle) |
[in] | text | The item name |
int gwinListGetSelected | ( | GHandle | gh | ) |
Get the ID of the selected item.
[in] | gh | The widget handle (must be a list handle) |
gwinListItemIsSelected()
to get the selection status for a multi-select list.const char* gwinListGetSelectedText | ( | GHandle | gh | ) |
Get the text of the selected item.
[in] | gh | The widget handle (must be a list handle) |
int gwinListItemCount | ( | GHandle | gh | ) |
Get the amount of items within the list.
[in] | gh | The widget handle (must be a list handle) |
void gwinListItemDelete | ( | GHandle | gh, |
int | item | ||
) |
Delete an item from the list.
[in] | gh | The widget handle (must be a list handle) |
[in] | item | The item ID |
gU16 gwinListItemGetParam | ( | GHandle | gh, |
int | item | ||
) |
Get the custom parameter of an item with a given ID.
[in] | gh | The widget handle (must be a list handle) |
[in] | item | The item ID |
const char* gwinListItemGetText | ( | GHandle | gh, |
int | item | ||
) |
Get the name behind an item with a given ID.
[in] | gh | The widget handle (must be a list handle) |
[in] | item | The item ID |
gBool gwinListItemIsSelected | ( | GHandle | gh, |
int | item | ||
) |
Check if an item with a given ID is selected.
[in] | gh | The widget handle (must be a list handle) |
[in] | item | The item ID |
Set the image for a list item.
[in] | gh | The widget handle (must be a list handle) |
[in] | item | The item ID |
[in] | pimg | The image to be displayed or NULL to turn off the image for this list item. |
gwinListItemSetImage()
with a NULL image or by calling gwinListItemDelete()
. The only way to turn-off the image area for this list is to call gwinListDeleteAll(). void gwinListItemSetParam | ( | GHandle | gh, |
int | item, | ||
gU16 | param | ||
) |
Set the custom parameter of an item with a given ID.
[in] | gh | The widget handle (must be a list handle) |
[in] | item | The item ID |
[in] | param | The parameter to be set |
void gwinListItemSetText | ( | GHandle | gh, |
int | item, | ||
const char * | text, | ||
gBool | useAlloc | ||
) |
Set the custom parameter of an item with a given ID.
[in] | gh | The widget handle (must be a list handle) |
[in] | item | The item ID |
[in] | text | The text to replace the existing text |
[in] | useAlloc | If set to gTrue, the string will be dynamically allocated. A static buffer must be passed otherwise |
Change the behaviour of the scroll bar.
scrollAlways
, scrollAuto
and scrollSmooth
[in] | gh | The widget handle (must be a list handle) |
[in] | flag | The behaviour to be set |
void gwinListSetSelected | ( | GHandle | gh, |
int | item, | ||
gBool | doSelect | ||
) |
Set whether a specific item is selected or not.
[in] | gh | The widget handle (must be a list handle) |
[in] | item | The item ID |
[in] | doSelect | gTrue to select the item or gFalse to deselect the item |
void gwinListViewItem | ( | GHandle | gh, |
int | item | ||
) |
Scroll the list so the specified item is in view.
[in] | gh | The widget handle (must be a list handle) |
[in] | item | The item ID |
#define GEVENT_GWIN_LIST (GEVENT_GWIN_CTRL_FIRST+4) |
The event type for a list event.
Definition at line 36 of file gwin_list.h.
#define GLIST_FLG_MULTISELECT 0x01 |
The internal list object flags.
Definition at line 84 of file gwin_list.h.
typedef struct GEventGWinList GEventGWinList |
A list event.
The internal list item structure.
Enum to change the behaviour of the scroll bar.
gwinListSetScroll()
scrollAlways
always show the scrollbar scrollAuto
show the scrollbar when there are more items on the list then fit on the screen scrollSmooth
enable touch screen smooth scrolling enum scroll_t |
Enum to change the behaviour of the scroll bar.
gwinListSetScroll()
scrollAlways
always show the scrollbar scrollAuto
show the scrollbar when there are more items on the list then fit on the screen scrollSmooth
enable touch screen smooth scrolling Definition at line 77 of file gwin_list.h.