Ticket #2111: allow pause in copy/move/delete file operation.
[midnight-commander.git] / lib / widget / button.h
blobf85be8b3cbb69ed20a9ce9e51545934d9a1dc429
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 /* return 0 to continue work with dialog, non-zero to close */
17 typedef int (*bcback_fn) (struct WButton * button, int action);
19 /*** enums ***************************************************************************************/
21 typedef enum
23 HIDDEN_BUTTON = 0,
24 NARROW_BUTTON = 1,
25 NORMAL_BUTTON = 2,
26 DEFPUSH_BUTTON = 3
27 } button_flags_t;
29 /*** structures declarations (and typedefs of structures)*****************************************/
31 typedef struct WButton
33 Widget widget;
34 int action; /* what to do when pressed */
35 gboolean selected; /* button state */
37 button_flags_t flags; /* button flags */
38 hotkey_t text; /* text of button, contain hotkey too */
39 int hotpos; /* offset hot KEY char in text */
40 bcback_fn callback; /* callback function */
41 } WButton;
43 /*** global variables defined in .c file *********************************************************/
45 /*** declarations of public functions ************************************************************/
47 WButton *button_new (int y, int x, int action, button_flags_t flags, const char *text,
48 bcback_fn callback);
49 const char *button_get_text (const WButton * b);
50 void button_set_text (WButton * b, const char *text);
51 int button_get_len (const WButton * b);
53 /*** inline functions ****************************************************************************/
55 #endif /* MC__WIDGET_BUTTON_H */