Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-05-18 08:29:43

0001 // * This makes emacs happy -*-Mode: C++;-*-
0002 // vile:cppmode
0003 /****************************************************************************
0004  * Copyright 2019-2021,2022 Thomas E. Dickey                                *
0005  * Copyright 1998-2014,2017 Free Software Foundation, Inc.                  *
0006  *                                                                          *
0007  * Permission is hereby granted, free of charge, to any person obtaining a  *
0008  * copy of this software and associated documentation files (the            *
0009  * "Software"), to deal in the Software without restriction, including      *
0010  * without limitation the rights to use, copy, modify, merge, publish,      *
0011  * distribute, distribute with modifications, sublicense, and/or sell       *
0012  * copies of the Software, and to permit persons to whom the Software is    *
0013  * furnished to do so, subject to the following conditions:                 *
0014  *                                                                          *
0015  * The above copyright notice and this permission notice shall be included  *
0016  * in all copies or substantial portions of the Software.                   *
0017  *                                                                          *
0018  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
0019  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
0020  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
0021  * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
0022  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
0023  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
0024  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
0025  *                                                                          *
0026  * Except as contained in this notice, the name(s) of the above copyright   *
0027  * holders shall not be used in advertising or otherwise to promote the     *
0028  * sale, use or other dealings in this Software without prior written       *
0029  * authorization.                                                           *
0030  ****************************************************************************/
0031 
0032 #ifndef NCURSES_CURSESW_H_incl
0033 #define NCURSES_CURSESW_H_incl 1
0034 
0035 // $Id: cursesw.h,v 1.59 2022/08/20 20:52:15 tom Exp $
0036 
0037 extern "C" {
0038 #  include   <ncursesw/curses.h>
0039 }
0040 
0041 #if defined(BUILDING_NCURSES_CXX)
0042 # define NCURSES_CXX_IMPEXP NCURSES_EXPORT_GENERAL_EXPORT
0043 #else
0044 # define NCURSES_CXX_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT
0045 #endif
0046 
0047 #define NCURSES_CXX_WRAPPED_VAR(type,name) extern NCURSES_CXX_IMPEXP type NCURSES_PUBLIC_VAR(name)(void)
0048 
0049 #define NCURSES_CXX_EXPORT(type) NCURSES_CXX_IMPEXP type NCURSES_API
0050 #define NCURSES_CXX_EXPORT_VAR(type) NCURSES_CXX_IMPEXP type
0051 
0052 #include <ncursesw/etip.h>
0053 
0054 /* SCO 3.2v4 curses.h includes term.h, which defines lines as a macro.
0055    Undefine it here, because NCursesWindow uses lines as a method.  */
0056 #undef lines
0057 
0058 /* "Convert" macros to inlines. We'll define it as another symbol to avoid
0059  * conflict with library symbols.
0060  */
0061 #undef UNDEF
0062 #define UNDEF(name) CUR_ ##name
0063 
0064 #ifdef addch
0065 inline int UNDEF(addch)(chtype ch)  { return addch(ch); }
0066 #undef addch
0067 #define addch UNDEF(addch)
0068 #endif
0069 
0070 #ifdef addchstr
0071 inline int UNDEF(addchstr)(chtype *at) { return addchstr(at); }
0072 #undef addchstr
0073 #define addchstr UNDEF(addchstr)
0074 #endif
0075 
0076 #ifdef addnstr
0077 inline int UNDEF(addnstr)(const char *str, int n)
0078 { return addnstr(str, n); }
0079 #undef addnstr
0080 #define addnstr UNDEF(addnstr)
0081 #endif
0082 
0083 #ifdef addstr
0084 inline int UNDEF(addstr)(const char * str)  { return addstr(str); }
0085 #undef addstr
0086 #define addstr UNDEF(addstr)
0087 #endif
0088 
0089 #ifdef attroff
0090 inline int UNDEF(attroff)(chtype at) { return attroff(at); }
0091 #undef attroff
0092 #define attroff UNDEF(attroff)
0093 #endif
0094 
0095 #ifdef attron
0096 inline int UNDEF(attron)(chtype at) { return attron(at); }
0097 #undef attron
0098 #define attron UNDEF(attron)
0099 #endif
0100 
0101 #ifdef attrset
0102 inline chtype UNDEF(attrset)(chtype at) { return attrset(at); }
0103 #undef attrset
0104 #define attrset UNDEF(attrset)
0105 #endif
0106 
0107 #ifdef bkgd
0108 inline int UNDEF(bkgd)(chtype ch) { return bkgd(ch); }
0109 #undef bkgd
0110 #define bkgd UNDEF(bkgd)
0111 #endif
0112 
0113 #ifdef bkgdset
0114 inline void UNDEF(bkgdset)(chtype ch) { bkgdset(ch); }
0115 #undef bkgdset
0116 #define bkgdset UNDEF(bkgdset)
0117 #endif
0118 
0119 #ifdef border
0120 inline int UNDEF(border)(chtype ls, chtype rs, chtype ts, chtype bs, chtype tl, chtype tr, chtype bl, chtype br)
0121 { return border(ls, rs, ts, bs, tl, tr, bl, br); }
0122 #undef border
0123 #define border UNDEF(border)
0124 #endif
0125 
0126 #ifdef box
0127 inline int UNDEF(box)(WINDOW *win, int v, int h) { return box(win, v, h); }
0128 #undef box
0129 #define box UNDEF(box)
0130 #endif
0131 
0132 #ifdef chgat
0133 inline int UNDEF(chgat)(int n, attr_t attr, NCURSES_PAIRS_T color, const void *opts) {
0134   return chgat(n, attr, color, opts); }
0135 #undef chgat
0136 #define chgat UNDEF(chgat)
0137 #endif
0138 
0139 #ifdef clear
0140 inline int UNDEF(clear)()  { return clear(); }
0141 #undef clear
0142 #define clear UNDEF(clear)
0143 #endif
0144 
0145 #ifdef clearok
0146 inline int UNDEF(clearok)(WINDOW* win, bool bf)  { return clearok(win, bf); }
0147 #undef clearok
0148 #define clearok UNDEF(clearok)
0149 #else
0150 extern "C" NCURSES_IMPEXP int NCURSES_API clearok(WINDOW*, bool);
0151 #endif
0152 
0153 #ifdef clrtobot
0154 inline int UNDEF(clrtobot)()  { return clrtobot(); }
0155 #undef clrtobot
0156 #define clrtobot UNDEF(clrtobot)
0157 #endif
0158 
0159 #ifdef clrtoeol
0160 inline int UNDEF(clrtoeol)()  { return clrtoeol(); }
0161 #undef clrtoeol
0162 #define clrtoeol UNDEF(clrtoeol)
0163 #endif
0164 
0165 #ifdef color_set
0166 inline chtype UNDEF(color_set)(NCURSES_PAIRS_T p, void* opts) { return color_set(p, opts); }
0167 #undef color_set
0168 #define color_set UNDEF(color_set)
0169 #endif
0170 
0171 #ifdef crmode
0172 inline int UNDEF(crmode)(void) { return crmode(); }
0173 #undef crmode
0174 #define crmode UNDEF(crmode)
0175 #endif
0176 
0177 #ifdef delch
0178 inline int UNDEF(delch)()  { return delch(); }
0179 #undef delch
0180 #define delch UNDEF(delch)
0181 #endif
0182 
0183 #ifdef deleteln
0184 inline int UNDEF(deleteln)()  { return deleteln(); }
0185 #undef deleteln
0186 #define deleteln UNDEF(deleteln)
0187 #endif
0188 
0189 #ifdef echochar
0190 inline int UNDEF(echochar)(chtype ch)  { return echochar(ch); }
0191 #undef echochar
0192 #define echochar UNDEF(echochar)
0193 #endif
0194 
0195 #ifdef erase
0196 inline int UNDEF(erase)()  { return erase(); }
0197 #undef erase
0198 #define erase UNDEF(erase)
0199 #endif
0200 
0201 #ifdef fixterm
0202 inline int UNDEF(fixterm)(void) { return fixterm(); }
0203 #undef fixterm
0204 #define fixterm UNDEF(fixterm)
0205 #endif
0206 
0207 #ifdef flushok
0208 inline int UNDEF(flushok)(WINDOW* _win, bool _bf)  {
0209   return flushok(_win, _bf); }
0210 #undef flushok
0211 #define flushok UNDEF(flushok)
0212 #else
0213 #define _no_flushok
0214 #endif
0215 
0216 #ifdef getattrs
0217 inline int UNDEF(getattrs)(WINDOW *win) { return getattrs(win); }
0218 #undef getattrs
0219 #define getattrs UNDEF(getattrs)
0220 #endif
0221 
0222 #ifdef getbegyx
0223 inline void UNDEF(getbegyx)(WINDOW* win, int& y, int& x) { getbegyx(win, y, x); }
0224 #undef getbegyx
0225 #define getbegyx UNDEF(getbegyx)
0226 #endif
0227 
0228 #ifdef getbkgd
0229 inline chtype UNDEF(getbkgd)(const WINDOW *win) { return getbkgd(win); }
0230 #undef getbkgd
0231 #define getbkgd UNDEF(getbkgd)
0232 #endif
0233 
0234 #ifdef getch
0235 inline int UNDEF(getch)()  { return getch(); }
0236 #undef getch
0237 #define getch UNDEF(getch)
0238 #endif
0239 
0240 #ifdef getmaxyx
0241 inline void UNDEF(getmaxyx)(WINDOW* win, int& y, int& x) { getmaxyx(win, y, x); }
0242 #undef getmaxyx
0243 #define getmaxyx UNDEF(getmaxyx)
0244 #endif
0245 
0246 #ifdef getnstr
0247 inline int UNDEF(getnstr)(char *_str, int n)  { return getnstr(_str, n); }
0248 #undef getnstr
0249 #define getnstr UNDEF(getnstr)
0250 #endif
0251 
0252 #ifdef getparyx
0253 inline void UNDEF(getparyx)(WINDOW* win, int& y, int& x) { getparyx(win, y, x); }
0254 #undef getparyx
0255 #define getparyx UNDEF(getparyx)
0256 #endif
0257 
0258 #ifdef getstr
0259 inline int UNDEF(getstr)(char *_str)  { return getstr(_str); }
0260 #undef getstr
0261 #define getstr UNDEF(getstr)
0262 #endif
0263 
0264 #ifdef getyx
0265 inline void UNDEF(getyx)(const WINDOW* win, int& y, int& x) {
0266   getyx(win, y, x); }
0267 #undef getyx
0268 #define getyx UNDEF(getyx)
0269 #endif
0270 
0271 #ifdef hline
0272 inline int UNDEF(hline)(chtype ch, int n) { return hline(ch, n); }
0273 #undef hline
0274 #define hline UNDEF(hline)
0275 #endif
0276 
0277 #ifdef inch
0278 inline chtype UNDEF(inch)()  { return inch(); }
0279 #undef inch
0280 #define inch UNDEF(inch)
0281 #endif
0282 
0283 #ifdef inchstr
0284 inline int UNDEF(inchstr)(chtype *str)  { return inchstr(str); }
0285 #undef inchstr
0286 #define inchstr UNDEF(inchstr)
0287 #endif
0288 
0289 #ifdef innstr
0290 inline int UNDEF(innstr)(char *_str, int n)  { return innstr(_str, n); }
0291 #undef innstr
0292 #define innstr UNDEF(innstr)
0293 #endif
0294 
0295 #ifdef insch
0296 inline int UNDEF(insch)(chtype c)  { return insch(c); }
0297 #undef insch
0298 #define insch UNDEF(insch)
0299 #endif
0300 
0301 #ifdef insdelln
0302 inline int UNDEF(insdelln)(int n)  { return insdelln(n); }
0303 #undef insdelln
0304 #define insdelln UNDEF(insdelln)
0305 #endif
0306 
0307 #ifdef insertln
0308 inline int UNDEF(insertln)()  { return insertln(); }
0309 #undef insertln
0310 #define insertln UNDEF(insertln)
0311 #endif
0312 
0313 #ifdef insnstr
0314 inline int UNDEF(insnstr)(const char *_str, int n)  {
0315   return insnstr(_str, n); }
0316 #undef insnstr
0317 #define insnstr UNDEF(insnstr)
0318 #endif
0319 
0320 #ifdef insstr
0321 inline int UNDEF(insstr)(const char *_str)  {
0322   return insstr(_str); }
0323 #undef insstr
0324 #define insstr UNDEF(insstr)
0325 #endif
0326 
0327 #ifdef instr
0328 inline int UNDEF(instr)(char *_str)  { return instr(_str); }
0329 #undef instr
0330 #define instr UNDEF(instr)
0331 #endif
0332 
0333 #ifdef intrflush
0334 inline void UNDEF(intrflush)(WINDOW *win, bool bf) { intrflush(); }
0335 #undef intrflush
0336 #define intrflush UNDEF(intrflush)
0337 #endif
0338 
0339 #ifdef is_linetouched
0340 inline int UNDEF(is_linetouched)(WINDOW *w, int l)  { return is_linetouched(w,l); }
0341 #undef is_linetouched
0342 #define is_linetouched UNDEF(is_linetouched)
0343 #endif
0344 
0345 #ifdef leaveok
0346 inline int UNDEF(leaveok)(WINDOW* win, bool bf)  { return leaveok(win, bf); }
0347 #undef leaveok
0348 #define leaveok UNDEF(leaveok)
0349 #else
0350 extern "C" NCURSES_IMPEXP int NCURSES_API leaveok(WINDOW* win, bool bf);
0351 #endif
0352 
0353 #ifdef move
0354 inline int UNDEF(move)(int x, int y)  { return move(x, y); }
0355 #undef move
0356 #define move UNDEF(move)
0357 #endif
0358 
0359 #ifdef mvaddch
0360 inline int UNDEF(mvaddch)(int y, int x, chtype ch)
0361 { return mvaddch(y, x, ch); }
0362 #undef mvaddch
0363 #define mvaddch UNDEF(mvaddch)
0364 #endif
0365 
0366 #ifdef mvaddnstr
0367 inline int UNDEF(mvaddnstr)(int y, int x, const char *str, int n)
0368 { return mvaddnstr(y, x, str, n); }
0369 #undef mvaddnstr
0370 #define mvaddnstr UNDEF(mvaddnstr)
0371 #endif
0372 
0373 #ifdef mvaddstr
0374 inline int UNDEF(mvaddstr)(int y, int x, const char * str)
0375 { return mvaddstr(y, x, str); }
0376 #undef mvaddstr
0377 #define mvaddstr UNDEF(mvaddstr)
0378 #endif
0379 
0380 #ifdef mvchgat
0381 inline int UNDEF(mvchgat)(int y, int x, int n,
0382               attr_t attr, NCURSES_PAIRS_T color, const void *opts) {
0383   return mvchgat(y, x, n, attr, color, opts); }
0384 #undef mvchgat
0385 #define mvchgat UNDEF(mvchgat)
0386 #endif
0387 
0388 #ifdef mvdelch
0389 inline int UNDEF(mvdelch)(int y, int x) { return mvdelch(y, x);}
0390 #undef mvdelch
0391 #define mvdelch UNDEF(mvdelch)
0392 #endif
0393 
0394 #ifdef mvgetch
0395 inline int UNDEF(mvgetch)(int y, int x) { return mvgetch(y, x);}
0396 #undef mvgetch
0397 #define mvgetch UNDEF(mvgetch)
0398 #endif
0399 
0400 #ifdef mvgetnstr
0401 inline int UNDEF(mvgetnstr)(int y, int x, char *str, int n) {
0402   return mvgetnstr(y, x, str, n);}
0403 #undef mvgetnstr
0404 #define mvgetnstr UNDEF(mvgetnstr)
0405 #endif
0406 
0407 #ifdef mvgetstr
0408 inline int UNDEF(mvgetstr)(int y, int x, char *str) {return mvgetstr(y, x, str);}
0409 #undef mvgetstr
0410 #define mvgetstr UNDEF(mvgetstr)
0411 #endif
0412 
0413 #ifdef mvinch
0414 inline chtype UNDEF(mvinch)(int y, int x) { return mvinch(y, x);}
0415 #undef mvinch
0416 #define mvinch UNDEF(mvinch)
0417 #endif
0418 
0419 #ifdef mvinnstr
0420 inline int UNDEF(mvinnstr)(int y, int x, char *_str, int n) {
0421   return mvinnstr(y, x, _str, n); }
0422 #undef mvinnstr
0423 #define mvinnstr UNDEF(mvinnstr)
0424 #endif
0425 
0426 #ifdef mvinsch
0427 inline int UNDEF(mvinsch)(int y, int x, chtype c)
0428 { return mvinsch(y, x, c); }
0429 #undef mvinsch
0430 #define mvinsch UNDEF(mvinsch)
0431 #endif
0432 
0433 #ifdef mvinsnstr
0434 inline int UNDEF(mvinsnstr)(int y, int x, const char *_str, int n) {
0435   return mvinsnstr(y, x, _str, n); }
0436 #undef mvinsnstr
0437 #define mvinsnstr UNDEF(mvinsnstr)
0438 #endif
0439 
0440 #ifdef mvinsstr
0441 inline int UNDEF(mvinsstr)(int y, int x, const char *_str)  {
0442   return mvinsstr(y, x, _str); }
0443 #undef mvinsstr
0444 #define mvinsstr UNDEF(mvinsstr)
0445 #endif
0446 
0447 #ifdef mvwaddch
0448 inline int UNDEF(mvwaddch)(WINDOW *win, int y, int x, const chtype ch)
0449 { return mvwaddch(win, y, x, ch); }
0450 #undef mvwaddch
0451 #define mvwaddch UNDEF(mvwaddch)
0452 #endif
0453 
0454 #ifdef mvwaddchnstr
0455 inline int UNDEF(mvwaddchnstr)(WINDOW *win, int y, int x, const chtype *str, int n)
0456 { return mvwaddchnstr(win, y, x, str, n); }
0457 #undef mvwaddchnstr
0458 #define mvwaddchnstr UNDEF(mvwaddchnstr)
0459 #endif
0460 
0461 #ifdef mvwaddchstr
0462 inline int UNDEF(mvwaddchstr)(WINDOW *win, int y, int x, const chtype *str)
0463 { return mvwaddchstr(win, y, x, str); }
0464 #undef mvwaddchstr
0465 #define mvwaddchstr UNDEF(mvwaddchstr)
0466 #endif
0467 
0468 #ifdef mvwaddnstr
0469 inline int UNDEF(mvwaddnstr)(WINDOW *win, int y, int x, const char *str, int n)
0470 { return mvwaddnstr(win, y, x, str, n); }
0471 #undef mvwaddnstr
0472 #define mvwaddnstr UNDEF(mvwaddnstr)
0473 #endif
0474 
0475 #ifdef mvwaddstr
0476 inline int UNDEF(mvwaddstr)(WINDOW *win, int y, int x, const char * str)
0477 { return mvwaddstr(win, y, x, str); }
0478 #undef mvwaddstr
0479 #define mvwaddstr UNDEF(mvwaddstr)
0480 #endif
0481 
0482 #ifdef mvwchgat
0483 inline int UNDEF(mvwchgat)(WINDOW *win, int y, int x, int n,
0484                attr_t attr, NCURSES_PAIRS_T color, const void *opts) {
0485   return mvwchgat(win, y, x, n, attr, color, opts); }
0486 #undef mvwchgat
0487 #define mvwchgat UNDEF(mvwchgat)
0488 #endif
0489 
0490 #ifdef mvwdelch
0491 inline int UNDEF(mvwdelch)(WINDOW *win, int y, int x)
0492 { return mvwdelch(win, y, x); }
0493 #undef mvwdelch
0494 #define mvwdelch UNDEF(mvwdelch)
0495 #endif
0496 
0497 #ifdef mvwgetch
0498 inline int UNDEF(mvwgetch)(WINDOW *win, int y, int x) { return mvwgetch(win, y, x);}
0499 #undef mvwgetch
0500 #define mvwgetch UNDEF(mvwgetch)
0501 #endif
0502 
0503 #ifdef mvwgetnstr
0504 inline int UNDEF(mvwgetnstr)(WINDOW *win, int y, int x, char *str, int n)
0505 {return mvwgetnstr(win, y, x, str, n);}
0506 #undef mvwgetnstr
0507 #define mvwgetnstr UNDEF(mvwgetnstr)
0508 #endif
0509 
0510 #ifdef mvwgetstr
0511 inline int UNDEF(mvwgetstr)(WINDOW *win, int y, int x, char *str)
0512 {return mvwgetstr(win, y, x, str);}
0513 #undef mvwgetstr
0514 #define mvwgetstr UNDEF(mvwgetstr)
0515 #endif
0516 
0517 #ifdef mvwhline
0518 inline int UNDEF(mvwhline)(WINDOW *win, int y, int x, chtype c, int n) {
0519   return mvwhline(win, y, x, c, n); }
0520 #undef mvwhline
0521 #define mvwhline UNDEF(mvwhline)
0522 #endif
0523 
0524 #ifdef mvwinch
0525 inline chtype UNDEF(mvwinch)(WINDOW *win, int y, int x) {
0526   return mvwinch(win, y, x);}
0527 #undef mvwinch
0528 #define mvwinch UNDEF(mvwinch)
0529 #endif
0530 
0531 #ifdef mvwinchnstr
0532 inline int UNDEF(mvwinchnstr)(WINDOW *win, int y, int x, chtype *str, int n)  { return mvwinchnstr(win, y, x, str, n); }
0533 #undef mvwinchnstr
0534 #define mvwinchnstr UNDEF(mvwinchnstr)
0535 #endif
0536 
0537 #ifdef mvwinchstr
0538 inline int UNDEF(mvwinchstr)(WINDOW *win, int y, int x, chtype *str)  { return mvwinchstr(win, y, x, str); }
0539 #undef mvwinchstr
0540 #define mvwinchstr UNDEF(mvwinchstr)
0541 #endif
0542 
0543 #ifdef mvwinnstr
0544 inline int UNDEF(mvwinnstr)(WINDOW *win, int y, int x, char *_str, int n) {
0545   return mvwinnstr(win, y, x, _str, n); }
0546 #undef mvwinnstr
0547 #define mvwinnstr UNDEF(mvwinnstr)
0548 #endif
0549 
0550 #ifdef mvwinsch
0551 inline int UNDEF(mvwinsch)(WINDOW *win, int y, int x, chtype c)
0552 { return mvwinsch(win, y, x, c); }
0553 #undef mvwinsch
0554 #define mvwinsch UNDEF(mvwinsch)
0555 #endif
0556 
0557 #ifdef mvwinsnstr
0558 inline int UNDEF(mvwinsnstr)(WINDOW *w, int y, int x, const char *_str, int n) {
0559   return mvwinsnstr(w, y, x, _str, n); }
0560 #undef mvwinsnstr
0561 #define mvwinsnstr UNDEF(mvwinsnstr)
0562 #endif
0563 
0564 #ifdef mvwinsstr
0565 inline int UNDEF(mvwinsstr)(WINDOW *w, int y, int x,  const char *_str)  {
0566   return mvwinsstr(w, y, x, _str); }
0567 #undef mvwinsstr
0568 #define mvwinsstr UNDEF(mvwinsstr)
0569 #endif
0570 
0571 #ifdef mvwvline
0572 inline int UNDEF(mvwvline)(WINDOW *win, int y, int x, chtype c, int n) {
0573   return mvwvline(win, y, x, c, n); }
0574 #undef mvwvline
0575 #define mvwvline UNDEF(mvwvline)
0576 #endif
0577 
0578 #ifdef napms
0579 inline void UNDEF(napms)(unsigned long x) { napms(x); }
0580 #undef napms
0581 #define napms UNDEF(napms)
0582 #endif
0583 
0584 #ifdef nocrmode
0585 inline int UNDEF(nocrmode)(void) { return nocrmode(); }
0586 #undef nocrmode
0587 #define nocrmode UNDEF(nocrmode)
0588 #endif
0589 
0590 #ifdef nodelay
0591 inline void UNDEF(nodelay)() { nodelay(); }
0592 #undef nodelay
0593 #define nodelay UNDEF(nodelay)
0594 #endif
0595 
0596 #ifdef redrawwin
0597 inline int UNDEF(redrawwin)(WINDOW *win)  { return redrawwin(win); }
0598 #undef redrawwin
0599 #define redrawwin UNDEF(redrawwin)
0600 #endif
0601 
0602 #ifdef refresh
0603 inline int UNDEF(refresh)()  { return refresh(); }
0604 #undef refresh
0605 #define refresh UNDEF(refresh)
0606 #endif
0607 
0608 #ifdef resetterm
0609 inline int UNDEF(resetterm)(void) { return resetterm(); }
0610 #undef resetterm
0611 #define resetterm UNDEF(resetterm)
0612 #endif
0613 
0614 #ifdef saveterm
0615 inline int UNDEF(saveterm)(void) { return saveterm(); }
0616 #undef saveterm
0617 #define saveterm UNDEF(saveterm)
0618 #endif
0619 
0620 #ifdef scrl
0621 inline int UNDEF(scrl)(int l) { return scrl(l); }
0622 #undef scrl
0623 #define scrl UNDEF(scrl)
0624 #endif
0625 
0626 #ifdef scroll
0627 inline int UNDEF(scroll)(WINDOW *win) { return scroll(win); }
0628 #undef scroll
0629 #define scroll UNDEF(scroll)
0630 #endif
0631 
0632 #ifdef scrollok
0633 inline int UNDEF(scrollok)(WINDOW* win, bool bf)  { return scrollok(win, bf); }
0634 #undef scrollok
0635 #define scrollok UNDEF(scrollok)
0636 #else
0637 #if defined(__NCURSES_H)
0638 extern "C" NCURSES_IMPEXP int NCURSES_API scrollok(WINDOW*, bool);
0639 #else
0640 extern "C" NCURSES_IMPEXP int NCURSES_API scrollok(WINDOW*, char);
0641 #endif
0642 #endif
0643 
0644 #ifdef setscrreg
0645 inline int UNDEF(setscrreg)(int t, int b) { return setscrreg(t, b); }
0646 #undef setscrreg
0647 #define setscrreg UNDEF(setscrreg)
0648 #endif
0649 
0650 #ifdef standend
0651 inline int UNDEF(standend)()  { return standend(); }
0652 #undef standend
0653 #define standend UNDEF(standend)
0654 #endif
0655 
0656 #ifdef standout
0657 inline int UNDEF(standout)()  { return standout(); }
0658 #undef standout
0659 #define standout UNDEF(standout)
0660 #endif
0661 
0662 #ifdef subpad
0663 inline WINDOW *UNDEF(subpad)(WINDOW *p, int l, int c, int y, int x)
0664 { return derwin(p, l, c, y, x); }
0665 #undef subpad
0666 #define subpad UNDEF(subpad)
0667 #endif
0668 
0669 #ifdef timeout
0670 inline void UNDEF(timeout)(int delay) { timeout(delay); }
0671 #undef timeout
0672 #define timeout UNDEF(timeout)
0673 #endif
0674 
0675 #ifdef touchline
0676 inline int UNDEF(touchline)(WINDOW *win, int s, int c)
0677 { return touchline(win, s, c); }
0678 #undef touchline
0679 #define touchline UNDEF(touchline)
0680 #endif
0681 
0682 #ifdef touchwin
0683 inline int UNDEF(touchwin)(WINDOW *win) { return touchwin(win); }
0684 #undef touchwin
0685 #define touchwin UNDEF(touchwin)
0686 #endif
0687 
0688 #ifdef untouchwin
0689 inline int UNDEF(untouchwin)(WINDOW *win) { return untouchwin(win); }
0690 #undef untouchwin
0691 #define untouchwin UNDEF(untouchwin)
0692 #endif
0693 
0694 #ifdef vline
0695 inline int UNDEF(vline)(chtype ch, int n) { return vline(ch, n); }
0696 #undef vline
0697 #define vline UNDEF(vline)
0698 #endif
0699 
0700 #ifdef waddchstr
0701 inline int UNDEF(waddchstr)(WINDOW *win, chtype *at) { return waddchstr(win, at); }
0702 #undef waddchstr
0703 #define waddchstr UNDEF(waddchstr)
0704 #endif
0705 
0706 #ifdef waddstr
0707 inline int UNDEF(waddstr)(WINDOW *win, char *str) { return waddstr(win, str); }
0708 #undef waddstr
0709 #define waddstr UNDEF(waddstr)
0710 #endif
0711 
0712 #ifdef wattroff
0713 inline int UNDEF(wattroff)(WINDOW *win, int att) { return wattroff(win, att); }
0714 #undef wattroff
0715 #define wattroff UNDEF(wattroff)
0716 #endif
0717 
0718 #ifdef wattrset
0719 inline int UNDEF(wattrset)(WINDOW *win, int att) { return wattrset(win, att); }
0720 #undef wattrset
0721 #define wattrset UNDEF(wattrset)
0722 #endif
0723 
0724 #ifdef winch
0725 inline chtype UNDEF(winch)(const WINDOW* win) { return winch(win); }
0726 #undef winch
0727 #define winch UNDEF(winch)
0728 #endif
0729 
0730 #ifdef winchnstr
0731 inline int UNDEF(winchnstr)(WINDOW *win, chtype *str, int n)  { return winchnstr(win, str, n); }
0732 #undef winchnstr
0733 #define winchnstr UNDEF(winchnstr)
0734 #endif
0735 
0736 #ifdef winchstr
0737 inline int UNDEF(winchstr)(WINDOW *win, chtype *str)  { return winchstr(win, str); }
0738 #undef winchstr
0739 #define winchstr UNDEF(winchstr)
0740 #endif
0741 
0742 #ifdef winsstr
0743 inline int UNDEF(winsstr)(WINDOW *w, const char *_str)  {
0744   return winsstr(w, _str); }
0745 #undef winsstr
0746 #define winsstr UNDEF(winsstr)
0747 #endif
0748 
0749 #ifdef wstandend
0750 inline int UNDEF(wstandend)(WINDOW *win)  { return wstandend(win); }
0751 #undef wstandend
0752 #define wstandend UNDEF(wstandend)
0753 #endif
0754 
0755 #ifdef wstandout
0756 inline int UNDEF(wstandout)(WINDOW *win)  { return wstandout(win); }
0757 #undef wstandout
0758 #define wstandout UNDEF(wstandout)
0759 #endif
0760 
0761 /*
0762  *
0763  * C++ class for windows.
0764  *
0765  */
0766 
0767 extern "C" int     _nc_ripoffline(int, int (*init)(WINDOW*, int));
0768 extern "C" int     _nc_xx_ripoff_init(WINDOW *, int);
0769 extern "C" int     _nc_has_mouse(void);
0770 
0771 class NCURSES_CXX_IMPEXP NCursesWindow
0772 {
0773   friend class NCursesMenu;
0774   friend class NCursesForm;
0775 
0776 private:
0777   static bool    b_initialized;
0778   static void    initialize();
0779   void           constructing();
0780   friend int     _nc_xx_ripoff_init(WINDOW *, int);
0781 
0782   void           set_keyboard();
0783 
0784   NCURSES_COLOR_T getcolor(int getback) const;
0785   NCURSES_PAIRS_T getPair() const;
0786 
0787   static int     setpalette(NCURSES_COLOR_T fore, NCURSES_COLOR_T back, NCURSES_PAIRS_T pair);
0788   static int     colorInitialized;
0789 
0790   // This private constructor is only used during the initialization
0791   // of windows generated by ripoffline() calls.
0792   NCursesWindow(WINDOW* win, int ncols);
0793 
0794 protected:
0795   virtual void   err_handler(const char *) const THROWS(NCursesException);
0796   // Signal an error with the given message text.
0797 
0798   static long count;        // count of all active windows:
0799   //   We rely on the c++ promise that
0800   //   all otherwise uninitialized
0801   //   static class vars are set to 0
0802 
0803   WINDOW*        w;                // the curses WINDOW
0804 
0805   bool           alloced;          // TRUE if we own the WINDOW
0806 
0807   NCursesWindow* par;              // parent, if subwindow
0808   NCursesWindow* subwins;          // head of subwindows list
0809   NCursesWindow* sib;              // next subwindow of parent
0810 
0811   void           kill_subwindows(); // disable all subwindows
0812   // Destroy all subwindows.
0813 
0814   /* Only for use by derived classes. They are then in charge to
0815      fill the member variables correctly. */
0816   NCursesWindow();
0817 
0818 public:
0819   explicit NCursesWindow(WINDOW* window);   // useful only for stdscr
0820 
0821   NCursesWindow(int nlines,        // number of lines
0822         int ncols,         // number of columns
0823         int begin_y,       // line origin
0824         int begin_x);      // col origin
0825 
0826   NCursesWindow(NCursesWindow& par,// parent window
0827         int nlines,        // number of lines
0828         int ncols,         // number of columns
0829         int begin_y,       // absolute or relative
0830         int begin_x,       //   origins:
0831         char absrel = 'a');// if `a', begin_y & begin_x are
0832   // absolute screen pos, else if `r', they are relative to par origin
0833 
0834   NCursesWindow(NCursesWindow& par,// parent window
0835         bool do_box = TRUE);
0836   // this is the very common case that we want to create the subwindow that
0837   // is two lines and two columns smaller and begins at (1,1).
0838   // We may automatically request the box around it.
0839 
0840   NCursesWindow& operator=(const NCursesWindow& rhs)
0841   {
0842     if (this != &rhs)
0843       *this = rhs;
0844     return *this;
0845   }
0846 
0847   NCursesWindow(const NCursesWindow& rhs)
0848     : w(rhs.w), alloced(rhs.alloced), par(rhs.par), subwins(rhs.subwins), sib(rhs.sib)
0849   {
0850   }
0851 
0852   virtual ~NCursesWindow() THROWS(NCursesException);
0853 
0854   NCursesWindow Clone();
0855   // Make an exact copy of the window.
0856 
0857   // Initialization.
0858   static void    useColors(void);
0859   // Call this routine very early if you want to have colors.
0860 
0861   static int ripoffline(int ripoff_lines,
0862             int (*init)(NCursesWindow& win));
0863   // This function is used to generate a window of ripped-of lines.
0864   // If the argument is positive, lines are removed from the top, if it
0865   // is negative lines are removed from the bottom. This enhances the
0866   // lowlevel ripoffline() function because it uses the internal
0867   // implementation that allows to remove more than just a single line.
0868   // This function must be called before any other ncurses function. The
0869   // creation of the window is deferred until ncurses gets initialized.
0870   // The initialization function is then called.
0871 
0872   // -------------------------------------------------------------------------
0873   // terminal status
0874   // -------------------------------------------------------------------------
0875   int            lines() const { initialize(); return LINES; }
0876   // Number of lines on terminal, *not* window
0877 
0878   int            cols() const { initialize(); return COLS; }
0879   // Number of cols  on terminal, *not* window
0880 
0881   int            tabsize() const { initialize(); return TABSIZE; }
0882   // Size of a tab on terminal, *not* window
0883 
0884   static int     NumberOfColors();
0885   // Number of available colors
0886 
0887   int            colors() const { return NumberOfColors(); }
0888   // Number of available colors
0889 
0890   // -------------------------------------------------------------------------
0891   // window status
0892   // -------------------------------------------------------------------------
0893   int            height() const { return maxy() + 1; }
0894   // Number of lines in this window
0895 
0896   int            width() const { return maxx() + 1; }
0897   // Number of columns in this window
0898 
0899   int            begx() const { return getbegx(w); }
0900   // Column of top left corner relative to stdscr
0901 
0902   int            begy() const { return getbegy(w); }
0903   // Line of top left corner relative to stdscr
0904 
0905   int            curx() const { return getcurx(w); }
0906   // Column of top left corner relative to stdscr
0907 
0908   int            cury() const { return getcury(w); }
0909   // Line of top left corner relative to stdscr
0910 
0911   int            maxx() const { return getmaxx(w) == ERR ? ERR : getmaxx(w)-1; }
0912   // Largest x coord in window
0913 
0914   int            maxy() const { return getmaxy(w) == ERR ? ERR : getmaxy(w)-1; }
0915   // Largest y coord in window
0916 
0917   NCURSES_PAIRS_T getcolor() const;
0918   // Actual color pair
0919 
0920   NCURSES_COLOR_T foreground() const { return getcolor(0); }
0921   // Actual foreground color
0922 
0923   NCURSES_COLOR_T background() const { return getcolor(1); }
0924   // Actual background color
0925 
0926   int            setpalette(NCURSES_COLOR_T fore, NCURSES_COLOR_T back);
0927   // Set color palette entry
0928 
0929   int            setcolor(NCURSES_PAIRS_T pair);
0930   // Set actually used palette entry
0931 
0932   // -------------------------------------------------------------------------
0933   // window positioning
0934   // -------------------------------------------------------------------------
0935   virtual int    mvwin(int begin_y, int begin_x) {
0936     return ::mvwin(w, begin_y, begin_x); }
0937   // Move window to new position with the new position as top left corner.
0938   // This is virtual because it is redefined in NCursesPanel.
0939 
0940   // -------------------------------------------------------------------------
0941   // coordinate positioning
0942   // -------------------------------------------------------------------------
0943   int            move(int y, int x) { return ::wmove(w, y, x); }
0944   // Move cursor the this position
0945 
0946   void           getyx(int& y, int& x) const { ::getyx(w, y, x); }
0947   // Get current position of the cursor
0948 
0949   void           getbegyx(int& y, int& x) const { ::getbegyx(w, y, x); }
0950   // Get beginning of the window
0951 
0952   void           getmaxyx(int& y, int& x) const { ::getmaxyx(w, y, x); }
0953   // Get size of the window
0954 
0955   void           getparyx(int& y, int& x) const { ::getparyx(w, y, x); }
0956   // Get parent's beginning of the window
0957 
0958   int            mvcur(int oldrow, int oldcol, int newrow, int newcol) const {
0959     return ::mvcur(oldrow, oldcol, newrow, newcol); }
0960   // Perform lowlevel cursor motion that takes effect immediately.
0961 
0962   // -------------------------------------------------------------------------
0963   // input
0964   // -------------------------------------------------------------------------
0965   int            getch() { return ::wgetch(w); }
0966   // Get a keystroke from the window.
0967 
0968   int            getch(int y, int x) { return ::mvwgetch(w, y, x); }
0969   // Move cursor to position and get a keystroke from the window
0970 
0971   int            getstr(char* str, int n=-1) {
0972     return ::wgetnstr(w, str, n); }
0973   // Read a series of characters into str until a newline or carriage return
0974   // is received. Read at most n characters. If n is negative, the limit is
0975   // ignored.
0976 
0977   int            getstr(int y, int x, char* str, int n=-1) {
0978     return ::mvwgetnstr(w, y, x, str, n); }
0979   // Move the cursor to the requested position and then perform the getstr()
0980   // as described above.
0981 
0982   int            instr(char *s, int n=-1) { return ::winnstr(w, s, n); }
0983   // Get a string of characters from the window into the buffer s. Retrieve
0984   // at most n characters, if n is negative retrieve all characters up to the
0985   // end of the current line. Attributes are stripped from the characters.
0986 
0987   int            instr(int y, int x, char *s, int n=-1) {
0988     return ::mvwinnstr(w, y, x, s, n); }
0989   // Move the cursor to the requested position and then perform the instr()
0990   // as described above.
0991 
0992   int            scanw(const char* fmt, ...)
0993     // Perform a scanw function from the window.
0994 #if __GNUG__ >= 2
0995     __attribute__ ((format (scanf, 2, 3)));
0996 #else
0997   ;
0998 #endif
0999 
1000   int            scanw(const char*, va_list);
1001     // Perform a scanw function from the window.
1002 
1003   int            scanw(int y, int x, const char* fmt, ...)
1004     // Move the cursor to the requested position and then perform a scanw
1005     // from the window.
1006 #if __GNUG__ >= 2
1007     __attribute__ ((format (scanf, 4, 5)));
1008 #else
1009   ;
1010 #endif
1011 
1012   int            scanw(int y, int x, const char* fmt, va_list);
1013     // Move the cursor to the requested position and then perform a scanw
1014     // from the window.
1015 
1016   // -------------------------------------------------------------------------
1017   // output
1018   // -------------------------------------------------------------------------
1019   int            addch(const chtype ch) { return ::waddch(w, ch); }
1020   // Put attributed character to the window.
1021 
1022   int            addch(int y, int x, const chtype ch) {
1023     return ::mvwaddch(w, y, x, ch); }
1024   // Move cursor to the requested position and then put attributed character
1025   // to the window.
1026 
1027   int            echochar(const chtype ch) { return ::wechochar(w, ch); }
1028   // Put attributed character to the window and refresh it immediately.
1029 
1030   int            addstr(const char* str, int n=-1) {
1031     return ::waddnstr(w, str, n); }
1032   // Write the string str to the window, stop writing if the terminating
1033   // NUL or the limit n is reached. If n is negative, it is ignored.
1034 
1035   int            addstr(int y, int x, const char * str, int n=-1) {
1036     return ::mvwaddnstr(w, y, x, str, n); }
1037   // Move the cursor to the requested position and then perform the addchstr
1038   // as described above.
1039 
1040   int            addchstr(const chtype* str, int n=-1) {
1041     return ::waddchnstr(w, str, n); }
1042   // Write the string str to the window, stop writing if the terminating
1043   // NUL or the limit n is reached. If n is negative, it is ignored.
1044 
1045   int            addchstr(int y, int x, const chtype * str, int n=-1) {
1046     return ::mvwaddchnstr(w, y, x, str, n); }
1047   // Move the cursor to the requested position and then perform the addchstr
1048   // as described above.
1049 
1050   int            printw(const char* fmt, ...)
1051     // Do a formatted print to the window.
1052 #if (__GNUG__ >= 2) && !defined(printf)
1053     __attribute__ ((format (printf, 2, 3)));
1054 #else
1055   ;
1056 #endif
1057 
1058   int            printw(int y, int x, const char * fmt, ...)
1059     // Move the cursor and then do a formatted print to the window.
1060 #if (__GNUG__ >= 2) && !defined(printf)
1061     __attribute__ ((format (printf, 4, 5)));
1062 #else
1063   ;
1064 #endif
1065 
1066   int            printw(const char* fmt, va_list args);
1067     // Do a formatted print to the window.
1068 
1069   int            printw(int y, int x, const char * fmt, va_list args);
1070     // Move the cursor and then do a formatted print to the window.
1071 
1072   chtype         inch() const { return ::winch(w); }
1073   // Retrieve attributed character under the current cursor position.
1074 
1075   chtype         inch(int y, int x) { return ::mvwinch(w, y, x); }
1076   // Move cursor to requested position and then retrieve attributed character
1077   // at this position.
1078 
1079   int            inchstr(chtype* str, int n=-1) {
1080     return ::winchnstr(w, str, n); }
1081   // Read the string str from the window, stop reading if the terminating
1082   // NUL or the limit n is reached. If n is negative, it is ignored.
1083 
1084   int            inchstr(int y, int x, chtype * str, int n=-1) {
1085     return ::mvwinchnstr(w, y, x, str, n); }
1086   // Move the cursor to the requested position and then perform the inchstr
1087   // as described above.
1088 
1089   int            insch(chtype ch) { return ::winsch(w, ch); }
1090   // Insert attributed character into the window before current cursor
1091   // position.
1092 
1093   int            insch(int y, int x, chtype ch) {
1094     return ::mvwinsch(w, y, x, ch); }
1095   // Move cursor to requested position and then insert the attributed
1096   // character before that position.
1097 
1098   int            insertln() { return ::winsdelln(w, 1); }
1099   // Insert an empty line above the current line.
1100 
1101   int            insdelln(int n=1) { return ::winsdelln(w, n); }
1102   // If n>0 insert that many lines above the current line. If n<0 delete
1103   // that many lines beginning with the current line.
1104 
1105   int            insstr(const char *s, int n=-1) {
1106     return ::winsnstr(w, s, n); }
1107   // Insert the string into the window before the current cursor position.
1108   // Insert stops at end of string or when the limit n is reached. If n is
1109   // negative, it is ignored.
1110 
1111   int            insstr(int y, int x, const char *s, int n=-1) {
1112     return ::mvwinsnstr(w, y, x, s, n); }
1113   // Move the cursor to the requested position and then perform the insstr()
1114   // as described above.
1115 
1116   int            attron (chtype at) { return ::wattron (w, at); }
1117   // Switch on the window attributes;
1118 
1119   int            attroff(chtype at) { return ::wattroff(w, static_cast<int>(at)); }
1120   // Switch off the window attributes;
1121 
1122   int            attrset(chtype at) { return ::wattrset(w, static_cast<int>(at)); }
1123   // Set the window attributes;
1124 
1125   chtype         attrget() { return ::getattrs(w); }
1126   // Get the window attributes;
1127 
1128   int            color_set(NCURSES_PAIRS_T color_pair_number, void* opts=NULL) {
1129     return ::wcolor_set(w, color_pair_number, opts); }
1130   // Set the window color attribute;
1131 
1132   int            chgat(int n, attr_t attr, NCURSES_PAIRS_T color, const void *opts=NULL) {
1133     return ::wchgat(w, n, attr, color, opts); }
1134   // Change the attributes of the next n characters in the current line. If
1135   // n is negative or greater than the number of remaining characters in the
1136   // line, the attributes will be changed up to the end of the line.
1137 
1138   int            chgat(int y, int x,
1139                int n, attr_t attr, NCURSES_PAIRS_T color, const void *opts=NULL) {
1140     return ::mvwchgat(w, y, x, n, attr, color, opts); }
1141   // Move the cursor to the requested position and then perform chgat() as
1142   // described above.
1143 
1144   // -------------------------------------------------------------------------
1145   // background
1146   // -------------------------------------------------------------------------
1147   chtype         getbkgd() const { return ::getbkgd(w); }
1148   // Get current background setting.
1149 
1150   int            bkgd(const chtype ch) { return ::wbkgd(w, ch); }
1151   // Set the background property and apply it to the window.
1152 
1153   void           bkgdset(chtype ch) { ::wbkgdset(w, ch); }
1154   // Set the background property.
1155 
1156   // -------------------------------------------------------------------------
1157   // borders
1158   // -------------------------------------------------------------------------
1159   int            box(chtype vert=0, chtype  hor=0) {
1160     return ::wborder(w, vert, vert, hor, hor, 0, 0, 0, 0); }
1161   // Draw a box around the window with the given vertical and horizontal
1162   // drawing characters. If you specify a zero as character, curses will try
1163   // to find a "nice" character.
1164 
1165   int            border(chtype left=0, chtype right=0,
1166             chtype top =0, chtype bottom=0,
1167             chtype top_left =0, chtype top_right=0,
1168             chtype bottom_left =0, chtype bottom_right=0) {
1169     return ::wborder(w, left, right, top, bottom, top_left, top_right,
1170              bottom_left, bottom_right); }
1171   // Draw a border around the window with the given characters for the
1172   // various parts of the border. If you pass zero for a character, curses
1173   // will try to find "nice" characters.
1174 
1175   // -------------------------------------------------------------------------
1176   // lines and boxes
1177   // -------------------------------------------------------------------------
1178   int            hline(int len, chtype ch=0) { return ::whline(w, ch, len); }
1179   // Draw a horizontal line of len characters with the given character. If
1180   // you pass zero for the character, curses will try to find a "nice" one.
1181 
1182   int            hline(int y, int x, int len, chtype ch=0) {
1183     return ::mvwhline(w, y, x, ch, len); }
1184   // Move the cursor to the requested position and then draw a horizontal line.
1185 
1186   int            vline(int len, chtype ch=0) { return ::wvline(w, ch, len); }
1187   // Draw a vertical line of len characters with the given character. If
1188   // you pass zero for the character, curses will try to find a "nice" one.
1189 
1190   int            vline(int y, int x, int len, chtype ch=0) {
1191     return ::mvwvline(w, y, x, ch, len); }
1192   // Move the cursor to the requested position and then draw a vertical line.
1193 
1194   // -------------------------------------------------------------------------
1195   // erasure
1196   // -------------------------------------------------------------------------
1197   int            erase() { return ::werase(w); }
1198   // Erase the window.
1199 
1200   int            clear() { return ::wclear(w); }
1201   // Clear the window.
1202 
1203   int            clearok(bool bf) { return ::clearok(w, bf); }
1204   // Set/Reset the clear flag. If set, the next refresh() will clear the
1205   // screen.
1206 
1207   int            clrtobot() { return ::wclrtobot(w); }
1208   // Clear to the end of the window.
1209 
1210   int            clrtoeol() { return ::wclrtoeol(w); }
1211   // Clear to the end of the line.
1212 
1213   int            delch() { return ::wdelch(w); }
1214   // Delete character under the cursor.
1215 
1216   int            delch(int y, int x) { return ::mvwdelch(w, y, x); }
1217   // Move cursor to requested position and delete the character under the
1218   // cursor.
1219 
1220   int            deleteln() { return ::winsdelln(w, -1); }
1221   // Delete the current line.
1222 
1223   // -------------------------------------------------------------------------
1224   // screen control
1225   // -------------------------------------------------------------------------
1226   int            scroll(int amount=1) { return ::wscrl(w, amount); }
1227   // Scroll amount lines. If amount is positive, scroll up, otherwise
1228   // scroll down.
1229 
1230   int            scrollok(bool bf) { return ::scrollok(w, bf); }
1231   // If bf is TRUE, window scrolls if cursor is moved off the bottom
1232   // edge of the window or a scrolling region, otherwise the cursor is left
1233   // at the bottom line.
1234 
1235   int            setscrreg(int from, int to) {
1236     return ::wsetscrreg(w, from, to); }
1237   // Define a soft scrolling region.
1238 
1239   int            idlok(bool bf) { return ::idlok(w, bf); }
1240   // If bf is TRUE, use insert/delete line hardware support if possible.
1241   // Otherwise do it in software.
1242 
1243   void           idcok(bool bf) { ::idcok(w, bf); }
1244   // If bf is TRUE, use insert/delete character hardware support if possible.
1245   // Otherwise do it in software.
1246 
1247   int            touchline(int s, int c) { return ::touchline(w, s, c); }
1248   // Mark the given lines as modified.
1249 
1250   int            touchwin()   { return ::wtouchln(w, 0, height(), 1); }
1251   // Mark the whole window as modified.
1252 
1253   int            untouchwin() { return ::wtouchln(w, 0, height(), 0); }
1254   // Mark the whole window as unmodified.
1255 
1256   int            touchln(int s, int cnt, bool changed=TRUE) {
1257     return ::wtouchln(w, s, cnt, static_cast<int>(changed ? 1 : 0)); }
1258   // Mark cnt lines beginning from line s as changed or unchanged, depending
1259   // on the value of the changed flag.
1260 
1261   bool           is_linetouched(int line) const {
1262     return (::is_linetouched(w, line) == TRUE ? TRUE:FALSE); }
1263   // Return TRUE if line is marked as changed, FALSE otherwise
1264 
1265   bool           is_wintouched() const {
1266     return (::is_wintouched(w) ? TRUE:FALSE); }
1267   // Return TRUE if window is marked as changed, FALSE otherwise
1268 
1269   int            leaveok(bool bf) { return ::leaveok(w, bf); }
1270   // If bf is TRUE, curses will leave the cursor after an update wherever
1271   // it is after the update.
1272 
1273   int            redrawln(int from, int n) { return ::wredrawln(w, from, n); }
1274   // Redraw n lines starting from the requested line
1275 
1276   int            redrawwin() { return ::wredrawln(w, 0, height()); }
1277   // Redraw the whole window
1278 
1279   int            doupdate()  { return ::doupdate(); }
1280   // Do all outputs to make the physical screen looking like the virtual one
1281 
1282   void           syncdown()  { ::wsyncdown(w); }
1283   // Propagate the changes down to all descendant windows
1284 
1285   void           syncup()    { ::wsyncup(w); }
1286   // Propagate the changes up in the hierarchy
1287 
1288   void           cursyncup() { ::wcursyncup(w); }
1289   // Position the cursor in all ancestor windows corresponding to our setting
1290 
1291   int            syncok(bool bf) { return ::syncok(w, bf); }
1292   // If called with bf=TRUE, syncup() is called whenever the window is changed
1293 
1294 #ifndef _no_flushok
1295   int            flushok(bool bf) { return ::flushok(w, bf); }
1296 #endif
1297 
1298   void           immedok(bool bf) { ::immedok(w, bf); }
1299   // If called with bf=TRUE, any change in the window will cause an
1300   // automatic immediate refresh()
1301 
1302   int            intrflush(bool bf) { return ::intrflush(w, bf); }
1303 
1304   int            keypad(bool bf) { return ::keypad(w, bf); }
1305   // If called with bf=TRUE, the application will interpret function keys.
1306 
1307   int            nodelay(bool bf) { return ::nodelay(w, bf); }
1308 
1309   int            meta(bool bf) { return ::meta(w, bf); }
1310   // If called with bf=TRUE, keys may generate 8-Bit characters. Otherwise
1311   // 7-Bit characters are generated.
1312 
1313   int            standout() { return ::wstandout(w); }
1314   // Enable "standout" attributes
1315 
1316   int            standend() { return ::wstandend(w); }
1317   // Disable "standout" attributes
1318 
1319   // -------------------------------------------------------------------------
1320   // The next two are virtual, because we redefine them in the
1321   // NCursesPanel class.
1322   // -------------------------------------------------------------------------
1323   virtual int    refresh() { return ::wrefresh(w); }
1324   // Propagate the changes in this window to the virtual screen and call
1325   // doupdate(). This is redefined in NCursesPanel.
1326 
1327   virtual int    noutrefresh() { return ::wnoutrefresh(w); }
1328   // Propagate the changes in this window to the virtual screen. This is
1329   // redefined in NCursesPanel.
1330 
1331   // -------------------------------------------------------------------------
1332   // multiple window control
1333   // -------------------------------------------------------------------------
1334   int            overlay(NCursesWindow& win) {
1335     return ::overlay(w, win.w); }
1336   // Overlay this window over win.
1337 
1338   int            overwrite(NCursesWindow& win) {
1339     return ::overwrite(w, win.w); }
1340   // Overwrite win with this window.
1341 
1342   int            copywin(NCursesWindow& win,
1343              int sminrow, int smincol,
1344              int dminrow, int dmincol,
1345              int dmaxrow, int dmaxcol, bool overlaywin=TRUE) {
1346     return ::copywin(w, win.w, sminrow, smincol, dminrow, dmincol,
1347              dmaxrow, dmaxcol, static_cast<int>(overlaywin ? 1 : 0)); }
1348   // Overlay or overwrite the rectangle in win given by dminrow,dmincol,
1349   // dmaxrow,dmaxcol with the rectangle in this window beginning at
1350   // sminrow,smincol.
1351 
1352   // -------------------------------------------------------------------------
1353   // Extended functions
1354   // -------------------------------------------------------------------------
1355 #if defined(NCURSES_EXT_FUNCS) && (NCURSES_EXT_FUNCS != 0)
1356   int            wresize(int newLines, int newColumns) {
1357     return ::wresize(w, newLines, newColumns); }
1358 #endif
1359 
1360   // -------------------------------------------------------------------------
1361   // Mouse related
1362   // -------------------------------------------------------------------------
1363   bool has_mouse() const;
1364   // Return TRUE if terminal supports a mouse, FALSE otherwise
1365 
1366   // -------------------------------------------------------------------------
1367   // traversal support
1368   // -------------------------------------------------------------------------
1369   NCursesWindow*  child() { return subwins; }
1370   // Get the first child window.
1371 
1372   NCursesWindow*  sibling() { return sib; }
1373   // Get the next child of my parent.
1374 
1375   NCursesWindow*  parent() { return par; }
1376   // Get my parent.
1377 
1378   bool isDescendant(NCursesWindow& win);
1379   // Return TRUE if win is a descendant of this.
1380 };
1381 
1382 // -------------------------------------------------------------------------
1383 // We leave this here for compatibility reasons.
1384 // -------------------------------------------------------------------------
1385 class NCURSES_CXX_IMPEXP NCursesColorWindow : public NCursesWindow
1386 {
1387 public:
1388   explicit NCursesColorWindow(WINDOW* &window)   // useful only for stdscr
1389     : NCursesWindow(window) {
1390       useColors(); }
1391 
1392   NCursesColorWindow(int nlines,        // number of lines
1393              int ncols,         // number of columns
1394              int begin_y,       // line origin
1395              int begin_x)       // col origin
1396     : NCursesWindow(nlines, ncols, begin_y, begin_x) {
1397       useColors(); }
1398 
1399   NCursesColorWindow(NCursesWindow& parentWin,// parent window
1400              int nlines,        // number of lines
1401              int ncols,         // number of columns
1402              int begin_y,       // absolute or relative
1403              int begin_x,       //   origins:
1404              char absrel = 'a') // if `a', by & bx are
1405     : NCursesWindow(parentWin,
1406             nlines, ncols,  // absolute screen pos,
1407             begin_y, begin_x,   // else if `r', they are
1408             absrel ) {          // relative to par origin
1409       useColors(); }
1410 };
1411 
1412 // These enum definitions really belong inside the NCursesPad class, but only
1413 // recent compilers support that feature.
1414 
1415   typedef enum {
1416     REQ_PAD_REFRESH = KEY_MAX + 1,
1417     REQ_PAD_UP,
1418     REQ_PAD_DOWN,
1419     REQ_PAD_LEFT,
1420     REQ_PAD_RIGHT,
1421     REQ_PAD_EXIT
1422   } Pad_Request;
1423 
1424   const Pad_Request PAD_LOW  = REQ_PAD_REFRESH;   // lowest  op-code
1425   const Pad_Request PAD_HIGH = REQ_PAD_EXIT;      // highest op-code
1426 
1427 // -------------------------------------------------------------------------
1428 // Pad Support. We allow an association of a pad with a "real" window
1429 // through which the pad may be viewed.
1430 // -------------------------------------------------------------------------
1431 class NCURSES_CXX_IMPEXP NCursesPad : public NCursesWindow
1432 {
1433 private:
1434   NCursesWindow* viewWin;       // the "viewport" window
1435   NCursesWindow* viewSub;       // the "viewport" subwindow
1436 
1437   int h_gridsize, v_gridsize;
1438 
1439 protected:
1440   int min_row, min_col;         // top left row/col of the pads display area
1441 
1442   NCursesWindow* Win(void) const {
1443     // Get the window into which the pad should be copied (if any)
1444     return (viewSub?viewSub:(viewWin?viewWin:0));
1445   }
1446 
1447   NCursesWindow* getWindow(void) const {
1448     return viewWin;
1449   }
1450 
1451   NCursesWindow* getSubWindow(void) const {
1452     return viewSub;
1453   }
1454 
1455   virtual int driver (int key);      // Virtualize keystroke key
1456   // The driver translates the keystroke c into an Pad_Request
1457 
1458   virtual void OnUnknownOperation(int pad_req) {
1459     (void) pad_req;
1460     ::beep();
1461   }
1462   // This is called if the driver returns an unknown op-code
1463 
1464   virtual void OnNavigationError(int pad_req) {
1465     (void) pad_req;
1466     ::beep();
1467   }
1468   // This is called if a navigation request couldn't be satisfied
1469 
1470   virtual void OnOperation(int pad_req) {
1471     (void) pad_req;
1472   };
1473   // OnOperation is called if a Pad_Operation was executed and just before
1474   // the refresh() operation is done.
1475 
1476 public:
1477   NCursesPad(int nlines, int ncols);
1478   // create a pad with the given size
1479 
1480   NCursesPad& operator=(const NCursesPad& rhs)
1481   {
1482     if (this != &rhs) {
1483       *this = rhs;
1484       NCursesWindow::operator=(rhs);
1485     }
1486     return *this;
1487   }
1488 
1489   NCursesPad(const NCursesPad& rhs)
1490     : NCursesWindow(rhs),
1491       viewWin(rhs.viewWin),
1492       viewSub(rhs.viewSub),
1493       h_gridsize(rhs.h_gridsize),
1494       v_gridsize(rhs.v_gridsize),
1495       min_row(rhs.min_row),
1496       min_col(rhs.min_col)
1497   {
1498   }
1499 
1500   virtual ~NCursesPad() THROWS(NCursesException) {}
1501 
1502   int echochar(const chtype ch) { return ::pechochar(w, ch); }
1503   // Put the attributed character onto the pad and immediately do a
1504   // prefresh().
1505 
1506   int refresh() NCURSES_OVERRIDE;
1507   // If a viewport is defined the pad is displayed in this window, otherwise
1508   // this is a noop.
1509 
1510   int refresh(int pminrow, int pmincol,
1511           int sminrow, int smincol,
1512           int smaxrow, int smaxcol) {
1513     return ::prefresh(w, pminrow, pmincol,
1514               sminrow, smincol, smaxrow, smaxcol);
1515   }
1516   // The coordinates sminrow,smincol,smaxrow,smaxcol describe a rectangle
1517   // on the screen. <b>refresh</b> copies a rectangle of this size beginning
1518   // with top left corner pminrow,pmincol onto the screen and calls doupdate().
1519 
1520   int noutrefresh() NCURSES_OVERRIDE;
1521   // If a viewport is defined the pad is displayed in this window, otherwise
1522   // this is a noop.
1523 
1524   int noutrefresh(int pminrow, int pmincol,
1525           int sminrow, int smincol,
1526           int smaxrow, int smaxcol) {
1527     return ::pnoutrefresh(w, pminrow, pmincol,
1528               sminrow, smincol, smaxrow, smaxcol);
1529   }
1530   // Does the same as refresh() but without calling doupdate().
1531 
1532   virtual void setWindow(NCursesWindow& view, int v_grid = 1, int h_grid = 1);
1533   // Add the window "view" as viewing window to the pad.
1534 
1535   virtual void setSubWindow(NCursesWindow& sub);
1536   // Use the subwindow "sub" of the viewport window for the actual viewing.
1537   // The full viewport window is usually used to provide some decorations
1538   // like frames, titles etc.
1539 
1540   virtual void operator() (void);
1541   // Perform Pad's operation
1542 };
1543 
1544 // A FramedPad is constructed always with a viewport window. This viewport
1545 // will be framed (by a box() command) and the interior of the box is the
1546 // viewport subwindow. On the frame we display scrollbar sliders.
1547 class NCURSES_CXX_IMPEXP NCursesFramedPad : public NCursesPad
1548 {
1549 protected:
1550   virtual void OnOperation(int pad_req) NCURSES_OVERRIDE;
1551 
1552 public:
1553   NCursesFramedPad(NCursesWindow& win, int nlines, int ncols,
1554            int v_grid = 1, int h_grid = 1)
1555     : NCursesPad(nlines, ncols) {
1556     NCursesPad::setWindow(win, v_grid, h_grid);
1557     NCursesPad::setSubWindow(*(new NCursesWindow(win)));
1558   }
1559   // Construct the FramedPad with the given Window win as viewport.
1560 
1561   virtual ~NCursesFramedPad() THROWS(NCursesException) {
1562     delete getSubWindow();
1563   }
1564 
1565   void setWindow(NCursesWindow& view, int v_grid = 1, int h_grid = 1) NCURSES_OVERRIDE {
1566     (void) view;
1567     (void) v_grid;
1568     (void) h_grid;
1569     err_handler("Operation not allowed");
1570   }
1571   // Disable this call; the viewport is already defined
1572 
1573   void setSubWindow(NCursesWindow& sub) NCURSES_OVERRIDE {
1574     (void) sub;
1575     err_handler("Operation not allowed");
1576   }
1577   // Disable this call; the viewport subwindow is already defined
1578 
1579 };
1580 
1581 #endif /* NCURSES_CURSESW_H_incl */