From 1dcea57f8533a11d7896b74f6299aaa91bf65ced Mon Sep 17 00:00:00 2001 From: jorton Date: Tue, 11 Jun 2002 12:35:25 +0000 Subject: [PATCH] Add newtListboxItemCount() to return number of items in a listbox. --- listbox.c | 6 ++++++ newt.h | 2 ++ 2 files changed, 8 insertions(+) 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); -- 2.47.2