int border_set(const cchar_t *ls, const cchar_t *rs, const cchar_t *ts, const cchar_t *bs, const cchar_t *tl, const cchar_t *tr, const cchar_t *bl, const cchar_t *br) { PDC_LOG(("border_set() - called\n")); return wborder_set(stdscr, ls, rs, ts, bs, tl, tr, bl, br); }
int box_set(WINDOW *win, const cchar_t *verch, const cchar_t *horch) { PDC_LOG(("box_set() - called\n")); return wborder_set(win, verch, verch, horch, horch, (const cchar_t *)NULL, (const cchar_t *)NULL, (const cchar_t *)NULL, (const cchar_t *)NULL); }
int box_set(WINDOW *win, const cchar_t *verch, const cchar_t *horch) { #ifndef HAVE_WCHAR return ERR; #else return wborder_set(win, verch, verch, horch, horch, NULL, NULL, NULL, NULL); #endif /* HAVE_WCHAR */ }
int border_set(const cchar_t *ls, const cchar_t *rs, const cchar_t *ts, const cchar_t *bs, const cchar_t *tl, const cchar_t *tr, const cchar_t *bl, const cchar_t *br) { #ifndef HAVE_WCHAR return ERR; #else return wborder_set(stdscr, ls, rs, ts, bs, tl, tr, bl, br); #endif /* HAVE_WCHAR */ }
/*f * Draw a border around the edges of the window. The parms correspond to * a character and attribute for the left, right, top, and bottom sides, * top left, top right, bottom left, and bottom right corners. A zero in * any character parm means to take the default. */ int wborder(WINDOW *w, chtype ls, chtype rs, chtype ts, chtype bs, chtype tl, chtype tr, chtype bl, chtype br) { int code; cchar_t wls, wrs, wts, wbs, wtl, wtr, wbl, wbr; #ifdef M_CURSES_TRACE __m_trace( "wborder(%p, %ld, %ld, %ld, %ld, %ld, %ld, %ld, %ld)", w, ls, rs, ts, bs, tl, tr, bl, br ); #endif if (ls == 0) ls = ACS_VLINE; (void) __m_acs_cc(ls, &wls); if (rs == 0) rs = ACS_VLINE; (void) __m_acs_cc(rs, &wrs); if (ts == 0) ts = ACS_HLINE; (void) __m_acs_cc(ts, &wts); if (bs == 0) bs = ACS_HLINE; (void) __m_acs_cc(bs, &wbs); if (tl == 0) tl = ACS_ULCORNER; (void) __m_acs_cc(tl, &wtl); if (tr == 0) tr = ACS_URCORNER; (void) __m_acs_cc(tr, &wtr); if (bl == 0) bl = ACS_LLCORNER; (void) __m_acs_cc(bl, &wbl); if (br == 0) br = ACS_LRCORNER; (void) __m_acs_cc(br, &wbr); code = wborder_set(w, &wls, &wrs, &wts, &wbs, &wtl, &wtr, &wbl, &wbr); return __m_return_code("wborder", code); }
wborder(WINDOW *win, chtype ls, chtype rs, chtype ts, chtype bs, chtype tl, chtype tr, chtype bl, chtype br) { NCURSES_CH_T wls, wrs, wts, wbs, wtl, wtr, wbl, wbr; WIDEVAR(ls); WIDEVAR(rs); WIDEVAR(ts); WIDEVAR(bs); WIDEVAR(tl); WIDEVAR(tr); WIDEVAR(bl); WIDEVAR(br); return wborder_set(win, WIDEPASS(ls), WIDEPASS(rs), WIDEPASS(ts), WIDEPASS(bs), WIDEPASS(tl), WIDEPASS(tr), WIDEPASS(bl), WIDEPASS(br)); }
/* * wborder -- * Draw a border around the given window using the specified delimiting * characters. */ int wborder(WINDOW *win, chtype left, chtype right, chtype top, chtype bottom, chtype topleft, chtype topright, chtype botleft, chtype botright) { #ifndef HAVE_WCHAR int endy, endx, i; __LDATA *fp, *lp; if (!(left & __CHARTEXT)) left |= ACS_VLINE; if (!(right & __CHARTEXT)) right |= ACS_VLINE; if (!(top & __CHARTEXT)) top |= ACS_HLINE; if (!(bottom & __CHARTEXT)) bottom |= ACS_HLINE; if (!(topleft & __CHARTEXT)) topleft |= ACS_ULCORNER; if (!(topright & __CHARTEXT)) topright |= ACS_URCORNER; if (!(botleft & __CHARTEXT)) botleft |= ACS_LLCORNER; if (!(botright & __CHARTEXT)) botright |= ACS_LRCORNER; #ifdef DEBUG __CTRACE(__CTRACE_INPUT, "wborder: left = %c, 0x%x\n", left & __CHARTEXT, left & __ATTRIBUTES); __CTRACE(__CTRACE_INPUT, "wborder: right = %c, 0x%x\n", right & __CHARTEXT, right & __ATTRIBUTES); __CTRACE(__CTRACE_INPUT, "wborder: top = %c, 0x%x\n", top & __CHARTEXT, top & __ATTRIBUTES); __CTRACE(__CTRACE_INPUT, "wborder: bottom = %c, 0x%x\n", bottom & __CHARTEXT, bottom & __ATTRIBUTES); __CTRACE(__CTRACE_INPUT, "wborder: topleft = %c, 0x%x\n", topleft & __CHARTEXT, topleft & __ATTRIBUTES); __CTRACE(__CTRACE_INPUT, "wborder: topright = %c, 0x%x\n", topright & __CHARTEXT, topright & __ATTRIBUTES); __CTRACE(__CTRACE_INPUT, "wborder: botleft = %c, 0x%x\n", botleft & __CHARTEXT, botleft & __ATTRIBUTES); __CTRACE(__CTRACE_INPUT, "wborder: botright = %c, 0x%x\n", botright & __CHARTEXT, botright & __ATTRIBUTES); #endif /* Merge window and background attributes */ left |= (left & __COLOR) ? (win->wattr & ~__COLOR) : win->wattr; left |= (left & __COLOR) ? (win->battr & ~__COLOR) : win->battr; right |= (right & __COLOR) ? (win->wattr & ~__COLOR) : win->wattr; right |= (right & __COLOR) ? (win->battr & ~__COLOR) : win->battr; top |= (top & __COLOR) ? (win->wattr & ~__COLOR) : win->wattr; top |= (top & __COLOR) ? (win->battr & ~__COLOR) : win->battr; bottom |= (bottom & __COLOR) ? (win->wattr & ~__COLOR) : win->wattr; bottom |= (bottom & __COLOR) ? (win->battr & ~__COLOR) : win->battr; topleft |= (topleft & __COLOR) ? (win->wattr & ~__COLOR) : win->wattr; topleft |= (topleft & __COLOR) ? (win->battr & ~__COLOR) : win->battr; topright |= (topright & __COLOR) ? (win->wattr & ~__COLOR) : win->wattr; topright |= (topright & __COLOR) ? (win->battr & ~__COLOR) : win->battr; botleft |= (botleft & __COLOR) ? (win->wattr & ~__COLOR) : win->wattr; botleft |= (botleft & __COLOR) ? (win->battr & ~__COLOR) : win->battr; botright |= (botright & __COLOR) ? (win->wattr & ~__COLOR) : win->wattr; botright |= (botright & __COLOR) ? (win->battr & ~__COLOR) : win->battr; endx = win->maxx - 1; endy = win->maxy - 1; fp = win->alines[0]->line; lp = win->alines[endy]->line; /* Sides */ for (i = 1; i < endy; i++) { win->alines[i]->line[0].ch = (wchar_t) left & __CHARTEXT; win->alines[i]->line[0].attr = (attr_t) left & __ATTRIBUTES; win->alines[i]->line[endx].ch = (wchar_t) right & __CHARTEXT; win->alines[i]->line[endx].attr = (attr_t) right & __ATTRIBUTES; } for (i = 1; i < endx; i++) { fp[i].ch = (wchar_t) top & __CHARTEXT; fp[i].attr = (attr_t) top & __ATTRIBUTES; lp[i].ch = (wchar_t) bottom & __CHARTEXT; lp[i].attr = (attr_t) bottom & __ATTRIBUTES; } /* Corners */ if (!(win->maxx == LINES && win->maxy == COLS && (win->flags & __SCROLLOK) && (win->flags & __SCROLLWIN))) { fp[0].ch = (wchar_t) topleft & __CHARTEXT; fp[0].attr = (attr_t) topleft & __ATTRIBUTES; fp[endx].ch = (wchar_t) topright & __CHARTEXT; fp[endx].attr = (attr_t) topright & __ATTRIBUTES; lp[0].ch = (wchar_t) botleft & __CHARTEXT; lp[0].attr = (attr_t) botleft & __ATTRIBUTES; lp[endx].ch = (wchar_t) botright & __CHARTEXT; lp[endx].attr = (attr_t) botright & __ATTRIBUTES; } __touchwin(win); return (OK); #else /* HAVE_WCHAR */ cchar_t ls, rs, ts, bs, tl, tr, bl, br; cchar_t *lsp, *rsp, *tsp, *bsp, *tlp, *trp, *blp, *brp; #define S(in, out, def) \ if (in & __CHARTEXT) { \ __cursesi_chtype_to_cchar(in, &out); \ } else { \ memcpy(&out, def, sizeof(cchar_t)); \ out.attributes |= in & __ATTRIBUTES; \ } \ out##p = &out; S(left, ls, WACS_VLINE); S(right, rs, WACS_VLINE); S(top, ts, WACS_HLINE); S(bottom, bs, WACS_HLINE); S(topleft, tl, WACS_ULCORNER); S(topright, tr, WACS_URCORNER); S(botleft, bl, WACS_LLCORNER); S(botright, br, WACS_LRCORNER); #undef S return wborder_set(win, lsp, rsp, tsp, bsp, tlp, trp, blp, brp); #endif /* HAVE_WCHAR */ }
NCURSES_EXPORT(int) (box_set) (WINDOW * a1, const cchar_t * a2, const cchar_t * z) { T((T_CALLED("box_set(%p,%p,%p)"), (const void *)a1, (const void *)a2, (const void *)z)); returnCode(wborder_set(a1,a2,a2,z,z,0,0,0,0)); }
NCURSES_EXPORT(int) (border_set) (const cchar_t * a1, const cchar_t * a2, const cchar_t * a3, const cchar_t * a4, const cchar_t * a5, const cchar_t * a6, const cchar_t * a7, const cchar_t * z) { T((T_CALLED("border_set(%p,%p,%p,%p,%p,%p,%p,%p)"), (const void *)a1, (const void *)a2, (const void *)a3, (const void *)a4, (const void *)a5, (const void *)a6, (const void *)a7, (const void *)z)); returnCode(wborder_set(stdscr,a1,a2,a3,a4,a5,a6,a7,z)); }