aboutsummaryrefslogtreecommitdiffstats
path: root/display.h
blob: 64e4ff6ea5fa639f29ea31c6462f2be88cb88e00 (plain) (blame)
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
#ifndef SF_DISPLAY_H
#define SF_DISPLAY_H

#include <ncurses.h>
#include <stdlib.h>

#include "dir.h"
#include "log.h"
#include "mem.h"

#define COLOR_PAIR_FM_HL 1
#define COLOR_PAIR_FM_DIR 2

#define STAT_INFO_WIDTH 15
#define BAR_LABEL_WIDTH 7
#define STAT_BAR_HEIGHT 1

#define FM_PANE_LEFT 0
#define FM_PANE_RIGHT 1

#include "wm.h"

typedef struct {
	size_t top;
	size_t bottom;
	size_t height;
	size_t widght;
	size_t margin;
	bool need_redraw;
	window *left;
	window *right;
} view_stat;

void color_pair_init(void);
terminal *ncurses_init(void);

static inline WINDOW *get_root_win(const terminal *t)
{
	if (!t) {
		log_write(LOG_ERR, "get_root_win: terminal is NULL");
		return NULL;
	}
	if (t->w_count <= 0 || !t->windows[0]) {
		log_write(LOG_ERR, "get_root_win: windows[0] is not allocated");
		return NULL;
	}
	return t->windows[0]->win;
}

#define ROOT_WIN get_root_win(t)

void draw_stat_bar(terminal *t, const char *sys_version);
void wprintw_colorful(WINDOW *w, int attr, const char *format, ...);
void handle_resize(void);
void redraw(void);

#endif /* SF_DISPLAY_H */