📄 ncurses.h
字号:
struct ldat;struct _win_st{ NCURSES_SIZE_T _cury, _curx; /* current cursor position */ /* window location and size */ NCURSES_SIZE_T _maxy, _maxx; /* maximums of x and y, NOT window size */ NCURSES_SIZE_T _begy, _begx; /* screen coords of upper-left-hand corner */ short _flags; /* window state flags */ /* attribute tracking */ attr_t _attrs; /* current attribute for non-space character */ chtype _bkgd; /* current background char/attribute pair */ /* option values set by user */ bool _notimeout; /* no time out on function-key entry? */ bool _clear; /* consider all data in the window invalid? */ bool _leaveok; /* OK to not reset cursor on exit? */ bool _scroll; /* OK to scroll this window? */ bool _idlok; /* OK to use insert/delete line? */ bool _idcok; /* OK to use insert/delete char? */ bool _immed; /* window in immed mode? (not yet used) */ bool _sync; /* window in sync mode? */ bool _use_keypad; /* process function keys into KEY_ symbols? */ int _delay; /* 0 = nodelay, <0 = blocking, >0 = delay */ struct ldat *_line; /* the actual line data */ /* global screen state */ NCURSES_SIZE_T _regtop; /* top line of scrolling region */ NCURSES_SIZE_T _regbottom; /* bottom line of scrolling region */ /* these are used only if this is a sub-window */ int _parx; /* x coordinate of this window in parent */ int _pary; /* y coordinate of this window in parent */ WINDOW *_parent; /* pointer to parent if a sub-window */ /* these are used only if this is a pad */ struct pdat { NCURSES_SIZE_T _pad_y, _pad_x; NCURSES_SIZE_T _pad_top, _pad_left; NCURSES_SIZE_T _pad_bottom, _pad_right; } _pad; NCURSES_SIZE_T _yoffset; /* real begy is _begy + _yoffset */#ifdef _XOPEN_SOURCE_EXTENDED cchar_t _bkgrnd; /* current background char/attribute pair */#endif};extern NCURSES_EXPORT_VAR(WINDOW *) stdscr;extern NCURSES_EXPORT_VAR(WINDOW *) curscr;extern NCURSES_EXPORT_VAR(WINDOW *) newscr;extern NCURSES_EXPORT_VAR(int) LINES;extern NCURSES_EXPORT_VAR(int) COLS;extern NCURSES_EXPORT_VAR(int) TABSIZE;/* * This global was an undocumented feature under AIX curses. */extern NCURSES_EXPORT_VAR(int) ESCDELAY; /* ESC expire time in milliseconds */extern NCURSES_EXPORT_VAR(char) ttytype[]; /* needed for backward compatibility *//* * These functions are extensions - not in XSI Curses. */#if 1extern NCURSES_EXPORT(bool) is_term_resized (int, int);extern NCURSES_EXPORT(char *) keybound (int, int);extern NCURSES_EXPORT(const char *) curses_version (void);extern NCURSES_EXPORT(int) assume_default_colors (int, int);extern NCURSES_EXPORT(int) define_key (char *, int);extern NCURSES_EXPORT(int) keyok (int, bool);extern NCURSES_EXPORT(int) resize_term (int, int);extern NCURSES_EXPORT(int) resizeterm (int, int);extern NCURSES_EXPORT(int) use_default_colors (void);extern NCURSES_EXPORT(int) use_extended_names (bool);extern NCURSES_EXPORT(int) wresize (WINDOW *, int, int);#else#define curses_version() NCURSES_VERSION#endif/* * This is an extension to support events... */#if 1#ifdef NCURSES_WGETCH_EVENTS#if !defined(__BEOS__) /* Fix _nc_timed_wait() on BEOS... */# define NCURSES_EVENT_VERSION 1#endif /* !defined(__BEOS__) *//* * Bits to set in _nc_event.data.flags */# define _NC_EVENT_TIMEOUT_MSEC 1# define _NC_EVENT_FILE 2# define _NC_EVENT_FILE_READABLE 2# if 0 /* Not supported yet... */# define _NC_EVENT_FILE_WRITABLE 4# define _NC_EVENT_FILE_EXCEPTION 8# endiftypedef struct{ int type; union { long timeout_msec; /* _NC_EVENT_TIMEOUT_MSEC */ struct { unsigned int flags; int fd; unsigned int result; } fev; /* _NC_EVENT_FILE */ } data;} _nc_event;typedef struct{ int count; int result_flags; /* _NC_EVENT_TIMEOUT_MSEC or _NC_EVENT_FILE_READABLE */ _nc_event *events[1];} _nc_eventlist;extern NCURSES_EXPORT(int) wgetch_events(WINDOW *, _nc_eventlist *); /* experimental */extern NCURSES_EXPORT(int) wgetnstr_events(WINDOW *,char *,int,_nc_eventlist *);/* experimental */#endif /* NCURSES_WGETCH_EVENTS */#endif /* NCURSES_EXT_FUNCS *//* * GCC (and some other compilers) define '__attribute__'; we're using this * macro to alert the compiler to flag inconsistencies in printf/scanf-like * function calls. Just in case '__attribute__' isn't defined, make a dummy. * G++ doesn't accept it anyway. */#if !defined(__GNUC__) && !defined(__attribute__)#define __attribute__(p) /* nothing */#endif/* * For g++, turn off our macros that use __attribute__ (g++ recognizes some * of them, but not at the same version levels as gcc). */#ifdef __cplusplus#undef GCC_NORETURN#undef GCC_PRINTF#undef GCC_SCANF#undef GCC_UNUSED#endif/* * We cannot define these in ncurses_cfg.h, since they require parameters to be * passed (that's non-portable). */#ifndef GCC_PRINTFLIKE#if defined(GCC_PRINTF) && !defined(printf)#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))#else#define GCC_PRINTFLIKE(fmt,var) /*nothing*/#endif#endif#ifndef GCC_SCANFLIKE#if defined(GCC_SCANF) && !defined(scanf)#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))#else#define GCC_SCANFLIKE(fmt,var) /*nothing*/#endif#endif#ifndef GCC_NORETURN#define GCC_NORETURN /* nothing */#endif#ifndef GCC_UNUSED#define GCC_UNUSED /* nothing */#endif/* * Function prototypes. This is the complete XSI Curses list of required * functions. Those marked `generated' will have sources generated from the * macro definitions later in this file, in order to satisfy XPG4.2 * requirements. */extern NCURSES_EXPORT(int) addch (const chtype); /* generated */extern NCURSES_EXPORT(int) addchnstr (const chtype *, int); /* generated */extern NCURSES_EXPORT(int) addchstr (const chtype *); /* generated */extern NCURSES_EXPORT(int) addnstr (const char *, int); /* generated */extern NCURSES_EXPORT(int) addstr (const char *); /* generated */extern NCURSES_EXPORT(int) attroff (NCURSES_ATTR_T); /* generated */extern NCURSES_EXPORT(int) attron (NCURSES_ATTR_T); /* generated */extern NCURSES_EXPORT(int) attrset (NCURSES_ATTR_T); /* generated */extern NCURSES_EXPORT(int) attr_get (attr_t *, short *, void *); /* generated */extern NCURSES_EXPORT(int) attr_off (attr_t, void *); /* generated */extern NCURSES_EXPORT(int) attr_on (attr_t, void *); /* generated */extern NCURSES_EXPORT(int) attr_set (attr_t, short, void *); /* generated */extern NCURSES_EXPORT(int) baudrate (void); /* implemented */extern NCURSES_EXPORT(int) beep (void); /* implemented */extern NCURSES_EXPORT(int) bkgd (chtype); /* generated */extern NCURSES_EXPORT(void) bkgdset (chtype); /* generated */extern NCURSES_EXPORT(int) border (chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* generated */extern NCURSES_EXPORT(int) box (WINDOW *, chtype, chtype); /* generated */extern NCURSES_EXPORT(bool) can_change_color (void); /* implemented */extern NCURSES_EXPORT(int) cbreak (void); /* implemented */extern NCURSES_EXPORT(int) chgat (int, attr_t, short, const void *); /* generated */extern NCURSES_EXPORT(int) clear (void); /* generated */extern NCURSES_EXPORT(int) clearok (WINDOW *,bool); /* implemented */extern NCURSES_EXPORT(int) clrtobot (void); /* generated */extern NCURSES_EXPORT(int) clrtoeol (void); /* generated */extern NCURSES_EXPORT(int) color_content (short,short*,short*,short*); /* implemented */extern NCURSES_EXPORT(int) color_set (short,void*); /* generated */extern NCURSES_EXPORT(int) COLOR_PAIR (int); /* generated */extern NCURSES_EXPORT(int) copywin (const WINDOW*,WINDOW*,int,int,int,int,int,int,int); /* implemented */extern NCURSES_EXPORT(int) curs_set (int); /* implemented */extern NCURSES_EXPORT(int) def_prog_mode (void); /* implemented */extern NCURSES_EXPORT(int) def_shell_mode (void); /* implemented */extern NCURSES_EXPORT(int) delay_output (int); /* implemented */extern NCURSES_EXPORT(int) delch (void); /* generated */extern NCURSES_EXPORT(void) delscreen (SCREEN *); /* implemented */extern NCURSES_EXPORT(int) delwin (WINDOW *); /* implemented */extern NCURSES_EXPORT(int) deleteln (void); /* generated */extern NCURSES_EXPORT(WINDOW *) derwin (WINDOW *,int,int,int,int); /* implemented */extern NCURSES_EXPORT(int) doupdate (void); /* implemented */extern NCURSES_EXPORT(WINDOW *) dupwin (WINDOW *); /* implemented */extern NCURSES_EXPORT(int) echo (void); /* implemented */extern NCURSES_EXPORT(int) echochar (const chtype); /* generated */extern NCURSES_EXPORT(int) erase (void); /* generated */extern NCURSES_EXPORT(int) endwin (void); /* implemented */extern NCURSES_EXPORT(char) erasechar (void); /* implemented */extern NCURSES_EXPORT(void) filter (void); /* implemented */extern NCURSES_EXPORT(int) flash (void); /* implemented */extern NCURSES_EXPORT(int) flushinp (void); /* implemented */extern NCURSES_EXPORT(chtype) getbkgd (WINDOW *); /* generated */extern NCURSES_EXPORT(int) getch (void); /* generated */extern NCURSES_EXPORT(int) getnstr (char *, int); /* generated */extern NCURSES_EXPORT(int) getstr (char *); /* generated */extern NCURSES_EXPORT(WINDOW *) getwin (FILE *); /* implemented */extern NCURSES_EXPORT(int) halfdelay (int); /* implemented */extern NCURSES_EXPORT(bool) has_colors (void); /* implemented */extern NCURSES_EXPORT(bool) has_ic (void); /* implemented */extern NCURSES_EXPORT(bool) has_il (void); /* implemented */extern NCURSES_EXPORT(int) hline (chtype, int); /* generated */extern NCURSES_EXPORT(void) idcok (WINDOW *, bool); /* implemented */extern NCURSES_EXPORT(int) idlok (WINDOW *, bool); /* implemented */extern NCURSES_EXPORT(void) immedok (WINDOW *, bool); /* implemented */extern NCURSES_EXPORT(chtype) inch (void); /* generated */extern NCURSES_EXPORT(int) inchnstr (chtype *, int); /* generated */extern NCURSES_EXPORT(int) inchstr (chtype *); /* generated */extern NCURSES_EXPORT(WINDOW *) initscr (void); /* implemented */extern NCURSES_EXPORT(int) init_color (short,short,short,short); /* implemented */extern NCURSES_EXPORT(int) init_pair (short,short,short); /* implemented */extern NCURSES_EXPORT(int) innstr (char *, int); /* generated */extern NCURSES_EXPORT(int) insch (chtype); /* generated */extern NCURSES_EXPORT(int) insdelln (int); /* generated */extern NCURSES_EXPORT(int) insertln (void); /* generated */extern NCURSES_EXPORT(int) insnstr (const char *, int); /* generated */extern NCURSES_EXPORT(int) insstr (const char *); /* generated */extern NCURSES_EXPORT(int) instr (char *); /* generated */extern NCURSES_EXPORT(int) intrflush (WINDOW *,bool); /* implemented */extern NCURSES_EXPORT(bool) isendwin (void); /* implemented */extern NCURSES_EXPORT(bool) is_linetouched (WINDOW *,int); /* implemented */extern NCURSES_EXPORT(bool) is_wintouched (WINDOW *); /* implemented */extern NCURSES_EXPORT(NCURSES_CONST char *) keyname (int); /* implemented */extern NCURSES_EXPORT(int) keypad (WINDOW *,bool); /* implemented */extern NCURSES_EXPORT(char) killchar (void); /* implemented */extern NCURSES_EXPORT(int) leaveok (WINDOW *,bool); /* implemented */extern NCURSES_EXPORT(char *) longname (void); /* implemented */extern NCURSES_EXPORT(int) meta (WINDOW *,bool); /* implemented */extern NCURSES_EXPORT(int) move (int, int); /* generated */extern NCURSES_EXPORT(int) mvaddch (int, int, const chtype); /* generated */extern NCURSES_EXPORT(int) mvaddchnstr (int, int, const chtype *, int); /* generated */extern NCURSES_EXPORT(int) mvaddchstr (int, int, const chtype *); /* generated */extern NCURSES_EXPORT(int) mvaddnstr (int, int, const char *, int); /* generated */extern NCURSES_EXPORT(int) mvaddstr (int, int, const char *); /* generated */extern NCURSES_EXPORT(int) mvchgat (int, int, int, attr_t, short, const void *); /* generated */extern NCURSES_EXPORT(int) mvcur (int,int,int,int); /* implemented */extern NCURSES_EXPORT(int) mvdelch (int, int); /* generated */extern NCURSES_EXPORT(int) mvderwin (WINDOW *, int, int); /* implemented */extern NCURSES_EXPORT(int) mvgetch (int, int); /* generated */extern NCURSES_EXPORT(int) mvgetnstr (int, int, char *, int); /* generated */extern NCURSES_EXPORT(int) mvgetstr (int, int, char *); /* generated */extern NCURSES_EXPORT(int) mvhline (int, int, chtype, int); /* generated */extern NCURSES_EXPORT(chtype) mvinch (int, int); /* generated */extern NCURSES_EXPORT(int) mvinchnstr (int, int, chtype *, int); /* generated */extern NCURSES_EXPORT(int) mvinchstr (int, int, chtype *); /* generated */extern NCURSES_EXPORT(int) mvinnstr (int, int, char *, int); /* generated */extern NCURSES_EXPORT(int) mvinsch (int, int, chtype); /* generated */extern NCURSES_EXPORT(int) mvinsnstr (int, int, const char *, int); /* generated */extern NCURSES_EXPORT(int) mvinsstr (int, int, const char *); /* generated */extern NCURSES_EXPORT(int) mvinstr (int, int, char *); /* generated */extern NCURSES_EXPORT(int) mvprintw (int,int, const char *,...) /* implemented */ GCC_PRINTFLIKE(3,4);extern NCURSES_EXPORT(int) mvscanw (int,int, NCURSES_CONST char *,...) /* implemented */ GCC_SCANFLIKE(3,4);extern NCURSES_EXPORT(int) mvvline (int, int, chtype, int); /* generated */extern NCURSES_EXPORT(int) mvwaddch (WINDOW *, int, int, const chtype); /* generated */extern NCURSES_EXPORT(int) mvwaddchnstr (WINDOW *, int, int, const chtype *, int);/* generated */extern NCURSES_EXPORT(int) mvwaddchstr (WINDOW *, int, int, const chtype *); /* generated */extern NCURSES_EXPORT(int) mvwaddnstr (WINDOW *, int, int, const char *, int); /* generated */extern NCURSES_EXPORT(int) mvwaddstr (WINDOW *, int, int, const char *); /* generated */extern NCURSES_EXPORT(int) mvwchgat (WINDOW *, int, int, int, attr_t, short, const void *);/* generated */extern NCURSES_EXPORT(int) mvwdelch (WINDOW *, int, int); /* generated */extern NCURSES_EXPORT(int) mvwgetch (WINDOW *, int, int); /* generated */extern NCURSES_EXPORT(int) mvwgetnstr (WINDOW *, int, int, char *, int); /* generated */extern NCURSES_EXPORT(int) mvwgetstr (WINDOW *, int, int, char *); /* generated */extern NCURSES_EXPORT(int) mvwhline (WINDOW *, int, int, chtype, int); /* generated */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -