summaryrefslogtreecommitdiff
path: root/richwin.h
blob: 5a9bfb24ac7b89cf603b29a2add23fca6bfc9d79 (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
65
66
67
68
#ifndef RICHWIN_H
#define RICHWIN_H

// a rich window: represents a ncurses window with stats
struct RichWin {
	WINDOW *win;
	struct WinBorders *winborders;
	const int lines, cols;
	const int begy, begx;
};

// window borders: holds each character for an ncurses window border
struct WinBorders {
	chtype ls, rs, ts, bs,
		tl, tr, bl, br;
};

/*
 * richwin_new: create a new rich window
 * parameters:
 * 	lines (int) -> window line number
 * 	colums (int) -> window column number
 * 	begy (int) -> y-coordinate of upper-left corner of window
 * 	begx (int) -> x-coordinate of upper-left corner of window
 * 	winborders (struct WinBorders *)
 * returns:
 * 	struct RichWin * -> pointer to the new window
 * 	NULL -> failure
 */
struct RichWin *richwin_new(int lines, int cols, int begy, int begx,
	struct WinBorders *winborders);

/*
 * richwin_new_centered create a new centered rich window
 * parameters:
 * 	lines (int) -> window line number
 * 	colums (int) -> window column number
 * 	begy (int) -> y-coordinate of upper-left corner of window
 * 	begx (int) -> x-coordinate of upper-left corner of window
 * 	winborders (struct WinBorders *)
 * returns:
 * 	struct RichWin * -> pointer to the new window
 * 	NULL -> failure
 */
struct RichWin *richwin_new_centered(int lines, int cols,
	struct WinBorders *winborders);

/*
 * richwin_border: border a rich window
 * parameters:
 * 	winborders (struct WinBorders *)
 * returns:
 * 	ERR -> if wborder() returns ERR
 * 	OK -> on success
 */
int richwin_border(struct RichWin *richwin);

/*
 * richwin_del: delete a rich window
 * parameters:
 * 	richwin (struct RichWin *) -> window to delete
 * returns:
 * 	ERR -> if delwin() returns ERR
 * 	OK -> on success
 */
int richwin_del(struct RichWin *richwin);

#endif /* RICHWIN_H */