Added gwinListGetSelectedText()

ugfx_release_2.6
Joel Bodenmann 2013-10-23 00:18:03 +02:00 committed by inmarket
parent 5f17570ebc
commit 6cc80926f0
2 changed files with 25 additions and 0 deletions

View File

@ -205,6 +205,19 @@ bool_t gwinListItemIsSelected(GHandle gh, int item);
*/
int gwinListGetSelected(GHandle gh);
/**
* @brief Get the text of the selected item
*
* @param[in] gh The widget handle (must be a list handle)
*
* @return The test of the selected list item for a single-select list.
*
* @note It always returns NULL (nothing selected) for a multi-select list.
*
* @api
*/
const char* gwinListGetSelectedText(GHandle gh);
#if GWIN_NEED_LIST_IMAGES || defined(__DOXYGEN__)
/**
* @brief Set the image for a list item

View File

@ -536,6 +536,18 @@ int gwinListItemCount(GHandle gh) {
return gh2obj->cnt;
}
const char* gwinListGetSelectedText(GHandle gh) {
// is it a valid handle?
if (gh->vmt != (gwinVMT *)&listVMT)
return 0;
// return NULL if nothing is selected (or multi-select)
if (gwinListGetSelected(gh) < 0)
return 0;
return gwinListItemGetText(gh, gwinListGetSelected(gh));
}
#if GWIN_NEED_LIST_IMAGES
void gwinListItemSetImage(GHandle gh, int item, gdispImage *pimg) {
const gfxQueueASyncItem * qi;