curses.h.html

来自「unix 下的C开发手册,还用详细的例程。」· HTML 代码 · 共 913 行 · 第 1/3 页

HTML
913
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>&lt;curses.h&gt;</title></head><body bgcolor=white><center><font size=2>The Single UNIX &reg; Specification, Version 2<br>Copyright &copy; 1997 The Open Group</font></center><hr size=2 noshade><xref type="10" name="curses.h"></xref><h4><a name = "tag_000_000_256">&nbsp;</a>NAME</h4><blockquote>curses.h - definitions for screen handling and optimisation functions</blockquote><h4><a name = "tag_000_000_257">&nbsp;</a>SYNOPSIS</h4><blockquote><pre><code>#include &lt;curses.h&gt;</code></pre></blockquote><h4><a name = "tag_000_000_258">&nbsp;</a>DESCRIPTION</h4><blockquote><h5><a name = "tag_000_000_258_001">&nbsp;</a>Objects</h5>The<i>&lt;curses.h&gt;</i>header provides a declaration for<i>COLOR_PAIRS</i>,<i>COLORS</i>,<i>COLS</i>,<i>curscr</i>,<i>LINES</i>and<i>stdscr</i>.<h5><a name = "tag_000_000_258_002">&nbsp;</a>Constants</h5>The following constants are defined:<dl compact><dt>EOF<dd>Function return value for end-of-file<dt>ERR<dd>Function return value for failure<dt>FALSE<dd>Boolean <i>false</i> value<dt>OK<dd>Function return value for success<dt>TRUE<dd>Boolean <i>true</i> value<dt>WEOF<dd>Wide-character function return value for end-of-file, as defined in<i><a href="../xsh/wchar.h.html">&lt;wchar.h&gt;</a></i>.</dl><p>The following constant is defined if the implementation supportsthe indicated revision of the X/Open Curses specification:<dl compact><dt>_XOPEN_CURSES<dd>X/Open Curses, Issue 4, Version 2, July 1996,(ISBN: 1-85912-171-3, C610) (this document).</dl><h5><a name = "tag_000_000_258_003">&nbsp;</a>Data Types</h5>The following data types are defined through <b>typedef</b>:<dl compact><dt><b>attr_t</b><dd>An OR-ed set of attributes<dt><b>bool</b><dd>Boolean data type<dt><b>chtype</b><dd>A character, attributes&nbsp;and a colour-pair<dt><b>SCREEN</b><dd>An opaque terminal representation<dt><b>wchar_t</b><dd>As described in<i><a href="../xsh/stddef.h.html">&lt;stddef.h&gt;</a></i><dt><b>wint_t</b><dd>As described in<i><a href="../xsh/wchar.h.html">&lt;wchar.h&gt;</a></i><dt><b>cchar_t</b><dd>References a string of wide characters<dt><b>WINDOW</b><dd>An opaque window representation</dl><p>These data types are described in more detail in<xref href=datatypes></xref><a href="implement.html#datatypes">Data Types</a>.<p>The inclusion of<i>&lt;curses.h&gt;</i>may make visible all symbols from the headers<i><a href="../xsh/stdio.h.html">&lt;stdio.h&gt;</a></i>,<i><a href="term.h.html">&lt;term.h&gt;</a></i>,<i><a href="../xsh/termios.h.html">&lt;termios.h&gt;</a></i>and<i><a href="../xsh/wchar.h.html">&lt;wchar.h&gt;</a></i>.<br><h5><a name = "tag_000_000_258_004">&nbsp;</a>Attribute Bits</h5>The following symbolic constants are used to manipulate objects of type<b>attr_t</b>:<pre><code>WA_ALTCHARSET  Alternate character setWA_BLINK       BlinkingWA_BOLD        Extra bright or boldWA_DIM         Half brightWA_HORIZONTAL  Horizontal highlightWA_INVIS       InvisibleWA_LEFT        Left highlightWA_LOW         Low highlightWA_PROTECT     ProtectedWA_REVERSE     Reverse videoWA_RIGHT       Right highlightWA_STANDOUT    Best highlighting mode of the terminalWA_TOP         Top highlightWA_UNDERLINE   UnderliningWA_VERTICAL    Vertical highlight</code></pre>These attribute flags shall be distinct.<p>The following symbolic constants are used to manipulate attribute bits inobjects of type<b>chtype</b>:<pre><code>A_ALTCHARSET   Alternate character setA_BLINK        BlinkingA_BOLD         Extra bright or boldA_DIM          Half brightA_INVIS        InvisibleA_PROTECT      ProtectedA_REVERSE      Reverse videoA_STANDOUT     Best highlighting mode of the terminalA_UNDERLINE    Underlining</code></pre>These attribute flags need not be distinct&nbsp;except when _XOPEN_CURSES is defined and the application sets_XOPEN_SOURCE_EXTENDED to 1.<p>The following symbolic constants can be used as bit-masks to extract thecomponents of a<b>chtype</b>:<pre><code>A_ATTRIBUTES   Bit-mask to extract attributesA_CHARTEXT     Bit-mask to extract a characterA_COLOR        Bit-mask to extract colour-pair information</code></pre><br><h5><a name = "tag_000_000_258_005">&nbsp;</a>Line-drawing Constants</h5>The<i>&lt;curses.h&gt;</i>header defines the symbolic constants shown in the leftmost two columns of thefollowing table for use in drawing lines.The symbolic constants that begin with ACS_ are<b>char</b>constants.The symbolic constants that begin with WACS_ are<b>cchar_t</b>constants for use with the wide-character interfaces that take a pointer to a<b>cchar_t</b>.<p>In the POSIX locale, the characters shown in the<b>POSIX Locale Default</b>column are used when the terminal database does not specify a value using the<b>acsc</b>capability.<p><p><table  align=center><tr valign=top><th align=center><b>char Constant</b><th align=center><b>cchar_t Constant</b><th align=center><b>POSIX Locale Default</b><th align=center><b>Glyph Description</b><tr valign=top><td align=center>ACS_ULCORNER<td align=center>WACS_ULCORNER<td align=center>+<td align=left>upper left-hand corner<tr valign=top><td align=center>ACS_LLCORNER<td align=center>WACS_LLCORNER<td align=center>+<td align=left>lower left-hand corner<tr valign=top><td align=center>ACS_URCORNER<td align=center>WACS_URCORNER<td align=center>+<td align=left>upper right-hand corner<tr valign=top><td align=center>ACS_LRCORNER<td align=center>WACS_LRCORNER<td align=center>+<td align=left>lower right-hand corner<tr valign=top><td align=center>ACS_RTEE<td align=center>WACS_RTEE<td align=center>+<td align=left>right tee<tr valign=top><td align=center>ACS_LTEE<td align=center>WACS_LTEE<td align=center>+<td align=left>left tee<tr valign=top><td align=center>ACS_BTEE<td align=center>WACS_BTEE<td align=center>+<td align=left>bottom tee<tr valign=top><td align=center>ACS_TTEE<td align=center>WACS_TTEE<td align=center>+<td align=left>top tee<tr valign=top><td align=center>ACS_HLINE<td align=center>WACS_HLINE<td align=center>-<td align=left>horizontal line<tr valign=top><td align=center>ACS_VLINE<td align=center>WACS_VLINE<td align=center>|<td align=left>vertical line<tr valign=top><td align=center>ACS_PLUS<td align=center>WACS_PLUS<td align=center>+<td align=left>plus<tr valign=top><td align=center>ACS_S1<td align=center>WACS_S1<td align=center>-<td align=left>scan line 1<tr valign=top><td align=center>ACS_S9<td align=center>WACS_S9<td align=center>_<td align=left>scan line 9<tr valign=top><td align=center>ACS_DIAMOND<td align=center>WACS_DIAMOND<td align=center>+<td align=left>diamond<tr valign=top><td align=center>ACS_CKBOARD<td align=center>WACS_CKBOARD<td align=center>:<td align=left>checker board (stipple)<tr valign=top><td align=center>ACS_DEGREE<td align=center>WACS_DEGREE<td align=center>'<td align=left>degree symbol<tr valign=top><td align=center>ACS_PLMINUS<td align=center>WACS_PLMINUS<td align=center>#<td align=left>plus/minus<tr valign=top><td align=center>ACS_BULLET<td align=center>WACS_BULLET<td align=center>o<td align=left>bullet<tr valign=top><td align=center>ACS_LARROW<td align=center>WACS_LARROW<td align=center>&lt;<td align=left>arrow pointing left<tr valign=top><td align=center>ACS_RARROW<td align=center>WACS_RARROW<td align=center>&gt;<td align=left>arrow pointing right<tr valign=top><td align=center>ACS_DARROW<td align=center>WACS_DARROW<td align=center>v<td align=left>arrow pointing down<tr valign=top><td align=center>ACS_UARROW<td align=center>WACS_UARROW<td align=center><sub>^</sub><td align=left>arrow pointing up<tr valign=top><td align=center>ACS_BOARD <td align=center>WACS_BOARD <td align=center>#<td align=left>board of squares<tr valign=top><td align=center>ACS_LANTERN<td align=center>WACS_LANTERN<td align=center>#<td align=left>lantern symbol<tr valign=top><td align=center>ACS_BLOCK <td align=center>WACS_BLOCK<td align=center>#<td align=left>solid square block</table><h5><a name = "tag_000_000_258_006">&nbsp;</a>Colour-related Macros</h5><xref type="5" name="colourmacros"></xref>The following colour-related macros are defined:<p><table <tr valign=top><th align=center>COLOR_BLACK<tr valign=top><td align=center>COLOR_BLUE<tr valign=top><td align=center>COLOR_GREEN<tr valign=top><td align=center>COLOR_CYAN<tr valign=top><td align=center>COLOR_RED<tr valign=top><td align=center>COLOR_MAGENTA<tr valign=top><td align=center>COLOR_YELLOW<tr valign=top><td align=center>COLOR_WHITE</table><h5><a name = "tag_000_000_258_007">&nbsp;</a>Coordinate-related Macros</h5>The following coordinate-related macros are defined:<p><pre><code>void   <a href="getbegyx.html">getbegyx</a>(WINDOW *<i>win</i>, int <i>y</i>, int <i>x</i>);void   <a href="getmaxyx.html">getmaxyx</a>(WINDOW *<i>win</i>, int <i>y</i>, int <i>x</i>);void   <a href="getparyx.html">getparyx</a>(WINDOW *<i>win</i>, int <i>y</i>, int <i>x</i>);void   <a href="getyx.html">getyx</a>(WINDOW *<i>win</i>, int <i>y</i>, int <i>x</i>);</code></pre><h5><a name = "tag_000_000_258_008">&nbsp;</a>Key Codes</h5>The following symbolic constants representing function key values aredefined:<p>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?