summaryrefslogtreecommitdiff
path: root/gui.h
blob: da884654979ec5c33cf9acf89bbabe313f48ba59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/* SPDX-License-Identifier: GPL-2.0 */

/** \file gui.h symbols used by gui and gui_theme */

/**
 * The foreground and background color of each status item, the decorations and
 * all messages can be customized through an instance of this structure.
 */
struct gui_color_spec {
	int fg; /**< Foreground color. */
	int bg; /**< Background color. */
};

/** Theme definition. */
struct gui_theme {
	/** Printed at startup. */
	const char *name;
	/** Default color, see assume_default_colors(3). */
	struct gui_color_spec dflt;
	/** Color for the top window. */
	struct gui_color_spec top;
	/** Color for the bottom window. */
	struct gui_color_spec bot;
	/** Default number of lines of the top window. */
	int top_lines_default;
	/** Minimal admissible number of lines to display the top window. */
	int top_lines_min;
	/** Minimal admissible number of lines to display this theme. */
	int lines_min;
	/** Minimal admissible number of columns to display this theme. */
	int cols_min;
	/** Called when status items change, it should update the top window. */
	bool (*print_status_items)(uint64_t mask, char **stat_content, WINDOW *win);
	/** Color of the bar that contains the version string. */
	struct gui_color_spec vbar;
	/** Color of the name and args of the executing process. */
	struct gui_color_spec cmd;
	/** Color for stdout of the executing process. */
	struct gui_color_spec output;
	/** Color for log messages of moderate severity. */
	struct gui_color_spec msg;
	/** Color for severe log messages. */
	struct gui_color_spec err_msg;
	/** Color of the progress bar. */
	struct gui_color_spec pbar;
	/** Color of the duration text shown next to the progress bar. */
	struct gui_color_spec duration;
};

/* gui.c */
int align_str(WINDOW *win, const char *str, unsigned int len,
		unsigned int align);

/* gui_theme.c */
const struct gui_theme *theme_init(const char *name);
const struct gui_theme *theme_prev(void);
const struct gui_theme *theme_next(void);

/** Status item text should be left-aligned. */
#define LEFT 1
/** Status item text should be right-aligned. */
#define RIGHT 2
/** Status item text should be displayed centered. */
#define CENTER 3