From: jorton Date: Tue, 11 Jun 2002 12:35:25 +0000 (+0000) Subject: Add newtListboxItemCount() to return number of items in a listbox. X-Git-Tag: r0-50-36~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1dcea57f8533a11d7896b74f6299aaa91bf65ced;p=thirdparty%2Fnewt.git Add newtListboxItemCount() to return number of items in a listbox. --- diff --git a/listbox.c b/listbox.c index e6716f9..259c5cc 100644 --- a/listbox.c +++ b/listbox.c @@ -449,6 +449,12 @@ void newtListboxClear(newtComponent co) updateWidth(co, li, 5); } +int newtListboxItemCount(newtComponent co) +{ + struct listbox *li = co->data; + return li->numItems; +} + /* If you don't want to get back the text, pass in NULL for the ptr-ptr. Same goes for the data. */ void newtListboxGetEntry(newtComponent co, int num, char **text, void **data) { diff --git a/newt.h b/newt.h index 3805b4e..55dd943 100644 --- a/newt.h +++ b/newt.h @@ -178,6 +178,8 @@ void **newtListboxGetSelection(newtComponent co, int *numitems); void newtListboxClearSelection(newtComponent co); void newtListboxSelectItem(newtComponent co, const void * key, enum newtFlagsSense sense); +/* Returns number of items currently in listbox. */ +int newtListboxItemCount(newtComponent co); newtComponent newtCheckboxTree(int left, int top, int height, int flags); newtComponent newtCheckboxTreeMulti(int left, int top, int height, char *seq, int flags);