menu.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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_create() 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_visible; /* If the menubar is visible */
  23. gboolean is_dropped; /* If the menubar has dropped */
  24. GList *menu; /* The actual menus */
  25. guint selected; /* Selected menu on the top bar */
  26. unsigned long previous_widget; /* Selected widget ID before activating menu */
  27. } WMenuBar;
  28. /*** global variables defined in .c file *********************************************************/
  29. extern const global_keymap_t *menu_map;
  30. /*** declarations of public functions ************************************************************/
  31. menu_entry_t *menu_entry_create (const char *name, long command);
  32. void menu_entry_free (menu_entry_t * me);
  33. menu_t *create_menu (const char *name, GList * entries, const char *help_node);
  34. void menu_set_name (menu_t * menu, const char *name);
  35. void destroy_menu (menu_t * menu);
  36. WMenuBar *menubar_new (GList * menu, gboolean visible);
  37. void menubar_set_menu (WMenuBar * menubar, GList * menu);
  38. void menubar_add_menu (WMenuBar * menubar, menu_t * menu);
  39. void menubar_arrange (WMenuBar * menubar);
  40. WMenuBar *find_menubar (const WDialog * h);
  41. void menubar_activate (WMenuBar * menubar, gboolean dropped, int which);
  42. /*** inline functions ****************************************************************************/
  43. static inline void
  44. menubar_set_visible (WMenuBar * menubar, gboolean visible)
  45. {
  46. menubar->is_visible = visible;
  47. }
  48. #endif /* MC__WIDGET_MENU_H */