diff --git a/src/Fl_Check_Browser.cxx b/src/Fl_Check_Browser.cxx index aada7b4f9..799d09cbb 100644 --- a/src/Fl_Check_Browser.cxx +++ b/src/Fl_Check_Browser.cxx @@ -193,6 +193,40 @@ int Fl_Check_Browser::add(char *s, int b) { return (nitems_); } +int Fl_Check_Browser::remove(int item) { + cb_item *p = find_item(item); + cb_item *prev; + cb_item *next; + + // line at item exists + if(p) { + // tell the Browser_ what we will do + deleting(p); + + // fix checked count + if(p->checked) + --nchecked_; + + // remove the node + if (p->prev) + p->prev->next = p->next; + else + first = p->next; + if (p->next) + p->next->prev = p->prev; + else + last = p->prev; + + free(p->text); + free(p); + + --nitems_; + cached_item = -1; + } + + return (nitems_); +} + void Fl_Check_Browser::clear() { cb_item *p = first; cb_item *next;