2 Header file for pulldown menu engine for Midnignt Commander
6 * \brief Header: pulldown menu code
9 #ifndef MC__WIDGET_MENU_H
10 #define MC__WIDGET_MENU_H
12 /*** typedefs(not structures) and defined constants **********************************************/
14 #define menu_separator_create() NULL
16 /*** enums ***************************************************************************************/
18 /*** structures declarations (and typedefs of structures)*****************************************/
20 typedef struct menu_entry_t
22 unsigned char first_letter
;
24 unsigned long command
;
30 int start_x
; /* position relative to menubar start */
33 size_t max_entry_len
; /* cached max length of entry texts (text + shortcut) */
34 size_t max_hotkey_len
; /* cached max length of shortcuts */
35 unsigned int selected
; /* pointer to current menu entry */
39 /* The button bar menu */
40 typedef struct WMenuBar
44 gboolean is_visible
; /* If the menubar is visible */
45 gboolean is_active
; /* If the menubar is in use */
46 gboolean is_dropped
; /* If the menubar has dropped */
47 GList
*menu
; /* The actual menus */
48 size_t selected
; /* Selected menu on the top bar */
49 int previous_widget
; /* Selected widget ID before activating menu */
52 /*** global variables defined in .c file *********************************************************/
54 /*** declarations of public functions ************************************************************/
56 menu_entry_t
*menu_entry_create (const char *name
, unsigned long command
);
57 void menu_entry_free (menu_entry_t
* me
);
59 Menu
*create_menu (const char *name
, GList
* entries
, const char *help_node
);
60 void menu_set_name (Menu
* menu
, const char *name
);
61 void destroy_menu (Menu
* menu
);
63 WMenuBar
*menubar_new (int y
, int x
, int cols
, GList
* menu
);
64 void menubar_set_menu (WMenuBar
* menubar
, GList
* menu
);
65 void menubar_add_menu (WMenuBar
* menubar
, Menu
* menu
);
66 void menubar_arrange (WMenuBar
* menubar
);
68 WMenuBar
*find_menubar (const Dlg_head
* h
);
70 /*** inline functions ****************************************************************************/
73 menubar_set_visible (WMenuBar
* menubar
, gboolean visible
)
75 menubar
->is_visible
= visible
;
78 #endif /* MC__WIDGET_MENU_H */