2 /***************************************************************************
4 ****************************************************************************
5 * ncurses is copyright (C) 1992-1995 *
7 * zmbenhal@netcom.com *
9 * esr@snark.thyrsus.com *
11 * Permission is hereby granted to reproduce and distribute ncurses *
12 * by any means and for any fee, whether alone or as part of a *
13 * larger distribution, in source or in binary form, PROVIDED *
14 * this notice is included with any such distribution, and is not *
15 * removed from any of its header files. Mention of ncurses in any *
16 * applications linked with it is highly appreciated. *
18 * ncurses comes AS IS with no warranty, implied or expressed. *
20 ***************************************************************************/
27 ** line drawing routines:
34 #include <curses.priv.h>
36 MODULE_ID("$Id: lib_box.c,v 1.7 1997/04/12 17:51:49 tom Exp $")
38 int wborder(WINDOW *win, chtype ls, chtype rs, chtype ts,
39 chtype bs, chtype tl, chtype tr, chtype bl, chtype br)
44 T((T_CALLED("wborder(%p,%s,%s,%s,%s,%s,%s,%s,%s)"),
53 _tracechtype2(8,br)));
55 if (ls == 0) ls = ACS_VLINE;
56 if (rs == 0) rs = ACS_VLINE;
57 if (ts == 0) ts = ACS_HLINE;
58 if (bs == 0) bs = ACS_HLINE;
59 if (tl == 0) tl = ACS_ULCORNER;
60 if (tr == 0) tr = ACS_URCORNER;
61 if (bl == 0) bl = ACS_LLCORNER;
62 if (br == 0) br = ACS_LRCORNER;
64 ls = _nc_render(win, ls);
65 rs = _nc_render(win, rs);
66 ts = _nc_render(win, ts);
67 bs = _nc_render(win, bs);
68 tl = _nc_render(win, tl);
69 tr = _nc_render(win, tr);
70 bl = _nc_render(win, bl);
71 br = _nc_render(win, br);
73 T(("using %#lx, %#lx, %#lx, %#lx, %#lx, %#lx, %#lx, %#lx", ls, rs, ts, bs, tl, tr, bl, br));
78 for (i = 0; i <= endx; i++) {
79 win->_line[0].text[i] = ts;
80 win->_line[endy].text[i] = bs;
82 win->_line[endy].firstchar = win->_line[0].firstchar = 0;
83 win->_line[endy].lastchar = win->_line[0].lastchar = endx;
85 for (i = 0; i <= endy; i++) {
86 win->_line[i].text[0] = ls;
87 win->_line[i].text[endx] = rs;
88 win->_line[i].firstchar = 0;
89 win->_line[i].lastchar = endx;
91 win->_line[0].text[0] = tl;
92 win->_line[0].text[endx] = tr;
93 win->_line[endy].text[0] = bl;
94 win->_line[endy].text[endx] = br;
100 int whline(WINDOW *win, chtype ch, int n)
106 T((T_CALLED("whline(%p,%s,%d)"), win, _tracechtype(ch), n));
111 if (end > win->_maxx)
114 if (win->_line[line].firstchar == _NOCHANGE || win->_line[line].firstchar > start)
115 win->_line[line].firstchar = start;
116 if (win->_line[line].lastchar == _NOCHANGE || win->_line[line].lastchar < start)
117 win->_line[line].lastchar = end;
121 ch = _nc_render(win, ch);
123 while ( end >= start) {
124 win->_line[line].text[end] = ch;
131 int wvline(WINDOW *win, chtype ch, int n)
136 T((T_CALLED("wvline(%p,%s,%d)"), win, _tracechtype(ch), n));
141 if (end > win->_maxy)
146 ch = _nc_render(win, ch);
149 win->_line[end].text[col] = ch;
150 if (win->_line[end].firstchar == _NOCHANGE || win->_line[end].firstchar > col)
151 win->_line[end].firstchar = col;
152 if (win->_line[end].lastchar == _NOCHANGE || win->_line[end].lastchar < col)
153 win->_line[end].lastchar = col;