Author: jcrouse Date: 2008-05-14 22:10:02 +0200 (Wed, 14 May 2008) New Revision: 3317
Modified: trunk/payloads/libpayload/curses/tinycurses.c Log: libpayload: implement wborder function
Implement the wborder function for curses to draw a box around a window.
Signed-off-by: Jordan Crouse jordan.crouse@amd.com Acked-by: Myles Watson mylesgw@gmail.com
Modified: trunk/payloads/libpayload/curses/tinycurses.c =================================================================== --- trunk/payloads/libpayload/curses/tinycurses.c 2008-05-14 20:07:31 UTC (rev 3316) +++ trunk/payloads/libpayload/curses/tinycurses.c 2008-05-14 20:10:02 UTC (rev 3317) @@ -464,7 +464,39 @@ } // int wbkgd (WINDOW *, chtype) {} void wbkgdset(WINDOW *win, chtype ch) { /* TODO */ } -// int wborder (WINDOW *,chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype) {} + +int wborder(WINDOW *win, chtype ls, chtype rs, chtype ts, chtype bs, + chtype tl, chtype tr, chtype bl, chtype br) +{ + int x, y; + + for(y = 0; y <= win->_maxy; y++) { + + if (y == 0) { + mvwaddch(win, y, 0, tl); + + for(x = 1; x < win->_maxx; x++) + mvwaddch(win, y, x, ts); + + mvwaddch(win, y, win->_maxx, tr); + } + else if (y == win->_maxy) { + mvwaddch(win, y, 0, bl); + + for(x = 1; x < win->_maxx; x++) + mvwaddch(win, y, x, bs); + + mvwaddch(win, y, win->_maxx, br); + } + else { + mvwaddch(win, y, 0, ls); + mvwaddch(win, y, win->_maxx, rs); + } + } + + return OK; +} + // int wchgat (WINDOW *, int, attr_t, short, const void *) {} /* D */ int wclear(WINDOW *win) {