Add useful macros for widget type cast.
[midnight-commander.git] / lib / widget / buttonbar.h
blobd6694a11a3401776293a63fcb0d1c038ceab0c24
2 /** \file buttonbar.h
3 * \brief Header: WButtonBar widget
4 */
6 #ifndef MC__WIDGET_BUTTONBAR_H
7 #define MC__WIDGET_BUTTONBAR_H
9 /*** typedefs(not structures) and defined constants **********************************************/
11 #define BUTTONBAR(x) ((WButtonBar *)(x))
13 /* number of bttons in buttonbar */
14 #define BUTTONBAR_LABELS_NUM 10
16 #define buttonbar_clear_label(bb, idx, recv) buttonbar_set_label (bb, idx, "", NULL, recv)
18 /*** enums ***************************************************************************************/
20 /*** structures declarations (and typedefs of structures)*****************************************/
22 struct global_keymap_t;
24 typedef struct WButtonBar
26 Widget widget;
27 gboolean visible; /* Is it visible? */
28 struct
30 char *text;
31 unsigned long command;
32 Widget *receiver;
33 int end_coord; /* cumulative width of buttons so far */
34 } labels[BUTTONBAR_LABELS_NUM];
35 } WButtonBar;
37 struct global_keymap_t;
39 /*** global variables defined in .c file *********************************************************/
41 /*** declarations of public functions ************************************************************/
43 WButtonBar *buttonbar_new (gboolean visible);
44 void buttonbar_set_label (WButtonBar * bb, int idx, const char *text,
45 const struct global_keymap_t *keymap, const Widget * receiver);
46 WButtonBar *find_buttonbar (const WDialog * h);
48 /*** inline functions ****************************************************************************/
50 static inline void
51 buttonbar_redraw (WButtonBar * bb)
53 if (bb != NULL)
54 send_message (bb, NULL, MSG_DRAW, 0, NULL);
57 static inline void
58 buttonbar_set_visible (WButtonBar * bb, gboolean visible)
60 bb->visible = visible;
63 #endif /* MC__WIDGET_BUTTONBAR_H */