diff options
Diffstat (limited to 'richwin.h')
-rw-r--r-- | richwin.h | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/richwin.h b/richwin.h new file mode 100644 index 0000000..5a9bfb2 --- /dev/null +++ b/richwin.h @@ -0,0 +1,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 */ |