buttonbar.h 1.8 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. /* number of bttons in buttonbar */
  8. #define BUTTONBAR_LABELS_NUM 10
  9. #define buttonbar_clear_label(bb, idx, recv) buttonbar_set_label (bb, idx, "", NULL, recv)
  10. /*** enums ***************************************************************************************/
  11. /*** structures declarations (and typedefs of structures)*****************************************/
  12. struct global_keymap_t;
  13. typedef struct WButtonBar
  14. {
  15. Widget widget;
  16. gboolean visible; /* Is it visible? */
  17. struct
  18. {
  19. char *text;
  20. unsigned long command;
  21. Widget *receiver;
  22. int end_coord; /* cumulative width of buttons so far */
  23. } labels[BUTTONBAR_LABELS_NUM];
  24. } WButtonBar;
  25. struct global_keymap_t;
  26. /*** global variables defined in .c file *********************************************************/
  27. /*** declarations of public functions ************************************************************/
  28. WButtonBar *buttonbar_new (gboolean visible);
  29. void buttonbar_set_label (WButtonBar * bb, int idx, const char *text,
  30. const struct global_keymap_t *keymap, const Widget * receiver);
  31. WButtonBar *find_buttonbar (const Dlg_head * h);
  32. /*** inline functions ****************************************************************************/
  33. static inline void
  34. buttonbar_redraw (WButtonBar * bb)
  35. {
  36. if (bb != NULL)
  37. send_message ((Widget *) bb, WIDGET_DRAW, 0);
  38. }
  39. static inline void
  40. buttonbar_set_visible (WButtonBar * bb, gboolean visible)
  41. {
  42. bb->visible = visible;
  43. }
  44. #endif /* MC__WIDGET_BUTTONBAR_H */