7 * MuCurses edging functions
12 * Draw borders from single-byte characters and renditions around a
15 * @v *win window to be bordered
16 * @v verch vertical chtype
17 * @v horch horizontal chtype
18 * @ret rc return status code
20 int box ( WINDOW *win, chtype verch, chtype horch ) {
21 chtype corner = '+' | win->attrs; /* default corner character */
22 return wborder( win, verch, verch, horch, horch,
23 corner, corner, corner, corner );
27 * Draw borders from single-byte characters and renditions around a
30 * @v *win window to be bordered
35 * @v tl top left corner
36 * @v tr top right corner
37 * @v bl bottom left corner
38 * @v br bottom right corner
39 * @ret rc return status code
41 int wborder ( WINDOW *win, chtype ls, chtype rs,
42 chtype ts, chtype bs, chtype tl,
43 chtype tr, chtype bl, chtype br ) {
44 struct cursor_pos pos;
46 _store_curs_pos( win, &pos );
50 while ( ( win->width - 1 ) - win->curs_x ) {
55 while ( ( win->height - 1 ) - win->curs_y ) {
57 wmove(win,win->curs_y,(win->width)-1);
62 while ( ( win->width -1 ) - win->curs_x ) {
65 _wputch(win,br,NOWRAP); /* do not wrap last char to leave
66 cursor in last position */
67 _restore_curs_pos( win, &pos );
73 * Create a horizontal line in a window
75 * @v *win subject window
76 * @v ch rendition and character
77 * @v n max number of chars (wide) to render
78 * @ret rc return status code
80 int whline ( WINDOW *win, chtype ch, int n ) {
81 struct cursor_pos pos;
83 _store_curs_pos ( win, &pos );
84 while ( ( win->curs_x - win->width ) && n-- ) {
85 _wputch ( win, ch, NOWRAP );
87 _restore_curs_pos ( win, &pos );
93 * Create a vertical line in a window
95 * @v *win subject window
96 * @v ch rendition and character
97 * @v n max number of chars (high) to render
98 * @ret rc return status code
100 int wvline ( WINDOW *win, chtype ch, int n ) {
101 struct cursor_pos pos;
103 _store_curs_pos ( win, &pos );
104 while ( ( win->curs_y - win->height ) && n-- ) {
105 _wputch ( win, ch, NOWRAP );
106 wmove( win, ++(win->curs_y), pos.x);
108 _restore_curs_pos ( win, &pos );