menu.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. Header file for pulldown menu engine for Midnignt Commander
  3. */
  4. /** \file menu.h
  5. * \brief Header: pulldown menu code
  6. */
  7. #ifndef MC__WIDGET_MENU_H
  8. #define MC__WIDGET_MENU_H
  9. /*** typedefs(not structures) and defined constants **********************************************/
  10. #define MENUBAR(x) ((WMenuBar *)(x))
  11. #define menu_separator_new() NULL
  12. /*** enums ***************************************************************************************/
  13. /*** structures declarations (and typedefs of structures)*****************************************/
  14. struct menu_entry_t;
  15. typedef struct menu_entry_t menu_entry_t;
  16. struct menu_t;
  17. typedef struct menu_t menu_t;
  18. /* The button bar menu */
  19. typedef struct WMenuBar
  20. {
  21. Widget widget;
  22. gboolean is_dropped; /* If the menubar has dropped */
  23. GList *menu; /* The actual menus */
  24. guint current; /* Current menu on the top bar */
  25. unsigned long previous_widget; /* Selected widget ID before activating menu */
  26. } WMenuBar;
  27. /*** global variables defined in .c file *********************************************************/
  28. extern const global_keymap_t *menu_map;
  29. /*** declarations of public functions ************************************************************/
  30. menu_entry_t *menu_entry_new (const char *name, long command);
  31. void menu_entry_free (menu_entry_t * me);
  32. menu_t *menu_new (const char *name, GList * entries, const char *help_node);
  33. void menu_set_name (menu_t * menu, const char *name);
  34. void menu_free (menu_t * menu);
  35. WMenuBar *menubar_new (GList * menu);
  36. void menubar_set_menu (WMenuBar * menubar, GList * menu);
  37. void menubar_add_menu (WMenuBar * menubar, menu_t * menu);
  38. void menubar_arrange (WMenuBar * menubar);
  39. WMenuBar *menubar_find (const WDialog * h);
  40. void menubar_activate (WMenuBar * menubar, gboolean dropped, int which);
  41. /*** inline functions ****************************************************************************/
  42. #endif /* MC__WIDGET_MENU_H */