big dialogs: set_curosr2 -> set_dlg_cursor.
[elinks.git] / src / bfu / text.h
blob469a94e142db23683ad4c38dae0e31b6abc096c4
1 #ifndef EL__BFU_TEXT_H
2 #define EL__BFU_TEXT_H
4 #include "util/color.h"
6 struct dialog;
7 struct dialog_data;
8 struct terminal;
10 struct widget_info_text {
11 enum format_align align;
12 unsigned int is_label:1;
13 unsigned int is_scrollable:1;
16 struct widget_data_info_text {
17 /* The number of the first line that should be
18 * displayed within the widget.
19 * This is used only for scrollable text widgets */
20 int current;
22 /* The number of lines saved in @cdata */
23 int lines;
25 /* The dialog width to which the lines are wrapped.
26 * This is used to check whether the lines must be
27 * rewrapped. */
28 int max_width;
29 #ifdef CONFIG_MOUSE
30 /* For mouse scrollbar handling. See bfu/text.c.*/
32 /* Height of selected part of scrollbar. */
33 int scroller_height;
35 /* Position of selected part of scrollbar. */
36 int scroller_y;
38 /* Direction of last mouse scroll. Used to adjust
39 * scrolling when selected bar part has a low height
40 * (especially the 1 char height) */
41 int scroller_last_dir;
42 #endif
45 void add_dlg_text(struct dialog *dlg, unsigned char *text,
46 enum format_align align, int bottom_pad);
48 extern const struct widget_ops text_ops;
49 void dlg_format_text_do(struct dialog_data *dlg_data,
50 unsigned char *text, int x, int *y, int w, int *rw,
51 struct color_pair *scolor, enum format_align align, int format_only);
53 void
54 dlg_format_text(struct dialog_data *dlg_data, struct widget_data *widget_data,
55 int x, int *y, int dlg_width, int *real_width, int height, int format_only);
57 #define text_is_scrollable(widget_data) \
58 ((widget_data)->widget->info.text.is_scrollable \
59 && (widget_data)->box.height > 0 \
60 && (widget_data)->info.text.lines > 0 \
61 && (widget_data)->box.height < (widget_data)->info.text.lines)
63 #endif