Merge branch '3643_cons_handler_min_macro'
[midnight-commander.git] / lib / widget / menu.h
blob6a2ec0e46bbb0b0b1f422d8960cf6070a5042a1d
1 /*
2 Header file for pulldown menu engine for Midnignt Commander
3 */
5 /** \file menu.h
6 * \brief Header: pulldown menu code
7 */
9 #ifndef MC__WIDGET_MENU_H
10 #define MC__WIDGET_MENU_H
12 /*** typedefs(not structures) and defined constants **********************************************/
14 #define MENUBAR(x) ((WMenuBar *)(x))
16 #define menu_separator_create() NULL
18 /*** enums ***************************************************************************************/
20 /*** structures declarations (and typedefs of structures)*****************************************/
22 struct menu_entry_t;
23 typedef struct menu_entry_t menu_entry_t;
25 struct menu_t;
26 typedef struct menu_t menu_t;
28 /* The button bar menu */
29 typedef struct WMenuBar
31 Widget widget;
33 gboolean is_visible; /* If the menubar is visible */
34 gboolean is_active; /* If the menubar is in use */
35 gboolean is_dropped; /* If the menubar has dropped */
36 GList *menu; /* The actual menus */
37 guint selected; /* Selected menu on the top bar */
38 unsigned long previous_widget; /* Selected widget ID before activating menu */
39 } WMenuBar;
41 /*** global variables defined in .c file *********************************************************/
43 /*** declarations of public functions ************************************************************/
45 menu_entry_t *menu_entry_create (const char *name, long command);
46 void menu_entry_free (menu_entry_t * me);
48 menu_t *create_menu (const char *name, GList * entries, const char *help_node);
49 void menu_set_name (menu_t * menu, const char *name);
50 void destroy_menu (menu_t * menu);
52 WMenuBar *menubar_new (int y, int x, int cols, GList * menu, gboolean visible);
53 void menubar_set_menu (WMenuBar * menubar, GList * menu);
54 void menubar_add_menu (WMenuBar * menubar, menu_t * menu);
55 void menubar_arrange (WMenuBar * menubar);
57 WMenuBar *find_menubar (const WDialog * h);
59 void menubar_activate (WMenuBar * menubar, gboolean dropped, int which);
61 /*** inline functions ****************************************************************************/
63 static inline void
64 menubar_set_visible (WMenuBar * menubar, gboolean visible)
66 menubar->is_visible = visible;
69 #endif /* MC__WIDGET_MENU_H */