menu.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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_active; /* If the menubar is in use */
  24. gboolean is_dropped; /* If the menubar has dropped */
  25. GList *menu; /* The actual menus */
  26. size_t selected; /* Selected menu on the top bar */
  27. unsigned long previous_widget; /* Selected widget ID before activating menu */
  28. } WMenuBar;
  29. /*** global variables defined in .c file *********************************************************/
  30. /*** declarations of public functions ************************************************************/
  31. menu_entry_t *menu_entry_create (const char *name, unsigned 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 (int y, int x, int cols, 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. /*** 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 */