summaryrefslogtreecommitdiff
path: root/richwin.h
diff options
context:
space:
mode:
authornoodle <shawtynoodle@gmail.com>2023-07-10 15:40:08 +0300
committernoodle <shawtynoodle@gmail.com>2023-07-10 15:40:08 +0300
commitb7ac144cd2d242791938b51569effb7a1378a332 (patch)
tree0db39dc6d72a96697707c662c32f4dcdb99372b7 /richwin.h
parent35eacac40f265aad47bf25d10f3ecd3670b79b2f (diff)
Add files
Diffstat (limited to 'richwin.h')
-rw-r--r--richwin.h68
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 */