2005-09-15 09:58:31 -04:00
|
|
|
#ifndef EL__BFU_TEXT_H
|
|
|
|
#define EL__BFU_TEXT_H
|
|
|
|
|
|
|
|
#include "util/color.h"
|
|
|
|
|
2020-10-05 14:14:55 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2005-09-15 09:58:31 -04:00
|
|
|
struct dialog;
|
2008-09-07 12:02:37 -04:00
|
|
|
struct dialog_data;
|
2005-09-15 09:58:31 -04:00
|
|
|
struct terminal;
|
|
|
|
|
|
|
|
struct widget_info_text {
|
|
|
|
enum format_align align;
|
|
|
|
unsigned int is_label:1;
|
|
|
|
unsigned int is_scrollable:1;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct widget_data_info_text {
|
|
|
|
/* The number of the first line that should be
|
|
|
|
* displayed within the widget.
|
|
|
|
* This is used only for scrollable text widgets */
|
|
|
|
int current;
|
|
|
|
|
|
|
|
/* The number of lines saved in @cdata */
|
|
|
|
int lines;
|
|
|
|
|
|
|
|
/* The dialog width to which the lines are wrapped.
|
|
|
|
* This is used to check whether the lines must be
|
|
|
|
* rewrapped. */
|
|
|
|
int max_width;
|
|
|
|
#ifdef CONFIG_MOUSE
|
|
|
|
/* For mouse scrollbar handling. See bfu/text.c.*/
|
|
|
|
|
|
|
|
/* Height of selected part of scrollbar. */
|
|
|
|
int scroller_height;
|
|
|
|
|
|
|
|
/* Position of selected part of scrollbar. */
|
|
|
|
int scroller_y;
|
|
|
|
|
|
|
|
/* Direction of last mouse scroll. Used to adjust
|
|
|
|
* scrolling when selected bar part has a low height
|
|
|
|
* (especially the 1 char height) */
|
|
|
|
int scroller_last_dir;
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
2021-01-02 10:20:27 -05:00
|
|
|
void add_dlg_text(struct dialog *dlg, char *text,
|
2005-09-15 09:58:31 -04:00
|
|
|
enum format_align align, int bottom_pad);
|
|
|
|
|
2007-01-28 07:41:40 -05:00
|
|
|
extern const struct widget_ops text_ops;
|
2008-09-07 12:12:42 -04:00
|
|
|
void dlg_format_text_do(struct dialog_data *dlg_data,
|
2021-01-02 10:20:27 -05:00
|
|
|
char *text, int x, int *y, int w, int *rw,
|
2006-03-06 00:01:12 -05:00
|
|
|
struct color_pair *scolor, enum format_align align, int format_only);
|
2005-09-15 09:58:31 -04:00
|
|
|
|
|
|
|
void
|
2008-09-07 12:12:42 -04:00
|
|
|
dlg_format_text(struct dialog_data *dlg_data, struct widget_data *widget_data,
|
2006-03-06 00:01:12 -05:00
|
|
|
int x, int *y, int dlg_width, int *real_width, int height, int format_only);
|
2005-09-15 09:58:31 -04:00
|
|
|
|
|
|
|
#define text_is_scrollable(widget_data) \
|
|
|
|
((widget_data)->widget->info.text.is_scrollable \
|
|
|
|
&& (widget_data)->box.height > 0 \
|
|
|
|
&& (widget_data)->info.text.lines > 0 \
|
|
|
|
&& (widget_data)->box.height < (widget_data)->info.text.lines)
|
|
|
|
|
2020-10-05 14:14:55 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2005-09-15 09:58:31 -04:00
|
|
|
#endif
|