struct Fl_Menu
#include <FL/Fl_Menu.H>

This structure is used to define a popup menu and used to construct an Fl_Menu_Bar or a Fl_Menu_Button.

A menu is an *array* of these structures. The structure is designed so it is relatively easy to define an entire hierarchy of menus with a C initialization constant. This is best described with an example:

Fl_Menu popup[] = {
  {"&alpha",    "#a", the_cb, (void *)'a'},
  {"&beta",     "#b", the_cb, (void *)'b'},
  {"_gamma",   "#c", the_cb, (void *)'c'},
  {"&strange",  0,    strange_cb},
  {"&charm",    0,    charm_cb},
  {"&truth",    0,    truth_cb},
  {"b&eauty",   0,    beauty_cb},
  {"/sub&menu"},
    {"one"},
    {"two"},
    {"three"},
  {0},
  {"_inactive","#i", 0, 0, FL_PUP_GREY},
  {"invisible","#i", 0, 0, FL_PUP_INVISIBLE},
  {"check",    "#i", 0, 0, FL_PUP_CHECK|FL_PUP_BOX},
  {"box",      "#i", 0, 0, FL_PUP_BOX},
{0}};
A submenu title is identified by a leading '/' character, and ends with a title that is null. You can nest menus to any depth. A pointer to the first item in the submenu can be treated as an Fl_Menu array itself. It is also possible to make seperate submenu arrays with FL_PUP_SUBMENU flags.

The fields in the structure are:

const char *text;

const char *shortcut;

Fl_Callback *callback;
void *argument;

int flags;

Methods on menu arrays:

There are several methods on an Fl_Menu defined, these are designed so that a pointer to the first item in the array can be considered a pointer to a "menu" object. However it is important to remember that this is an array:

const Fl_Menu *popup(int x, int y, int w, int h, const Fl_Menu* picked = 0, const char* title = 0) const;

const Fl_Menu *popup(int x, int y, const char *title = 0) const;

static void textfont(uchar x);
static void textsize(uchar x);
static uchar textfont();
static uchar textsize();

const Fl_Menu *test_shortcut() const;

int size();

int add(const char *text,const char * shortcut,Fl_Callback *,void *,int);

Methods on menu items:

const Fl_Menu *next(int=1) const;
Fl_Menu *next(int=1);

int checked() const;
int checkbox() const;
void check();
void uncheck();

int active() const;
void activate();
void deactivate();

int visible() const;
void show();
void hide();

int submenu() const;