richwin.h (1783B)
1 #ifndef RICHWIN_H 2 #define RICHWIN_H 3 4 // a rich window: represents a ncurses window with stats 5 struct RichWin { 6 WINDOW *win; 7 struct WinBorders *winborders; 8 const int lines, cols; 9 const int begy, begx; 10 }; 11 12 // window borders: holds each character for an ncurses window border 13 struct WinBorders { 14 chtype ls, rs, ts, bs, 15 tl, tr, bl, br; 16 }; 17 18 /* 19 * richwin_new: create a new rich window 20 * parameters: 21 * lines (int) -> window line number 22 * colums (int) -> window column number 23 * begy (int) -> y-coordinate of upper-left corner of window 24 * begx (int) -> x-coordinate of upper-left corner of window 25 * winborders (struct WinBorders *) 26 * returns: 27 * struct RichWin * -> pointer to the new window 28 * NULL -> failure 29 */ 30 struct RichWin *richwin_new(int lines, int cols, int begy, int begx, 31 struct WinBorders *winborders); 32 33 /* 34 * richwin_new_centered create a new centered rich window 35 * parameters: 36 * lines (int) -> window line number 37 * colums (int) -> window column number 38 * begy (int) -> y-coordinate of upper-left corner of window 39 * begx (int) -> x-coordinate of upper-left corner of window 40 * winborders (struct WinBorders *) 41 * returns: 42 * struct RichWin * -> pointer to the new window 43 * NULL -> failure 44 */ 45 struct RichWin *richwin_new_centered(int lines, int cols, 46 struct WinBorders *winborders); 47 48 /* 49 * richwin_border: border a rich window 50 * parameters: 51 * winborders (struct WinBorders *) 52 * returns: 53 * ERR -> if wborder() returns ERR 54 * OK -> on success 55 */ 56 int richwin_border(struct RichWin *richwin); 57 58 /* 59 * richwin_del: delete a rich window 60 * parameters: 61 * richwin (struct RichWin *) -> window to delete 62 * returns: 63 * ERR -> if delwin() returns ERR 64 * OK -> on success 65 */ 66 int richwin_del(struct RichWin *richwin); 67 68 #endif /* RICHWIN_H */