File: ALLEGRO_MENU_INFO.3

package info (click to toggle)
allegro5 2%3A5.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 23,032 kB
  • sloc: ansic: 120,340; cpp: 15,707; objc: 4,805; python: 2,915; java: 2,195; sh: 887; xml: 86; makefile: 49; perl: 37; pascal: 24
file content (67 lines) | stat: -rw-r--r-- 1,578 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
.TH "ALLEGRO_MENU_INFO" "3" "" "Allegro reference manual" ""
.SH NAME
.PP
ALLEGRO_MENU_INFO \- Allegro 5 API
.SH SYNOPSIS
.IP
.nf
\f[C]
#include\ <allegro5/allegro_native_dialog.h>

typedef\ struct\ ALLEGRO_MENU_INFO\ {
\f[]
.fi
.SH DESCRIPTION
.PP
A structure that defines how to create a complete menu system.
For standard menu items, the following format is used:
.IP
.nf
\f[C]
\ \ \ {\ caption,\ id,\ flags,\ icon\ }
\f[]
.fi
.PP
For special items, these macros are helpful:
.IP
.nf
\f[C]
ALLEGRO_START_OF_MENU(caption,\ id)
ALLEGRO_MENU_SEPARATOR
ALLEGRO_END_OF_MENU
\f[]
.fi
.PP
A well\-defined menu will begin with \f[C]ALLEGRO_START_OF_MENU\f[],
contain one or more menu items, and end with
\f[C]ALLEGRO_END_OF_MENU\f[].
A menu may contain sub\-menus.
An example:
.IP
.nf
\f[C]
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);
\f[]
.fi
.PP
If you prefer, you can build the menu without the structure by using
al_create_menu(3) and al_insert_menu_item(3).
.SH SEE ALSO
.PP
al_build_menu(3)