ALLEGRO_MENU_INFO man page

ALLEGRO_MENU_INFO — Allegro 5 API

Synopsis

#include <allegro5/allegro_native_dialog.h>

typedef struct ALLEGRO_MENU_INFO {

Description

A structure that defines how to create a complete menu system. For standard menu items, the following format is used:

{ caption, id, flags, icon }

For special items, these macros are helpful:

ALLEGRO_START_OF_MENU(caption, id)
ALLEGRO_MENU_SEPARATOR
ALLEGRO_END_OF_MENU

A well-defined menu will begin with ALLEGRO_START_OF_MENU, contain one or more menu items, and end with ALLEGRO_END_OF_MENU. A menu may contain sub-menus. An example:

ALLEGRO_MENU_INFO menu_info[] = {
   ALLEGRO_START_OF_MENU("&File", 1),
      { "&Open", 2, 0, NULL },
      ALLEGRO_START_OF_MENU("Open &Recent...", 3),
         { "Recent 1", 4, 0, NULL },
         { "Recent 2", 5, 0, NULL },
         ALLEGRO_END_OF_MENU,
      ALLEGRO_MENU_SEPARATOR,
      { "E&xit", 6, 0, NULL },
      ALLEGRO_END_OF_MENU,
   ALLEGRO_START_OF_MENU("&Help", 7),
      {"&About", 8, 0, NULL },
      ALLEGRO_END_OF_MENU,
   ALLEGRO_END_OF_MENU
};

ALLEGRO_MENU *menu = al_build_menu(menu_info);

If you prefer, you can build the menu without the structure by using al_create_menu(3) and al_insert_menu_item(3).

See Also

al_build_menu(3)

Referenced By

al_build_menu(3).

Allegro reference manual