Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

ncursesw.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                                                                      |
00003 |                      __   __    ____ _____ ____                      |
00004 |                      \ \ / /_ _/ ___|_   _|___ \                     |
00005 |                       \ V / _` \___ \ | |   __) |                    |
00006 |                        | | (_| |___) || |  / __/                     |
00007 |                        |_|\__,_|____/ |_| |_____|                    |
00008 |                                                                      |
00009 |                               core system                            |
00010 |                                                        (C) SuSE GmbH |
00011 \----------------------------------------------------------------------/
00012 
00013    File:       ncursesw.h
00014 
00015    Author:     Michael Andres <ma@suse.de>
00016    Maintainer: Michael Andres <ma@suse.de>
00017 
00018 /-*/
00019 // * This makes emacs happy -*-Mode: C++;-*-
00020 #ifndef _CURSESW_H
00021 #define _CURSESW_H
00022 
00023 #include <iosfwd>
00024 
00025 // $Id: ncursesw.h 16687 2004-03-22 15:05:19Z gs $
00026 
00027 #include <etip.h>
00028 #include <cstdio>
00029 #include <cstdarg>
00030 #include "position.h"
00031 
00032 extern "C" {
00033 #  include   <curses.h>
00034 }
00035 
00036 /* SCO 3.2v4 curses.h includes term.h, which defines lines as a macro.
00037    Undefine it here, because NCursesWindow uses lines as a method.  */
00038 #undef lines
00039 
00040 /* "Convert" macros to inlines. We'll define it as another symbol to avoid
00041  * conflict with library symbols.
00042  */
00043 #undef UNDEF
00044 #define UNDEF(name) CUR_ ##name
00045 
00046 #ifdef addch
00047 inline int UNDEF(addch)(chtype ch)  { return addch(ch); }
00048 #undef addch
00049 #define addch UNDEF(addch)
00050 #endif
00051 
00052 #ifdef add_wch
00053 inline int UNDEF(add_wch)(cchar_t * cch)  { return add_wch(cch); }
00054 #undef add_wch
00055 #define add_wch UNDEF(add_wch)
00056 #endif
00057 
00058 #ifdef echochar
00059 inline int UNDEF(echochar)(chtype ch)  { return echochar(ch); }
00060 #undef echochar
00061 #define echochar UNDEF(echochar)
00062 #endif
00063 
00064 #ifdef insdelln
00065 inline int UNDEF(insdelln)(int n)  { return insdelln(n); }
00066 #undef insdelln
00067 #define insdelln UNDEF(insdelln)
00068 #endif
00069 
00070 #ifdef addstr
00071 /* The (char*) cast is to hack around missing const's */
00072 inline int UNDEF(addstr)(const char * str)  { return addstr((char*)str); }
00073 #undef addstr
00074 #define addstr UNDEF(addstr)
00075 #endif
00076 
00077 #ifdef addwstr
00078 /* The (wchar*_t) cast is to hack around missing const's */
00079 inline int UNDEF(addwstr)(const wchar_t * str)  { return addwstr((wchar_t*)str); }
00080 #undef addwstr
00081 #define addwstr UNDEF(addwstr)
00082 #endif
00083 
00084 #ifdef attron
00085 inline int UNDEF(attron)(chtype at) { return attron(at); }
00086 #undef attron
00087 #define attron UNDEF(attron)
00088 #endif
00089 
00090 #ifdef attroff
00091 inline int UNDEF(attroff)(chtype at) { return attroff(at); }
00092 #undef attroff
00093 #define attroff UNDEF(attroff)
00094 #endif
00095 
00096 #ifdef attrset
00097 inline chtype UNDEF(attrset)(chtype at) { return attrset(at); }
00098 #undef attrset
00099 #define attrset UNDEF(attrset)
00100 #endif
00101 
00102 #ifdef border
00103 inline int UNDEF(border)(chtype ls, chtype rs, chtype ts, chtype bs, chtype tl, chtype tr, chtype bl, chtype br)
00104 { return border(ls,rs,ts,bs,tl,tr,bl,br); }
00105 #undef border
00106 #define border UNDEF(border)
00107 #endif
00108 
00109 #ifdef box
00110 inline int UNDEF(box)(WINDOW *win, int v, int h) { return box(win, v, h); }
00111 #undef box
00112 #define box UNDEF(box)
00113 #endif
00114 
00115 #ifdef mvwhline
00116 inline int UNDEF(mvwhline)(WINDOW *win,int y,int x,chtype c,int n) {
00117   return mvwhline(win,y,x,c,n); }
00118 #undef mvwhline
00119 #define mvwhline UNDEF(mvwhline)
00120 #endif
00121 
00122 #ifdef mvwvline
00123 inline int UNDEF(mvwvline)(WINDOW *win,int y,int x,chtype c,int n) {
00124   return mvwvline(win,y,x,c,n); }
00125 #undef mvwvline
00126 #define mvwvline UNDEF(mvwvline)
00127 #endif
00128 
00129 #ifdef clear
00130 inline int UNDEF(clear)()  { return clear(); }
00131 #undef clear
00132 #define clear UNDEF(clear)
00133 #endif
00134 
00135 #ifdef clearok
00136 inline int UNDEF(clearok)(WINDOW* win, bool bf)  { return clearok(win, bf); }
00137 #undef clearok
00138 #define clearok UNDEF(clearok)
00139 #else
00140 extern "C" int clearok(WINDOW*, bool);
00141 #endif
00142 
00143 #ifdef clrtobot
00144 inline int UNDEF(clrtobot)()  { return clrtobot(); }
00145 #undef clrtobot
00146 #define clrtobot UNDEF(clrtobot)
00147 #endif
00148 
00149 #ifdef clrtoeol
00150 inline int UNDEF(clrtoeol)()  { return clrtoeol(); }
00151 #undef clrtoeol
00152 #define clrtoeol UNDEF(clrtoeol)
00153 #endif
00154 
00155 #ifdef delch
00156 inline int UNDEF(delch)()  { return delch(); }
00157 #undef delch
00158 #define delch UNDEF(delch)
00159 #endif
00160 
00161 #ifdef deleteln
00162 inline int UNDEF(deleteln)()  { return deleteln(); }
00163 #undef deleteln
00164 #define deleteln UNDEF(deleteln)
00165 #endif
00166 
00167 #ifdef erase
00168 inline int UNDEF(erase)()  { return erase(); }
00169 #undef erase
00170 #define erase UNDEF(erase)
00171 #endif
00172 
00173 #ifdef flushok
00174 inline int UNDEF(flushok)(WINDOW* _win, bool _bf)  {
00175   return flushok(_win, _bf); }
00176 #undef flushok
00177 #define flushok UNDEF(flushok)
00178 #else
00179 #define _no_flushok
00180 #endif
00181 
00182 #ifdef getch
00183 inline int UNDEF(getch)()  { return getch(); }
00184 #undef getch
00185 #define getch UNDEF(getch)
00186 #endif
00187 
00188 #ifdef getstr
00189 inline int UNDEF(getstr)(char *_str)  { return getstr(_str); }
00190 #undef getstr
00191 #define getstr UNDEF(getstr)
00192 #endif
00193 
00194 #ifdef instr
00195 inline int UNDEF(instr)(char *_str)  { return instr(_str); }
00196 #undef instr
00197 #define instr UNDEF(instr)
00198 #endif
00199 
00200 #ifdef innstr
00201 inline int UNDEF(innstr)(char *_str, int n)  { return innstr(_str,n); }
00202 #undef innstr
00203 #define innstr UNDEF(innstr)
00204 #endif
00205 
00206 #ifdef mvwinnstr
00207 inline int UNDEF(mvwinnstr)(WINDOW *win, int y, int x, char *_str, int n) {
00208   return mvwinnstr(win,y,x,_str,n); }
00209 #undef mvwinnstr
00210 #define mvwinnstr UNDEF(mvwinnstr)
00211 #endif
00212 
00213 #ifdef mvinnstr
00214 inline int UNDEF(mvinnstr)(int y, int x, char *_str, int n) {
00215   return mvinnstr(y,x,_str,n); }
00216 #undef mvinnstr
00217 #define mvinnstr UNDEF(mvinnstr)
00218 #endif
00219 
00220 #ifdef winsstr
00221 inline int UNDEF(winsstr)(WINDOW *w, const char *_str)  {
00222   return winsstr(w,_str); }
00223 #undef winsstr
00224 #define winsstr UNDEF(winsstr)
00225 #endif
00226 
00227 #ifdef mvwinsstr
00228 inline int UNDEF(mvwinsstr)(WINDOW *w, int y, int x,  const char *_str)  {
00229   return mvwinsstr(w,y,x,_str); }
00230 #undef mvwinsstr
00231 #define mvwinsstr UNDEF(mvwinsstr)
00232 #endif
00233 
00234 #ifdef insstr
00235 inline int UNDEF(insstr)(const char *_str)  {
00236   return insstr(_str); }
00237 #undef insstr
00238 #define insstr UNDEF(insstr)
00239 #endif
00240 
00241 #ifdef mvinsstr
00242 inline int UNDEF(mvinsstr)(int y, int x,const char *_str)  {
00243   return mvinsstr(y,x,_str); }
00244 #undef mvinsstr
00245 #define mvinsstr UNDEF(mvinsstr)
00246 #endif
00247 
00248 #ifdef insnstr
00249 inline int UNDEF(insnstr)(const char *_str, int n)  {
00250   return insnstr(_str,n); }
00251 #undef insnstr
00252 #define insnstr UNDEF(insnstr)
00253 #endif
00254 
00255 #ifdef mvwinsnstr
00256 inline int UNDEF(mvwinsnstr)(WINDOW *w, int y, int x,const char *_str, int n) {
00257   return mvwinsnstr(w,y,x,_str,n); }
00258 #undef mvwinsnstr
00259 #define mvwinsnstr UNDEF(mvwinsnstr)
00260 #endif
00261 
00262 #ifdef mvinsnstr
00263 inline int UNDEF(mvinsnstr)(int y, int x,const char *_str, int n) {
00264   return mvinsnstr(y,x,_str,n); }
00265 #undef mvinsnstr
00266 #define mvinsnstr UNDEF(mvinsnstr)
00267 #endif
00268 
00269 #ifdef getnstr
00270 inline int UNDEF(getnstr)(char *_str, int n)  { return getnstr(_str,n); }
00271 #undef getnstr
00272 #define getnstr UNDEF(getnstr)
00273 #endif
00274 
00275 #ifdef getyx
00276 inline void UNDEF(getyx)(const WINDOW* win, int& y, int& x) {
00277   getyx(win, y, x); }
00278 #undef getyx
00279 #define getyx UNDEF(getyx)
00280 #endif
00281 
00282 #ifdef getbegyx
00283 inline void UNDEF(getbegyx)(WINDOW* win, int& y, int& x) { getbegyx(win, y, x); }
00284 #undef getbegyx
00285 #define getbegyx UNDEF(getbegyx)
00286 #endif
00287 
00288 #ifdef getmaxyx
00289 inline void UNDEF(getmaxyx)(WINDOW* win, int& y, int& x) { getmaxyx(win, y, x); }
00290 #undef getmaxyx
00291 #define getmaxyx UNDEF(getmaxyx)
00292 #endif
00293 
00294 #ifdef hline
00295 inline int UNDEF(hline)(chtype ch, int n) { return hline(ch, n); }
00296 #undef hline
00297 #define hline UNDEF(hline)
00298 #endif
00299 
00300 #ifdef inch
00301 inline chtype UNDEF(inch)()  { return inch(); }
00302 #undef inch
00303 #define inch UNDEF(inch)
00304 #endif
00305 
00306 #ifdef in_wch
00307 inline int UNDEF(in_wch)(cchar_t * cch)  { return in_wch(cch); }
00308 #undef in_wch
00309 #define in_wch UNDEF(in_wch)
00310 #endif
00311 
00312 #ifdef insch
00313 inline int UNDEF(insch)(char c)  { return insch(c); }
00314 #undef insch
00315 #define insch UNDEF(insch)
00316 #endif
00317 
00318 #ifdef ins_wch
00319 inline int UNDEF(ins_wch)(const cchar_t *c)  { return ins_wch(c); }
00320 #undef ins_wch
00321 #define ins_wch UNDEF(ins_wch)
00322 #endif
00323 
00324 #ifdef mvwins_wch
00325 inline int UNDEF(mvwins_wch)(WINDOW *w, int y, int x, const cchar_t *cchar)  { return mvwins_wch(w,y,x,cchar); }
00326 #undef mvwins_wch
00327 #define mvwins_wch UNDEF(mvwins_wch)
00328 #endif
00329 
00330 #ifdef insertln
00331 inline int UNDEF(insertln)()  { return insertln(); }
00332 #undef insertln
00333 #define insertln UNDEF(insertln)
00334 #endif
00335 
00336 #ifdef leaveok
00337 inline int UNDEF(leaveok)(WINDOW* win, bool bf)  { return leaveok(win, bf); }
00338 #undef leaveok
00339 #define leaveok UNDEF(leaveok)
00340 #else
00341 extern "C" int leaveok(WINDOW* win, bool bf);
00342 #endif
00343 
00344 #ifdef move
00345 inline int UNDEF(move)(int x, int y)  { return move(x, y); }
00346 #undef move
00347 #define move UNDEF(move)
00348 #endif
00349 
00350 #ifdef refresh
00351 inline int UNDEF(refresh)()  { return refresh(); }
00352 #undef refresh
00353 #define refresh UNDEF(refresh)
00354 #endif
00355 
00356 #ifdef redrawwin
00357 inline int UNDEF(redrawwin)(WINDOW *win)  { return redrawwin(win); }
00358 #undef redrawwin
00359 #define redrawwin UNDEF(redrawwin)
00360 #endif
00361 
00362 #ifdef scrl
00363 inline int UNDEF(scrl)(int l) { return scrl(l); }
00364 #undef scrl
00365 #define scrl UNDEF(scrl)
00366 #endif
00367 
00368 #ifdef scroll
00369 inline int UNDEF(scroll)(WINDOW *win) { return scroll(win); }
00370 #undef scroll
00371 #define scroll UNDEF(scroll)
00372 #endif
00373 
00374 #ifdef scrollok
00375 inline int UNDEF(scrollok)(WINDOW* win, bool bf)  { return scrollok(win, bf); }
00376 #undef scrollok
00377 #define scrollok UNDEF(scrollok)
00378 #else
00379 #if     defined(__NCURSES_H)
00380 extern "C" int scrollok(WINDOW*, bool);
00381 #else
00382 extern "C" int scrollok(WINDOW*, char);
00383 #endif
00384 #endif
00385 
00386 #ifdef setscrreg
00387 inline int UNDEF(setscrreg)(int t, int b) { return setscrreg(t, b); }
00388 #undef setscrreg
00389 #define setscrreg UNDEF(setscrreg)
00390 #endif
00391 
00392 #ifdef standend
00393 inline int UNDEF(standend)()  { return standend(); }
00394 #undef standend
00395 #define standend UNDEF(standend)
00396 #endif
00397 
00398 #ifdef standout
00399 inline int UNDEF(standout)()  { return standout(); }
00400 #undef standout
00401 #define standout UNDEF(standout)
00402 #endif
00403 
00404 #ifdef subpad
00405 inline WINDOW *UNDEF(subpad)(WINDOW *p, int l, int c, int y, int x)
00406 { return derwin(p,l,c,y,x); }
00407 #undef subpad
00408 #define subpad UNDEF(subpad)
00409 #endif
00410 
00411 #ifdef timeout
00412 #if NCURSES_VERSION_MAJOR < 5
00413 inline int UNDEF(timeout)(int delay) { return timeout(delay); }
00414 #else
00415 inline void UNDEF(timeout)(int delay) { timeout(delay); }
00416 #endif
00417 #undef timeout
00418 #define timeout UNDEF(timeout)
00419 #endif
00420 
00421 #ifdef touchline
00422 inline int UNDEF(touchline)(WINDOW *win, int s, int c)
00423 { return touchline(win,s,c); }
00424 #undef touchline
00425 #define touchline UNDEF(touchline)
00426 #endif
00427 
00428 #ifdef touchwin
00429 inline int UNDEF(touchwin)(WINDOW *win) { return touchwin(win); }
00430 #undef touchwin
00431 #define touchwin UNDEF(touchwin)
00432 #endif
00433 
00434 #ifdef untouchwin
00435 inline int UNDEF(untouchwin)(WINDOW *win) { return untouchwin(win); }
00436 #undef untouchwin
00437 #define untouchwin UNDEF(untouchwin)
00438 #endif
00439 
00440 #ifdef vline
00441 inline int UNDEF(vline)(chtype ch, int n) { return vline(ch, n); }
00442 #undef vline
00443 #define vline UNDEF(vline)
00444 #endif
00445 
00446 #ifdef waddstr
00447 inline int UNDEF(waddstr)(WINDOW *win, char *str) { return waddstr(win, str); }
00448 #undef waddstr
00449 #define waddstr UNDEF(waddstr)
00450 #endif
00451 
00452 #ifdef waddwstr
00453 inline int UNDEF(waddwstr)(WINDOW *win, wchar_t *str) { return waddwstr(win, str); }
00454 #undef waddwstr
00455 #define waddwstr UNDEF(waddwstr)
00456 #endif
00457 
00458 #ifdef mvwaddwstr
00459 inline int UNDEF(mvwaddwstr)(WINDOW *win, int y, int x, wchar_t *str)
00460 { return mvwaddwstr(win, y, x, str); }
00461 #undef mvwaddwstr
00462 #define mvwaddwstr UNDEF(mvwaddwstr)
00463 #endif
00464 
00465 #ifdef waddchstr
00466 inline int UNDEF(waddchstr)(WINDOW *win, chtype *at) { return waddchstr(win, at); }
00467 #undef waddchstr
00468 #define waddchstr UNDEF(waddchstr)
00469 #endif
00470 
00471 #ifdef wstandend
00472 inline int UNDEF(wstandend)(WINDOW *win)  { return wstandend(win); }
00473 #undef wstandend
00474 #define wstandend UNDEF(wstandend)
00475 #endif
00476 
00477 #ifdef wstandout
00478 inline int UNDEF(wstandout)(WINDOW *win)  { return wstandout(win); }
00479 #undef wstandout
00480 #define wstandout UNDEF(wstandout)
00481 #endif
00482 
00483 
00484 #ifdef wattroff
00485 inline int UNDEF(wattroff)(WINDOW *win, int att) { return wattroff(win, att); }
00486 #undef wattroff
00487 #define wattroff UNDEF(wattroff)
00488 #endif
00489 
00490 #ifdef chgat
00491 inline int UNDEF(chgat)(int n,attr_t attr, short color, const void *opts) {
00492   return chgat(n,attr,color,opts); }
00493 #undef chgat
00494 #define chgat UNDEF(chgat)
00495 #endif
00496 
00497 #ifdef mvchgat
00498 inline int UNDEF(mvchgat)(int y, int x, int n,
00499                           attr_t attr, short color, const void *opts) {
00500   return mvchgat(y,x,n,attr,color,opts); }
00501 #undef mvchgat
00502 #define mvchgat UNDEF(mvchgat)
00503 #endif
00504 
00505 #ifdef mvwchgat
00506 inline int UNDEF(mvwchgat)(WINDOW *win, int y, int x, int n,
00507                            attr_t attr, short color, const void *opts) {
00508   return mvwchgat(win,y,x,n,attr,color,opts); }
00509 #undef mvwchgat
00510 #define mvwchgat UNDEF(mvwchgat)
00511 #endif
00512 
00513 #ifdef wattrset
00514 inline int UNDEF(wattrset)(WINDOW *win, int att) { return wattrset(win, att); }
00515 #undef wattrset
00516 #define wattrset UNDEF(wattrset)
00517 #endif
00518 
00519 #ifdef winch
00520 inline chtype UNDEF(winch)(const WINDOW* win) { return winch(win); }
00521 #undef winch
00522 #define winch UNDEF(winch)
00523 #endif
00524 
00525 #ifdef mvwaddch
00526 inline int UNDEF(mvwaddch)(WINDOW *win, int y, int x, const chtype ch)
00527 { return mvwaddch(win, y, x, ch); }
00528 #undef mvwaddch
00529 #define mvwaddch UNDEF(mvwaddch)
00530 #endif
00531 
00532 #ifdef mvwaddchnstr
00533 inline int UNDEF(mvwaddchnstr)(WINDOW *win, int y, int x, chtype *str, int n)
00534 { return mvwaddchnstr(win, y, x, str, n); }
00535 #undef mvwaddchnstr
00536 #define mvwaddchnstr UNDEF(mvwaddchnstr)
00537 #endif
00538 
00539 #ifdef mvwaddchstr
00540 inline int UNDEF(mvwaddchstr)(WINDOW *win, int y, int x, chtype *str)
00541 { return mvwaddchstr(win, y, x, str); }
00542 #undef mvwaddchstr
00543 #define mvwaddchstr UNDEF(mvwaddchstr)
00544 #endif
00545 
00546 #ifdef addnstr
00547 inline int UNDEF(addnstr)(const char *str, int n)
00548 { return addnstr((char*)str, n); }
00549 #undef addnstr
00550 #define addnstr UNDEF(addnstr)
00551 #endif
00552 
00553 #ifdef addnwstr
00554 inline int UNDEF(addnwstr)(const wchar_t *str, int n)
00555 { return addnwstr((wchar_t*)str, n); }
00556 #undef addnwstr
00557 #define addnwstr UNDEF(addnwstr)
00558 #endif
00559 
00560 #ifdef mvwaddnstr
00561 inline int UNDEF(mvwaddnstr)(WINDOW *win, int y, int x, const char *str, int n)
00562 { return mvwaddnstr(win, y, x, (char*)str, n); }
00563 #undef mvwaddnstr
00564 #define mvwaddnstr UNDEF(mvwaddnstr)
00565 #endif
00566 
00567 #ifdef mvwaddnwstr
00568 inline int UNDEF(mvwaddnwstr)(WINDOW *win, int y, int x, const wchar_t *str, int n)
00569 { return mvwaddnwstr(win, y, x, (wchar_t*)str, n); }
00570 #undef mvwaddnwstr
00571 #define mvwaddnwstr UNDEF(mvwaddnwstr)
00572 #endif
00573 
00574 #ifdef mvwaddstr
00575 inline int UNDEF(mvwaddstr)(WINDOW *win, int y, int x, const char * str)
00576 { return mvwaddstr(win, y, x, (char*)str); }
00577 #undef mvwaddstr
00578 #define mvwaddstr UNDEF(mvwaddstr)
00579 #endif
00580 
00581 #ifdef mvwdelch
00582 inline int UNDEF(mvwdelch)(WINDOW *win, int y, int x)
00583 { return mvwdelch(win, y, x); }
00584 #undef mvwdelch
00585 #define mvwdelch UNDEF(mvwdelch)
00586 #endif
00587 
00588 #ifdef mvwgetch
00589 inline int UNDEF(mvwgetch)(WINDOW *win, int y, int x) { return mvwgetch(win, y, x);}
00590 #undef mvwgetch
00591 #define mvwgetch UNDEF(mvwgetch)
00592 #endif
00593 
00594 #ifdef mvwgetstr
00595 inline int UNDEF(mvwgetstr)(WINDOW *win, int y, int x, char *str)
00596 {return mvwgetstr(win,y,x, str);}
00597 #undef mvwgetstr
00598 #define mvwgetstr UNDEF(mvwgetstr)
00599 #endif
00600 
00601 #ifdef mvwgetnstr
00602 inline int UNDEF(mvwgetnstr)(WINDOW *win, int y, int x, char *str, int n)
00603 {return mvwgetnstr(win,y,x, str,n);}
00604 #undef mvwgetnstr
00605 #define mvwgetnstr UNDEF(mvwgetnstr)
00606 #endif
00607 
00608 #ifdef mvwinch
00609 inline chtype UNDEF(mvwinch)(WINDOW *win, int y, int x) {
00610   return mvwinch(win, y, x);}
00611 #undef mvwinch
00612 #define mvwinch UNDEF(mvwinch)
00613 #endif
00614 
00615 #ifdef mvwin_wch
00616 inline int UNDEF(mvwin_wch)(WINDOW *win, int y, int x, cchar_t * cch) {
00617   return mvwin_wch(win, y, x, cch);}
00618 #undef mvwin_wch
00619 #define mvwin_wch UNDEF(mvwin_wch)
00620 #endif
00621 
00622 #ifdef mvwinsch
00623 inline int UNDEF(mvwinsch)(WINDOW *win, int y, int x, char c)
00624 { return mvwinsch(win, y, x, c); }
00625 #undef mvwinsch
00626 #define mvwinsch UNDEF(mvwinsch)
00627 #endif
00628 
00629 #ifdef mvaddch
00630 inline int UNDEF(mvaddch)(int y, int x, chtype ch)
00631 { return mvaddch(y, x, ch); }
00632 #undef mvaddch
00633 #define mvaddch UNDEF(mvaddch)
00634 #endif
00635 
00636 #ifdef mvaddnstr
00637 inline int UNDEF(mvaddnstr)(int y, int x, const char *str, int n)
00638 { return mvaddnstr(y, x, (char*)str, n); }
00639 #undef mvaddnstr
00640 #define mvaddnstr UNDEF(mvaddnstr)
00641 #endif
00642 
00643 #ifdef mvaddstr
00644 inline int UNDEF(mvaddstr)(int y, int x, const char * str)
00645 { return mvaddstr(y, x, (char*)str); }
00646 #undef mvaddstr
00647 #define mvaddstr UNDEF(mvaddstr)
00648 #endif
00649 
00650 #ifdef mvwadd_wch
00651 inline int UNDEF(mvwadd_wch)(WINDOW *win, int y, int x, const cchar_t * cch)
00652 { return mvwadd_wch(win, y, x, (cchar_t*)cch); }
00653 #undef mvwadd_wch
00654 #define mvwadd_wch UNDEF(mvwadd_wch)
00655 #endif
00656 
00657 #ifdef mvdelch
00658 inline int UNDEF(mvdelch)(int y, int x) { return mvdelch(y, x);}
00659 #undef mvdelch
00660 #define mvdelch UNDEF(mvdelch)
00661 #endif
00662 
00663 #ifdef mvgetch
00664 inline int UNDEF(mvgetch)(int y, int x) { return mvgetch(y, x);}
00665 #undef mvgetch
00666 #define mvgetch UNDEF(mvgetch)
00667 #endif
00668 
00669 #ifdef mvgetstr
00670 inline int UNDEF(mvgetstr)(int y, int x, char *str) {return mvgetstr(y, x, str);}
00671 #undef mvgetstr
00672 #define mvgetstr UNDEF(mvgetstr)
00673 #endif
00674 
00675 #ifdef mvgetnstr
00676 inline int UNDEF(mvgetnstr)(int y, int x, char *str, int n) {
00677   return mvgetnstr(y, x, str,n);}
00678 #undef mvgetnstr
00679 #define mvgetnstr UNDEF(mvgetnstr)
00680 #endif
00681 
00682 #ifdef mvinch
00683 inline chtype UNDEF(mvinch)(int y, int x) { return mvinch(y, x);}
00684 #undef mvinch
00685 #define mvinch UNDEF(mvinch)
00686 #endif
00687 
00688 #ifdef mvinsch
00689 inline int UNDEF(mvinsch)(int y, int x, char c)
00690 { return mvinsch(y, x, c); }
00691 #undef mvinsch
00692 #define mvinsch UNDEF(mvinsch)
00693 #endif
00694 
00695 #ifdef napms
00696 inline void UNDEF(napms)(unsigned long x) { napms(x); }
00697 #undef napms
00698 #define napms UNDEF(napms)
00699 #endif
00700 
00701 #ifdef fixterm
00702 inline int UNDEF(fixterm)(void) { return fixterm(); }
00703 #undef fixterm
00704 #define fixterm UNDEF(fixterm)
00705 #endif
00706 
00707 #ifdef resetterm
00708 inline int UNDEF(resetterm)(void) { return resetterm(); }
00709 #undef resetterm
00710 #define resetterm UNDEF(resetterm)
00711 #endif
00712 
00713 #ifdef saveterm
00714 inline int UNDEF(saveterm)(void) { return saveterm(); }
00715 #undef saveterm
00716 #define saveterm UNDEF(saveterm)
00717 #endif
00718 
00719 #ifdef crmode
00720 inline int UNDEF(crmode)(void) { return crmode(); }
00721 #undef crmode
00722 #define crmode UNDEF(crmode)
00723 #endif
00724 
00725 #ifdef nocrmode
00726 inline int UNDEF(nocrmode)(void) { return nocrmode(); }
00727 #undef nocrmode
00728 #define nocrmode UNDEF(nocrmode)
00729 #endif
00730 
00731 #ifdef getbkgd
00732 inline chtype UNDEF(getbkgd)(const WINDOW *win) { return getbkgd(win); }
00733 #undef getbkgd
00734 #define getbkgd UNDEF(getbkgd)
00735 #endif
00736 
00737 #ifdef bkgd
00738 inline int UNDEF(bkgd)(chtype ch) { return bkgd(ch); }
00739 #undef bkgd
00740 #define bkgd UNDEF(bkgd)
00741 #endif
00742 
00743 #ifdef bkgdset
00744 inline void UNDEF(bkgdset)(chtype ch) { bkgdset(ch); }
00745 #undef bkgdset
00746 #define bkgdset UNDEF(bkgdset)
00747 #endif
00748 
00752 class NCursesWindow
00753 {
00754   friend std::ostream & operator<<( std::ostream & Stream, const NCursesWindow & Obj_Cv );
00755   friend std::ostream & operator<<( std::ostream & Stream, const NCursesWindow * Obj_Cv );
00756   friend class NCursesMenu;
00757   friend class NCursesForm;
00758 
00759 private:
00760   static bool    b_initialized;
00761   static void    initialize();
00762   static int     ripoff_init(WINDOW *,int);
00763 
00764   void           init();
00765 
00766   short          getcolor(int getback) const;
00767 
00768   static int     setpalette(short fore, short back, short pair);
00769   static int     colorInitialized;
00770 
00775   NCursesWindow(WINDOW* win, int cols);
00776 
00777 protected:
00781   void           err_handler(const char *) const THROWS(NCursesException);
00782 
00786   static long count;
00787   //   We rely on the c++ promise that
00788   //   all otherwise uninitialized
00789   //   static class vars are set to 0
00790 
00794   WINDOW*        w;
00795 
00799   bool           alloced;
00800 
00804   NCursesWindow* par;
00808   NCursesWindow* subwins;
00812   NCursesWindow* sib;
00813 
00817   void           kill_subwindows();
00818 
00823   NCursesWindow();
00824 
00825 public:
00829   NCursesWindow(WINDOW* &window);
00830 
00842   NCursesWindow(int lines,
00843                 int cols,
00844                 int begin_y,
00845                 int begin_x);
00846 
00863   NCursesWindow(NCursesWindow& par,
00864                 int lines,
00865                 int cols,
00866                 int begin_y,
00867                 int begin_x,
00868                 char absrel = 'a');
00869 
00873   virtual ~NCursesWindow();
00874 
00878   NCursesWindow Clone();
00879 
00880   // -------------------------------------------------------------------------
00881   // Initialization.
00882   // -------------------------------------------------------------------------
00886   static void    useColors(void);
00887 
00898   static int ripoffline(int ripoff_lines,
00899                         int (*init)(NCursesWindow& win));
00900 
00901   // -------------------------------------------------------------------------
00902   // terminal status
00903   // -------------------------------------------------------------------------
00907   static int     lines() { return LINES; }
00908 
00912   static int     cols() { return COLS; }
00913 
00917   static int     tabsize() { return TABSIZE; }
00918 
00922   static int     NumberOfColors();
00923 
00927   int     colors() const { return NumberOfColors(); }
00928 
00929   // -------------------------------------------------------------------------
00930   // window status
00931   // -------------------------------------------------------------------------
00935   int            height() const { return maxy() + 1; }
00936 
00940   int            width() const { return maxx() + 1; }
00941 
00945   int            begx() const { return w->_begx; }
00946 
00950   int            begy() const { return w->_begy; }
00951 
00955   int            maxx() const { return w->_maxx; }
00956 
00960   int            maxy() const { return w->_maxy; }
00961 
00962 
00963   wsze   size()      const { return wsze(height(),width()); }
00964   wpos   begpos()    const { return wpos(begy(),begx()); }
00965   wpos   maxpos()    const { return wpos(maxy(),maxx()); }
00966 
00967   wrect  area()      const { return wrect( begpos(), size() ); }
00968 
00972   short  getcolor() const;
00973 
00977   short  foreground() const { return getcolor(0); }
00978 
00982   short  background() const { return getcolor(1); }
00983 
00987   int    setpalette(short fore, short back);
00988 
00992   int    setcolor(short pair);
00993 
00994   // -------------------------------------------------------------------------
00995   // window positioning
00996   // -------------------------------------------------------------------------
01001   virtual int  mvwin(int begin_y, int begin_x) {
01002     return ::mvwin(w,begin_y,begin_x); }
01003 
01004   int mvsubwin( NCursesWindow* sub, int begin_y, int begin_x );
01005 
01006   virtual int resize( int lines, int columns );
01007 
01008   // -------------------------------------------------------------------------
01009   // coordinate positioning
01010   // -------------------------------------------------------------------------
01014   int            move(int y, int x) { return ::wmove(w, y, x); }
01015 
01019   void           getyx(int& y, int& x) const { ::getyx(w, y, x); }
01020 
01024   int            mvcur(int oldrow, int oldcol, int newrow, int newcol) const {
01025     return ::mvcur(oldrow, oldcol, newrow, newcol); }
01026 
01027   // -------------------------------------------------------------------------
01028   // input
01029   // -------------------------------------------------------------------------
01030 
01031   int            nodelay( bool bf ) { return ::nodelay( w, bf ); }
01032 
01036   int            getch() { return ::wgetch(w); }
01037 
01041   int            getch(int y, int x) { return ::mvwgetch(w,y,x); }
01042 
01048   int            getstr(char* str, int n=-1) {
01049     return ::wgetnstr(w, str,n); }
01050 
01055   int            getstr(int y, int x, char* str, int n=-1) {
01056     return ::mvwgetnstr(w,y,x,str,n); }
01057 
01063   int            instr(char *s, int n=-1) { return ::winnstr(w,s,n); }
01064 
01069   int            instr(int y, int x, char *s, int n=-1) {
01070     return ::mvwinnstr(w,y,x,s,n); }
01071 
01072 #if 0
01073 
01077   int            scanw(const char* fmt, ...)
01078 #if __GNUG__ >= 2
01079     __attribute__ ((format (scanf, 2, 3)));
01080 #else
01081   ;
01082 #endif
01083 
01088   int            scanw(int y, int x, const char* fmt, ...)
01089 #if __GNUG__ >= 2
01090     __attribute__ ((format (scanf, 4, 5)));
01091 #else
01092   ;
01093 #endif
01094 #endif
01095 
01096   // -------------------------------------------------------------------------
01097   // output
01098   // -------------------------------------------------------------------------
01102   int            addch( const char ch ) {
01103     return addch( (const chtype)(ch&A_CHARTEXT) );
01104   }
01105   int            addch(const chtype ch) { return ::waddch(w, ch); }
01106 
01110   int           add_attr_char( int y, int x );
01111   int           add_attr_char();
01112     
01116   int            add_wch( const cchar_t * cch ) { return ::wadd_wch(w, cch); }
01117   int            add_wch( int y, int x, const cchar_t * cch ) { return mvwadd_wch(w, y, x, cch); }
01118      
01123   int            addch(int y, int x, const char ch ) {
01124     return addch( y, x, (const chtype)(ch&A_CHARTEXT) );
01125   }
01126   int            addch(int y, int x, const chtype ch) {
01127     return ::mvwaddch(w,y,x,ch); }
01128 
01132   int            echochar(const char ch ) {
01133     return echochar( (const chtype)(ch&A_CHARTEXT) );
01134   }
01135   int            echochar(const chtype ch) { return ::wechochar(w,ch); }
01136 
01141   int            addstr(const char* str, int n=-1) {
01142     return ::waddnstr(w, (char*)str,n); }
01143 
01148   int            addstr(int y, int x, const char * str, int n=-1) {
01149     return ::mvwaddnstr(w,y,x,(char*)str,n);
01150   }
01151 
01156   int            addwstr(const wchar_t* str, int n=-1);
01157     
01162   int            addwstr(int y, int x, const wchar_t * str, int n=-1);
01163 
01167   int            printw(const char* fmt, ...)
01168 #if __GNUG__ >= 2
01169     __attribute__ ((format (printf, 2, 3)));
01170 #else
01171   ;
01172 #endif
01173 
01177   int            printw(int y, int x, const char * fmt, ...)
01178 #if __GNUG__ >= 2
01179     __attribute__ ((format (printf, 4, 5)));
01180 #else
01181   ;
01182 #endif
01183 
01187   chtype         inch() const { return ::winch(w); }
01188   chtype         inchar() const { return inch()&(A_CHARTEXT|A_ALTCHARSET); }
01189 
01194   chtype         inch(int y, int x) { return ::mvwinch(w,y,x); }
01195   chtype         inchar(int y, int x) { return inch(y,x)&(A_CHARTEXT|A_ALTCHARSET); }
01196 
01200   int           in_wchar( cchar_t * cchar );
01201   int           in_wchar( int y, int x, cchar_t * cchar );
01202 
01207   int            insch(chtype ch) { return ::winsch(w, ch); }
01208 
01213   int            insch(int y, int x, chtype ch) {
01214     return ::mvwinsch(w,y,x,ch); }
01215 
01220   int            ins_wch(int y, int x, const cchar_t * cchar) {
01221     return mvwins_wch(w,y,x,cchar); }
01222 
01226   int            insertln() { return ::winsdelln(w,1); }
01227 
01232   int            insdelln(int n=1) { return ::winsdelln(w,n); }
01233 
01239   int            insstr(const char *s, int n=-1) {
01240     return ::winsnstr(w,s,n); }
01241 
01246   int            insstr(int y, int x, const char *s, int n=-1) {
01247     return ::mvwinsnstr(w,y,x,s,n); }
01248 
01252   int            attron (chtype at) { return ::wattron (w, at); }
01253 
01257   int            attroff(chtype at) { return ::wattroff(w, at); }
01258 
01262   int            attrset(chtype at) { return ::wattrset(w, at); }
01263 
01269   int            chgat(int n,attr_t attr, short color, const void *opts=NULL) {
01270     return ::wchgat(w,n,attr,color,opts); }
01271 
01276   int            chgat(int y, int x,
01277                        int n,attr_t attr, short color, const void *opts=NULL) {
01278     return ::mvwchgat(w,y,x,n,attr,color,opts); }
01279 
01280   // -------------------------------------------------------------------------
01281   // background
01282   // -------------------------------------------------------------------------
01286   chtype         getbkgd() const { return ::getbkgd(w); }
01287 
01291   int            bkgd(const chtype ch) { return ::wbkgd(w,ch); }
01292 
01296   void           bkgdset(chtype ch) { ::wbkgdset(w,ch); }
01297 
01298   // -------------------------------------------------------------------------
01299   // borders
01300   // -------------------------------------------------------------------------
01306   // int            box(chtype vert=0, chtype  hor=0) {
01307   //   return ::wborder(w, vert, vert, hor, hor, 0, 0 ,0, 0); }
01308 
01309   // workaround for 8.1: don't use wborder to draw the box 
01310   int box() { return box(wrect( wpos(0,0), size() )); }
01311     
01317   int            border(chtype left=0, chtype right=0,
01318                         chtype top =0, chtype bottom=0,
01319                         chtype top_left =0, chtype top_right=0,
01320                         chtype bottom_left =0, chtype bottom_right=0) {
01321     return ::wborder(w,left,right,top,bottom,top_left,top_right,
01322                      bottom_left,bottom_right); }
01323 
01324   // -------------------------------------------------------------------------
01325   // lines and boxes
01326   // -------------------------------------------------------------------------
01331   int            hline(int len, chtype ch=0) { return ::whline(w, ch, len); }
01332 
01336   int            hline(int y, int x, int len, chtype ch=0) {
01337     return ::mvwhline(w,y,x,ch,len); }
01338 
01343   int            vline(int len, chtype ch=0) { return ::wvline(w, ch, len); }
01344 
01348   int            vline(int y, int x, int len, chtype ch=0) {
01349     return ::mvwvline(w,y,x,ch,len); }
01350 
01351   int            box( const wrect & dim );
01352 
01353   // -------------------------------------------------------------------------
01354   // erasure
01355   // -------------------------------------------------------------------------
01359   int            erase() { return ::werase(w); }
01360 
01364   int            clear() { return ::wclear(w); }
01365 
01370   int            clearok(bool bf) { return ::clearok(w, bf); }
01371 
01375   int            clrtobot() { return ::wclrtobot(w); }
01376 
01380   int            clrtoeol() { return ::wclrtoeol(w); }
01381 
01385   int            delch() { return ::wdelch(w); }
01386 
01391   int            delch(int y, int x) { return ::mvwdelch(w,y,x); }
01392 
01396   int            deleteln() { return ::winsdelln(w,-1); }
01397 
01398   // -------------------------------------------------------------------------
01399   // screen control
01400   // -------------------------------------------------------------------------
01405   int            scroll(int amount=1) { return ::wscrl(w,amount); }
01406 
01412   int            scrollok(bool bf) { return ::scrollok(w, bf); }
01413 
01417   int            setscrreg(int from, int to) {
01418     return ::wsetscrreg(w,from,to); }
01419 
01424   int            idlok(bool bf) { return ::idlok(w, bf); }
01425 
01430   void           idcok(bool bf) { ::idcok(w, bf); }
01431 
01435   int            touchwin()   { return ::wtouchln(w,0,height(),1); }
01436 
01440   int            untouchwin() { return ::wtouchln(w,0,height(),0); }
01441 
01446   int            touchln(int s, int cnt, bool changed=TRUE) {
01447     return ::wtouchln(w,s,cnt,(int)(changed?1:0)); }
01448 
01452   bool           is_linetouched(int line) const {
01453     return (::is_linetouched(w,line) ? TRUE:FALSE); }
01454 
01458   bool           is_wintouched() const {
01459     return (::is_wintouched(w) ? TRUE:FALSE); }
01460 
01465   int            leaveok(bool bf) { return ::leaveok(w, bf); }
01466 
01470   int            redrawln(int from, int n) { return ::wredrawln(w,from,n); }
01471 
01475   int            redrawwin() { return ::wredrawln(w,0,height()); }
01476 
01480   int            doupdate()  { return ::doupdate(); }
01481 
01485   void           syncdown()  { ::wsyncdown(w); }
01486 
01490   void           syncup()    { ::wsyncup(w); }
01491 
01495   void           cursyncup() { ::wcursyncup(w); }
01496 
01500   int            syncok(bool bf) { return ::syncok(w,bf); }
01501 
01502 #ifndef _no_flushok
01503   int            flushok(bool bf) { return ::flushok(w, bf); }
01504 #endif
01505 
01510   void           immedok(bool bf) { ::immedok(w,bf); }
01511 
01515   int            keypad(bool bf) { return ::keypad(w, bf); }
01516 
01521   int            meta(bool bf) { return ::meta(w,bf); }
01522 
01526   int            standout() { return ::wstandout(w); }
01527 
01531   int            standend() { return ::wstandend(w); }
01532 
01533   // -------------------------------------------------------------------------
01534   // The next two are virtual, because we redefine them in the
01535   // NCursesPanel class.
01536   // -------------------------------------------------------------------------
01541   virtual int    refresh() { return ::wrefresh(w); }
01542 
01547   virtual int    noutrefresh() { return ::wnoutrefresh(w); }
01548 
01549   // -------------------------------------------------------------------------
01550   // multiple window control
01551   // -------------------------------------------------------------------------
01555   int            overlay(NCursesWindow& win) {
01556     return ::overlay(w, win.w); }
01557 
01561   int            overwrite(NCursesWindow& win) {
01562     return ::overwrite(w, win.w); }
01563 
01569   int            copywin(NCursesWindow& win,
01570                          int sminrow, int smincol,
01571                          int dminrow, int dmincol,
01572                          int dmaxrow, int dmaxcol, bool overlay=TRUE) {
01573     return ::copywin(w,win.w,sminrow,smincol,dminrow,dmincol,
01574                      dmaxrow,dmaxcol,(int)(overlay?1:0)); }
01575 
01576   // -------------------------------------------------------------------------
01577   // Mouse related
01578   // -------------------------------------------------------------------------
01582   bool has_mouse() const;
01583 
01584   // -------------------------------------------------------------------------
01585   // traversal support
01586   // -------------------------------------------------------------------------
01590   NCursesWindow*        child()       { return subwins; }
01591   const NCursesWindow*  child() const { return subwins; }
01592 
01596   NCursesWindow*        sibling()       { return sib; }
01597   const NCursesWindow*  sibling() const { return sib; }
01598 
01602   NCursesWindow*        parent()       { return par; }
01603   const NCursesWindow*  parent() const { return par; }
01604 
01608   bool isDescendant(NCursesWindow& win);
01609 };
01610 
01614 class NCursesColorWindow : public NCursesWindow {
01615 public:
01619   NCursesColorWindow(WINDOW* &window)
01620     : NCursesWindow(window) {
01621       useColors(); }
01622 
01634   NCursesColorWindow(int lines,
01635                      int cols,
01636                      int begin_y,
01637                      int begin_x)
01638     : NCursesWindow(lines,cols,begin_y,begin_x) {
01639       useColors(); }
01640 
01657   NCursesColorWindow(NCursesWindow& par,
01658                      int lines,
01659                      int cols,
01660                      int begin_y,
01661                      int begin_x,
01662                      char absrel = 'a')
01663     : NCursesWindow(par,lines,cols,
01664                     begin_y,begin_x,
01665                     absrel ) {
01666       useColors(); }
01667 };
01668 
01672 class NCursesPad : public NCursesWindow {
01673 public:
01674   NCursesPad(int lines, int cols);
01675 
01680   int echochar(const chtype ch) { return ::pechochar(w,ch); }
01681 
01687   int refresh() { return OK; };
01688   int noutrefresh() { return OK; };
01689 
01695   int refresh(int pminrow, int pmincol,
01696               int sminrow, int smincol,
01697               int smaxrow, int smaxcol) {
01698     return ::prefresh(w,pminrow,pmincol,
01699                       sminrow,smincol,smaxrow,smaxcol);
01700   }
01701 
01705   int noutrefresh(int pminrow, int pmincol,
01706                   int sminrow, int smincol,
01707                   int smaxrow, int smaxcol) {
01708     return ::pnoutrefresh(w,pminrow,pmincol,
01709                           sminrow,smincol,smaxrow,smaxcol);
01710   }
01711 };
01712 
01713 #endif // _CURSESW_H

Generated on Wed Sep 14 10:52:54 2005 for yast2-ncurses by  doxygen 1.4.4