class Fl_Menu_ : public Fl_Object
This is the base class for all objects that contain a menu, including
Fl_Menu_Button, Fl_Choice, and Fl_Menu_Bar. This base class provides the
methods for setting or modifying the menu.
The menu is an array of Fl_Menu objects. You may either declare the
array yourself, or call methods on this object to construct it's own array.
~Fl_Menu_();
The destructor deletes its own storage if it has allocated a menu.
const Fl_Menu *menu() const ;
void menu(const Fl_Menu *);
Get or set the menu array directly. Setting it to null indicates that
you want the object to allocate its own array.
int value() const ;
const Fl_Menu *mvalue() const;
int value(int);
int value(const Fl_Menu *);
The value is the index into the Fl_Menu array of the last item chosen
by the user. It is zero initially. You can set it as an integer, or
set it with a pointer to a menu item. The set routines return
non-zero if the new value is different than the old one.
int changed() const;
void set_changed();
void clear_changed();
This value is true if the user picks a different value. It is
turned off by value(x) and just before doing a callback (the callback
can turn it back on if desired).
uchar when() const;
void when(uchar);
It is probably useless to set this to any value other than the default
FL_WHEN_RELEASE|FL_WHEN_NOT_CHANGED
. See Fl_Choice for a subclass that uses this.
char *text() const ;
char *text(int i) const ;
Returns the title of the last item chosen, or of item i.
int size() const ;
This returns menu()->size(), which is how many entries are in the
array, not counting the null ending, but including all submenus titles
and the nulls that end them. If the menu is null this returns zero.
int add(const char *,const char *,Fl_Callback *,void
*v=0,int f=0);
Add a new menu item, with a title string, shortcut string, callback,
argument to the callback, and flags. If menu() was originally set
with null then space is allocated for the new item. If instead you
gave it an array then the array must have enough empty space for the
new item. The title string is copied, but the shortcut is not.
See the Fl_Menu documentation for information on what a slash in
the item title does.
The return value is the index into the array that the entry was put.
int add(const char *);
void clear();
void replace(int,const char *);
Change the text of item n. The passed string is copied.
void remove(int);
Delete item n from the menu.
void shortcut(int i,const char *str);
Change the shortcut of item n. The passed string is not
copied.
void mode(int i,int x);
Change the flags of item n. This can be used to enable and disable
items and to create and set check boxes.
FL_PUP_GRAY = 1,
FL_PUP_BOX = 2,
FL_PUP_CHECK = 4,
FL_PUP_INVISIBLE = 8,
uchar textfont() const;
void textfont(uchar);
uchar textsize() const;
void textsize(uchar);
uchar textcolor() const;
void textcolor(uchar);
Get or set the font, font size, or color of the text displayed in the
menu (the current implementation ignores the color, although the
Fl_Choice subclass will use it for it's own display). The default is
normal-sized Bold Italic Helvetica and black.