big dialogs: set_curosr2 -> set_dlg_cursor.
[elinks.git] / src / bfu / button.h
blob3f00b264320c4242ad209a4cddb3018e3dc835d5
1 #ifndef EL__BFU_BUTTON_H
2 #define EL__BFU_BUTTON_H
4 #include "bfu/common.h"
5 #include "util/align.h"
7 struct dialog;
8 struct dialog_data;
9 struct terminal;
10 struct widget_data;
12 typedef void (done_handler_T)(void *);
14 struct widget_info_button {
15 int flags;
16 int hotkey_pos; /* -1 means no hotkey, hotkeys are marked by ~. */
17 int textlen; /* Text length without hotkey */
18 int truetextlen; /* Original text length (with hotkey if any) */
19 /* Used by some default handlers like ok_dialog()
20 * as a callback. */
21 done_handler_T *done;
22 void *done_data;
25 /* Button flags, go into widget.gid */
26 #define B_ENTER 1
27 #define B_ESC 2
29 /* Define to find buttons without keyboard accelerator. */
30 /* #define DEBUG_BUTTON_HOTKEY */
33 #ifdef DEBUG_BUTTON_HOTKEY
34 void add_dlg_button_do(const unsigned char *file, int line, struct dialog *dlg, unsigned char *text, int flags, widget_handler_T *handler, void *data, done_handler_T *done, void *done_data);
35 #define add_dlg_ok_button(dlg, text, flags, done, data) \
36 add_dlg_button_do(__FILE__, __LINE__, dlg, text, flags, ok_dialog, NULL, done, data)
38 #define add_dlg_button(dlg, text, flags, handler, data) \
39 add_dlg_button_do(__FILE__, __LINE__, dlg, text, flags, handler, data, NULL, NULL)
41 #else
42 void add_dlg_button_do(struct dialog *dlg, unsigned char *text, int flags, widget_handler_T *handler, void *data, done_handler_T *done, void *done_data);
44 #define add_dlg_ok_button(dlg, text, flags, done, data) \
45 add_dlg_button_do(dlg, text, flags, ok_dialog, NULL, done, data)
47 #define add_dlg_button(dlg, text, flags, handler, data) \
48 add_dlg_button_do(dlg, text, flags, handler, data, NULL, NULL)
49 #endif
51 extern const struct widget_ops button_ops;
52 void dlg_format_buttons(struct terminal *, struct dialog_data *, struct widget_data *, int, int, int *, int, int *, enum format_align, int);
54 #endif