annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/cursesw.h @ 69:33d812a61356

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 17:55:14 -0400
parents
children
rev   line source
jpayne@69 1 // * This makes emacs happy -*-Mode: C++;-*-
jpayne@69 2 // vile:cppmode
jpayne@69 3 /****************************************************************************
jpayne@69 4 * Copyright 2019-2021,2022 Thomas E. Dickey *
jpayne@69 5 * Copyright 1998-2014,2017 Free Software Foundation, Inc. *
jpayne@69 6 * *
jpayne@69 7 * Permission is hereby granted, free of charge, to any person obtaining a *
jpayne@69 8 * copy of this software and associated documentation files (the *
jpayne@69 9 * "Software"), to deal in the Software without restriction, including *
jpayne@69 10 * without limitation the rights to use, copy, modify, merge, publish, *
jpayne@69 11 * distribute, distribute with modifications, sublicense, and/or sell *
jpayne@69 12 * copies of the Software, and to permit persons to whom the Software is *
jpayne@69 13 * furnished to do so, subject to the following conditions: *
jpayne@69 14 * *
jpayne@69 15 * The above copyright notice and this permission notice shall be included *
jpayne@69 16 * in all copies or substantial portions of the Software. *
jpayne@69 17 * *
jpayne@69 18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
jpayne@69 19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
jpayne@69 20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
jpayne@69 21 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
jpayne@69 22 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
jpayne@69 23 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
jpayne@69 24 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
jpayne@69 25 * *
jpayne@69 26 * Except as contained in this notice, the name(s) of the above copyright *
jpayne@69 27 * holders shall not be used in advertising or otherwise to promote the *
jpayne@69 28 * sale, use or other dealings in this Software without prior written *
jpayne@69 29 * authorization. *
jpayne@69 30 ****************************************************************************/
jpayne@69 31
jpayne@69 32 #ifndef NCURSES_CURSESW_H_incl
jpayne@69 33 #define NCURSES_CURSESW_H_incl 1
jpayne@69 34
jpayne@69 35 // $Id: cursesw.h,v 1.59 2022/08/20 20:52:15 tom Exp $
jpayne@69 36
jpayne@69 37 extern "C" {
jpayne@69 38 # include <ncursesw/curses.h>
jpayne@69 39 }
jpayne@69 40
jpayne@69 41 #if defined(BUILDING_NCURSES_CXX)
jpayne@69 42 # define NCURSES_CXX_IMPEXP NCURSES_EXPORT_GENERAL_EXPORT
jpayne@69 43 #else
jpayne@69 44 # define NCURSES_CXX_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT
jpayne@69 45 #endif
jpayne@69 46
jpayne@69 47 #define NCURSES_CXX_WRAPPED_VAR(type,name) extern NCURSES_CXX_IMPEXP type NCURSES_PUBLIC_VAR(name)(void)
jpayne@69 48
jpayne@69 49 #define NCURSES_CXX_EXPORT(type) NCURSES_CXX_IMPEXP type NCURSES_API
jpayne@69 50 #define NCURSES_CXX_EXPORT_VAR(type) NCURSES_CXX_IMPEXP type
jpayne@69 51
jpayne@69 52 #include <ncursesw/etip.h>
jpayne@69 53
jpayne@69 54 /* SCO 3.2v4 curses.h includes term.h, which defines lines as a macro.
jpayne@69 55 Undefine it here, because NCursesWindow uses lines as a method. */
jpayne@69 56 #undef lines
jpayne@69 57
jpayne@69 58 /* "Convert" macros to inlines. We'll define it as another symbol to avoid
jpayne@69 59 * conflict with library symbols.
jpayne@69 60 */
jpayne@69 61 #undef UNDEF
jpayne@69 62 #define UNDEF(name) CUR_ ##name
jpayne@69 63
jpayne@69 64 #ifdef addch
jpayne@69 65 inline int UNDEF(addch)(chtype ch) { return addch(ch); }
jpayne@69 66 #undef addch
jpayne@69 67 #define addch UNDEF(addch)
jpayne@69 68 #endif
jpayne@69 69
jpayne@69 70 #ifdef addchstr
jpayne@69 71 inline int UNDEF(addchstr)(chtype *at) { return addchstr(at); }
jpayne@69 72 #undef addchstr
jpayne@69 73 #define addchstr UNDEF(addchstr)
jpayne@69 74 #endif
jpayne@69 75
jpayne@69 76 #ifdef addnstr
jpayne@69 77 inline int UNDEF(addnstr)(const char *str, int n)
jpayne@69 78 { return addnstr(str, n); }
jpayne@69 79 #undef addnstr
jpayne@69 80 #define addnstr UNDEF(addnstr)
jpayne@69 81 #endif
jpayne@69 82
jpayne@69 83 #ifdef addstr
jpayne@69 84 inline int UNDEF(addstr)(const char * str) { return addstr(str); }
jpayne@69 85 #undef addstr
jpayne@69 86 #define addstr UNDEF(addstr)
jpayne@69 87 #endif
jpayne@69 88
jpayne@69 89 #ifdef attroff
jpayne@69 90 inline int UNDEF(attroff)(chtype at) { return attroff(at); }
jpayne@69 91 #undef attroff
jpayne@69 92 #define attroff UNDEF(attroff)
jpayne@69 93 #endif
jpayne@69 94
jpayne@69 95 #ifdef attron
jpayne@69 96 inline int UNDEF(attron)(chtype at) { return attron(at); }
jpayne@69 97 #undef attron
jpayne@69 98 #define attron UNDEF(attron)
jpayne@69 99 #endif
jpayne@69 100
jpayne@69 101 #ifdef attrset
jpayne@69 102 inline chtype UNDEF(attrset)(chtype at) { return attrset(at); }
jpayne@69 103 #undef attrset
jpayne@69 104 #define attrset UNDEF(attrset)
jpayne@69 105 #endif
jpayne@69 106
jpayne@69 107 #ifdef bkgd
jpayne@69 108 inline int UNDEF(bkgd)(chtype ch) { return bkgd(ch); }
jpayne@69 109 #undef bkgd
jpayne@69 110 #define bkgd UNDEF(bkgd)
jpayne@69 111 #endif
jpayne@69 112
jpayne@69 113 #ifdef bkgdset
jpayne@69 114 inline void UNDEF(bkgdset)(chtype ch) { bkgdset(ch); }
jpayne@69 115 #undef bkgdset
jpayne@69 116 #define bkgdset UNDEF(bkgdset)
jpayne@69 117 #endif
jpayne@69 118
jpayne@69 119 #ifdef border
jpayne@69 120 inline int UNDEF(border)(chtype ls, chtype rs, chtype ts, chtype bs, chtype tl, chtype tr, chtype bl, chtype br)
jpayne@69 121 { return border(ls, rs, ts, bs, tl, tr, bl, br); }
jpayne@69 122 #undef border
jpayne@69 123 #define border UNDEF(border)
jpayne@69 124 #endif
jpayne@69 125
jpayne@69 126 #ifdef box
jpayne@69 127 inline int UNDEF(box)(WINDOW *win, int v, int h) { return box(win, v, h); }
jpayne@69 128 #undef box
jpayne@69 129 #define box UNDEF(box)
jpayne@69 130 #endif
jpayne@69 131
jpayne@69 132 #ifdef chgat
jpayne@69 133 inline int UNDEF(chgat)(int n, attr_t attr, NCURSES_PAIRS_T color, const void *opts) {
jpayne@69 134 return chgat(n, attr, color, opts); }
jpayne@69 135 #undef chgat
jpayne@69 136 #define chgat UNDEF(chgat)
jpayne@69 137 #endif
jpayne@69 138
jpayne@69 139 #ifdef clear
jpayne@69 140 inline int UNDEF(clear)() { return clear(); }
jpayne@69 141 #undef clear
jpayne@69 142 #define clear UNDEF(clear)
jpayne@69 143 #endif
jpayne@69 144
jpayne@69 145 #ifdef clearok
jpayne@69 146 inline int UNDEF(clearok)(WINDOW* win, bool bf) { return clearok(win, bf); }
jpayne@69 147 #undef clearok
jpayne@69 148 #define clearok UNDEF(clearok)
jpayne@69 149 #else
jpayne@69 150 extern "C" NCURSES_IMPEXP int NCURSES_API clearok(WINDOW*, bool);
jpayne@69 151 #endif
jpayne@69 152
jpayne@69 153 #ifdef clrtobot
jpayne@69 154 inline int UNDEF(clrtobot)() { return clrtobot(); }
jpayne@69 155 #undef clrtobot
jpayne@69 156 #define clrtobot UNDEF(clrtobot)
jpayne@69 157 #endif
jpayne@69 158
jpayne@69 159 #ifdef clrtoeol
jpayne@69 160 inline int UNDEF(clrtoeol)() { return clrtoeol(); }
jpayne@69 161 #undef clrtoeol
jpayne@69 162 #define clrtoeol UNDEF(clrtoeol)
jpayne@69 163 #endif
jpayne@69 164
jpayne@69 165 #ifdef color_set
jpayne@69 166 inline chtype UNDEF(color_set)(NCURSES_PAIRS_T p, void* opts) { return color_set(p, opts); }
jpayne@69 167 #undef color_set
jpayne@69 168 #define color_set UNDEF(color_set)
jpayne@69 169 #endif
jpayne@69 170
jpayne@69 171 #ifdef crmode
jpayne@69 172 inline int UNDEF(crmode)(void) { return crmode(); }
jpayne@69 173 #undef crmode
jpayne@69 174 #define crmode UNDEF(crmode)
jpayne@69 175 #endif
jpayne@69 176
jpayne@69 177 #ifdef delch
jpayne@69 178 inline int UNDEF(delch)() { return delch(); }
jpayne@69 179 #undef delch
jpayne@69 180 #define delch UNDEF(delch)
jpayne@69 181 #endif
jpayne@69 182
jpayne@69 183 #ifdef deleteln
jpayne@69 184 inline int UNDEF(deleteln)() { return deleteln(); }
jpayne@69 185 #undef deleteln
jpayne@69 186 #define deleteln UNDEF(deleteln)
jpayne@69 187 #endif
jpayne@69 188
jpayne@69 189 #ifdef echochar
jpayne@69 190 inline int UNDEF(echochar)(chtype ch) { return echochar(ch); }
jpayne@69 191 #undef echochar
jpayne@69 192 #define echochar UNDEF(echochar)
jpayne@69 193 #endif
jpayne@69 194
jpayne@69 195 #ifdef erase
jpayne@69 196 inline int UNDEF(erase)() { return erase(); }
jpayne@69 197 #undef erase
jpayne@69 198 #define erase UNDEF(erase)
jpayne@69 199 #endif
jpayne@69 200
jpayne@69 201 #ifdef fixterm
jpayne@69 202 inline int UNDEF(fixterm)(void) { return fixterm(); }
jpayne@69 203 #undef fixterm
jpayne@69 204 #define fixterm UNDEF(fixterm)
jpayne@69 205 #endif
jpayne@69 206
jpayne@69 207 #ifdef flushok
jpayne@69 208 inline int UNDEF(flushok)(WINDOW* _win, bool _bf) {
jpayne@69 209 return flushok(_win, _bf); }
jpayne@69 210 #undef flushok
jpayne@69 211 #define flushok UNDEF(flushok)
jpayne@69 212 #else
jpayne@69 213 #define _no_flushok
jpayne@69 214 #endif
jpayne@69 215
jpayne@69 216 #ifdef getattrs
jpayne@69 217 inline int UNDEF(getattrs)(WINDOW *win) { return getattrs(win); }
jpayne@69 218 #undef getattrs
jpayne@69 219 #define getattrs UNDEF(getattrs)
jpayne@69 220 #endif
jpayne@69 221
jpayne@69 222 #ifdef getbegyx
jpayne@69 223 inline void UNDEF(getbegyx)(WINDOW* win, int& y, int& x) { getbegyx(win, y, x); }
jpayne@69 224 #undef getbegyx
jpayne@69 225 #define getbegyx UNDEF(getbegyx)
jpayne@69 226 #endif
jpayne@69 227
jpayne@69 228 #ifdef getbkgd
jpayne@69 229 inline chtype UNDEF(getbkgd)(const WINDOW *win) { return getbkgd(win); }
jpayne@69 230 #undef getbkgd
jpayne@69 231 #define getbkgd UNDEF(getbkgd)
jpayne@69 232 #endif
jpayne@69 233
jpayne@69 234 #ifdef getch
jpayne@69 235 inline int UNDEF(getch)() { return getch(); }
jpayne@69 236 #undef getch
jpayne@69 237 #define getch UNDEF(getch)
jpayne@69 238 #endif
jpayne@69 239
jpayne@69 240 #ifdef getmaxyx
jpayne@69 241 inline void UNDEF(getmaxyx)(WINDOW* win, int& y, int& x) { getmaxyx(win, y, x); }
jpayne@69 242 #undef getmaxyx
jpayne@69 243 #define getmaxyx UNDEF(getmaxyx)
jpayne@69 244 #endif
jpayne@69 245
jpayne@69 246 #ifdef getnstr
jpayne@69 247 inline int UNDEF(getnstr)(char *_str, int n) { return getnstr(_str, n); }
jpayne@69 248 #undef getnstr
jpayne@69 249 #define getnstr UNDEF(getnstr)
jpayne@69 250 #endif
jpayne@69 251
jpayne@69 252 #ifdef getparyx
jpayne@69 253 inline void UNDEF(getparyx)(WINDOW* win, int& y, int& x) { getparyx(win, y, x); }
jpayne@69 254 #undef getparyx
jpayne@69 255 #define getparyx UNDEF(getparyx)
jpayne@69 256 #endif
jpayne@69 257
jpayne@69 258 #ifdef getstr
jpayne@69 259 inline int UNDEF(getstr)(char *_str) { return getstr(_str); }
jpayne@69 260 #undef getstr
jpayne@69 261 #define getstr UNDEF(getstr)
jpayne@69 262 #endif
jpayne@69 263
jpayne@69 264 #ifdef getyx
jpayne@69 265 inline void UNDEF(getyx)(const WINDOW* win, int& y, int& x) {
jpayne@69 266 getyx(win, y, x); }
jpayne@69 267 #undef getyx
jpayne@69 268 #define getyx UNDEF(getyx)
jpayne@69 269 #endif
jpayne@69 270
jpayne@69 271 #ifdef hline
jpayne@69 272 inline int UNDEF(hline)(chtype ch, int n) { return hline(ch, n); }
jpayne@69 273 #undef hline
jpayne@69 274 #define hline UNDEF(hline)
jpayne@69 275 #endif
jpayne@69 276
jpayne@69 277 #ifdef inch
jpayne@69 278 inline chtype UNDEF(inch)() { return inch(); }
jpayne@69 279 #undef inch
jpayne@69 280 #define inch UNDEF(inch)
jpayne@69 281 #endif
jpayne@69 282
jpayne@69 283 #ifdef inchstr
jpayne@69 284 inline int UNDEF(inchstr)(chtype *str) { return inchstr(str); }
jpayne@69 285 #undef inchstr
jpayne@69 286 #define inchstr UNDEF(inchstr)
jpayne@69 287 #endif
jpayne@69 288
jpayne@69 289 #ifdef innstr
jpayne@69 290 inline int UNDEF(innstr)(char *_str, int n) { return innstr(_str, n); }
jpayne@69 291 #undef innstr
jpayne@69 292 #define innstr UNDEF(innstr)
jpayne@69 293 #endif
jpayne@69 294
jpayne@69 295 #ifdef insch
jpayne@69 296 inline int UNDEF(insch)(chtype c) { return insch(c); }
jpayne@69 297 #undef insch
jpayne@69 298 #define insch UNDEF(insch)
jpayne@69 299 #endif
jpayne@69 300
jpayne@69 301 #ifdef insdelln
jpayne@69 302 inline int UNDEF(insdelln)(int n) { return insdelln(n); }
jpayne@69 303 #undef insdelln
jpayne@69 304 #define insdelln UNDEF(insdelln)
jpayne@69 305 #endif
jpayne@69 306
jpayne@69 307 #ifdef insertln
jpayne@69 308 inline int UNDEF(insertln)() { return insertln(); }
jpayne@69 309 #undef insertln
jpayne@69 310 #define insertln UNDEF(insertln)
jpayne@69 311 #endif
jpayne@69 312
jpayne@69 313 #ifdef insnstr
jpayne@69 314 inline int UNDEF(insnstr)(const char *_str, int n) {
jpayne@69 315 return insnstr(_str, n); }
jpayne@69 316 #undef insnstr
jpayne@69 317 #define insnstr UNDEF(insnstr)
jpayne@69 318 #endif
jpayne@69 319
jpayne@69 320 #ifdef insstr
jpayne@69 321 inline int UNDEF(insstr)(const char *_str) {
jpayne@69 322 return insstr(_str); }
jpayne@69 323 #undef insstr
jpayne@69 324 #define insstr UNDEF(insstr)
jpayne@69 325 #endif
jpayne@69 326
jpayne@69 327 #ifdef instr
jpayne@69 328 inline int UNDEF(instr)(char *_str) { return instr(_str); }
jpayne@69 329 #undef instr
jpayne@69 330 #define instr UNDEF(instr)
jpayne@69 331 #endif
jpayne@69 332
jpayne@69 333 #ifdef intrflush
jpayne@69 334 inline void UNDEF(intrflush)(WINDOW *win, bool bf) { intrflush(); }
jpayne@69 335 #undef intrflush
jpayne@69 336 #define intrflush UNDEF(intrflush)
jpayne@69 337 #endif
jpayne@69 338
jpayne@69 339 #ifdef is_linetouched
jpayne@69 340 inline int UNDEF(is_linetouched)(WINDOW *w, int l) { return is_linetouched(w,l); }
jpayne@69 341 #undef is_linetouched
jpayne@69 342 #define is_linetouched UNDEF(is_linetouched)
jpayne@69 343 #endif
jpayne@69 344
jpayne@69 345 #ifdef leaveok
jpayne@69 346 inline int UNDEF(leaveok)(WINDOW* win, bool bf) { return leaveok(win, bf); }
jpayne@69 347 #undef leaveok
jpayne@69 348 #define leaveok UNDEF(leaveok)
jpayne@69 349 #else
jpayne@69 350 extern "C" NCURSES_IMPEXP int NCURSES_API leaveok(WINDOW* win, bool bf);
jpayne@69 351 #endif
jpayne@69 352
jpayne@69 353 #ifdef move
jpayne@69 354 inline int UNDEF(move)(int x, int y) { return move(x, y); }
jpayne@69 355 #undef move
jpayne@69 356 #define move UNDEF(move)
jpayne@69 357 #endif
jpayne@69 358
jpayne@69 359 #ifdef mvaddch
jpayne@69 360 inline int UNDEF(mvaddch)(int y, int x, chtype ch)
jpayne@69 361 { return mvaddch(y, x, ch); }
jpayne@69 362 #undef mvaddch
jpayne@69 363 #define mvaddch UNDEF(mvaddch)
jpayne@69 364 #endif
jpayne@69 365
jpayne@69 366 #ifdef mvaddnstr
jpayne@69 367 inline int UNDEF(mvaddnstr)(int y, int x, const char *str, int n)
jpayne@69 368 { return mvaddnstr(y, x, str, n); }
jpayne@69 369 #undef mvaddnstr
jpayne@69 370 #define mvaddnstr UNDEF(mvaddnstr)
jpayne@69 371 #endif
jpayne@69 372
jpayne@69 373 #ifdef mvaddstr
jpayne@69 374 inline int UNDEF(mvaddstr)(int y, int x, const char * str)
jpayne@69 375 { return mvaddstr(y, x, str); }
jpayne@69 376 #undef mvaddstr
jpayne@69 377 #define mvaddstr UNDEF(mvaddstr)
jpayne@69 378 #endif
jpayne@69 379
jpayne@69 380 #ifdef mvchgat
jpayne@69 381 inline int UNDEF(mvchgat)(int y, int x, int n,
jpayne@69 382 attr_t attr, NCURSES_PAIRS_T color, const void *opts) {
jpayne@69 383 return mvchgat(y, x, n, attr, color, opts); }
jpayne@69 384 #undef mvchgat
jpayne@69 385 #define mvchgat UNDEF(mvchgat)
jpayne@69 386 #endif
jpayne@69 387
jpayne@69 388 #ifdef mvdelch
jpayne@69 389 inline int UNDEF(mvdelch)(int y, int x) { return mvdelch(y, x);}
jpayne@69 390 #undef mvdelch
jpayne@69 391 #define mvdelch UNDEF(mvdelch)
jpayne@69 392 #endif
jpayne@69 393
jpayne@69 394 #ifdef mvgetch
jpayne@69 395 inline int UNDEF(mvgetch)(int y, int x) { return mvgetch(y, x);}
jpayne@69 396 #undef mvgetch
jpayne@69 397 #define mvgetch UNDEF(mvgetch)
jpayne@69 398 #endif
jpayne@69 399
jpayne@69 400 #ifdef mvgetnstr
jpayne@69 401 inline int UNDEF(mvgetnstr)(int y, int x, char *str, int n) {
jpayne@69 402 return mvgetnstr(y, x, str, n);}
jpayne@69 403 #undef mvgetnstr
jpayne@69 404 #define mvgetnstr UNDEF(mvgetnstr)
jpayne@69 405 #endif
jpayne@69 406
jpayne@69 407 #ifdef mvgetstr
jpayne@69 408 inline int UNDEF(mvgetstr)(int y, int x, char *str) {return mvgetstr(y, x, str);}
jpayne@69 409 #undef mvgetstr
jpayne@69 410 #define mvgetstr UNDEF(mvgetstr)
jpayne@69 411 #endif
jpayne@69 412
jpayne@69 413 #ifdef mvinch
jpayne@69 414 inline chtype UNDEF(mvinch)(int y, int x) { return mvinch(y, x);}
jpayne@69 415 #undef mvinch
jpayne@69 416 #define mvinch UNDEF(mvinch)
jpayne@69 417 #endif
jpayne@69 418
jpayne@69 419 #ifdef mvinnstr
jpayne@69 420 inline int UNDEF(mvinnstr)(int y, int x, char *_str, int n) {
jpayne@69 421 return mvinnstr(y, x, _str, n); }
jpayne@69 422 #undef mvinnstr
jpayne@69 423 #define mvinnstr UNDEF(mvinnstr)
jpayne@69 424 #endif
jpayne@69 425
jpayne@69 426 #ifdef mvinsch
jpayne@69 427 inline int UNDEF(mvinsch)(int y, int x, chtype c)
jpayne@69 428 { return mvinsch(y, x, c); }
jpayne@69 429 #undef mvinsch
jpayne@69 430 #define mvinsch UNDEF(mvinsch)
jpayne@69 431 #endif
jpayne@69 432
jpayne@69 433 #ifdef mvinsnstr
jpayne@69 434 inline int UNDEF(mvinsnstr)(int y, int x, const char *_str, int n) {
jpayne@69 435 return mvinsnstr(y, x, _str, n); }
jpayne@69 436 #undef mvinsnstr
jpayne@69 437 #define mvinsnstr UNDEF(mvinsnstr)
jpayne@69 438 #endif
jpayne@69 439
jpayne@69 440 #ifdef mvinsstr
jpayne@69 441 inline int UNDEF(mvinsstr)(int y, int x, const char *_str) {
jpayne@69 442 return mvinsstr(y, x, _str); }
jpayne@69 443 #undef mvinsstr
jpayne@69 444 #define mvinsstr UNDEF(mvinsstr)
jpayne@69 445 #endif
jpayne@69 446
jpayne@69 447 #ifdef mvwaddch
jpayne@69 448 inline int UNDEF(mvwaddch)(WINDOW *win, int y, int x, const chtype ch)
jpayne@69 449 { return mvwaddch(win, y, x, ch); }
jpayne@69 450 #undef mvwaddch
jpayne@69 451 #define mvwaddch UNDEF(mvwaddch)
jpayne@69 452 #endif
jpayne@69 453
jpayne@69 454 #ifdef mvwaddchnstr
jpayne@69 455 inline int UNDEF(mvwaddchnstr)(WINDOW *win, int y, int x, const chtype *str, int n)
jpayne@69 456 { return mvwaddchnstr(win, y, x, str, n); }
jpayne@69 457 #undef mvwaddchnstr
jpayne@69 458 #define mvwaddchnstr UNDEF(mvwaddchnstr)
jpayne@69 459 #endif
jpayne@69 460
jpayne@69 461 #ifdef mvwaddchstr
jpayne@69 462 inline int UNDEF(mvwaddchstr)(WINDOW *win, int y, int x, const chtype *str)
jpayne@69 463 { return mvwaddchstr(win, y, x, str); }
jpayne@69 464 #undef mvwaddchstr
jpayne@69 465 #define mvwaddchstr UNDEF(mvwaddchstr)
jpayne@69 466 #endif
jpayne@69 467
jpayne@69 468 #ifdef mvwaddnstr
jpayne@69 469 inline int UNDEF(mvwaddnstr)(WINDOW *win, int y, int x, const char *str, int n)
jpayne@69 470 { return mvwaddnstr(win, y, x, str, n); }
jpayne@69 471 #undef mvwaddnstr
jpayne@69 472 #define mvwaddnstr UNDEF(mvwaddnstr)
jpayne@69 473 #endif
jpayne@69 474
jpayne@69 475 #ifdef mvwaddstr
jpayne@69 476 inline int UNDEF(mvwaddstr)(WINDOW *win, int y, int x, const char * str)
jpayne@69 477 { return mvwaddstr(win, y, x, str); }
jpayne@69 478 #undef mvwaddstr
jpayne@69 479 #define mvwaddstr UNDEF(mvwaddstr)
jpayne@69 480 #endif
jpayne@69 481
jpayne@69 482 #ifdef mvwchgat
jpayne@69 483 inline int UNDEF(mvwchgat)(WINDOW *win, int y, int x, int n,
jpayne@69 484 attr_t attr, NCURSES_PAIRS_T color, const void *opts) {
jpayne@69 485 return mvwchgat(win, y, x, n, attr, color, opts); }
jpayne@69 486 #undef mvwchgat
jpayne@69 487 #define mvwchgat UNDEF(mvwchgat)
jpayne@69 488 #endif
jpayne@69 489
jpayne@69 490 #ifdef mvwdelch
jpayne@69 491 inline int UNDEF(mvwdelch)(WINDOW *win, int y, int x)
jpayne@69 492 { return mvwdelch(win, y, x); }
jpayne@69 493 #undef mvwdelch
jpayne@69 494 #define mvwdelch UNDEF(mvwdelch)
jpayne@69 495 #endif
jpayne@69 496
jpayne@69 497 #ifdef mvwgetch
jpayne@69 498 inline int UNDEF(mvwgetch)(WINDOW *win, int y, int x) { return mvwgetch(win, y, x);}
jpayne@69 499 #undef mvwgetch
jpayne@69 500 #define mvwgetch UNDEF(mvwgetch)
jpayne@69 501 #endif
jpayne@69 502
jpayne@69 503 #ifdef mvwgetnstr
jpayne@69 504 inline int UNDEF(mvwgetnstr)(WINDOW *win, int y, int x, char *str, int n)
jpayne@69 505 {return mvwgetnstr(win, y, x, str, n);}
jpayne@69 506 #undef mvwgetnstr
jpayne@69 507 #define mvwgetnstr UNDEF(mvwgetnstr)
jpayne@69 508 #endif
jpayne@69 509
jpayne@69 510 #ifdef mvwgetstr
jpayne@69 511 inline int UNDEF(mvwgetstr)(WINDOW *win, int y, int x, char *str)
jpayne@69 512 {return mvwgetstr(win, y, x, str);}
jpayne@69 513 #undef mvwgetstr
jpayne@69 514 #define mvwgetstr UNDEF(mvwgetstr)
jpayne@69 515 #endif
jpayne@69 516
jpayne@69 517 #ifdef mvwhline
jpayne@69 518 inline int UNDEF(mvwhline)(WINDOW *win, int y, int x, chtype c, int n) {
jpayne@69 519 return mvwhline(win, y, x, c, n); }
jpayne@69 520 #undef mvwhline
jpayne@69 521 #define mvwhline UNDEF(mvwhline)
jpayne@69 522 #endif
jpayne@69 523
jpayne@69 524 #ifdef mvwinch
jpayne@69 525 inline chtype UNDEF(mvwinch)(WINDOW *win, int y, int x) {
jpayne@69 526 return mvwinch(win, y, x);}
jpayne@69 527 #undef mvwinch
jpayne@69 528 #define mvwinch UNDEF(mvwinch)
jpayne@69 529 #endif
jpayne@69 530
jpayne@69 531 #ifdef mvwinchnstr
jpayne@69 532 inline int UNDEF(mvwinchnstr)(WINDOW *win, int y, int x, chtype *str, int n) { return mvwinchnstr(win, y, x, str, n); }
jpayne@69 533 #undef mvwinchnstr
jpayne@69 534 #define mvwinchnstr UNDEF(mvwinchnstr)
jpayne@69 535 #endif
jpayne@69 536
jpayne@69 537 #ifdef mvwinchstr
jpayne@69 538 inline int UNDEF(mvwinchstr)(WINDOW *win, int y, int x, chtype *str) { return mvwinchstr(win, y, x, str); }
jpayne@69 539 #undef mvwinchstr
jpayne@69 540 #define mvwinchstr UNDEF(mvwinchstr)
jpayne@69 541 #endif
jpayne@69 542
jpayne@69 543 #ifdef mvwinnstr
jpayne@69 544 inline int UNDEF(mvwinnstr)(WINDOW *win, int y, int x, char *_str, int n) {
jpayne@69 545 return mvwinnstr(win, y, x, _str, n); }
jpayne@69 546 #undef mvwinnstr
jpayne@69 547 #define mvwinnstr UNDEF(mvwinnstr)
jpayne@69 548 #endif
jpayne@69 549
jpayne@69 550 #ifdef mvwinsch
jpayne@69 551 inline int UNDEF(mvwinsch)(WINDOW *win, int y, int x, chtype c)
jpayne@69 552 { return mvwinsch(win, y, x, c); }
jpayne@69 553 #undef mvwinsch
jpayne@69 554 #define mvwinsch UNDEF(mvwinsch)
jpayne@69 555 #endif
jpayne@69 556
jpayne@69 557 #ifdef mvwinsnstr
jpayne@69 558 inline int UNDEF(mvwinsnstr)(WINDOW *w, int y, int x, const char *_str, int n) {
jpayne@69 559 return mvwinsnstr(w, y, x, _str, n); }
jpayne@69 560 #undef mvwinsnstr
jpayne@69 561 #define mvwinsnstr UNDEF(mvwinsnstr)
jpayne@69 562 #endif
jpayne@69 563
jpayne@69 564 #ifdef mvwinsstr
jpayne@69 565 inline int UNDEF(mvwinsstr)(WINDOW *w, int y, int x, const char *_str) {
jpayne@69 566 return mvwinsstr(w, y, x, _str); }
jpayne@69 567 #undef mvwinsstr
jpayne@69 568 #define mvwinsstr UNDEF(mvwinsstr)
jpayne@69 569 #endif
jpayne@69 570
jpayne@69 571 #ifdef mvwvline
jpayne@69 572 inline int UNDEF(mvwvline)(WINDOW *win, int y, int x, chtype c, int n) {
jpayne@69 573 return mvwvline(win, y, x, c, n); }
jpayne@69 574 #undef mvwvline
jpayne@69 575 #define mvwvline UNDEF(mvwvline)
jpayne@69 576 #endif
jpayne@69 577
jpayne@69 578 #ifdef napms
jpayne@69 579 inline void UNDEF(napms)(unsigned long x) { napms(x); }
jpayne@69 580 #undef napms
jpayne@69 581 #define napms UNDEF(napms)
jpayne@69 582 #endif
jpayne@69 583
jpayne@69 584 #ifdef nocrmode
jpayne@69 585 inline int UNDEF(nocrmode)(void) { return nocrmode(); }
jpayne@69 586 #undef nocrmode
jpayne@69 587 #define nocrmode UNDEF(nocrmode)
jpayne@69 588 #endif
jpayne@69 589
jpayne@69 590 #ifdef nodelay
jpayne@69 591 inline void UNDEF(nodelay)() { nodelay(); }
jpayne@69 592 #undef nodelay
jpayne@69 593 #define nodelay UNDEF(nodelay)
jpayne@69 594 #endif
jpayne@69 595
jpayne@69 596 #ifdef redrawwin
jpayne@69 597 inline int UNDEF(redrawwin)(WINDOW *win) { return redrawwin(win); }
jpayne@69 598 #undef redrawwin
jpayne@69 599 #define redrawwin UNDEF(redrawwin)
jpayne@69 600 #endif
jpayne@69 601
jpayne@69 602 #ifdef refresh
jpayne@69 603 inline int UNDEF(refresh)() { return refresh(); }
jpayne@69 604 #undef refresh
jpayne@69 605 #define refresh UNDEF(refresh)
jpayne@69 606 #endif
jpayne@69 607
jpayne@69 608 #ifdef resetterm
jpayne@69 609 inline int UNDEF(resetterm)(void) { return resetterm(); }
jpayne@69 610 #undef resetterm
jpayne@69 611 #define resetterm UNDEF(resetterm)
jpayne@69 612 #endif
jpayne@69 613
jpayne@69 614 #ifdef saveterm
jpayne@69 615 inline int UNDEF(saveterm)(void) { return saveterm(); }
jpayne@69 616 #undef saveterm
jpayne@69 617 #define saveterm UNDEF(saveterm)
jpayne@69 618 #endif
jpayne@69 619
jpayne@69 620 #ifdef scrl
jpayne@69 621 inline int UNDEF(scrl)(int l) { return scrl(l); }
jpayne@69 622 #undef scrl
jpayne@69 623 #define scrl UNDEF(scrl)
jpayne@69 624 #endif
jpayne@69 625
jpayne@69 626 #ifdef scroll
jpayne@69 627 inline int UNDEF(scroll)(WINDOW *win) { return scroll(win); }
jpayne@69 628 #undef scroll
jpayne@69 629 #define scroll UNDEF(scroll)
jpayne@69 630 #endif
jpayne@69 631
jpayne@69 632 #ifdef scrollok
jpayne@69 633 inline int UNDEF(scrollok)(WINDOW* win, bool bf) { return scrollok(win, bf); }
jpayne@69 634 #undef scrollok
jpayne@69 635 #define scrollok UNDEF(scrollok)
jpayne@69 636 #else
jpayne@69 637 #if defined(__NCURSES_H)
jpayne@69 638 extern "C" NCURSES_IMPEXP int NCURSES_API scrollok(WINDOW*, bool);
jpayne@69 639 #else
jpayne@69 640 extern "C" NCURSES_IMPEXP int NCURSES_API scrollok(WINDOW*, char);
jpayne@69 641 #endif
jpayne@69 642 #endif
jpayne@69 643
jpayne@69 644 #ifdef setscrreg
jpayne@69 645 inline int UNDEF(setscrreg)(int t, int b) { return setscrreg(t, b); }
jpayne@69 646 #undef setscrreg
jpayne@69 647 #define setscrreg UNDEF(setscrreg)
jpayne@69 648 #endif
jpayne@69 649
jpayne@69 650 #ifdef standend
jpayne@69 651 inline int UNDEF(standend)() { return standend(); }
jpayne@69 652 #undef standend
jpayne@69 653 #define standend UNDEF(standend)
jpayne@69 654 #endif
jpayne@69 655
jpayne@69 656 #ifdef standout
jpayne@69 657 inline int UNDEF(standout)() { return standout(); }
jpayne@69 658 #undef standout
jpayne@69 659 #define standout UNDEF(standout)
jpayne@69 660 #endif
jpayne@69 661
jpayne@69 662 #ifdef subpad
jpayne@69 663 inline WINDOW *UNDEF(subpad)(WINDOW *p, int l, int c, int y, int x)
jpayne@69 664 { return derwin(p, l, c, y, x); }
jpayne@69 665 #undef subpad
jpayne@69 666 #define subpad UNDEF(subpad)
jpayne@69 667 #endif
jpayne@69 668
jpayne@69 669 #ifdef timeout
jpayne@69 670 inline void UNDEF(timeout)(int delay) { timeout(delay); }
jpayne@69 671 #undef timeout
jpayne@69 672 #define timeout UNDEF(timeout)
jpayne@69 673 #endif
jpayne@69 674
jpayne@69 675 #ifdef touchline
jpayne@69 676 inline int UNDEF(touchline)(WINDOW *win, int s, int c)
jpayne@69 677 { return touchline(win, s, c); }
jpayne@69 678 #undef touchline
jpayne@69 679 #define touchline UNDEF(touchline)
jpayne@69 680 #endif
jpayne@69 681
jpayne@69 682 #ifdef touchwin
jpayne@69 683 inline int UNDEF(touchwin)(WINDOW *win) { return touchwin(win); }
jpayne@69 684 #undef touchwin
jpayne@69 685 #define touchwin UNDEF(touchwin)
jpayne@69 686 #endif
jpayne@69 687
jpayne@69 688 #ifdef untouchwin
jpayne@69 689 inline int UNDEF(untouchwin)(WINDOW *win) { return untouchwin(win); }
jpayne@69 690 #undef untouchwin
jpayne@69 691 #define untouchwin UNDEF(untouchwin)
jpayne@69 692 #endif
jpayne@69 693
jpayne@69 694 #ifdef vline
jpayne@69 695 inline int UNDEF(vline)(chtype ch, int n) { return vline(ch, n); }
jpayne@69 696 #undef vline
jpayne@69 697 #define vline UNDEF(vline)
jpayne@69 698 #endif
jpayne@69 699
jpayne@69 700 #ifdef waddchstr
jpayne@69 701 inline int UNDEF(waddchstr)(WINDOW *win, chtype *at) { return waddchstr(win, at); }
jpayne@69 702 #undef waddchstr
jpayne@69 703 #define waddchstr UNDEF(waddchstr)
jpayne@69 704 #endif
jpayne@69 705
jpayne@69 706 #ifdef waddstr
jpayne@69 707 inline int UNDEF(waddstr)(WINDOW *win, char *str) { return waddstr(win, str); }
jpayne@69 708 #undef waddstr
jpayne@69 709 #define waddstr UNDEF(waddstr)
jpayne@69 710 #endif
jpayne@69 711
jpayne@69 712 #ifdef wattroff
jpayne@69 713 inline int UNDEF(wattroff)(WINDOW *win, int att) { return wattroff(win, att); }
jpayne@69 714 #undef wattroff
jpayne@69 715 #define wattroff UNDEF(wattroff)
jpayne@69 716 #endif
jpayne@69 717
jpayne@69 718 #ifdef wattrset
jpayne@69 719 inline int UNDEF(wattrset)(WINDOW *win, int att) { return wattrset(win, att); }
jpayne@69 720 #undef wattrset
jpayne@69 721 #define wattrset UNDEF(wattrset)
jpayne@69 722 #endif
jpayne@69 723
jpayne@69 724 #ifdef winch
jpayne@69 725 inline chtype UNDEF(winch)(const WINDOW* win) { return winch(win); }
jpayne@69 726 #undef winch
jpayne@69 727 #define winch UNDEF(winch)
jpayne@69 728 #endif
jpayne@69 729
jpayne@69 730 #ifdef winchnstr
jpayne@69 731 inline int UNDEF(winchnstr)(WINDOW *win, chtype *str, int n) { return winchnstr(win, str, n); }
jpayne@69 732 #undef winchnstr
jpayne@69 733 #define winchnstr UNDEF(winchnstr)
jpayne@69 734 #endif
jpayne@69 735
jpayne@69 736 #ifdef winchstr
jpayne@69 737 inline int UNDEF(winchstr)(WINDOW *win, chtype *str) { return winchstr(win, str); }
jpayne@69 738 #undef winchstr
jpayne@69 739 #define winchstr UNDEF(winchstr)
jpayne@69 740 #endif
jpayne@69 741
jpayne@69 742 #ifdef winsstr
jpayne@69 743 inline int UNDEF(winsstr)(WINDOW *w, const char *_str) {
jpayne@69 744 return winsstr(w, _str); }
jpayne@69 745 #undef winsstr
jpayne@69 746 #define winsstr UNDEF(winsstr)
jpayne@69 747 #endif
jpayne@69 748
jpayne@69 749 #ifdef wstandend
jpayne@69 750 inline int UNDEF(wstandend)(WINDOW *win) { return wstandend(win); }
jpayne@69 751 #undef wstandend
jpayne@69 752 #define wstandend UNDEF(wstandend)
jpayne@69 753 #endif
jpayne@69 754
jpayne@69 755 #ifdef wstandout
jpayne@69 756 inline int UNDEF(wstandout)(WINDOW *win) { return wstandout(win); }
jpayne@69 757 #undef wstandout
jpayne@69 758 #define wstandout UNDEF(wstandout)
jpayne@69 759 #endif
jpayne@69 760
jpayne@69 761 /*
jpayne@69 762 *
jpayne@69 763 * C++ class for windows.
jpayne@69 764 *
jpayne@69 765 */
jpayne@69 766
jpayne@69 767 extern "C" int _nc_ripoffline(int, int (*init)(WINDOW*, int));
jpayne@69 768 extern "C" int _nc_xx_ripoff_init(WINDOW *, int);
jpayne@69 769 extern "C" int _nc_has_mouse(void);
jpayne@69 770
jpayne@69 771 class NCURSES_CXX_IMPEXP NCursesWindow
jpayne@69 772 {
jpayne@69 773 friend class NCursesMenu;
jpayne@69 774 friend class NCursesForm;
jpayne@69 775
jpayne@69 776 private:
jpayne@69 777 static bool b_initialized;
jpayne@69 778 static void initialize();
jpayne@69 779 void constructing();
jpayne@69 780 friend int _nc_xx_ripoff_init(WINDOW *, int);
jpayne@69 781
jpayne@69 782 void set_keyboard();
jpayne@69 783
jpayne@69 784 NCURSES_COLOR_T getcolor(int getback) const;
jpayne@69 785 NCURSES_PAIRS_T getPair() const;
jpayne@69 786
jpayne@69 787 static int setpalette(NCURSES_COLOR_T fore, NCURSES_COLOR_T back, NCURSES_PAIRS_T pair);
jpayne@69 788 static int colorInitialized;
jpayne@69 789
jpayne@69 790 // This private constructor is only used during the initialization
jpayne@69 791 // of windows generated by ripoffline() calls.
jpayne@69 792 NCursesWindow(WINDOW* win, int ncols);
jpayne@69 793
jpayne@69 794 protected:
jpayne@69 795 virtual void err_handler(const char *) const THROWS(NCursesException);
jpayne@69 796 // Signal an error with the given message text.
jpayne@69 797
jpayne@69 798 static long count; // count of all active windows:
jpayne@69 799 // We rely on the c++ promise that
jpayne@69 800 // all otherwise uninitialized
jpayne@69 801 // static class vars are set to 0
jpayne@69 802
jpayne@69 803 WINDOW* w; // the curses WINDOW
jpayne@69 804
jpayne@69 805 bool alloced; // TRUE if we own the WINDOW
jpayne@69 806
jpayne@69 807 NCursesWindow* par; // parent, if subwindow
jpayne@69 808 NCursesWindow* subwins; // head of subwindows list
jpayne@69 809 NCursesWindow* sib; // next subwindow of parent
jpayne@69 810
jpayne@69 811 void kill_subwindows(); // disable all subwindows
jpayne@69 812 // Destroy all subwindows.
jpayne@69 813
jpayne@69 814 /* Only for use by derived classes. They are then in charge to
jpayne@69 815 fill the member variables correctly. */
jpayne@69 816 NCursesWindow();
jpayne@69 817
jpayne@69 818 public:
jpayne@69 819 explicit NCursesWindow(WINDOW* window); // useful only for stdscr
jpayne@69 820
jpayne@69 821 NCursesWindow(int nlines, // number of lines
jpayne@69 822 int ncols, // number of columns
jpayne@69 823 int begin_y, // line origin
jpayne@69 824 int begin_x); // col origin
jpayne@69 825
jpayne@69 826 NCursesWindow(NCursesWindow& par,// parent window
jpayne@69 827 int nlines, // number of lines
jpayne@69 828 int ncols, // number of columns
jpayne@69 829 int begin_y, // absolute or relative
jpayne@69 830 int begin_x, // origins:
jpayne@69 831 char absrel = 'a');// if `a', begin_y & begin_x are
jpayne@69 832 // absolute screen pos, else if `r', they are relative to par origin
jpayne@69 833
jpayne@69 834 NCursesWindow(NCursesWindow& par,// parent window
jpayne@69 835 bool do_box = TRUE);
jpayne@69 836 // this is the very common case that we want to create the subwindow that
jpayne@69 837 // is two lines and two columns smaller and begins at (1,1).
jpayne@69 838 // We may automatically request the box around it.
jpayne@69 839
jpayne@69 840 NCursesWindow& operator=(const NCursesWindow& rhs)
jpayne@69 841 {
jpayne@69 842 if (this != &rhs)
jpayne@69 843 *this = rhs;
jpayne@69 844 return *this;
jpayne@69 845 }
jpayne@69 846
jpayne@69 847 NCursesWindow(const NCursesWindow& rhs)
jpayne@69 848 : w(rhs.w), alloced(rhs.alloced), par(rhs.par), subwins(rhs.subwins), sib(rhs.sib)
jpayne@69 849 {
jpayne@69 850 }
jpayne@69 851
jpayne@69 852 virtual ~NCursesWindow() THROWS(NCursesException);
jpayne@69 853
jpayne@69 854 NCursesWindow Clone();
jpayne@69 855 // Make an exact copy of the window.
jpayne@69 856
jpayne@69 857 // Initialization.
jpayne@69 858 static void useColors(void);
jpayne@69 859 // Call this routine very early if you want to have colors.
jpayne@69 860
jpayne@69 861 static int ripoffline(int ripoff_lines,
jpayne@69 862 int (*init)(NCursesWindow& win));
jpayne@69 863 // This function is used to generate a window of ripped-of lines.
jpayne@69 864 // If the argument is positive, lines are removed from the top, if it
jpayne@69 865 // is negative lines are removed from the bottom. This enhances the
jpayne@69 866 // lowlevel ripoffline() function because it uses the internal
jpayne@69 867 // implementation that allows to remove more than just a single line.
jpayne@69 868 // This function must be called before any other ncurses function. The
jpayne@69 869 // creation of the window is deferred until ncurses gets initialized.
jpayne@69 870 // The initialization function is then called.
jpayne@69 871
jpayne@69 872 // -------------------------------------------------------------------------
jpayne@69 873 // terminal status
jpayne@69 874 // -------------------------------------------------------------------------
jpayne@69 875 int lines() const { initialize(); return LINES; }
jpayne@69 876 // Number of lines on terminal, *not* window
jpayne@69 877
jpayne@69 878 int cols() const { initialize(); return COLS; }
jpayne@69 879 // Number of cols on terminal, *not* window
jpayne@69 880
jpayne@69 881 int tabsize() const { initialize(); return TABSIZE; }
jpayne@69 882 // Size of a tab on terminal, *not* window
jpayne@69 883
jpayne@69 884 static int NumberOfColors();
jpayne@69 885 // Number of available colors
jpayne@69 886
jpayne@69 887 int colors() const { return NumberOfColors(); }
jpayne@69 888 // Number of available colors
jpayne@69 889
jpayne@69 890 // -------------------------------------------------------------------------
jpayne@69 891 // window status
jpayne@69 892 // -------------------------------------------------------------------------
jpayne@69 893 int height() const { return maxy() + 1; }
jpayne@69 894 // Number of lines in this window
jpayne@69 895
jpayne@69 896 int width() const { return maxx() + 1; }
jpayne@69 897 // Number of columns in this window
jpayne@69 898
jpayne@69 899 int begx() const { return getbegx(w); }
jpayne@69 900 // Column of top left corner relative to stdscr
jpayne@69 901
jpayne@69 902 int begy() const { return getbegy(w); }
jpayne@69 903 // Line of top left corner relative to stdscr
jpayne@69 904
jpayne@69 905 int curx() const { return getcurx(w); }
jpayne@69 906 // Column of top left corner relative to stdscr
jpayne@69 907
jpayne@69 908 int cury() const { return getcury(w); }
jpayne@69 909 // Line of top left corner relative to stdscr
jpayne@69 910
jpayne@69 911 int maxx() const { return getmaxx(w) == ERR ? ERR : getmaxx(w)-1; }
jpayne@69 912 // Largest x coord in window
jpayne@69 913
jpayne@69 914 int maxy() const { return getmaxy(w) == ERR ? ERR : getmaxy(w)-1; }
jpayne@69 915 // Largest y coord in window
jpayne@69 916
jpayne@69 917 NCURSES_PAIRS_T getcolor() const;
jpayne@69 918 // Actual color pair
jpayne@69 919
jpayne@69 920 NCURSES_COLOR_T foreground() const { return getcolor(0); }
jpayne@69 921 // Actual foreground color
jpayne@69 922
jpayne@69 923 NCURSES_COLOR_T background() const { return getcolor(1); }
jpayne@69 924 // Actual background color
jpayne@69 925
jpayne@69 926 int setpalette(NCURSES_COLOR_T fore, NCURSES_COLOR_T back);
jpayne@69 927 // Set color palette entry
jpayne@69 928
jpayne@69 929 int setcolor(NCURSES_PAIRS_T pair);
jpayne@69 930 // Set actually used palette entry
jpayne@69 931
jpayne@69 932 // -------------------------------------------------------------------------
jpayne@69 933 // window positioning
jpayne@69 934 // -------------------------------------------------------------------------
jpayne@69 935 virtual int mvwin(int begin_y, int begin_x) {
jpayne@69 936 return ::mvwin(w, begin_y, begin_x); }
jpayne@69 937 // Move window to new position with the new position as top left corner.
jpayne@69 938 // This is virtual because it is redefined in NCursesPanel.
jpayne@69 939
jpayne@69 940 // -------------------------------------------------------------------------
jpayne@69 941 // coordinate positioning
jpayne@69 942 // -------------------------------------------------------------------------
jpayne@69 943 int move(int y, int x) { return ::wmove(w, y, x); }
jpayne@69 944 // Move cursor the this position
jpayne@69 945
jpayne@69 946 void getyx(int& y, int& x) const { ::getyx(w, y, x); }
jpayne@69 947 // Get current position of the cursor
jpayne@69 948
jpayne@69 949 void getbegyx(int& y, int& x) const { ::getbegyx(w, y, x); }
jpayne@69 950 // Get beginning of the window
jpayne@69 951
jpayne@69 952 void getmaxyx(int& y, int& x) const { ::getmaxyx(w, y, x); }
jpayne@69 953 // Get size of the window
jpayne@69 954
jpayne@69 955 void getparyx(int& y, int& x) const { ::getparyx(w, y, x); }
jpayne@69 956 // Get parent's beginning of the window
jpayne@69 957
jpayne@69 958 int mvcur(int oldrow, int oldcol, int newrow, int newcol) const {
jpayne@69 959 return ::mvcur(oldrow, oldcol, newrow, newcol); }
jpayne@69 960 // Perform lowlevel cursor motion that takes effect immediately.
jpayne@69 961
jpayne@69 962 // -------------------------------------------------------------------------
jpayne@69 963 // input
jpayne@69 964 // -------------------------------------------------------------------------
jpayne@69 965 int getch() { return ::wgetch(w); }
jpayne@69 966 // Get a keystroke from the window.
jpayne@69 967
jpayne@69 968 int getch(int y, int x) { return ::mvwgetch(w, y, x); }
jpayne@69 969 // Move cursor to position and get a keystroke from the window
jpayne@69 970
jpayne@69 971 int getstr(char* str, int n=-1) {
jpayne@69 972 return ::wgetnstr(w, str, n); }
jpayne@69 973 // Read a series of characters into str until a newline or carriage return
jpayne@69 974 // is received. Read at most n characters. If n is negative, the limit is
jpayne@69 975 // ignored.
jpayne@69 976
jpayne@69 977 int getstr(int y, int x, char* str, int n=-1) {
jpayne@69 978 return ::mvwgetnstr(w, y, x, str, n); }
jpayne@69 979 // Move the cursor to the requested position and then perform the getstr()
jpayne@69 980 // as described above.
jpayne@69 981
jpayne@69 982 int instr(char *s, int n=-1) { return ::winnstr(w, s, n); }
jpayne@69 983 // Get a string of characters from the window into the buffer s. Retrieve
jpayne@69 984 // at most n characters, if n is negative retrieve all characters up to the
jpayne@69 985 // end of the current line. Attributes are stripped from the characters.
jpayne@69 986
jpayne@69 987 int instr(int y, int x, char *s, int n=-1) {
jpayne@69 988 return ::mvwinnstr(w, y, x, s, n); }
jpayne@69 989 // Move the cursor to the requested position and then perform the instr()
jpayne@69 990 // as described above.
jpayne@69 991
jpayne@69 992 int scanw(const char* fmt, ...)
jpayne@69 993 // Perform a scanw function from the window.
jpayne@69 994 #if __GNUG__ >= 2
jpayne@69 995 __attribute__ ((format (scanf, 2, 3)));
jpayne@69 996 #else
jpayne@69 997 ;
jpayne@69 998 #endif
jpayne@69 999
jpayne@69 1000 int scanw(const char*, va_list);
jpayne@69 1001 // Perform a scanw function from the window.
jpayne@69 1002
jpayne@69 1003 int scanw(int y, int x, const char* fmt, ...)
jpayne@69 1004 // Move the cursor to the requested position and then perform a scanw
jpayne@69 1005 // from the window.
jpayne@69 1006 #if __GNUG__ >= 2
jpayne@69 1007 __attribute__ ((format (scanf, 4, 5)));
jpayne@69 1008 #else
jpayne@69 1009 ;
jpayne@69 1010 #endif
jpayne@69 1011
jpayne@69 1012 int scanw(int y, int x, const char* fmt, va_list);
jpayne@69 1013 // Move the cursor to the requested position and then perform a scanw
jpayne@69 1014 // from the window.
jpayne@69 1015
jpayne@69 1016 // -------------------------------------------------------------------------
jpayne@69 1017 // output
jpayne@69 1018 // -------------------------------------------------------------------------
jpayne@69 1019 int addch(const chtype ch) { return ::waddch(w, ch); }
jpayne@69 1020 // Put attributed character to the window.
jpayne@69 1021
jpayne@69 1022 int addch(int y, int x, const chtype ch) {
jpayne@69 1023 return ::mvwaddch(w, y, x, ch); }
jpayne@69 1024 // Move cursor to the requested position and then put attributed character
jpayne@69 1025 // to the window.
jpayne@69 1026
jpayne@69 1027 int echochar(const chtype ch) { return ::wechochar(w, ch); }
jpayne@69 1028 // Put attributed character to the window and refresh it immediately.
jpayne@69 1029
jpayne@69 1030 int addstr(const char* str, int n=-1) {
jpayne@69 1031 return ::waddnstr(w, str, n); }
jpayne@69 1032 // Write the string str to the window, stop writing if the terminating
jpayne@69 1033 // NUL or the limit n is reached. If n is negative, it is ignored.
jpayne@69 1034
jpayne@69 1035 int addstr(int y, int x, const char * str, int n=-1) {
jpayne@69 1036 return ::mvwaddnstr(w, y, x, str, n); }
jpayne@69 1037 // Move the cursor to the requested position and then perform the addchstr
jpayne@69 1038 // as described above.
jpayne@69 1039
jpayne@69 1040 int addchstr(const chtype* str, int n=-1) {
jpayne@69 1041 return ::waddchnstr(w, str, n); }
jpayne@69 1042 // Write the string str to the window, stop writing if the terminating
jpayne@69 1043 // NUL or the limit n is reached. If n is negative, it is ignored.
jpayne@69 1044
jpayne@69 1045 int addchstr(int y, int x, const chtype * str, int n=-1) {
jpayne@69 1046 return ::mvwaddchnstr(w, y, x, str, n); }
jpayne@69 1047 // Move the cursor to the requested position and then perform the addchstr
jpayne@69 1048 // as described above.
jpayne@69 1049
jpayne@69 1050 int printw(const char* fmt, ...)
jpayne@69 1051 // Do a formatted print to the window.
jpayne@69 1052 #if (__GNUG__ >= 2) && !defined(printf)
jpayne@69 1053 __attribute__ ((format (printf, 2, 3)));
jpayne@69 1054 #else
jpayne@69 1055 ;
jpayne@69 1056 #endif
jpayne@69 1057
jpayne@69 1058 int printw(int y, int x, const char * fmt, ...)
jpayne@69 1059 // Move the cursor and then do a formatted print to the window.
jpayne@69 1060 #if (__GNUG__ >= 2) && !defined(printf)
jpayne@69 1061 __attribute__ ((format (printf, 4, 5)));
jpayne@69 1062 #else
jpayne@69 1063 ;
jpayne@69 1064 #endif
jpayne@69 1065
jpayne@69 1066 int printw(const char* fmt, va_list args);
jpayne@69 1067 // Do a formatted print to the window.
jpayne@69 1068
jpayne@69 1069 int printw(int y, int x, const char * fmt, va_list args);
jpayne@69 1070 // Move the cursor and then do a formatted print to the window.
jpayne@69 1071
jpayne@69 1072 chtype inch() const { return ::winch(w); }
jpayne@69 1073 // Retrieve attributed character under the current cursor position.
jpayne@69 1074
jpayne@69 1075 chtype inch(int y, int x) { return ::mvwinch(w, y, x); }
jpayne@69 1076 // Move cursor to requested position and then retrieve attributed character
jpayne@69 1077 // at this position.
jpayne@69 1078
jpayne@69 1079 int inchstr(chtype* str, int n=-1) {
jpayne@69 1080 return ::winchnstr(w, str, n); }
jpayne@69 1081 // Read the string str from the window, stop reading if the terminating
jpayne@69 1082 // NUL or the limit n is reached. If n is negative, it is ignored.
jpayne@69 1083
jpayne@69 1084 int inchstr(int y, int x, chtype * str, int n=-1) {
jpayne@69 1085 return ::mvwinchnstr(w, y, x, str, n); }
jpayne@69 1086 // Move the cursor to the requested position and then perform the inchstr
jpayne@69 1087 // as described above.
jpayne@69 1088
jpayne@69 1089 int insch(chtype ch) { return ::winsch(w, ch); }
jpayne@69 1090 // Insert attributed character into the window before current cursor
jpayne@69 1091 // position.
jpayne@69 1092
jpayne@69 1093 int insch(int y, int x, chtype ch) {
jpayne@69 1094 return ::mvwinsch(w, y, x, ch); }
jpayne@69 1095 // Move cursor to requested position and then insert the attributed
jpayne@69 1096 // character before that position.
jpayne@69 1097
jpayne@69 1098 int insertln() { return ::winsdelln(w, 1); }
jpayne@69 1099 // Insert an empty line above the current line.
jpayne@69 1100
jpayne@69 1101 int insdelln(int n=1) { return ::winsdelln(w, n); }
jpayne@69 1102 // If n>0 insert that many lines above the current line. If n<0 delete
jpayne@69 1103 // that many lines beginning with the current line.
jpayne@69 1104
jpayne@69 1105 int insstr(const char *s, int n=-1) {
jpayne@69 1106 return ::winsnstr(w, s, n); }
jpayne@69 1107 // Insert the string into the window before the current cursor position.
jpayne@69 1108 // Insert stops at end of string or when the limit n is reached. If n is
jpayne@69 1109 // negative, it is ignored.
jpayne@69 1110
jpayne@69 1111 int insstr(int y, int x, const char *s, int n=-1) {
jpayne@69 1112 return ::mvwinsnstr(w, y, x, s, n); }
jpayne@69 1113 // Move the cursor to the requested position and then perform the insstr()
jpayne@69 1114 // as described above.
jpayne@69 1115
jpayne@69 1116 int attron (chtype at) { return ::wattron (w, at); }
jpayne@69 1117 // Switch on the window attributes;
jpayne@69 1118
jpayne@69 1119 int attroff(chtype at) { return ::wattroff(w, static_cast<int>(at)); }
jpayne@69 1120 // Switch off the window attributes;
jpayne@69 1121
jpayne@69 1122 int attrset(chtype at) { return ::wattrset(w, static_cast<int>(at)); }
jpayne@69 1123 // Set the window attributes;
jpayne@69 1124
jpayne@69 1125 chtype attrget() { return ::getattrs(w); }
jpayne@69 1126 // Get the window attributes;
jpayne@69 1127
jpayne@69 1128 int color_set(NCURSES_PAIRS_T color_pair_number, void* opts=NULL) {
jpayne@69 1129 return ::wcolor_set(w, color_pair_number, opts); }
jpayne@69 1130 // Set the window color attribute;
jpayne@69 1131
jpayne@69 1132 int chgat(int n, attr_t attr, NCURSES_PAIRS_T color, const void *opts=NULL) {
jpayne@69 1133 return ::wchgat(w, n, attr, color, opts); }
jpayne@69 1134 // Change the attributes of the next n characters in the current line. If
jpayne@69 1135 // n is negative or greater than the number of remaining characters in the
jpayne@69 1136 // line, the attributes will be changed up to the end of the line.
jpayne@69 1137
jpayne@69 1138 int chgat(int y, int x,
jpayne@69 1139 int n, attr_t attr, NCURSES_PAIRS_T color, const void *opts=NULL) {
jpayne@69 1140 return ::mvwchgat(w, y, x, n, attr, color, opts); }
jpayne@69 1141 // Move the cursor to the requested position and then perform chgat() as
jpayne@69 1142 // described above.
jpayne@69 1143
jpayne@69 1144 // -------------------------------------------------------------------------
jpayne@69 1145 // background
jpayne@69 1146 // -------------------------------------------------------------------------
jpayne@69 1147 chtype getbkgd() const { return ::getbkgd(w); }
jpayne@69 1148 // Get current background setting.
jpayne@69 1149
jpayne@69 1150 int bkgd(const chtype ch) { return ::wbkgd(w, ch); }
jpayne@69 1151 // Set the background property and apply it to the window.
jpayne@69 1152
jpayne@69 1153 void bkgdset(chtype ch) { ::wbkgdset(w, ch); }
jpayne@69 1154 // Set the background property.
jpayne@69 1155
jpayne@69 1156 // -------------------------------------------------------------------------
jpayne@69 1157 // borders
jpayne@69 1158 // -------------------------------------------------------------------------
jpayne@69 1159 int box(chtype vert=0, chtype hor=0) {
jpayne@69 1160 return ::wborder(w, vert, vert, hor, hor, 0, 0, 0, 0); }
jpayne@69 1161 // Draw a box around the window with the given vertical and horizontal
jpayne@69 1162 // drawing characters. If you specify a zero as character, curses will try
jpayne@69 1163 // to find a "nice" character.
jpayne@69 1164
jpayne@69 1165 int border(chtype left=0, chtype right=0,
jpayne@69 1166 chtype top =0, chtype bottom=0,
jpayne@69 1167 chtype top_left =0, chtype top_right=0,
jpayne@69 1168 chtype bottom_left =0, chtype bottom_right=0) {
jpayne@69 1169 return ::wborder(w, left, right, top, bottom, top_left, top_right,
jpayne@69 1170 bottom_left, bottom_right); }
jpayne@69 1171 // Draw a border around the window with the given characters for the
jpayne@69 1172 // various parts of the border. If you pass zero for a character, curses
jpayne@69 1173 // will try to find "nice" characters.
jpayne@69 1174
jpayne@69 1175 // -------------------------------------------------------------------------
jpayne@69 1176 // lines and boxes
jpayne@69 1177 // -------------------------------------------------------------------------
jpayne@69 1178 int hline(int len, chtype ch=0) { return ::whline(w, ch, len); }
jpayne@69 1179 // Draw a horizontal line of len characters with the given character. If
jpayne@69 1180 // you pass zero for the character, curses will try to find a "nice" one.
jpayne@69 1181
jpayne@69 1182 int hline(int y, int x, int len, chtype ch=0) {
jpayne@69 1183 return ::mvwhline(w, y, x, ch, len); }
jpayne@69 1184 // Move the cursor to the requested position and then draw a horizontal line.
jpayne@69 1185
jpayne@69 1186 int vline(int len, chtype ch=0) { return ::wvline(w, ch, len); }
jpayne@69 1187 // Draw a vertical line of len characters with the given character. If
jpayne@69 1188 // you pass zero for the character, curses will try to find a "nice" one.
jpayne@69 1189
jpayne@69 1190 int vline(int y, int x, int len, chtype ch=0) {
jpayne@69 1191 return ::mvwvline(w, y, x, ch, len); }
jpayne@69 1192 // Move the cursor to the requested position and then draw a vertical line.
jpayne@69 1193
jpayne@69 1194 // -------------------------------------------------------------------------
jpayne@69 1195 // erasure
jpayne@69 1196 // -------------------------------------------------------------------------
jpayne@69 1197 int erase() { return ::werase(w); }
jpayne@69 1198 // Erase the window.
jpayne@69 1199
jpayne@69 1200 int clear() { return ::wclear(w); }
jpayne@69 1201 // Clear the window.
jpayne@69 1202
jpayne@69 1203 int clearok(bool bf) { return ::clearok(w, bf); }
jpayne@69 1204 // Set/Reset the clear flag. If set, the next refresh() will clear the
jpayne@69 1205 // screen.
jpayne@69 1206
jpayne@69 1207 int clrtobot() { return ::wclrtobot(w); }
jpayne@69 1208 // Clear to the end of the window.
jpayne@69 1209
jpayne@69 1210 int clrtoeol() { return ::wclrtoeol(w); }
jpayne@69 1211 // Clear to the end of the line.
jpayne@69 1212
jpayne@69 1213 int delch() { return ::wdelch(w); }
jpayne@69 1214 // Delete character under the cursor.
jpayne@69 1215
jpayne@69 1216 int delch(int y, int x) { return ::mvwdelch(w, y, x); }
jpayne@69 1217 // Move cursor to requested position and delete the character under the
jpayne@69 1218 // cursor.
jpayne@69 1219
jpayne@69 1220 int deleteln() { return ::winsdelln(w, -1); }
jpayne@69 1221 // Delete the current line.
jpayne@69 1222
jpayne@69 1223 // -------------------------------------------------------------------------
jpayne@69 1224 // screen control
jpayne@69 1225 // -------------------------------------------------------------------------
jpayne@69 1226 int scroll(int amount=1) { return ::wscrl(w, amount); }
jpayne@69 1227 // Scroll amount lines. If amount is positive, scroll up, otherwise
jpayne@69 1228 // scroll down.
jpayne@69 1229
jpayne@69 1230 int scrollok(bool bf) { return ::scrollok(w, bf); }
jpayne@69 1231 // If bf is TRUE, window scrolls if cursor is moved off the bottom
jpayne@69 1232 // edge of the window or a scrolling region, otherwise the cursor is left
jpayne@69 1233 // at the bottom line.
jpayne@69 1234
jpayne@69 1235 int setscrreg(int from, int to) {
jpayne@69 1236 return ::wsetscrreg(w, from, to); }
jpayne@69 1237 // Define a soft scrolling region.
jpayne@69 1238
jpayne@69 1239 int idlok(bool bf) { return ::idlok(w, bf); }
jpayne@69 1240 // If bf is TRUE, use insert/delete line hardware support if possible.
jpayne@69 1241 // Otherwise do it in software.
jpayne@69 1242
jpayne@69 1243 void idcok(bool bf) { ::idcok(w, bf); }
jpayne@69 1244 // If bf is TRUE, use insert/delete character hardware support if possible.
jpayne@69 1245 // Otherwise do it in software.
jpayne@69 1246
jpayne@69 1247 int touchline(int s, int c) { return ::touchline(w, s, c); }
jpayne@69 1248 // Mark the given lines as modified.
jpayne@69 1249
jpayne@69 1250 int touchwin() { return ::wtouchln(w, 0, height(), 1); }
jpayne@69 1251 // Mark the whole window as modified.
jpayne@69 1252
jpayne@69 1253 int untouchwin() { return ::wtouchln(w, 0, height(), 0); }
jpayne@69 1254 // Mark the whole window as unmodified.
jpayne@69 1255
jpayne@69 1256 int touchln(int s, int cnt, bool changed=TRUE) {
jpayne@69 1257 return ::wtouchln(w, s, cnt, static_cast<int>(changed ? 1 : 0)); }
jpayne@69 1258 // Mark cnt lines beginning from line s as changed or unchanged, depending
jpayne@69 1259 // on the value of the changed flag.
jpayne@69 1260
jpayne@69 1261 bool is_linetouched(int line) const {
jpayne@69 1262 return (::is_linetouched(w, line) == TRUE ? TRUE:FALSE); }
jpayne@69 1263 // Return TRUE if line is marked as changed, FALSE otherwise
jpayne@69 1264
jpayne@69 1265 bool is_wintouched() const {
jpayne@69 1266 return (::is_wintouched(w) ? TRUE:FALSE); }
jpayne@69 1267 // Return TRUE if window is marked as changed, FALSE otherwise
jpayne@69 1268
jpayne@69 1269 int leaveok(bool bf) { return ::leaveok(w, bf); }
jpayne@69 1270 // If bf is TRUE, curses will leave the cursor after an update wherever
jpayne@69 1271 // it is after the update.
jpayne@69 1272
jpayne@69 1273 int redrawln(int from, int n) { return ::wredrawln(w, from, n); }
jpayne@69 1274 // Redraw n lines starting from the requested line
jpayne@69 1275
jpayne@69 1276 int redrawwin() { return ::wredrawln(w, 0, height()); }
jpayne@69 1277 // Redraw the whole window
jpayne@69 1278
jpayne@69 1279 int doupdate() { return ::doupdate(); }
jpayne@69 1280 // Do all outputs to make the physical screen looking like the virtual one
jpayne@69 1281
jpayne@69 1282 void syncdown() { ::wsyncdown(w); }
jpayne@69 1283 // Propagate the changes down to all descendant windows
jpayne@69 1284
jpayne@69 1285 void syncup() { ::wsyncup(w); }
jpayne@69 1286 // Propagate the changes up in the hierarchy
jpayne@69 1287
jpayne@69 1288 void cursyncup() { ::wcursyncup(w); }
jpayne@69 1289 // Position the cursor in all ancestor windows corresponding to our setting
jpayne@69 1290
jpayne@69 1291 int syncok(bool bf) { return ::syncok(w, bf); }
jpayne@69 1292 // If called with bf=TRUE, syncup() is called whenever the window is changed
jpayne@69 1293
jpayne@69 1294 #ifndef _no_flushok
jpayne@69 1295 int flushok(bool bf) { return ::flushok(w, bf); }
jpayne@69 1296 #endif
jpayne@69 1297
jpayne@69 1298 void immedok(bool bf) { ::immedok(w, bf); }
jpayne@69 1299 // If called with bf=TRUE, any change in the window will cause an
jpayne@69 1300 // automatic immediate refresh()
jpayne@69 1301
jpayne@69 1302 int intrflush(bool bf) { return ::intrflush(w, bf); }
jpayne@69 1303
jpayne@69 1304 int keypad(bool bf) { return ::keypad(w, bf); }
jpayne@69 1305 // If called with bf=TRUE, the application will interpret function keys.
jpayne@69 1306
jpayne@69 1307 int nodelay(bool bf) { return ::nodelay(w, bf); }
jpayne@69 1308
jpayne@69 1309 int meta(bool bf) { return ::meta(w, bf); }
jpayne@69 1310 // If called with bf=TRUE, keys may generate 8-Bit characters. Otherwise
jpayne@69 1311 // 7-Bit characters are generated.
jpayne@69 1312
jpayne@69 1313 int standout() { return ::wstandout(w); }
jpayne@69 1314 // Enable "standout" attributes
jpayne@69 1315
jpayne@69 1316 int standend() { return ::wstandend(w); }
jpayne@69 1317 // Disable "standout" attributes
jpayne@69 1318
jpayne@69 1319 // -------------------------------------------------------------------------
jpayne@69 1320 // The next two are virtual, because we redefine them in the
jpayne@69 1321 // NCursesPanel class.
jpayne@69 1322 // -------------------------------------------------------------------------
jpayne@69 1323 virtual int refresh() { return ::wrefresh(w); }
jpayne@69 1324 // Propagate the changes in this window to the virtual screen and call
jpayne@69 1325 // doupdate(). This is redefined in NCursesPanel.
jpayne@69 1326
jpayne@69 1327 virtual int noutrefresh() { return ::wnoutrefresh(w); }
jpayne@69 1328 // Propagate the changes in this window to the virtual screen. This is
jpayne@69 1329 // redefined in NCursesPanel.
jpayne@69 1330
jpayne@69 1331 // -------------------------------------------------------------------------
jpayne@69 1332 // multiple window control
jpayne@69 1333 // -------------------------------------------------------------------------
jpayne@69 1334 int overlay(NCursesWindow& win) {
jpayne@69 1335 return ::overlay(w, win.w); }
jpayne@69 1336 // Overlay this window over win.
jpayne@69 1337
jpayne@69 1338 int overwrite(NCursesWindow& win) {
jpayne@69 1339 return ::overwrite(w, win.w); }
jpayne@69 1340 // Overwrite win with this window.
jpayne@69 1341
jpayne@69 1342 int copywin(NCursesWindow& win,
jpayne@69 1343 int sminrow, int smincol,
jpayne@69 1344 int dminrow, int dmincol,
jpayne@69 1345 int dmaxrow, int dmaxcol, bool overlaywin=TRUE) {
jpayne@69 1346 return ::copywin(w, win.w, sminrow, smincol, dminrow, dmincol,
jpayne@69 1347 dmaxrow, dmaxcol, static_cast<int>(overlaywin ? 1 : 0)); }
jpayne@69 1348 // Overlay or overwrite the rectangle in win given by dminrow,dmincol,
jpayne@69 1349 // dmaxrow,dmaxcol with the rectangle in this window beginning at
jpayne@69 1350 // sminrow,smincol.
jpayne@69 1351
jpayne@69 1352 // -------------------------------------------------------------------------
jpayne@69 1353 // Extended functions
jpayne@69 1354 // -------------------------------------------------------------------------
jpayne@69 1355 #if defined(NCURSES_EXT_FUNCS) && (NCURSES_EXT_FUNCS != 0)
jpayne@69 1356 int wresize(int newLines, int newColumns) {
jpayne@69 1357 return ::wresize(w, newLines, newColumns); }
jpayne@69 1358 #endif
jpayne@69 1359
jpayne@69 1360 // -------------------------------------------------------------------------
jpayne@69 1361 // Mouse related
jpayne@69 1362 // -------------------------------------------------------------------------
jpayne@69 1363 bool has_mouse() const;
jpayne@69 1364 // Return TRUE if terminal supports a mouse, FALSE otherwise
jpayne@69 1365
jpayne@69 1366 // -------------------------------------------------------------------------
jpayne@69 1367 // traversal support
jpayne@69 1368 // -------------------------------------------------------------------------
jpayne@69 1369 NCursesWindow* child() { return subwins; }
jpayne@69 1370 // Get the first child window.
jpayne@69 1371
jpayne@69 1372 NCursesWindow* sibling() { return sib; }
jpayne@69 1373 // Get the next child of my parent.
jpayne@69 1374
jpayne@69 1375 NCursesWindow* parent() { return par; }
jpayne@69 1376 // Get my parent.
jpayne@69 1377
jpayne@69 1378 bool isDescendant(NCursesWindow& win);
jpayne@69 1379 // Return TRUE if win is a descendant of this.
jpayne@69 1380 };
jpayne@69 1381
jpayne@69 1382 // -------------------------------------------------------------------------
jpayne@69 1383 // We leave this here for compatibility reasons.
jpayne@69 1384 // -------------------------------------------------------------------------
jpayne@69 1385 class NCURSES_CXX_IMPEXP NCursesColorWindow : public NCursesWindow
jpayne@69 1386 {
jpayne@69 1387 public:
jpayne@69 1388 explicit NCursesColorWindow(WINDOW* &window) // useful only for stdscr
jpayne@69 1389 : NCursesWindow(window) {
jpayne@69 1390 useColors(); }
jpayne@69 1391
jpayne@69 1392 NCursesColorWindow(int nlines, // number of lines
jpayne@69 1393 int ncols, // number of columns
jpayne@69 1394 int begin_y, // line origin
jpayne@69 1395 int begin_x) // col origin
jpayne@69 1396 : NCursesWindow(nlines, ncols, begin_y, begin_x) {
jpayne@69 1397 useColors(); }
jpayne@69 1398
jpayne@69 1399 NCursesColorWindow(NCursesWindow& parentWin,// parent window
jpayne@69 1400 int nlines, // number of lines
jpayne@69 1401 int ncols, // number of columns
jpayne@69 1402 int begin_y, // absolute or relative
jpayne@69 1403 int begin_x, // origins:
jpayne@69 1404 char absrel = 'a') // if `a', by & bx are
jpayne@69 1405 : NCursesWindow(parentWin,
jpayne@69 1406 nlines, ncols, // absolute screen pos,
jpayne@69 1407 begin_y, begin_x, // else if `r', they are
jpayne@69 1408 absrel ) { // relative to par origin
jpayne@69 1409 useColors(); }
jpayne@69 1410 };
jpayne@69 1411
jpayne@69 1412 // These enum definitions really belong inside the NCursesPad class, but only
jpayne@69 1413 // recent compilers support that feature.
jpayne@69 1414
jpayne@69 1415 typedef enum {
jpayne@69 1416 REQ_PAD_REFRESH = KEY_MAX + 1,
jpayne@69 1417 REQ_PAD_UP,
jpayne@69 1418 REQ_PAD_DOWN,
jpayne@69 1419 REQ_PAD_LEFT,
jpayne@69 1420 REQ_PAD_RIGHT,
jpayne@69 1421 REQ_PAD_EXIT
jpayne@69 1422 } Pad_Request;
jpayne@69 1423
jpayne@69 1424 const Pad_Request PAD_LOW = REQ_PAD_REFRESH; // lowest op-code
jpayne@69 1425 const Pad_Request PAD_HIGH = REQ_PAD_EXIT; // highest op-code
jpayne@69 1426
jpayne@69 1427 // -------------------------------------------------------------------------
jpayne@69 1428 // Pad Support. We allow an association of a pad with a "real" window
jpayne@69 1429 // through which the pad may be viewed.
jpayne@69 1430 // -------------------------------------------------------------------------
jpayne@69 1431 class NCURSES_CXX_IMPEXP NCursesPad : public NCursesWindow
jpayne@69 1432 {
jpayne@69 1433 private:
jpayne@69 1434 NCursesWindow* viewWin; // the "viewport" window
jpayne@69 1435 NCursesWindow* viewSub; // the "viewport" subwindow
jpayne@69 1436
jpayne@69 1437 int h_gridsize, v_gridsize;
jpayne@69 1438
jpayne@69 1439 protected:
jpayne@69 1440 int min_row, min_col; // top left row/col of the pads display area
jpayne@69 1441
jpayne@69 1442 NCursesWindow* Win(void) const {
jpayne@69 1443 // Get the window into which the pad should be copied (if any)
jpayne@69 1444 return (viewSub?viewSub:(viewWin?viewWin:0));
jpayne@69 1445 }
jpayne@69 1446
jpayne@69 1447 NCursesWindow* getWindow(void) const {
jpayne@69 1448 return viewWin;
jpayne@69 1449 }
jpayne@69 1450
jpayne@69 1451 NCursesWindow* getSubWindow(void) const {
jpayne@69 1452 return viewSub;
jpayne@69 1453 }
jpayne@69 1454
jpayne@69 1455 virtual int driver (int key); // Virtualize keystroke key
jpayne@69 1456 // The driver translates the keystroke c into an Pad_Request
jpayne@69 1457
jpayne@69 1458 virtual void OnUnknownOperation(int pad_req) {
jpayne@69 1459 (void) pad_req;
jpayne@69 1460 ::beep();
jpayne@69 1461 }
jpayne@69 1462 // This is called if the driver returns an unknown op-code
jpayne@69 1463
jpayne@69 1464 virtual void OnNavigationError(int pad_req) {
jpayne@69 1465 (void) pad_req;
jpayne@69 1466 ::beep();
jpayne@69 1467 }
jpayne@69 1468 // This is called if a navigation request couldn't be satisfied
jpayne@69 1469
jpayne@69 1470 virtual void OnOperation(int pad_req) {
jpayne@69 1471 (void) pad_req;
jpayne@69 1472 };
jpayne@69 1473 // OnOperation is called if a Pad_Operation was executed and just before
jpayne@69 1474 // the refresh() operation is done.
jpayne@69 1475
jpayne@69 1476 public:
jpayne@69 1477 NCursesPad(int nlines, int ncols);
jpayne@69 1478 // create a pad with the given size
jpayne@69 1479
jpayne@69 1480 NCursesPad& operator=(const NCursesPad& rhs)
jpayne@69 1481 {
jpayne@69 1482 if (this != &rhs) {
jpayne@69 1483 *this = rhs;
jpayne@69 1484 NCursesWindow::operator=(rhs);
jpayne@69 1485 }
jpayne@69 1486 return *this;
jpayne@69 1487 }
jpayne@69 1488
jpayne@69 1489 NCursesPad(const NCursesPad& rhs)
jpayne@69 1490 : NCursesWindow(rhs),
jpayne@69 1491 viewWin(rhs.viewWin),
jpayne@69 1492 viewSub(rhs.viewSub),
jpayne@69 1493 h_gridsize(rhs.h_gridsize),
jpayne@69 1494 v_gridsize(rhs.v_gridsize),
jpayne@69 1495 min_row(rhs.min_row),
jpayne@69 1496 min_col(rhs.min_col)
jpayne@69 1497 {
jpayne@69 1498 }
jpayne@69 1499
jpayne@69 1500 virtual ~NCursesPad() THROWS(NCursesException) {}
jpayne@69 1501
jpayne@69 1502 int echochar(const chtype ch) { return ::pechochar(w, ch); }
jpayne@69 1503 // Put the attributed character onto the pad and immediately do a
jpayne@69 1504 // prefresh().
jpayne@69 1505
jpayne@69 1506 int refresh() NCURSES_OVERRIDE;
jpayne@69 1507 // If a viewport is defined the pad is displayed in this window, otherwise
jpayne@69 1508 // this is a noop.
jpayne@69 1509
jpayne@69 1510 int refresh(int pminrow, int pmincol,
jpayne@69 1511 int sminrow, int smincol,
jpayne@69 1512 int smaxrow, int smaxcol) {
jpayne@69 1513 return ::prefresh(w, pminrow, pmincol,
jpayne@69 1514 sminrow, smincol, smaxrow, smaxcol);
jpayne@69 1515 }
jpayne@69 1516 // The coordinates sminrow,smincol,smaxrow,smaxcol describe a rectangle
jpayne@69 1517 // on the screen. <b>refresh</b> copies a rectangle of this size beginning
jpayne@69 1518 // with top left corner pminrow,pmincol onto the screen and calls doupdate().
jpayne@69 1519
jpayne@69 1520 int noutrefresh() NCURSES_OVERRIDE;
jpayne@69 1521 // If a viewport is defined the pad is displayed in this window, otherwise
jpayne@69 1522 // this is a noop.
jpayne@69 1523
jpayne@69 1524 int noutrefresh(int pminrow, int pmincol,
jpayne@69 1525 int sminrow, int smincol,
jpayne@69 1526 int smaxrow, int smaxcol) {
jpayne@69 1527 return ::pnoutrefresh(w, pminrow, pmincol,
jpayne@69 1528 sminrow, smincol, smaxrow, smaxcol);
jpayne@69 1529 }
jpayne@69 1530 // Does the same as refresh() but without calling doupdate().
jpayne@69 1531
jpayne@69 1532 virtual void setWindow(NCursesWindow& view, int v_grid = 1, int h_grid = 1);
jpayne@69 1533 // Add the window "view" as viewing window to the pad.
jpayne@69 1534
jpayne@69 1535 virtual void setSubWindow(NCursesWindow& sub);
jpayne@69 1536 // Use the subwindow "sub" of the viewport window for the actual viewing.
jpayne@69 1537 // The full viewport window is usually used to provide some decorations
jpayne@69 1538 // like frames, titles etc.
jpayne@69 1539
jpayne@69 1540 virtual void operator() (void);
jpayne@69 1541 // Perform Pad's operation
jpayne@69 1542 };
jpayne@69 1543
jpayne@69 1544 // A FramedPad is constructed always with a viewport window. This viewport
jpayne@69 1545 // will be framed (by a box() command) and the interior of the box is the
jpayne@69 1546 // viewport subwindow. On the frame we display scrollbar sliders.
jpayne@69 1547 class NCURSES_CXX_IMPEXP NCursesFramedPad : public NCursesPad
jpayne@69 1548 {
jpayne@69 1549 protected:
jpayne@69 1550 virtual void OnOperation(int pad_req) NCURSES_OVERRIDE;
jpayne@69 1551
jpayne@69 1552 public:
jpayne@69 1553 NCursesFramedPad(NCursesWindow& win, int nlines, int ncols,
jpayne@69 1554 int v_grid = 1, int h_grid = 1)
jpayne@69 1555 : NCursesPad(nlines, ncols) {
jpayne@69 1556 NCursesPad::setWindow(win, v_grid, h_grid);
jpayne@69 1557 NCursesPad::setSubWindow(*(new NCursesWindow(win)));
jpayne@69 1558 }
jpayne@69 1559 // Construct the FramedPad with the given Window win as viewport.
jpayne@69 1560
jpayne@69 1561 virtual ~NCursesFramedPad() THROWS(NCursesException) {
jpayne@69 1562 delete getSubWindow();
jpayne@69 1563 }
jpayne@69 1564
jpayne@69 1565 void setWindow(NCursesWindow& view, int v_grid = 1, int h_grid = 1) NCURSES_OVERRIDE {
jpayne@69 1566 (void) view;
jpayne@69 1567 (void) v_grid;
jpayne@69 1568 (void) h_grid;
jpayne@69 1569 err_handler("Operation not allowed");
jpayne@69 1570 }
jpayne@69 1571 // Disable this call; the viewport is already defined
jpayne@69 1572
jpayne@69 1573 void setSubWindow(NCursesWindow& sub) NCURSES_OVERRIDE {
jpayne@69 1574 (void) sub;
jpayne@69 1575 err_handler("Operation not allowed");
jpayne@69 1576 }
jpayne@69 1577 // Disable this call; the viewport subwindow is already defined
jpayne@69 1578
jpayne@69 1579 };
jpayne@69 1580
jpayne@69 1581 #endif /* NCURSES_CURSESW_H_incl */