Would like to suggest adding a few things to Fl_Input_Choice:
1) Change the existing method:
void add(const char *s) { menu_->add(s); }
to instead:
int add(const char *s) { return(menu_->add(s)); }
This corrects an omission, allowing the user to access
the integer value that is the index for the menu item.
2) Add an additional add() method with extra args:
/** Adds item \p name to the menu, with shortcut \p sc,
callback \p cb, optional callback data \p cbd (default 0),
and optional \p flags (default 0). For more info, see
Fl_Menu_::add().
\returns the integer index into the menu() array for the created
menu item.
**/
int add(const char *name, int sc, Fl_Callback *cb, void *cbd = 0, int
flags = 0) {
return(menu_->add(name,sc,cb,cbd,flags));
}
This gives the user to access all extended arguments of the
underlying menu widget, as well as avoiding the unusual behavior
of add(const char*) which interprets '|' like '/', only it cannot
be escaped. (An old FORMS holdover that should probably be
disabled..yuck!)
3) Add a size() method:
/** This returns the total menu items in the menu().
This includes the "terminator" item at the end.
See Fl_Menu_::size() for more info.
**/
int size() const { return(menu_->size()); }
This solves another omission which would allow the
caller to walk the menu() items by accessing its size.
A few questions:
a) Does (1) break the ABI (by changing the return value from void to int)?
Pretty sure the others would have no impact.
b) Assuming no ABI issues, any other objections?
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev