int newtListboxAddEntry(newtComponent co, char * text, void * data) {
struct listbox * li = co->data;
+#if 1
+ newtListboxInsertEntry(co, text, data, li->numItems + 1);
+#else
struct items *item;
if(li->boxItems) {
listboxDraw(co);
return li->numItems;
+#endif
}
return li->numItems;
}
+void newtListboxClear(newtComponent co)
+{
+ struct listbox * li;
+ struct items *anitem, *nextitem;
+ if(co == NULL || (li = co->data) == NULL)
+ return;
+ for(anitem = li->boxItems; anitem != NULL; anitem = nextitem) {
+ nextitem = anitem->next;
+ free(anitem->key);
+ free(anitem);
+ }
+ li->numItems = li->numSelected = li->currItem = li->startShowItem = 0;
+ li->boxItems = NULL;
+ if(li->userHasSetWidth == 0)
+ li->curWidth = 0;
+}
+
/* 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) {
int newtListboxAddEntry(newtComponent co, char * text, void * data);
int newtListboxInsertEntry(newtComponent co, char * text, void * data, int num);
int newtListboxDeleteEntry(newtComponent co, int num);
+void newtListboxClear(newtComponent co); /* removes all entries from listbox */
void newtListboxGetEntry(newtComponent co, int num, char **text, void **data);
void **newtListboxGetSelection(newtComponent co);
void newtListboxClearSelection(newtComponent co);