buttonbar.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. struct
  19. {
  20. char *text;
  21. unsigned long command;
  22. Widget *receiver;
  23. int end_coord; /* cumulative width of buttons so far */
  24. } labels[BUTTONBAR_LABELS_NUM];
  25. } WButtonBar;
  26. struct global_keymap_t;
  27. /*** global variables defined in .c file *********************************************************/
  28. /*** declarations of public functions ************************************************************/
  29. WButtonBar *buttonbar_new (gboolean visible);
  30. void buttonbar_set_label (WButtonBar * bb, int idx, const char *text,
  31. const struct global_keymap_t *keymap, const Widget * receiver);
  32. WButtonBar *find_buttonbar (const WDialog * h);
  33. /*** inline functions ****************************************************************************/
  34. static inline void
  35. buttonbar_redraw (WButtonBar * bb)
  36. {
  37. if (bb != NULL)
  38. send_message (bb, NULL, MSG_DRAW, 0, NULL);
  39. }
  40. static inline void
  41. buttonbar_set_visible (WButtonBar * bb, gboolean visible)
  42. {
  43. bb->visible = visible;
  44. }
  45. #endif /* MC__WIDGET_BUTTONBAR_H */