Merge branch '54_dlg_mouse_handling'
[midnight-commander.git] / src / menu.h
blob5e6d734c4175aec147119372377073b7603ad9e1
2 /** \file menu.h
3 * \brief Header: pulldown menu code
4 */
6 #ifndef MC_MENU_H
7 #define MC_MENU_H
9 #include "widget.h"
11 typedef void (*callfn) (void);
13 typedef struct {
14 char first_letter;
15 const char *label;
16 struct hotkey_t text;
17 callfn call_back;
18 } menu_entry;
20 typedef struct Menu {
21 struct hotkey_t text;
22 int count;
23 int max_entry_len;
24 int selected;
25 menu_entry *entries;
26 int start_x; /* position relative to menubar start */
27 char *help_node;
28 } Menu;
30 extern int menubar_visible;
32 /* The button bar menu */
33 typedef struct WMenu {
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_widget; /* Selected widget ID before activating menu */
44 } WMenu;
46 Menu *create_menu (const char *name, menu_entry *entries, int count,
47 const char *help_node);
48 void destroy_menu (Menu *menu);
49 WMenu *menubar_new (int y, int x, int cols, Menu *menu[], int items);
50 void menubar_arrange (WMenu *menubar);
52 #endif