dccb2b26bda4c15ca593fbddccff3f189cf623e2
[midnight-commander.git] / lib / widget / button.h
blobdccb2b26bda4c15ca593fbddccff3f189cf623e2
2 /** \file button.h
3 * \brief Header: WButton widget
4 */
6 #ifndef MC__WIDGET_BUTTON_H
7 #define MC__WIDGET_BUTTON_H
9 /*** typedefs(not structures) and defined constants **********************************************/
11 #define BUTTON(x) ((WButton *)(x))
13 struct WButton;
15 /* button callback */
16 typedef int (*bcback_fn) (struct WButton * button, int action);
18 /*** enums ***************************************************************************************/
20 typedef enum
22 HIDDEN_BUTTON = 0,
23 NARROW_BUTTON = 1,
24 NORMAL_BUTTON = 2,
25 DEFPUSH_BUTTON = 3
26 } button_flags_t;
28 /*** structures declarations (and typedefs of structures)*****************************************/
30 typedef struct WButton
32 Widget widget;
33 int action; /* what to do when pressed */
34 gboolean selected; /* button state */
36 button_flags_t flags; /* button flags */
37 hotkey_t text; /* text of button, contain hotkey too */
38 int hotpos; /* offset hot KEY char in text */
39 bcback_fn callback; /* callback function */
40 } WButton;
42 /*** global variables defined in .c file *********************************************************/
44 /*** declarations of public functions ************************************************************/
46 WButton *button_new (int y, int x, int action, button_flags_t flags, const char *text,
47 bcback_fn callback);
48 const char *button_get_text (const WButton * b);
49 void button_set_text (WButton * b, const char *text);
50 int button_get_len (const WButton * b);
52 /*** inline functions ****************************************************************************/
54 #endif /* MC__WIDGET_BUTTON_H */