DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.
[STR New] Link: http://www.fltk.org/str.php?L2113 Version: 1.3-feature Fl_Browser is missing a few needed methods for derived classes to work efficiently with the linked list of items. These appear to be omissions: 1) The existing methods item_first(), item_next(), item_prev() etc. allow fast walks through the linked list using item pointers. But it's missing a way to get the text for an item.. we need e.g: ---------------------------------------------------------- // RETURN TEXT FOR 'item' const char* Fl_Browser::item_text(void*item) const { return(((FL_BLINE*)(item))->txt); } ---------------------------------------------------------- Currently a derived class can only access text via a line number, eg: Fl_Browser::text(int linenum) ..which has to do a linear lookup through the linked list to find linenum, which is very slow with large lists, esp. when doing bubble sorts. 2) The protected methods item_first(), item_next() and item_prev() have been provided, but item_last() seems to have been omitted. eg: void* Fl_Browser::item_last() const {return last;} ..which is needed for starting at the end of the linked list and working backwards. 3) The following existing protected methods are useful for eg. bubble sorts in derived classes: FL_BLINE* find_line(int) void swap(FL_BLINE*,FL_BLINE*) etc.. But unfortunately they currently can't be used by a derived classes because the struct "FL_BLINE" is defined only in Fl_Browser.cxx, where it can't be accessed. Probably best would be to provide void* versions of these methods so FL_BLINE doesn't need to be referenced. Or, provide FL_BLINE in the header file so derived classes can access the definition. (The former is probably a better solution; derived classes probably shouldn't need to know FL_BLINE's definition at all) Link: http://www.fltk.org/str.php?L2113 Version: 1.3-feature _______________________________________________ fltk-dev mailing list fltk-dev@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-dev