4 /****************************************************************/
5 /* Wbox(win,ymin,xmin,ymax,xmax,v,h) draws a box in window */
6 /* 'win', enclosing the area xmin-xmax and ymin-xmax. If */
7 /* Xmax and/or ymax is 0, the window max value is used. 'v' and */
8 /* 'h' are the vertical and horizontal characters to use. If */
9 /* 'v' and 'h' are 0, wbox will use the alternate character set */
10 /* In a pretty way. */
11 /****************************************************************/
13 int wbox(win
, ymin
, xmin
, ymax
, xmax
, v
, h
)
15 int ymin
, xmin
, ymax
, xmax
;
19 unsigned int vc
, hc
, ulc
, urc
, llc
, lrc
; /* corner chars */
22 if (ymax
== 0) ymax
= win
->_maxy
;
23 if (xmax
== 0) xmax
= win
->_maxx
;
25 if (ymin
>= win
->_maxy
|| ymax
> win
->_maxy
||
26 xmin
>= win
->_maxx
|| xmax
> win
->_maxx
||
27 ymin
>= ymax
|| xmin
>= xmax
)
32 ulc
= urc
= llc
= lrc
= vc
; /* default same as vertical */
34 if (v
== 0 && h
== 0) {
42 for (i
= xmin
+ 1; i
<= xmax
- 1; i
++) {
43 win
->_line
[ymin
][i
] = hc
| win
->_attrs
;
44 win
->_line
[ymax
][i
] = hc
| win
->_attrs
;
46 for (i
= ymin
+ 1; i
<= ymax
- 1; i
++) {
47 win
->_line
[i
][xmin
] = vc
| win
->_attrs
;
48 win
->_line
[i
][xmax
] = vc
| win
->_attrs
;
50 win
->_line
[ymin
][xmin
] = ulc
| win
->_attrs
;
51 win
->_line
[ymin
][xmax
] = urc
| win
->_attrs
;
52 win
->_line
[ymax
][xmin
] = llc
| win
->_attrs
;
53 win
->_line
[ymax
][xmax
] = lrc
| win
->_attrs
;
55 for (i
= ymin
; i
<= ymax
; i
++) {
56 if (win
->_minchng
[i
] == _NO_CHANGE
) {
57 win
->_minchng
[i
] = xmin
;
58 win
->_maxchng
[i
] = xmax
;
60 win
->_minchng
[i
] = min(win
->_minchng
[i
], xmin
);
61 win
->_maxchng
[i
] = max(win
->_maxchng
[i
], xmax
);