diff options
author | Joursoir <chat@joursoir.net> | 2021-10-26 21:28:29 +0300 |
---|---|---|
committer | Joursoir <chat@joursoir.net> | 2021-10-26 21:28:29 +0300 |
commit | d4ce900ed5fc6a15b71421d1a65b374366983f9a (patch) | |
tree | eb76f7c4b56049cb3e7815e7d53d5fcbdfee80d6 /lib/tbi | |
parent | 642e48ad0625a65eec5ca216bb8d6ef5db7d457d (diff) | |
download | ufm-d4ce900ed5fc6a15b71421d1a65b374366983f9a.tar.gz ufm-d4ce900ed5fc6a15b71421d1a65b374366983f9a.tar.bz2 ufm-d4ce900ed5fc6a15b71421d1a65b374366983f9a.zip |
tbi/win: make mvwhline(), mvwvline()
Diffstat (limited to 'lib/tbi')
-rw-r--r-- | lib/tbi/win.c | 36 | ||||
-rw-r--r-- | lib/tbi/win.h | 30 |
2 files changed, 66 insertions, 0 deletions
diff --git a/lib/tbi/win.c b/lib/tbi/win.c index 4acc23f..3486c7a 100644 --- a/lib/tbi/win.c +++ b/lib/tbi/win.c @@ -150,3 +150,39 @@ BOOLEAN wborder(struct window *w, CHAR16 ls, CHAR16 rs, CHAR16 ts, return TRUE; } +BOOLEAN mvwhline(struct window *w, INT32 x, INT32 y, CHAR16 ch, INT32 n) +{ + UINTN i, length; + ASSERT(w != NULL); + CHECK_POSITION(w, x, y); + + length = w->width - x; + if(length > n) + length = n; + + length += x; + for(i = x; i < length; i++) { + w->text[y][i] = ch; + w->attr[y][i] = w->cur_attr; + } + return TRUE; +} + +BOOLEAN mvwvline(struct window *w, INT32 x, INT32 y, CHAR16 ch, INT32 n) +{ + UINTN i, length; + ASSERT(w != NULL); + CHECK_POSITION(w, x, y); + + length = w->height - y; + if(length > n) + length = n; + + length += y; + for(i = y; i < length; i++) { + w->text[i][x] = ch; + w->attr[i][x] = w->cur_attr; + } + return TRUE; +} + diff --git a/lib/tbi/win.h b/lib/tbi/win.h index eddda05..404cdd1 100644 --- a/lib/tbi/win.h +++ b/lib/tbi/win.h @@ -103,4 +103,34 @@ BOOLEAN wmove(struct window *w, INT32 x, INT32 y); BOOLEAN wborder(struct window *w, CHAR16 ls, CHAR16 rs, CHAR16 ts, CHAR16 bs, CHAR16 tl, CHAR16 tr, CHAR16 bl, CHAR16 br); +/* + * Moves to specified coordinates, draws a horizontal line using ch + * starting at (x, y) in the window. The current cursor position is + * not changed. + * + * w: the window on which to operate + * x: the X(column) coordinate for the start of the line + * y: the Y(row) coordinate for the start of the line + * ch: the character used to draw the line + * n: the maximum number of chars in the line + * + * return: FALSE upon failure and TRUE upon successful completion +*/ +BOOLEAN mvwhline(struct window *w, INT32 x, INT32 y, CHAR16 ch, INT32 n); + +/* + * Moves to specified coordinates, draws a vertical line using ch + * starting at (x, y) in the window. The current cursor position is + * not changed. + * + * w: the window on which to operate + * x: the X(column) coordinate for the start of the line + * y: the Y(row) coordinate for the start of the line + * ch: the character used to draw the line + * n: the maximum number of chars in the line + * + * return: FALSE upon failure and TRUE upon successful completion +*/ +BOOLEAN mvwvline(struct window *w, INT32 x, INT32 y, CHAR16 ch, INT32 n); + #endif /* UFM_TBI_WINDOW_H */ |