1 /****************************************************************************
2 * Copyright (c) 1998,2000,2001,2002 Free Software Foundation, Inc. *
4 * Permission is hereby granted, free of charge, to any person obtaining a *
5 * copy of this software and associated documentation files (the *
6 * "Software"), to deal in the Software without restriction, including *
7 * without limitation the rights to use, copy, modify, merge, publish, *
8 * distribute, distribute with modifications, sublicense, and/or sell *
9 * copies of the Software, and to permit persons to whom the Software is *
10 * furnished to do so, subject to the following conditions: *
12 * The above copyright notice and this permission notice shall be included *
13 * in all copies or substantial portions of the Software. *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
16 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
18 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
21 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
23 * Except as contained in this notice, the name(s) of the above copyright *
24 * holders shall not be used in advertising or otherwise to promote the *
25 * sale, use or other dealings in this Software without prior written *
27 ****************************************************************************/
29 /****************************************************************************
30 * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
31 * and: Eric S. Raymond <esr@snark.thyrsus.com> *
32 ****************************************************************************/
37 ** The routine wborder().
41 #include <curses.priv.h>
43 MODULE_ID("$Id: lib_box.c,v 1.18 2002/02/23 20:40:06 tom Exp $")
53 NCURSES_SIZE_T endx, endy;
54 chtype wls, wrs, wts, wbs, wtl, wtr, wbl, wbr;
56 T((T_CALLED("wborder(%p,%s,%s,%s,%s,%s,%s,%s,%s)"),
65 _tracechtype2(8, br)));
70 #define RENDER_WITH_DEFAULT(ch,def) w ## ch = (ch == 0) ? def : ch
72 RENDER_WITH_DEFAULT(ls, ACS_VLINE);
73 RENDER_WITH_DEFAULT(rs, ACS_VLINE);
74 RENDER_WITH_DEFAULT(ts, ACS_HLINE);
75 RENDER_WITH_DEFAULT(bs, ACS_HLINE);
76 RENDER_WITH_DEFAULT(tl, ACS_ULCORNER);
77 RENDER_WITH_DEFAULT(tr, ACS_URCORNER);
78 RENDER_WITH_DEFAULT(bl, ACS_LLCORNER);
79 RENDER_WITH_DEFAULT(br, ACS_LRCORNER);
81 T(("using %s, %s, %s, %s, %s, %s, %s, %s",
82 _tracechtype2(1, wls),
83 _tracechtype2(2, wrs),
84 _tracechtype2(3, wts),
85 _tracechtype2(4, wbs),
86 _tracechtype2(5, wtl),
87 _tracechtype2(6, wtr),
88 _tracechtype2(7, wbl),
89 _tracechtype2(8, wbr)));
94 for (i = 0; i <= endx; i++) {
95 SetChar(win->_line[0].text[i], ChCharOf(wts), ChAttrOf(wts));
96 SetChar(win->_line[endy].text[i], ChCharOf(wbs), ChAttrOf(wbs));
98 win->_line[endy].firstchar = win->_line[0].firstchar = 0;
99 win->_line[endy].lastchar = win->_line[0].lastchar = endx;
101 for (i = 0; i <= endy; i++) {
102 SetChar(win->_line[i].text[0], ChCharOf(wls), ChAttrOf(wls));
103 SetChar(win->_line[i].text[endx], ChCharOf(wrs), ChAttrOf(wrs));
104 win->_line[i].firstchar = 0;
105 win->_line[i].lastchar = endx;
107 SetChar(win->_line[0].text[0], ChCharOf(wtl), ChAttrOf(wtl));
108 SetChar(win->_line[0].text[endx], ChCharOf(wtr), ChAttrOf(wtr));
109 SetChar(win->_line[endy].text[0], ChCharOf(wbl), ChAttrOf(wbl));
110 SetChar(win->_line[endy].text[endx], ChCharOf(wbr), ChAttrOf(wbr));