1 /* vifm
2  * Copyright (C) 2014 xaizek.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18 
19 #ifndef VIFM__UI__STATUSLINE_H__
20 #define VIFM__UI__STATUSLINE_H__
21 
22 #include <curses.h> /* WINDOW */
23 
24 #include <stddef.h> /* size_t */
25 
26 #include "../utils/test_helpers.h"
27 
28 struct view_t;
29 
30 /* Status line managing.  Job bar is considered as a continuation of status bar,
31  * but its visibility is controlled separately. */
32 
33 /* Redraw contents of stat line (possibly lazily). */
34 void ui_stat_update(struct view_t *view, int lazy_redraw);
35 
36 /* Puts status line where it's suppose to be according to other elements (also
37  * moves job bar).  If displaying status line is disabled, force flag can help
38  * ignore it for this call.  Returns non-zero if status line is visible, and
39  * zero otherwise. */
40 int ui_stat_reposition(int statusbar_height, int force_stat_win);
41 
42 /* Updates content of status line on the screen (also updates job bar). */
43 void ui_stat_refresh(void);
44 
45 /* Gets height of the job bar (>= 0).  Returns the height. */
46 int ui_stat_job_bar_height(void);
47 
48 struct bg_op_t;
49 
50 /* Adds job to the bar. */
51 void ui_stat_job_bar_add(struct bg_op_t *bg_op);
52 
53 /* Removes job from the bar. */
54 void ui_stat_job_bar_remove(struct bg_op_t *bg_op);
55 
56 /* Informs about changes of the job. */
57 void ui_stat_job_bar_changed(struct bg_op_t *bg_op);
58 
59 /* Fills job bar UI element with up-to-date content. */
60 void ui_stat_job_bar_redraw(void);
61 
62 /* Checks for previously reported changes in background jobs and updates view if
63  * needed. */
64 void ui_stat_job_bar_check_for_updates(void);
65 
66 /* Draws single popup line with text and its description.  Attributes and cursor
67  * should be managed outside this function.  max_width is the maximum width of
68  * item, and is used to choose formatting style. */
69 void ui_stat_draw_popup_line(WINDOW *win, const char item[], const char descr[],
70 		size_t max_width);
71 
72 #ifdef TEST
73 #include "colored_line.h"
74 #endif
75 TSTATIC_DEFS(
76 	cline_t expand_status_line_macros(struct view_t *view, const char format[]);
77 )
78 
79 #endif /* VIFM__UI__STATUSLINE_H__ */
80 
81 /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 : */
82 /* vim: set cinoptions+=t0 filetype=c : */
83