mirror of
https://github.com/VARCem/PDCurses.git
synced 2026-09-23 07:15:05 +00:00
Some functions from ncurses / NetBSD curses: is_keypad(), is_leaveok(),
is_pad(), set_tabsize(). Code by Karthik Kumar Viswanathan.
This commit is contained in:
6
curses.h
6
curses.h
@@ -28,7 +28,7 @@ Defined by this header:
|
||||
**man-end****************************************************************/
|
||||
|
||||
#define PDCURSES 1 /* PDCurses-only routines */
|
||||
#define PDC_BUILD 3803
|
||||
#define PDC_BUILD 3804
|
||||
#define PDC_VER_MAJOR 3
|
||||
#define PDC_VER_MINOR 8
|
||||
#define PDC_VERDOT "3.8"
|
||||
@@ -1271,6 +1271,10 @@ PDCEX mmask_t getmouse(void);
|
||||
PDCEX int assume_default_colors(int, int);
|
||||
PDCEX const char *curses_version(void);
|
||||
PDCEX bool has_key(int);
|
||||
PDCEX bool is_keypad(const WINDOW *);
|
||||
PDCEX bool is_leaveok(const WINDOW *);
|
||||
PDCEX bool is_pad(const WINDOW *);
|
||||
PDCEX int set_tabsize(int);
|
||||
PDCEX int use_default_colors(void);
|
||||
PDCEX int wresize(WINDOW *, int, int);
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@ initscr
|
||||
const char *curses_version(void);
|
||||
void PDC_get_version(PDC_VERSION *ver);
|
||||
|
||||
int set_tabsize(int tabsize);
|
||||
|
||||
### Description
|
||||
|
||||
initscr() should be the first curses routine called. It will
|
||||
@@ -76,6 +78,8 @@ initscr
|
||||
PDC_get_version() fills a PDC_VERSION structure provided by the user
|
||||
with more detailed version info (see curses.h).
|
||||
|
||||
set_tabsize() sets the tab interval, stored in TABSIZE.
|
||||
|
||||
### Return Value
|
||||
|
||||
All functions return NULL on error, except endwin(), which always
|
||||
@@ -92,6 +96,7 @@ initscr
|
||||
resize_term - - -
|
||||
is_termresized - - -
|
||||
curses_version - - -
|
||||
set_tabsize - Y -
|
||||
|
||||
**man-end****************************************************************/
|
||||
|
||||
@@ -379,3 +384,15 @@ void PDC_get_version(PDC_VERSION *ver)
|
||||
ver->csize = sizeof(chtype);
|
||||
ver->bsize = sizeof(bool);
|
||||
}
|
||||
|
||||
int set_tabsize(int tabsize)
|
||||
{
|
||||
PDC_LOG(("set_tabsize() - called: tabsize %d\n", tabsize));
|
||||
|
||||
if (tabsize < 1)
|
||||
return ERR;
|
||||
|
||||
TABSIZE = tabsize;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -32,6 +32,8 @@ inopts
|
||||
int crmode(void);
|
||||
int nocrmode(void);
|
||||
|
||||
bool is_keypad(const WINDOW *win);
|
||||
|
||||
### Description
|
||||
|
||||
cbreak() and nocbreak() toggle cbreak mode. In cbreak mode,
|
||||
@@ -87,9 +89,12 @@ inopts
|
||||
crmode() and nocrmode() are archaic equivalents to cbreak() and
|
||||
nocbreak(), respectively.
|
||||
|
||||
is_keypad() reports whether the specified window is in keypad mode.
|
||||
|
||||
### Return Value
|
||||
|
||||
All functions return OK on success and ERR on error.
|
||||
All functions except is_keypad() and the void functions return OK on
|
||||
success and ERR on error.
|
||||
|
||||
### Portability
|
||||
X/Open BSD SYS V
|
||||
@@ -114,6 +119,7 @@ inopts
|
||||
typeahead Y - Y
|
||||
crmode -
|
||||
nocrmode -
|
||||
is_keypad - Y -
|
||||
|
||||
**man-end****************************************************************/
|
||||
|
||||
@@ -322,3 +328,13 @@ int nocrmode(void)
|
||||
|
||||
return nocbreak();
|
||||
}
|
||||
|
||||
bool is_keypad(const WINDOW *win)
|
||||
{
|
||||
PDC_LOG(("is_keypad() - called\n"));
|
||||
|
||||
if (!win)
|
||||
return FALSE;
|
||||
|
||||
return win->_use_keypad;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ outopts
|
||||
|
||||
int raw_output(bool bf);
|
||||
|
||||
bool is_leaveok(const WINDOW *win);
|
||||
|
||||
### Description
|
||||
|
||||
With clearok(), if bf is TRUE, the next call to wrefresh() with
|
||||
@@ -50,9 +52,12 @@ outopts
|
||||
standard *add* and *ins* curses functions (that is, it disables
|
||||
translation of control characters).
|
||||
|
||||
is_leaveok() reports whether the specified window is in leaveok mode.
|
||||
|
||||
### Return Value
|
||||
|
||||
All functions return OK on success and ERR on error.
|
||||
All functions except is_leaveok() return OK on success and ERR on
|
||||
error.
|
||||
|
||||
### Portability
|
||||
X/Open BSD SYS V
|
||||
@@ -65,6 +70,7 @@ outopts
|
||||
wsetscrreg Y Y Y
|
||||
scrollok Y Y Y
|
||||
raw_output - - -
|
||||
is_leaveok - Y -
|
||||
|
||||
**man-end****************************************************************/
|
||||
|
||||
@@ -157,3 +163,13 @@ int raw_output(bool bf)
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
bool is_leaveok(const WINDOW *win)
|
||||
{
|
||||
PDC_LOG(("is_leaveok() - called\n"));
|
||||
|
||||
if (!win)
|
||||
return FALSE;
|
||||
|
||||
return win->_leaveit;
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@ pad
|
||||
int pechochar(WINDOW *pad, chtype ch);
|
||||
int pecho_wchar(WINDOW *pad, const cchar_t *wch);
|
||||
|
||||
bool is_pad(const WINDOW *pad);
|
||||
|
||||
### Description
|
||||
|
||||
A pad is a special kind of window, which is not restricted by
|
||||
@@ -54,9 +56,11 @@ pad
|
||||
a call to prefresh(), with the last-used coordinates and
|
||||
dimensions. pecho_wchar() is the wide-character version.
|
||||
|
||||
is_pad() reports whether the specified window is a pad.
|
||||
|
||||
### Return Value
|
||||
|
||||
All functions return OK on success and ERR on error.
|
||||
All functions except is_pad() return OK on success and ERR on error.
|
||||
|
||||
### Portability
|
||||
X/Open BSD SYS V
|
||||
@@ -66,6 +70,7 @@ pad
|
||||
pnoutrefresh Y - Y
|
||||
pechochar Y - 3.0
|
||||
pecho_wchar Y
|
||||
is_pad - Y -
|
||||
|
||||
**man-end****************************************************************/
|
||||
|
||||
@@ -262,3 +267,13 @@ int pecho_wchar(WINDOW *pad, const cchar_t *wch)
|
||||
save_smincol, save_smaxrow, save_smaxcol);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool is_pad(const WINDOW *pad)
|
||||
{
|
||||
PDC_LOG(("is_pad() - called\n"));
|
||||
|
||||
if (!pad)
|
||||
return FALSE;
|
||||
|
||||
return (pad->_flags & _PAD) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user