]> git.ipfire.org Git - thirdparty/newt.git/commitdiff
Add newtListboxItemCount() to return number of items in a listbox.
authorjorton <jorton>
Tue, 11 Jun 2002 12:35:25 +0000 (12:35 +0000)
committerjorton <jorton>
Tue, 11 Jun 2002 12:35:25 +0000 (12:35 +0000)
listbox.c
newt.h

index e6716f9ea57ec2f51bb6e9917c5a2c367ffe0086..259c5ccfb751b12091d2c559d4036e0920d7fc98 100644 (file)
--- 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 3805b4e4f15a8232b0bd01759c9e3c296f9bc949..55dd94389ff7b7cba50027b688f89c9421c7f207 100644 (file)
--- 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);