X-Git-Url: https://plomlompom.com/repos/test.html?a=blobdiff_plain;f=src%2Fwindows.h;h=ce6d7cbc6d0645f5bf59435ea5f9709973bea5e1;hb=f9274f0ef5edae9b1a2afcc0a4e739552d6d875a;hp=98f5d9a870a119c3ed08962b2b7aaf992ec83553;hpb=8d8eba7405f426c45fd059a17d2f00cfb21c5253;p=plomrogue
diff --git a/src/windows.h b/src/windows.h
index 98f5d9a..ce6d7cb 100644
--- a/src/windows.h
+++ b/src/windows.h
@@ -31,7 +31,7 @@
-#include /* for uint16_t, uint32_t */
+#include /* for uint8_t, uint16_t, uint32_t */
#include /* for the WINDOW typedef */
#include "yx_uint16.h" /* for yx_uint16 coordinates */
@@ -52,13 +52,13 @@ struct Frame
struct Win
{
- struct Win * prev; /* prev=next=0 if Win is outside the chain */
- struct Win * next;
- struct yx_uint16 start; /* upper left corner (of WINDOW or border?) */
+ struct Win * _prev; /* INTERNAL */ /* _prev == _next == 0 if */
+ struct Win * _next; /* INTERNAL */ /* Win is outside the chain */
+ struct yx_uint16 _start; /* INTERNAL: upper left corner of WINDOW */
+ char * _title; /* INTERNAL: title for window title bar */
+ void (* _draw) (struct Win *); /* INTERNAL: how to draw window content */
struct Frame frame;
- char * title; /* title to be shown on window border top */
- void (* draw) (struct Win *); /* function to draw window content ("data") */
- void * data; /* content to be drawn; draw() knows how */
+ void * data; /* window content to be drawn by _draw() */
};
@@ -69,12 +69,12 @@ struct Win
*/
struct WinMeta
{
- WINDOW * screen; /* terminal screen */
- uint16_t pad_offset; /* number of cells view is moved to the right */
- struct Frame padframe; /* virtual screen fitted into terminal screen */
- struct Win * chain_start; /* first Win, whose .prev shall point to 0 */
- struct Win * chain_end; /* last Win, whose .next shall point to 0 */
- struct Win * active; /* window highlighted/selected for manipulation */
+ WINDOW * _screen; /* INTERNAL: terminal screen */
+ struct Win * _chain_start; /* INTERNAL: first Win, ._prev to point to 0 */
+ struct Win * _chain_end; /* INTERNAL: last Win, ._next to point to 0 */
+ uint16_t pad_offset; /* number of cells view is moved to the right */
+ struct Frame padframe; /* virtual screen fitted into terminal screen */
+ struct Win * active; /* Win highlighted/selected for manipulation */
};
@@ -103,7 +103,7 @@ extern uint8_t init_win_meta(WINDOW * screen, struct WinMeta * wmeta);
* invisible until appended to the chain of visible windows via append_win().
*/
extern struct Win init_win(struct WinMeta * wmeta, char * title,
- uint16_t height, uint16_t widtht,
+ uint16_t height, uint16_t width,
void * data, void * func);
@@ -148,8 +148,11 @@ extern void cycle_active_win(struct WinMeta * wmeta, char dir);
/* Move active window forwards (set dir="f") or backwards (set dir="b"). Wrap
- * around in the window chain if start / end of it is met. */
-extern void shift_active_win(struct WinMeta * wmeta, char dir);
+ * around in the window chain if start / end of it is met.
+ *
+ * Returns 0 on success, 1 on (ncurses window/pad memory allocation) error.
+ */
+extern uint8_t shift_active_win(struct WinMeta * wmeta, char dir);