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