X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=c%2B%2B%2Fcursesw.h;h=602b7a9650912544cac6ad385dc1324d8c1b5a94;hp=b8e921a9b7aa41edb1d5461b3a276d87a24c34f8;hb=2b7c2fd2f9d58719770902ce4d0d0aeb87b284f7;hpb=25358bc041a5566ce2de4c9c792837e552b35671 diff --git a/c++/cursesw.h b/c++/cursesw.h index b8e921a9..602b7a96 100644 --- a/c++/cursesw.h +++ b/c++/cursesw.h @@ -1,7 +1,8 @@ // * This makes emacs happy -*-Mode: C++;-*- // vile:cppmode /**************************************************************************** - * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. * + * Copyright 2019,2020 Thomas E. Dickey * + * Copyright 1998-2014,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,14 +32,25 @@ #ifndef NCURSES_CURSESW_H_incl #define NCURSES_CURSESW_H_incl 1 -// $Id: cursesw.h,v 1.48 2008/01/19 21:09:10 tom Exp $ - -#include +// $Id: cursesw.h,v 1.57 2020/07/04 20:38:43 tom Exp $ extern "C" { # include } +#if defined(BUILDING_NCURSES_CXX) +# define NCURSES_CXX_IMPEXP NCURSES_EXPORT_GENERAL_EXPORT +#else +# define NCURSES_CXX_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT +#endif + +#define NCURSES_CXX_WRAPPED_VAR(type,name) extern NCURSES_CXX_IMPEXP type NCURSES_PUBLIC_VAR(name)(void) + +#define NCURSES_CXX_EXPORT(type) NCURSES_CXX_IMPEXP type NCURSES_API +#define NCURSES_CXX_EXPORT_VAR(type) NCURSES_CXX_IMPEXP type + +#include + /* SCO 3.2v4 curses.h includes term.h, which defines lines as a macro. Undefine it here, because NCursesWindow uses lines as a method. */ #undef lines @@ -118,7 +130,7 @@ inline int UNDEF(box)(WINDOW *win, int v, int h) { return box(win, v, h); } #endif #ifdef chgat -inline int UNDEF(chgat)(int n, attr_t attr, short color, const void *opts) { +inline int UNDEF(chgat)(int n, attr_t attr, NCURSES_PAIRS_T color, const void *opts) { return chgat(n, attr, color, opts); } #undef chgat #define chgat UNDEF(chgat) @@ -151,7 +163,7 @@ inline int UNDEF(clrtoeol)() { return clrtoeol(); } #endif #ifdef color_set -inline chtype UNDEF(color_set)(short p, void* opts) { return color_set(p, opts); } +inline chtype UNDEF(color_set)(NCURSES_PAIRS_T p, void* opts) { return color_set(p, opts); } #undef color_set #define color_set UNDEF(color_set) #endif @@ -324,6 +336,12 @@ inline void UNDEF(intrflush)(WINDOW *win, bool bf) { intrflush(); } #define intrflush UNDEF(intrflush) #endif +#ifdef is_linetouched +inline int UNDEF(is_linetouched)(WINDOW *w, int l) { return is_linetouched(w,l); } +#undef is_linetouched +#define is_linetouched UNDEF(is_linetouched) +#endif + #ifdef leaveok inline int UNDEF(leaveok)(WINDOW* win, bool bf) { return leaveok(win, bf); } #undef leaveok @@ -361,7 +379,7 @@ inline int UNDEF(mvaddstr)(int y, int x, const char * str) #ifdef mvchgat inline int UNDEF(mvchgat)(int y, int x, int n, - attr_t attr, short color, const void *opts) { + attr_t attr, NCURSES_PAIRS_T color, const void *opts) { return mvchgat(y, x, n, attr, color, opts); } #undef mvchgat #define mvchgat UNDEF(mvchgat) @@ -463,7 +481,7 @@ inline int UNDEF(mvwaddstr)(WINDOW *win, int y, int x, const char * str) #ifdef mvwchgat inline int UNDEF(mvwchgat)(WINDOW *win, int y, int x, int n, - attr_t attr, short color, const void *opts) { + attr_t attr, NCURSES_PAIRS_T color, const void *opts) { return mvwchgat(win, y, x, n, attr, color, opts); } #undef mvwchgat #define mvwchgat UNDEF(mvwchgat) @@ -750,7 +768,7 @@ extern "C" int _nc_ripoffline(int, int (*init)(WINDOW*, int)); extern "C" int _nc_xx_ripoff_init(WINDOW *, int); extern "C" int _nc_has_mouse(void); -class NCURSES_IMPEXP NCursesWindow +class NCURSES_CXX_IMPEXP NCursesWindow { friend class NCursesMenu; friend class NCursesForm; @@ -763,10 +781,10 @@ private: void set_keyboard(); - short getcolor(int getback) const; - short getPair() const; + NCURSES_COLOR_T getcolor(int getback) const; + NCURSES_PAIRS_T getPair() const; - static int setpalette(short fore, short back, short pair); + static int setpalette(NCURSES_COLOR_T fore, NCURSES_COLOR_T back, NCURSES_PAIRS_T pair); static int colorInitialized; // This private constructor is only used during the initialization @@ -831,7 +849,7 @@ public: { } - virtual ~NCursesWindow(); + virtual ~NCursesWindow() THROWS(NCursesException); NCursesWindow Clone(); // Make an exact copy of the window. @@ -896,19 +914,19 @@ public: int maxy() const { return getmaxy(w) == ERR ? ERR : getmaxy(w)-1; } // Largest y coord in window - short getcolor() const; + NCURSES_PAIRS_T getcolor() const; // Actual color pair - short foreground() const { return getcolor(0); } + NCURSES_COLOR_T foreground() const { return getcolor(0); } // Actual foreground color - short background() const { return getcolor(1); } + NCURSES_COLOR_T background() const { return getcolor(1); } // Actual background color - int setpalette(short fore, short back); + int setpalette(NCURSES_COLOR_T fore, NCURSES_COLOR_T back); // Set color palette entry - int setcolor(short pair); + int setcolor(NCURSES_PAIRS_T pair); // Set actually used palette entry // ------------------------------------------------------------------------- @@ -1107,18 +1125,18 @@ public: chtype attrget() { return ::getattrs(w); } // Get the window attributes; - int color_set(short color_pair_number, void* opts=NULL) { + int color_set(NCURSES_PAIRS_T color_pair_number, void* opts=NULL) { return ::wcolor_set(w, color_pair_number, opts); } // Set the window color attribute; - int chgat(int n, attr_t attr, short color, const void *opts=NULL) { + int chgat(int n, attr_t attr, NCURSES_PAIRS_T color, const void *opts=NULL) { return ::wchgat(w, n, attr, color, opts); } // Change the attributes of the next n characters in the current line. If // n is negative or greater than the number of remaining characters in the // line, the attributes will be changed up to the end of the line. int chgat(int y, int x, - int n, attr_t attr, short color, const void *opts=NULL) { + int n, attr_t attr, NCURSES_PAIRS_T color, const void *opts=NULL) { return ::mvwchgat(w, y, x, n, attr, color, opts); } // Move the cursor to the requested position and then perform chgat() as // described above. @@ -1241,7 +1259,7 @@ public: // on the value of the changed flag. bool is_linetouched(int line) const { - return (::is_linetouched(w, line) ? TRUE:FALSE); } + return (::is_linetouched(w, line) == TRUE ? TRUE:FALSE); } // Return TRUE if line is marked as changed, FALSE otherwise bool is_wintouched() const { @@ -1249,7 +1267,7 @@ public: // Return TRUE if window is marked as changed, FALSE otherwise int leaveok(bool bf) { return ::leaveok(w, bf); } - // If bf is TRUE, curses will leave the cursor after an update whereever + // If bf is TRUE, curses will leave the cursor after an update wherever // it is after the update. int redrawln(int from, int n) { return ::wredrawln(w, from, n); } @@ -1364,7 +1382,7 @@ public: // ------------------------------------------------------------------------- // We leave this here for compatibility reasons. // ------------------------------------------------------------------------- -class NCURSES_IMPEXP NCursesColorWindow : public NCursesWindow +class NCURSES_CXX_IMPEXP NCursesColorWindow : public NCursesWindow { public: NCursesColorWindow(WINDOW* &window) // useful only for stdscr @@ -1410,7 +1428,7 @@ public: // Pad Support. We allow an association of a pad with a "real" window // through which the pad may be viewed. // ------------------------------------------------------------------------- -class NCURSES_IMPEXP NCursesPad : public NCursesWindow +class NCURSES_CXX_IMPEXP NCursesPad : public NCursesWindow { private: NCursesWindow* viewWin; // the "viewport" window @@ -1438,16 +1456,19 @@ protected: // The driver translates the keystroke c into an Pad_Request virtual void OnUnknownOperation(int pad_req) { + (void) pad_req; ::beep(); } // This is called if the driver returns an unknown op-code virtual void OnNavigationError(int pad_req) { + (void) pad_req; ::beep(); } // This is called if a navigation request couldn't be satisfied virtual void OnOperation(int pad_req) { + (void) pad_req; }; // OnOperation is called if a Pad_Operation was executed and just before // the refresh() operation is done. @@ -1476,7 +1497,7 @@ public: { } - virtual ~NCursesPad() {} + virtual ~NCursesPad() THROWS(NCursesException) {} int echochar(const chtype ch) { return ::pechochar(w, ch); } // Put the attributed character onto the pad and immediately do a @@ -1523,7 +1544,7 @@ public: // A FramedPad is constructed always with a viewport window. This viewport // will be framed (by a box() command) and the interior of the box is the // viewport subwindow. On the frame we display scrollbar sliders. -class NCURSES_IMPEXP NCursesFramedPad : public NCursesPad +class NCURSES_CXX_IMPEXP NCursesFramedPad : public NCursesPad { protected: virtual void OnOperation(int pad_req); @@ -1537,16 +1558,20 @@ public: } // Construct the FramedPad with the given Window win as viewport. - virtual ~NCursesFramedPad() { + virtual ~NCursesFramedPad() THROWS(NCursesException) { delete getSubWindow(); } void setWindow(NCursesWindow& view, int v_grid = 1, int h_grid = 1) { + (void) view; + (void) v_grid; + (void) h_grid; err_handler("Operation not allowed"); } // Disable this call; the viewport is already defined void setSubWindow(NCursesWindow& sub) { + (void) sub; err_handler("Operation not allowed"); } // Disable this call; the viewport subwindow is already defined