1 /****************************************************************************
2 * Copyright (c) 2002-2009,2011 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 * Authors: Sven Verdoolaege and Thomas Dickey 2001,2002 *
31 ****************************************************************************/
36 ** The routine wborder_set().
40 #include <curses.priv.h>
42 MODULE_ID("$Id: lib_box_set.c,v 1.6 2011/06/25 19:02:07 Vassili.Courzakis Exp $")
45 wborder_set(WINDOW
*win
,
46 const ARG_CH_T ls
, const ARG_CH_T rs
,
47 const ARG_CH_T ts
, const ARG_CH_T bs
,
48 const ARG_CH_T tl
, const ARG_CH_T tr
,
49 const ARG_CH_T bl
, const ARG_CH_T br
)
52 NCURSES_SIZE_T endx
, endy
;
53 NCURSES_CH_T wls
, wrs
, wts
, wbs
, wtl
, wtr
, wbl
, wbr
;
55 T((T_CALLED("wborder_set(%p,%s,%s,%s,%s,%s,%s,%s,%s)"),
69 #define RENDER_WITH_DEFAULT(ch,def) w ##ch = _nc_render(win, (ch == 0) ? *(const ARG_CH_T)def : *ch)
71 RENDER_WITH_DEFAULT(ls
, WACS_VLINE
);
72 RENDER_WITH_DEFAULT(rs
, WACS_VLINE
);
73 RENDER_WITH_DEFAULT(ts
, WACS_HLINE
);
74 RENDER_WITH_DEFAULT(bs
, WACS_HLINE
);
75 RENDER_WITH_DEFAULT(tl
, WACS_ULCORNER
);
76 RENDER_WITH_DEFAULT(tr
, WACS_URCORNER
);
77 RENDER_WITH_DEFAULT(bl
, WACS_LLCORNER
);
78 RENDER_WITH_DEFAULT(br
, WACS_LRCORNER
);
80 T(("using %s, %s, %s, %s, %s, %s, %s, %s",
81 _tracech_t2(1, CHREF(wls
)),
82 _tracech_t2(2, CHREF(wrs
)),
83 _tracech_t2(3, CHREF(wts
)),
84 _tracech_t2(4, CHREF(wbs
)),
85 _tracech_t2(5, CHREF(wtl
)),
86 _tracech_t2(6, CHREF(wtr
)),
87 _tracech_t2(7, CHREF(wbl
)),
88 _tracech_t2(8, CHREF(wbr
))));
93 for (i
= 0; i
<= endx
; i
++) {
94 win
->_line
[0].text
[i
] = wts
;
95 win
->_line
[endy
].text
[i
] = wbs
;
97 win
->_line
[endy
].firstchar
= win
->_line
[0].firstchar
= 0;
98 win
->_line
[endy
].lastchar
= win
->_line
[0].lastchar
= endx
;
100 for (i
= 0; i
<= endy
; i
++) {
101 win
->_line
[i
].text
[0] = wls
;
102 win
->_line
[i
].text
[endx
] = wrs
;
103 win
->_line
[i
].firstchar
= 0;
104 win
->_line
[i
].lastchar
= endx
;
106 win
->_line
[0].text
[0] = wtl
;
107 win
->_line
[0].text
[endx
] = wtr
;
108 win
->_line
[endy
].text
[0] = wbl
;
109 win
->_line
[endy
].text
[endx
] = wbr
;