buttonbar.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /** \file buttonbar.h
  2. * \brief Header: WButtonBar widget
  3. */
  4. #ifndef MC__WIDGET_BUTTONBAR_H
  5. #define MC__WIDGET_BUTTONBAR_H
  6. /*** typedefs(not structures) and defined constants **********************************************/
  7. #define BUTTONBAR(x) ((WButtonBar *)(x))
  8. /* number of bttons in buttonbar */
  9. #define BUTTONBAR_LABELS_NUM 10
  10. #define buttonbar_clear_label(bb, idx, recv) buttonbar_set_label (bb, idx, "", NULL, recv)
  11. /*** enums ***************************************************************************************/
  12. /*** structures declarations (and typedefs of structures)*****************************************/
  13. struct global_keymap_t;
  14. typedef struct WButtonBar
  15. {
  16. Widget widget;
  17. gboolean visible; /* Is it visible? */
  18. gboolean use_keymap; /* is the widget used Keymap(new, true) or keybind(old, false)? */
  19. struct
  20. {
  21. char *text;
  22. const char *keymap_section;
  23. unsigned long command;
  24. Widget *receiver;
  25. int end_coord; /* cumulative width of buttons so far */
  26. } labels[BUTTONBAR_LABELS_NUM];
  27. } WButtonBar;
  28. struct global_keymap_t;
  29. /*** global variables defined in .c file *********************************************************/
  30. /*** declarations of public functions ************************************************************/
  31. WButtonBar *buttonbar_new (gboolean visible);
  32. void
  33. buttonbar_init_button (WButtonBar * bb, int idx, const char *text,
  34. const char *keymap_section, const Widget * w);
  35. void buttonbar_set_label (WButtonBar * bb, int idx, const char *text,
  36. const struct global_keymap_t *keymap, const Widget * receiver);
  37. WButtonBar *find_buttonbar (const WDialog * h);
  38. /*** inline functions ****************************************************************************/
  39. static inline void
  40. buttonbar_set_visible (WButtonBar * bb, gboolean visible)
  41. {
  42. bb->visible = visible;
  43. }
  44. #endif /* MC__WIDGET_BUTTONBAR_H */