bug 153, 1066: Convert bookmarks to/from UTF-8 when searching.
[elinks.git] / src / bfu / button.h
blobca7b3d655626025a5eb7caf4d57c37890c7dc33f
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 terminal;
9 struct widget_data;
11 typedef void (done_handler_T)(void *);
13 struct widget_info_button {
14 int flags;
15 int hotkey_pos; /* -1 means no hotkey, hotkeys are marked by ~. */
16 int textlen; /* Text length without hotkey */
17 int truetextlen; /* Original text length (with hotkey if any) */
18 /* Used by some default handlers like ok_dialog()
19 * as a callback. */
20 done_handler_T *done;
21 void *done_data;
24 /* Button flags, go into widget.gid */
25 #define B_ENTER 1
26 #define B_ESC 2
28 /* Define to find buttons without keyboard accelerator. */
29 /* #define DEBUG_BUTTON_HOTKEY */
32 #ifdef DEBUG_BUTTON_HOTKEY
33 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);
34 #define add_dlg_ok_button(dlg, text, flags, done, data) \
35 add_dlg_button_do(__FILE__, __LINE__, dlg, text, flags, ok_dialog, NULL, done, data)
37 #define add_dlg_button(dlg, text, flags, handler, data) \
38 add_dlg_button_do(__FILE__, __LINE__, dlg, text, flags, handler, data, NULL, NULL)
40 #else
41 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);
43 #define add_dlg_ok_button(dlg, text, flags, done, data) \
44 add_dlg_button_do(dlg, text, flags, ok_dialog, NULL, done, data)
46 #define add_dlg_button(dlg, text, flags, handler, data) \
47 add_dlg_button_do(dlg, text, flags, handler, data, NULL, NULL)
48 #endif
50 extern const struct widget_ops button_ops;
51 void dlg_format_buttons(struct terminal *, struct widget_data *, int, int, int *, int, int *, enum format_align, int);
53 #endif