Path: blob/master/Utilities/cmpdcurses/pdcurses/outopts.c
3153 views
/* PDCurses */12#include <curspriv.h>34/*man-start**************************************************************56outopts7-------89### Synopsis1011int clearok(WINDOW *win, bool bf);12int idlok(WINDOW *win, bool bf);13void idcok(WINDOW *win, bool bf);14void immedok(WINDOW *win, bool bf);15int leaveok(WINDOW *win, bool bf);16int setscrreg(int top, int bot);17int wsetscrreg(WINDOW *win, int top, int bot);18int scrollok(WINDOW *win, bool bf);1920int raw_output(bool bf);2122bool is_leaveok(const WINDOW *win);2324### Description2526With clearok(), if bf is TRUE, the next call to wrefresh() with this27window will clear the screen completely and redraw the entire screen.2829immedok(), called with a second argument of TRUE, causes an automatic30wrefresh() every time a change is made to the specified window.3132Normally, the hardware cursor is left at the location of the window33being refreshed. leaveok() allows the cursor to be left wherever the34update happens to leave it. It's useful for applications where the35cursor is not used, since it reduces the need for cursor motions. If36possible, the cursor is made invisible when this option is enabled.3738wsetscrreg() sets a scrolling region in a window; "top" and "bot" are39the line numbers for the top and bottom margins. If this option and40scrollok() are enabled, any attempt to move off the bottom margin41will cause all lines in the scrolling region to scroll up one line.42setscrreg() is the stdscr version.4344idlok() and idcok() do nothing in PDCurses, but are provided for45compatibility with other curses implementations.4647raw_output() enables the output of raw characters using the standard48*add* and *ins* curses functions (that is, it disables translation of49control characters).5051is_leaveok() reports whether the specified window is in leaveok mode.5253### Return Value5455All functions except is_leaveok() return OK on success and ERR on56error.5758### Portability59X/Open ncurses NetBSD60clearok Y Y Y61idlok Y Y Y62idcok Y Y Y63immedok Y Y Y64leaveok Y Y Y65setscrreg Y Y Y66wsetscrreg Y Y Y67scrollok Y Y Y68is_leaveok - Y Y69raw_output - - -7071**man-end****************************************************************/7273int clearok(WINDOW *win, bool bf)74{75PDC_LOG(("clearok() - called\n"));7677if (!win)78return ERR;7980win->_clear = bf;8182return OK;83}8485int idlok(WINDOW *win, bool bf)86{87PDC_LOG(("idlok() - called\n"));8889return OK;90}9192void idcok(WINDOW *win, bool bf)93{94PDC_LOG(("idcok() - called\n"));95}9697void immedok(WINDOW *win, bool bf)98{99PDC_LOG(("immedok() - called\n"));100101if (win)102win->_immed = bf;103}104105int leaveok(WINDOW *win, bool bf)106{107PDC_LOG(("leaveok() - called\n"));108109if (!win)110return ERR;111112win->_leaveit = bf;113114curs_set(!bf);115116return OK;117}118119int setscrreg(int top, int bottom)120{121PDC_LOG(("setscrreg() - called: top %d bottom %d\n", top, bottom));122123return wsetscrreg(stdscr, top, bottom);124}125126int wsetscrreg(WINDOW *win, int top, int bottom)127{128PDC_LOG(("wsetscrreg() - called: top %d bottom %d\n", top, bottom));129130if (win && 0 <= top && top <= win->_cury &&131win->_cury <= bottom && bottom < win->_maxy)132{133win->_tmarg = top;134win->_bmarg = bottom;135136return OK;137}138else139return ERR;140}141142int scrollok(WINDOW *win, bool bf)143{144PDC_LOG(("scrollok() - called\n"));145146if (!win)147return ERR;148149win->_scroll = bf;150151return OK;152}153154int raw_output(bool bf)155{156PDC_LOG(("raw_output() - called\n"));157158if (!SP)159return ERR;160161SP->raw_out = bf;162163return OK;164}165166bool is_leaveok(const WINDOW *win)167{168PDC_LOG(("is_leaveok() - called\n"));169170if (!win)171return FALSE;172173return win->_leaveit;174}175176177