*** empty log message ***
[midnight-commander.git] / src / menu.h
blob0e637aeee86a9c98101c1beebace459f111167bd
1 #ifndef __MENU_H
2 #define __MENU_H
4 #include "dlg.h"
5 #include "widget.h"
7 typedef void (*callfn) ();
8 /* FIXME: We have to leave this type ambiguous, because `callfn' is
9 used both for functions that take an argument and ones that don't.
10 That ought to be cleared up. */
12 typedef struct {
13 char first_letter;
14 char *text;
15 int hot_key;
16 callfn call_back;
17 } menu_entry;
19 typedef struct {
20 char *name;
21 int count;
22 int max_entry_len;
23 int selected;
24 int hotkey;
25 menu_entry *entries;
26 int start_x; /* position relative to menubar start */
27 } sMenu;
28 typedef sMenu *Menu;
30 extern int menubar_visible;
32 /* The button bar menu */
33 typedef struct {
34 Widget widget;
36 int active; /* If the menubar is in use */
37 int dropped; /* If the menubar has dropped */
38 Menu *menu; /* The actual menus */
39 int items;
40 int selected; /* Selected menu on the top bar */
41 int subsel; /* Selected entry on the submenu */
42 int max_entry_len; /* Cache value for the columns in a box */
43 int previous_selection; /* Selected widget before activating menu */
44 } WMenu;
46 Menu create_menu (char *name, menu_entry *entries, int count);
47 void destroy_menu (Menu menu);
48 WMenu *menubar_new (int y, int x, int cols, Menu menu [], int items);
49 void menubar_arrange (WMenu* menubar);
50 int menubar_event (Gpm_Event *event, WMenu *menubar);
52 #endif /* __MENU_H */