menu.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. /*** declarations of public functions ************************************************************/
  30. menu_entry_t *menu_entry_create (const char *name, long command);
  31. void menu_entry_free (menu_entry_t * me);
  32. menu_t *create_menu (const char *name, GList * entries, const char *help_node);
  33. void menu_set_name (menu_t * menu, const char *name);
  34. void destroy_menu (menu_t * menu);
  35. WMenuBar *menubar_new (int y, int x, int cols, GList * menu, gboolean visible);
  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 *find_menubar (const WDialog * h);
  40. void menubar_activate (WMenuBar * menubar, gboolean dropped, int which);
  41. /*** inline functions ****************************************************************************/
  42. static inline void
  43. menubar_set_visible (WMenuBar * menubar, gboolean visible)
  44. {
  45. menubar->is_visible = visible;
  46. }
  47. #endif /* MC__WIDGET_MENU_H */