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. Example:
Fl_Menu popup[] = {
  {"&alpha",   FL_ALT+'a', the_cb, (void*)1},
  {"&beta",    FL_ALT+'b', the_cb, (void*)2},
  {"gamma",    FL_ALT+'c', the_cb, (void*)3, FL_MENU_DIVIDER},
  {"&strange",  0,   strange_cb},
  {"&charm",    0,   charm_cb},
  {"&truth",    0,   truth_cb},
  {"b&eauty",   0,   beauty_cb},
  {"sub&menu",	0,   0, 0, FL_SUBMENU},
    {"one"},
    {"two"},
    {"three"},
  {0},
  {"inactive", FL_ALT+'i', 0, 0, FL_MENU_INACTIVE|FL_MENU_DIVIDER},
  {"invisible",FL_ALT+'i', 0, 0, FL_MENU_INVISIBLE},
  {"check",    FL_ALT+'i', 0, 0, FL_MENU_CHECK|FL_MENU_BOX},
  {"box",      FL_ALT+'i', 0, 0, FL_MENU_BOX},
{0}};
A submenu title is identified by the bit FL_SUBMENU in the flags field, and ends with a label() 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_SUBMENU_POINTER flags.

struct Fl_Menu

Fl_Menu is a structure with all the members public and no constructors. This is so that even the stupidest compilers will produce efficient initializers.

Unfortunately all the fields have to be initialized by position. You don't need to give values for unused fields, the remaining ones get zero as their default value.

struct Fl_Menu {
  const char*	text; // label()
  ulong		shortcut_;
  Fl_Callback*	callback_;
  void*		user_data_;
  int		flags;
  uchar		labeltype_;
  uchar		labelfont_;
  uchar		labelsize_;
  uchar		labelcolor_;
};

enum { // values for flags:
  FL_MENU_INACTIVE	= 1,
  FL_MENU_BOX		= 2,
  FL_MENU_CHECK		= 4,
  FL_MENU_RADIO		= 8,
  FL_MENU_INVISIBLE	= 0x10,
  FL_SUBMENU_POINTER	= 0x20,
  FL_SUBMENU		= 0x40,
  FL_MENU_DIVIDER	= 0x80,
  FL_MENU_HORIZONTAL	= 0x100
};

You should not use the member names to refer to the Fl_Menu structure, instead use the methods described below.

Methods on menu items:

const char* Fl_Menu::label() const;
void Fl_Menu::label(const char*);

void Fl_Menu::label(uchar,const char*);
uchar Fl_Menu::labeltype() const;
void Fl_Menu::labeltype(uchar);

uchar Fl_Menu::labelcolor() const;
void Fl_Menu::labelcolor(uchar);

uchar Fl_Menu::labelfont() const;
void Fl_Menu::labelfont(uchar);

uchar Fl_Menu::labelsize() const;
void Fl_Menu::labelsize(uchar);

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

typedef void (Fl_Callback)(Fl_Widget*, void*);
Fl_Callback* Fl_Menu::callback() const;
void Fl_Menu::callback(Fl_Callback*, void* = 0);

void* Fl_Menu::user_data() const;
void Fl_Menu::user_data(void*);

void Fl_Menu::callback(void (*)(Fl_Widget*, long), long = 0);
long Fl_Menu::argument() const;
void Fl_Menu::argument(long);

void Fl_Menu::callback(void (*)(Fl_Widget*));

void Fl_Menu::do_callback(Fl_Widget*);
void Fl_Menu::do_callback(Fl_Widget*, void*);
void Fl_Menu::do_callback(Fl_Widget*, long);

ulong Fl_Menu::shortcut() const;
void Fl_Menu::shortcut(ulong);

int Fl_Menu::submenu() const;

int Fl_Menu::checkbox() const;

int Fl_Menu::radio() const;

int Fl_Menu::value() const;
void Fl_Menu::set();
void Fl_Menu::setonly();
void Fl_Menu::clear();

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

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

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* Fl_Menu::popup(int x, int y, int w, int h, const Fl_Menu* picked = 0, const char* title = 0) const;

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

const Fl_Menu* Fl_Menu::test_shortcut() const;

int Fl_Menu::size();

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

int Fl_Menu::add(const char* label, ulong shortcut, Fl_Callback* callback=0, void* user_data=0, int flags=0);