├── README.md ├── doc └── ncurses.html ├── example ├── helloworld.nim ├── init.nim ├── printw.nim └── scanw.nim ├── ncurses.nim └── ncurses.nimble /README.md: -------------------------------------------------------------------------------- 1 | # nim-ncurses 2 | A Nim language wrapper for NCurses 3 | -------------------------------------------------------------------------------- /doc/ncurses.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | Module ncurses 18 | 1143 | 1144 | 1145 | 1146 |
1147 |
1148 |

Module ncurses

1149 |
1150 |
1151 | 1500 | 1501 |
1502 |
1503 |

1504 |
1505 |

Types

1506 |
1507 |
chtype* = int64
1508 |
1509 | 1510 | 1511 |
1512 |
mmask_t* = uint32
1513 |
1514 | 1515 | 1516 |
1517 |
attr_t* = chtype
1518 |
1519 | 1520 | 1521 |
1522 |
window* = win_st
1523 |
1524 | 1525 | 1526 |
1527 |
ldat* = object 
1528 |
1529 | 1530 | 1531 |
1532 |
pdat_4299782170994856172* = object 
1533 |   pad_y*: cshort
1534 |   pad_x*: cshort
1535 |   pad_top*: cshort
1536 |   pad_left*: cshort
1537 |   pad_bottom*: cshort
1538 |   pad_right*: cshort
1539 | 
1540 |
1541 | 1542 | 1543 |
1544 |
win_st* = object 
1545 |   cury*: cshort
1546 |   curx*: cshort
1547 |   maxy*: cshort
1548 |   maxx*: cshort
1549 |   begy*: cshort
1550 |   begx*: cshort
1551 |   flags*: cshort
1552 |   attrs*: attr_t
1553 |   bkgd*: chtype
1554 |   notimeout*: bool
1555 |   clear*: bool
1556 |   leaveok*: bool
1557 |   scroll*: bool
1558 |   idlok*: bool
1559 |   idcok*: bool
1560 |   immed*: bool
1561 |   sync*: bool
1562 |   use_keypad*: bool
1563 |   delay*: cint
1564 |   line*: ptr ldat
1565 |   regtop*: cshort
1566 |   regbottom*: cshort
1567 |   parx*: cint
1568 |   pary*: cint
1569 |   parent*: ptr window
1570 |   pad*: pdat_4299782170994856172
1571 |   yoffset*: cshort
1572 |   color*: cint
1573 | 
1574 |
1575 | 1576 | 1577 |
1578 |
MEVENT* = object 
1579 |   id*: cshort
1580 |   x*: cint
1581 |   y*: cint
1582 |   z*: cint
1583 |   bstate*: mmask_t
1584 | 
1585 |
1586 | 1587 | 1588 |
1589 | 1590 |
1591 |
1592 |

Vars

1593 |
1594 |
COLORS* {.importc: "COLORS", dynlib: libncurses.}: int
1595 |
1596 | 1597 | 1598 |
1599 |
COLOR_PAIRS* {.importc: "COLOR_PAIRS", dynlib: libncurses.}: int
1600 |
1601 | 1602 | 1603 |
1604 | 1605 |
1606 |
1607 |

Consts

1608 |
1609 |
libncurses* = "libncurses.dll"
1610 |
1611 | 1612 | 1613 |
1614 |
ERR* = (- 1)
1615 |
1616 | 1617 | 1618 |
1619 |
OK* = (0)
1620 |
1621 | 1622 | 1623 |
1624 |
COLOR_BLACK* = 0
1625 |
1626 | 1627 | 1628 |
1629 |
COLOR_RED* = 1
1630 |
1631 | 1632 | 1633 |
1634 |
COLOR_GREEN* = 2
1635 |
1636 | 1637 | 1638 |
1639 |
COLOR_YELLOW* = 3
1640 |
1641 | 1642 | 1643 |
1644 |
COLOR_BLUE* = 4
1645 |
1646 | 1647 | 1648 |
1649 |
COLOR_MAGENTA* = 5
1650 |
1651 | 1652 | 1653 |
1654 |
COLOR_CYAN* = 6
1655 |
1656 | 1657 | 1658 |
1659 |
COLOR_WHITE* = 7
1660 |
1661 | 1662 | 1663 |
1664 |
NCURSES_ATTR_SHIFT* = 8'i64
1665 |
1666 | 1667 | 1668 |
1669 |
A_NORMAL* = 0
1670 |
1671 | 1672 | 1673 |
1674 |
A_BOLD* = 2097152
1675 |
1676 | 1677 | 1678 |
1679 |
A_UNDERLINE* = 131072
1680 |
1681 | 1682 | 1683 |
1684 |
A_ATTRIBUTES* = 4294967040'i64
1685 |
1686 | 1687 | 1688 |
1689 |
A_CHAR_TEXT* = 255
1690 |
1691 | 1692 | 1693 |
1694 |
A_REVERSE* = 262144
1695 |
1696 | 1697 | 1698 |
1699 | 1700 |
1701 | 1702 | 1703 |
1704 |
A_DIM* = 1048576
1705 |
1706 | 1707 | 1708 |
1709 |
A_ALT_CHARSET* = 4194304
1710 |
1711 | 1712 | 1713 |
1714 |
A_INVIS* = 8388608
1715 |
1716 | 1717 | 1718 |
1719 |
A_PROTECT* = 16777216
1720 |
1721 | 1722 | 1723 |
1724 |
A_HORIZONTAL* = 33554432
1725 |
1726 | 1727 | 1728 |
1729 |
A_LEFT* = 67108864
1730 |
1731 | 1732 | 1733 |
1734 |
A_LOW* = 34217728
1735 |
1736 | 1737 | 1738 |
1739 |
A_RIGHT* = 268435456
1740 |
1741 | 1742 | 1743 |
1744 |
A_TOP* = 536870912
1745 |
1746 | 1747 | 1748 |
1749 |
A_VERTICAL* = 1073741824
1750 |
1751 | 1752 | 1753 |
1754 |
A_ITALIC* = 2147483648'i64
1755 |
1756 | 1757 | 1758 |
1759 |
NCURSES_BUTTON_RELEASED* = 1
1760 |
1761 | 1762 | 1763 |
1764 |
NCURSES_BUTTON_PRESSED* = 2
1765 |
1766 | 1767 | 1768 |
1769 |
NCURSES_BUTTON_CLICKED* = 4
1770 |
1771 | 1772 | 1773 |
1774 |
NCURSES_DOUBLE_CLICKED* = 0o000000000010
1775 |
1776 | 1777 | 1778 |
1779 |
NCURSES_TRIPLE_CLICKED* = 0o000000000020
1780 |
1781 | 1782 | 1783 |
1784 |
NCURSES_RESERVED_EVENT* = 0o000000000040
1785 |
1786 | 1787 | 1788 |
1789 |
BUTTON1_RELEASED* = NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_RELEASED)
1790 |
1791 | 1792 | 1793 |
1794 |
BUTTON1_PRESSED* = NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_PRESSED)
1795 |
1796 | 1797 | 1798 |
1799 |
BUTTON1_CLICKED* = NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_CLICKED)
1800 |
1801 | 1802 | 1803 |
1804 |
BUTTON1_DOUBLE_CLICKED* = NCURSES_MOUSE_MASK(1, NCURSES_DOUBLE_CLICKED)
1805 |
1806 | 1807 | 1808 |
1809 |
BUTTON1_TRIPLE_CLICKED* = NCURSES_MOUSE_MASK(1, NCURSES_TRIPLE_CLICKED)
1810 |
1811 | 1812 | 1813 |
1814 |
BUTTON2_RELEASED* = NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_RELEASED)
1815 |
1816 | 1817 | 1818 |
1819 |
BUTTON2_PRESSED* = NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_PRESSED)
1820 |
1821 | 1822 | 1823 |
1824 |
BUTTON2_CLICKED* = NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_CLICKED)
1825 |
1826 | 1827 | 1828 |
1829 |
BUTTON2_DOUBLE_CLICKED* = NCURSES_MOUSE_MASK(2, NCURSES_DOUBLE_CLICKED)
1830 |
1831 | 1832 | 1833 |
1834 |
BUTTON2_TRIPLE_CLICKED* = NCURSES_MOUSE_MASK(2, NCURSES_TRIPLE_CLICKED)
1835 |
1836 | 1837 | 1838 |
1839 |
BUTTON3_RELEASED* = NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_RELEASED)
1840 |
1841 | 1842 | 1843 |
1844 |
BUTTON3_PRESSED* = NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_PRESSED)
1845 |
1846 | 1847 | 1848 |
1849 |
BUTTON3_CLICKED* = NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_CLICKED)
1850 |
1851 | 1852 | 1853 |
1854 |
BUTTON3_DOUBLE_CLICKED* = NCURSES_MOUSE_MASK(3, NCURSES_DOUBLE_CLICKED)
1855 |
1856 | 1857 | 1858 |
1859 |
BUTTON3_TRIPLE_CLICKED* = NCURSES_MOUSE_MASK(3, NCURSES_TRIPLE_CLICKED)
1860 |
1861 | 1862 | 1863 |
1864 |
BUTTON4_RELEASED* = NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_RELEASED)
1865 |
1866 | 1867 | 1868 |
1869 |
BUTTON4_PRESSED* = NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_PRESSED)
1870 |
1871 | 1872 | 1873 |
1874 |
BUTTON4_CLICKED* = NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_CLICKED)
1875 |
1876 | 1877 | 1878 |
1879 |
BUTTON4_DOUBLE_CLICKED* = NCURSES_MOUSE_MASK(4, NCURSES_DOUBLE_CLICKED)
1880 |
1881 | 1882 | 1883 |
1884 |
BUTTON4_TRIPLE_CLICKED* = NCURSES_MOUSE_MASK(4, NCURSES_TRIPLE_CLICKED)
1885 |
1886 | 1887 | 1888 |
1889 |
BUTTON5_RELEASED* = NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_RELEASED)
1890 |
1891 | 1892 | 1893 |
1894 |
BUTTON5_PRESSED* = NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_PRESSED)
1895 |
1896 | 1897 | 1898 |
1899 |
BUTTON5_CLICKED* = NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_CLICKED)
1900 |
1901 | 1902 | 1903 |
1904 |
BUTTON5_DOUBLE_CLICKED* = NCURSES_MOUSE_MASK(5, NCURSES_DOUBLE_CLICKED)
1905 |
1906 | 1907 | 1908 |
1909 |
BUTTON5_TRIPLE_CLICKED* = NCURSES_MOUSE_MASK(5, NCURSES_TRIPLE_CLICKED)
1910 |
1911 | 1912 | 1913 |
1914 |
BUTTON_CTRL* = NCURSES_MOUSE_MASK(6, 1)
1915 |
1916 | 1917 | 1918 |
1919 |
BUTTON_SHIFT* = NCURSES_MOUSE_MASK(6, 2)
1920 |
1921 | 1922 | 1923 |
1924 |
BUTTON_ALT* = NCURSES_MOUSE_MASK(6, 4)
1925 |
1926 | 1927 | 1928 |
1929 | 1930 |
1931 |
1932 |

Procs

1933 |
1934 |
proc has_mouse*(): bool {.cdecl, importc: "has_mouse", dynlib: libncurses.}
1935 |
1936 | 1937 | 1938 |
1939 |
proc getmouse*(a2: ptr MEVENT): cint {.cdecl, importc: "getmouse", 
1940 |                                        dynlib: libncurses.}
1941 |
1942 | 1943 | 1944 |
1945 |
proc ungetmouse*(a2: ptr MEVENT): cint {.cdecl, importc: "ungetmouse", 
1946 |     dynlib: libncurses.}
1947 |
1948 | 1949 | 1950 |
1951 |
proc mousemask*(a2: mmask_t; a3: ptr mmask_t): mmask_t {.cdecl, 
1952 |     importc: "mousemask", dynlib: libncurses.}
1953 |
1954 | 1955 | 1956 |
1957 |
proc wenclose*(a2: ptr window; a3: cint; a4: cint): bool {.cdecl, 
1958 |     importc: "wenclose", dynlib: libncurses.}
1959 |
1960 | 1961 | 1962 |
1963 |
proc mouseinterval*(a2: cint): cint {.cdecl, importc: "mouseinterval", 
1964 |                                       dynlib: libncurses.}
1965 |
1966 | 1967 | 1968 |
1969 |
proc wmouse_trafo*(a2: ptr window; a3: ptr cint; a4: ptr cint; a5: bool): bool {.
1970 |     cdecl, importc: "wmouse_trafo", dynlib: libncurses.}
1971 |
1972 | 1973 | 1974 |
1975 |
proc mouse_trafo*(a2: ptr cint; a3: ptr cint; a4: bool): bool {.cdecl, 
1976 |     importc: "mouse_trafo", dynlib: libncurses.}
1977 |
1978 | 1979 | 1980 |
1981 |
proc getattrs*(a2: ptr window): int {.cdecl, discardable, importc: "getattrs", 
1982 |                                       dynlib: libncurses.}
1983 |
1984 | 1985 | 1986 |
1987 |
proc getcurx*(a2: ptr window): int {.cdecl, discardable, importc: "getcurx", 
1988 |                                      dynlib: libncurses.}
1989 |
1990 | 1991 | 1992 |
1993 |
proc getcury*(a2: ptr window): int {.cdecl, discardable, importc: "getcury", 
1994 |                                      dynlib: libncurses.}
1995 |
1996 | 1997 | 1998 |
1999 |
proc getbegx*(a2: ptr window): int {.cdecl, discardable, importc: "getbegx", 
2000 |                                      dynlib: libncurses.}
2001 |
2002 | 2003 | 2004 |
2005 |
proc getbegy*(a2: ptr window): int {.cdecl, discardable, importc: "getbegy", 
2006 |                                      dynlib: libncurses.}
2007 |
2008 | 2009 | 2010 |
2011 |
proc getmaxx*(a2: ptr window): int {.cdecl, discardable, importc: "getmaxx", 
2012 |                                      dynlib: libncurses.}
2013 |
2014 | 2015 | 2016 |
2017 |
proc getmaxy*(a2: ptr window): int {.cdecl, discardable, importc: "getmaxy", 
2018 |                                      dynlib: libncurses.}
2019 |
2020 | 2021 | 2022 |
2023 |
proc getparx*(a2: ptr window): int {.cdecl, discardable, importc: "getparx", 
2024 |                                      dynlib: libncurses.}
2025 |
2026 | 2027 | 2028 |
2029 |
proc getpary*(a2: ptr window): int {.cdecl, discardable, importc: "getpary", 
2030 |                                      dynlib: libncurses.}
2031 |
2032 | 2033 | 2034 |
2035 |
proc addch*(character: chtype): int {.cdecl, discardable, importc: "addch", 
2036 |                                       dynlib: libncurses.}
2037 |
2038 | Puts a character into the stdscr at its current window position and then advances the current window position to the next position. @Param: 'character' the character to put into the current window. @Returns: ERR on failure and OK upon successful completion. 2039 | 2040 |
2041 |
proc addstr*(stringToAdd: cstring): int {.cdecl, discardable, importc: "addstr", 
2042 |     dynlib: libncurses.}
2043 |
2044 | Adds a string of characters the the stdscr and advances the cursor. @Param: The string to add the stdscr. @Returns: ERR on failure and OK upon successful completion. 2045 | 2046 |
2047 |
proc attroff*(attributes: int64): int {.cdecl, discardable, importc: "attroff", 
2048 |                                         dynlib: libncurses.}
2049 |
2050 | Turns off the named attributes without affecting any other attributes. @Param: 'attributes' the attributes to turn off for the current window. @Returns: An integer value, but the returned value does not have any meaning and can thus be ignored. 2051 | 2052 |
2053 |
proc attron*(attributes: int64): int {.cdecl, discardable, importc: "attron", 
2054 |                                        dynlib: libncurses.}
2055 |
2056 | Turns on the named attributes without affecting any other attributes. @Param: 'attributes' the attributes to turn on for the current window. @Returns: An integer value, but the returned value does not have any meaning and can thus be ignored. 2057 | 2058 |
2059 |
proc attrset*(attributes: int64): int {.cdecl, discardable, importc: "attrset", 
2060 |                                         dynlib: libncurses.}
2061 |
2062 | Sets the current attributes of the given window to the provided attributes. @Param: 'attributes', the attributes to apply to the current window. @Returns: An integer value, but the returned value does not have any meaning and can thus be ignored. 2063 | 2064 |
2065 |
proc beep*(): int {.cdecl, discardable, importc: "beep", dynlib: libncurses.}
2066 |
2067 | Sounds an audible alarm on the terminal, otherwise it flashes the screen (visible bell). @Returns: ERR on failure and OK upon successfully beeping. 2068 | 2069 |
2070 |
proc bkgd*(background: int64): int {.cdecl, discardable, importc: "bkgd", 
2071 |                                      dynlib: libncurses.}
2072 |
2073 | Sets the background property of the current window and apply this setting to every character position in the window. @Param: 'background' the background property to apply. 2074 | 2075 |
2076 |
proc can_change_color*(): bool {.cdecl, importc: "can_change_color", 
2077 |                                  dynlib: libncurses.}
2078 |
2079 | Used to determine if the terminal supports colours and can change their definitions. @Returns: true if the terminal supports colours and can change their definitions or false otherwise. 2080 | 2081 |
2082 |
proc cbreak*(): int {.cdecl, discardable, importc: "cbreak", dynlib: libncurses.}
2083 |
2084 | The cbreak routine disables line buffering and erase/kill character-processing (interrupt and flow control characters are unaffected), making characters typed by the user immediately available to the program. @Returns: ERR on failure and OK upon successful completion. 2085 | 2086 |
2087 |
proc delch*(): int {.cdecl, discardable, importc: "delch", dynlib: libncurses.}
2088 |
2089 | Delete the character under the cursor in the stdscr. @Returns: ERR on failure and OK upon successfully flashing. 2090 | 2091 |
2092 |
proc deleteln*(): int {.cdecl, discardable, importc: "deleteln", 
2093 |                         dynlib: libncurses.}
2094 |
2095 | Deletes the line under the cursor in the stdscr. All lines below the current line are moved up one line. The bottom line of the window is cleared and the cursor position does not change. @Returns: ERR on failure and OK upon successful completion. 2096 | 2097 |
2098 |
proc endwin*(): int {.cdecl, discardable, importc: "endwin", dynlib: libncurses.}
2099 |
2100 | A program should always call endwin before exiting or escaping from curses mode temporarily. This routine restores tty modes, moves the cursor to the lower left-hand corner of the screen and resets the terminal into the proper non-visual mode. Calling refresh or doupdate after a temporary escape causes the program to resume visual mode. @Returns: ERR on failure and OK upon successful completion. 2101 | 2102 |
2103 |
proc flash*(): int {.cdecl, discardable, importc: "flash", dynlib: libncurses.}
2104 |
2105 | Flashes the screen and if that is not possible it sounds the alert. If this is not possible nothing happens. @Returns: ERR on failure and OK upon successfully flashing. 2106 | 2107 |
2108 |
proc getch*(): int {.cdecl, discardable, importc: "getch", dynlib: libncurses.}
2109 |
2110 | Read a character from the stdscr window. @Returns: ERR on failure and OK upon successful completion. 2111 | 2112 |
2113 |
proc getnstr*(inputString: cstring; numberOfCharacters: int): int {.cdecl, 
2114 |     discardable, importc: "getnstr", dynlib: libncurses.}
2115 |
2116 | Reads at most the specified number of characters into the provided string. @Param: 'inputString' the variable to read the input into. @Param: 'numberOfCharacters' the maximum number of characters to read. @Returns: ERR on failure and OK upon successful completion. 2117 | 2118 |
2119 |
proc getstr*(inputString: cstring): int {.cdecl, discardable, importc: "getstr", 
2120 |     dynlib: libncurses.}
2121 |
2122 | Reads the inputted characters into the provided string. @Param: 'inputString' the variable to read the input into. @Returns: ERR on failure and OK upon successful completion. 2123 | 2124 |
2125 |
proc has_colors*(): bool {.cdecl, importc: "has_colors", dynlib: libncurses.}
2126 |
2127 | Used to determine if the terminal can manipulate colours. @Returns: true if the terminal can manipulate colours or false if it cannot. 2128 | 2129 |
2130 |
proc init_pair*(pair: cshort; foreground: cshort; background: cshort): int {.
2131 |     cdecl, discardable, importc: "init_pair", dynlib: libncurses.}
2132 |
2133 | Changes the definition of a colour pair. @Param: 'pair' the number of the colour pair to change. @Param: 'foreground': the foreground colour number. @Param: 'background': the background colour number. @Returns: ERR on failure and OK upon successful completion. 2134 | 2135 |
2136 |
proc initscr*(): ptr window {.cdecl, discardable, importc: "initscr", 
2137 |                               dynlib: libncurses.}
2138 |
2139 | Usually the first curses routine to be called when initialising a program The initscr code determines the terminal type and initialises all curses data structures. initscr also causes the first call to refresh to clear the screen. @Returns: A pointer to stdscr is returned if the operation is successful. @Note: If errors occur, initscr writes an appropriate error message to standard error and exits. 2140 | 2141 |
2142 |
proc insch*(character: chtype): int {.cdecl, discardable, importc: "insch", 
2143 |                                       dynlib: libncurses.}
2144 |
2145 | Inserts a character before the cursor in the stdscr. @Param: 'character' the character to insert. @Returns: ERR on failure and OK upon successful completion. 2146 | 2147 |
2148 |
proc insertln*(): int {.cdecl, discardable, importc: "insertln", 
2149 |                         dynlib: libncurses.}
2150 |
2151 | Inserts a blank line above the current line in stdscr and the bottom line is lost. @Returns: ERR on failure and OK upon successful completion. 2152 | 2153 |
2154 |
proc move*(y: int; x: int): int {.cdecl, discardable, importc: "move", 
2155 |                                   dynlib: libncurses.}
2156 |
2157 | Moves the cursor of stdscr to the specified coordinates. @Param: 'y' the line to move the cursor to. @Param: 'x' the column to move the cursor to. @Returns: ERR on failure and OK upon successful completion. 2158 | 2159 |
2160 |
proc mvaddch*(y: int; x: int; character: chtype): int {.cdecl, discardable, 
2161 |     importc: "mvaddch", dynlib: libncurses.}
2162 |
2163 | Moves the cursor to the specified position and outputs the provided character. The cursor is then advanced to the next position. @Param: 'y' the line to move the cursor to. @Param: 'x' the column to move the cursor to. @Param: 'character' the character to put into the current window. @Returns: ERR on failure and OK upon successful completion. 2164 | 2165 |
2166 |
proc mvaddstr*(y: int; x: int; stringToOutput: cstring): int {.cdecl, 
2167 |     discardable, importc: "mvaddstr", dynlib: libncurses.}
2168 |
2169 | Moves the cursor to the specified position and outputs the provided string. The cursor is then advanced to the next position. @Param: 'y' the line to move the cursor to. @Param: 'x' the column to move the cursor to. @Param: 'stringToOutput' the string to put into the current window. @Returns: ERR on failure and OK upon successful completion. 2170 | 2171 |
2172 |
proc mvprintw*(y: int; x: int; formattedString: cstring): int {.varargs, cdecl, 
2173 |     discardable, importc: "mvprintw", dynlib: libncurses.}
2174 |
2175 | Prints out a formatted string to the stdscr at the specified row and column. @Param: 'y' the line to move the cursor to. @Param: 'x' the column to move the cursor to. @Param: 'formattedString' the string with formatting to be output to stdscr. @Returns: ERR on failure and OK upon successful completion. 2176 | 2177 |
2178 |
proc mvwprintw*(destinationWindow: ptr window; y: int; x: int; 
2179 |                 formattedString: cstring): int {.varargs, cdecl, discardable, 
2180 |     importc: "mvwprintw", dynlib: libncurses.}
2181 |
2182 | Prints out a formatted string to the specified window at the specified row and column. @Param: 'destinationWindow' the window to write the string to. @Param: 'y' the line to move the cursor to. @Param: 'x' the column to move the cursor to. @Param: 'formattedString' the string with formatting to be output to stdscr. @Returns: ERR on failure and OK upon successful completion. 2183 | 2184 |
2185 |
proc napms*(milliseconds: int): int {.cdecl, discardable, importc: "napms", 
2186 |                                       dynlib: libncurses.}
2187 |
2188 | Used to sleep for the specified milliseconds. @Params: 'milliseconds' the number of milliseconds to sleep for. @Returns: ERR on failure and OK upon successful completion. 2189 | 2190 |
2191 |
proc nocbreak*(): int {.cdecl, discardable, importc: "nocbreak", 
2192 |                         dynlib: libncurses.}
2193 |
2194 | Returns the terminal to normal (cooked mode). @Returns: ERR on failure and OK upon successful completion. 2195 | 2196 |
2197 |
proc printw*(formattedString: cstring): int {.varargs, cdecl, discardable, 
2198 |     importc: "printw", dynlib: libncurses.}
2199 |
2200 | Prints out a formatted string to the stdscr. @Param: 'formattedString' the string with formatting to be output to stdscr. @Returns: ERR on failure and OK upon successful completion. 2201 | 2202 |
2203 |
proc refresh*(): int {.cdecl, discardable, importc: "refresh", 
2204 |                        dynlib: libncurses.}
2205 |
2206 | Must be called to get actual output to the terminal. refresh uses stdscr has the default window. @Returns: ERR on failure and OK upon successful completion. 2207 | 2208 |
2209 |
proc scanw*(formattedInput: cstring): int {.varargs, cdecl, discardable, 
2210 |     importc: "scanw", dynlib: libncurses.}
2211 |
2212 | Converts formatted input from the stdscr. @Param: 'formattedInput' Contains the fields for the input to be mapped to. @Returns: The number of fields that were mapped in the call. 2213 | 2214 |
2215 |
proc start_color*(): int {.cdecl, discardable, importc: "start_color", 
2216 |                            dynlib: libncurses.}
2217 |
2218 | Initialises the the eight basic colours and the two global varables COLORS and COLOR_PAIRS. It also restores the colours on the terminal to the values that they had when the terminal was just turned on. @Note: It is good practice to call this routine right after initscr. It must be called before any other colour manipulating routines. 2219 | 2220 |
2221 |
proc waddstr*(destinationWindow: ptr window; stringToWrite: cstring): int {.
2222 |     cdecl, discardable, importc: "waddstr", dynlib: libncurses.}
2223 |
2224 | Writes a string to the specified window. @Param: 'destinationWindow' the window to write the string to. @Param: 'stringToWrite' @Returns: ERR on failure and OK upon successful completion. 2225 | 2226 |
2227 |
proc wgetch*(sourceWindow: ptr window): int {.cdecl, discardable, 
2228 |     importc: "wgetch", dynlib: libncurses.}
2229 |
2230 | Read a character from the specified window. @Param: 'sourceWindow' the window to read a character from. @Returns: ERR on failure and OK upon successful completion. 2231 | 2232 |
2233 |
proc getmaxyx*(win: ptr window; y, x: var int)
2234 |
2235 | retrieves the size of the specified window in the provided y and x parameters. @Param: 'win' the window to measure. @Param: 'y' stores the height of the window. @Param: 'x' stores the width of the window. 2236 | 2237 |
2238 |
proc getyx*(win: ptr window; y, x: var int)
2239 |
2240 | Reads the logical cursor location from the specified window. @Param: 'win' the window to get the cursor location from. @Param: 'y' stores the height of the window. @Param: 'x' stores the width of the window. 2241 | 2242 |
2243 | 2244 |
2245 |
2246 |

Templates

2247 |
2248 |
template NCURSES_CAST*(`type`, value: expr): expr
2249 |
2250 | 2251 | 2252 |
2253 |
template NCURSES_BITS*(mask, shift: expr): expr
2254 |
2255 | 2256 | 2257 |
2258 |
template COLOR_PAIR*(n: expr): expr
2259 |
2260 | 2261 | 2262 |
2263 |
template PAIR_NUMBER*(a: expr): expr
2264 |
2265 | 2266 | 2267 |
2268 |
template NCURSES_MOUSE_MASK*(b, m: expr): expr
2269 |
2270 | 2271 | 2272 |
2273 |
template BUTTON_RELEASE*(e, x: expr): expr
2274 |
2275 | 2276 | 2277 |
2278 |
template BUTTON_PRESS*(e, x: expr): expr
2279 |
2280 | 2281 | 2282 |
2283 |
template BUTTON_CLICK*(e, x: expr): expr
2284 |
2285 | 2286 | 2287 |
2288 |
template BUTTON_DOUBLE_CLICK*(e, x: expr): expr
2289 |
2290 | 2291 | 2292 |
2293 |
template BUTTON_TRIPLE_CLICK*(e, x: expr): expr
2294 |
2295 | 2296 | 2297 |
2298 |
template BUTTON_RESERVED_EVENT*(e, x: expr): expr
2299 |
2300 | 2301 | 2302 |
2303 | 2304 |
2305 | 2306 |
2307 |
2308 | 2309 |
2310 | 2315 |
2316 |
2317 |
2318 | 2319 | 2320 | 2321 | -------------------------------------------------------------------------------- /example/helloworld.nim: -------------------------------------------------------------------------------- 1 | # a hello world example 2 | # reference: http://www.tldp.org/HOWTO/NCURSES-Programming-HOWTO/helloworld.html 3 | 4 | import ../ncurses 5 | 6 | initscr() 7 | printw("hello world") 8 | refresh() 9 | getch() 10 | endwin() 11 | -------------------------------------------------------------------------------- /example/init.nim: -------------------------------------------------------------------------------- 1 | # an init example 2 | # reference: http://www.tldp.org/HOWTO/NCURSES-Programming-HOWTO/init.html 3 | 4 | import ../ncurses 5 | 6 | var pwin = initscr() 7 | raw() 8 | keypad(pwin, true) 9 | noecho() 10 | 11 | printw("Type any character to see it in bold\n") 12 | var ch = getch() 13 | 14 | case ch 15 | of KEY_F(2): 16 | printw("F2 Key pressed") 17 | else: 18 | printw("The pressed key is ") 19 | attron(A_BOLD) 20 | printw("%c", ch) 21 | attroff(A_BOLD) 22 | 23 | refresh() 24 | getch() 25 | endwin() -------------------------------------------------------------------------------- /example/printw.nim: -------------------------------------------------------------------------------- 1 | # a printw example 2 | # reference: http://www.tldp.org/HOWTO/NCURSES-Programming-HOWTO/printw.html 3 | 4 | import ../ncurses 5 | 6 | let mesg = "Just a string" 7 | var 8 | row: cint 9 | col: cint 10 | 11 | let stdscr = initscr() 12 | getmaxyx(stdscr, row, col) 13 | mvprintw(row div 2, (cint)((col - mesg.len) div 2), "%s", mesg) 14 | mvprintw(row - 2, 0, "This screen has %d rows and %d columns\n", row, col) 15 | printw("Try resizing your window(if possible) and then run this program again") 16 | refresh() 17 | getch() 18 | endwin() 19 | -------------------------------------------------------------------------------- /example/scanw.nim: -------------------------------------------------------------------------------- 1 | # a scanw example 2 | # reference: http://www.tldp.org/HOWTO/NCURSES-Programming-HOWTO/scanw.html 3 | 4 | import ../ncurses 5 | 6 | var 7 | mesg = "Enter a string: " 8 | row: cint 9 | col: cint 10 | 11 | let pwin = initscr() 12 | getmaxyx(pwin, row, col) 13 | mvprintw(row div 2, (cint)((col - mesg.len) div 2), "%s", mesg) 14 | getstr(mesg) 15 | mvprintw(row - 2, 0, "You Entered: %s", mesg) 16 | getch() 17 | endwin() -------------------------------------------------------------------------------- /ncurses.nim: -------------------------------------------------------------------------------- 1 | {.deadCodeElim: on.} 2 | when defined(windows): 3 | const libncurses* = "libncurses.dll" 4 | elif defined(macosx): 5 | const libncurses* = "libncurses.dylib" 6 | else: 7 | const libncurses* = "libncursesw.so" 8 | 9 | type 10 | chtype* = cint ## Holds a character and possibly an attribute 11 | attr_t* = chtype ## Attribute type 12 | 13 | cchar_t* = object ## Complex char 14 | attr: attr_t 15 | chars: WideCString #5 16 | ext_color: cint 17 | 18 | ldat = object ## Holds line data 19 | Screen* = object 20 | Terminal* = object 21 | Window* = object ## Holds window data 22 | cury, curx: cshort # current cursor position 23 | 24 | # window location and size 25 | maxy, maxx: cshort # maximums of x and y, NOT window size 26 | begy, begx: cshort # screen coords of upper-left-hand corner 27 | flags: cshort # window state flags 28 | 29 | # attribute tracking 30 | attrs: attr_t # current attribute for non-space character 31 | bkgd: chtype # current background char/attribute pair 32 | 33 | # option values set by user 34 | notimeout: bool # no time out on function-key entry? 35 | clear: bool # consider all data in the window invalid? 36 | leaveok: bool # OK to not reset cursor on exit? 37 | scroll: bool # OK to scroll this window? 38 | idlok: bool # OK to use insert/delete line? 39 | idcok: bool # OK to use insert/delete char? 40 | immed: bool # window in immed mode? (not yet used) 41 | sync: bool # window in sync mode? 42 | use_keypad: bool # process function keys into KEY_ symbols? 43 | delay: cint # 0 = nodelay, <0 = blocking, >0 = delay 44 | 45 | line: ptr ldat # the actual line data 46 | 47 | # global screen state 48 | regtop: cshort # top line of scrolling region 49 | regbottom: cshort # bottom line of scrolling region 50 | 51 | # these are used only if this is a sub-window 52 | pary, parx: cint # y, x coordinates of this window in parent 53 | parent: PWindow # pointer to parent if a sub-window 54 | 55 | # these are used only if this is a pad 56 | pad: pdat 57 | yoffset: cshort # real begy is _begy + _yoffset 58 | bkgrnd: cchar_t # current background char/attribute pair 59 | color: cint # current color-pair for non-space character 60 | window* {.deprecated: "Use PWindow instead".} = Window 61 | 62 | pdat = object ## pad data 63 | pad_y*, pad_x*: cshort 64 | pad_top*, pad_left*: cshort 65 | pad_bottom*, pad_right*: cshort 66 | 67 | mmask_t* = uint32 68 | Mevent* = object ## mouse event 69 | id*: cshort # ID to distinguish multiple devices 70 | x*, y*, z*: cint # event coordinates (character-cell) 71 | bstate*: mmask_t # button state bits 72 | 73 | #not ncurses but used to make things easier 74 | ErrCode* = cint ## Error Code. Returns ERR (-1) upon failure or OK (0) on success. 75 | PWindow* = ptr Window 76 | PScreen* = ptr Screen 77 | 78 | const 79 | ERR*: ErrCode = (-1) 80 | OK*: ErrCode = (0) 81 | NCURSES_ATTR_SHIFT = 8 82 | template NCURSES_CAST(`type`, value: untyped): untyped = (`type`)(value) 83 | template NCURSES_BITS(mask, shift: untyped): untyped = 84 | (NCURSES_CAST(chtype, (mask)) shl ((shift) + NCURSES_ATTR_SHIFT)) 85 | 86 | #color: color manipulation routines 87 | const 88 | COLOR_BLACK* = 0 89 | COLOR_RED* = 1 90 | COLOR_GREEN* = 2 91 | COLOR_YELLOW* = 3 92 | COLOR_BLUE* = 4 93 | COLOR_MAGENTA* = 5 94 | COLOR_CYAN* = 6 95 | COLOR_WHITE* = 7 96 | var 97 | COLORS* {.importc: "COLORS", dynlib: libncurses.}: cint 98 | ## Initialized by start_color to the maximum number of colors thfe 99 | ## terminal can support. 100 | COLOR_PAIRS* {.importc: "COLOR_PAIRS", dynlib: libncurses.}: cint 101 | ## Initialized by start_color to the maximum number of color pairs the 102 | ## terminal can support. 103 | template COLOR_PAIR*(n: untyped): untyped = NCURSES_BITS((n), 0'i64) 104 | template PAIR_NUMBER*(a: untyped): untyped = 105 | (NCURSES_CAST(cint, ((NCURSES_CAST(cuint, (a)) and A_COLOR) shr 106 | NCURSES_ATTR_SHIFT))) 107 | 108 | proc start_color*(): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 109 | ## Initialises the the eight basic colours and the two global varables COLORS and COLOR_PAIRS. 110 | ## It also restores the colours on the terminal to the values that they had when the 111 | ## terminal was just turned on. 112 | ## @Note: It is good practice to call this routine right after initscr. It must be 113 | ## called before any other colour manipulating routines. 114 | proc has_colors*(): bool {.cdecl, importc, discardable, dynlib: libncurses.} 115 | ## Used to determine if the terminal can manipulate colours. 116 | ## @Returns: true if the terminal can manipulate colours or false if it cannot. 117 | proc can_change_color*(): bool {.cdecl, importc, discardable, dynlib: libncurses.} 118 | ## Used to determine if the terminal supports colours and can change their definitions. 119 | ## @Returns: true if the terminal supports colours and can change their definitions or 120 | ## false otherwise. 121 | proc init_pair*(pair, f,b: cshort): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 122 | ## Changes the definition of a colour pair. 123 | ## @Param: 'pair' the number of the colour pair to change. 124 | ## @Param: 'foreground': the foreground colour number. 125 | ## @Param: 'background': the background colour number. 126 | ## @Returns: ERR on failure and OK upon successful completion. 127 | proc init_color*(color: cshort, r, g, b: cshort): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 128 | proc init_extended_pair*(pair, f,b: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 129 | proc init_extended_color*(color: cint, r, g, b: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 130 | proc color_content*(color: cshort, r, g, b: ptr cshort): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 131 | proc pair_content*(pair: cshort, f,b: ptr cshort): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 132 | proc extended_color_content*(color: cint, r, g, b: ptr cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 133 | proc pair_content*(pair: cint, f,b: ptr cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 134 | proc reset_color_pairs*(): void {.cdecl, importc, discardable, dynlib: libncurses.} 135 | 136 | #threads: thread support 137 | proc get_escdelay*(): cint {.cdecl, importc, discardable, dynlib: libncurses.} 138 | proc set_escdelay*(size: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 139 | proc set_tabsize*(size: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 140 | proc use_screen*(scr: PScreen, scr_cb: proc(scr: PScreen, pt: pointer): cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 141 | proc use_window*(win: PWindow, win_cb: proc(win: PWindow, pt: pointer): cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 142 | 143 | #add_wch: Adding complex characters to a window 144 | proc add_wch*(wch: ptr cchar_t): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 145 | proc wadd_wch*(win: PWindow, wch: ptr cchar_t): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 146 | proc mvadd_wch*(y, x: cint, wch: ptr cchar_t): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 147 | proc mvwadd_wch*(win: PWindow, y, x: cint, wch: ptr cchar_t): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 148 | proc echo_wchar*(wch: ptr cchar_t): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 149 | proc wecho_wchar*(win: PWindow, wch: ptr cchar_t): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 150 | 151 | #add_wchstr: Adding an array of complex characters to a window 152 | proc add_wchstr*(wchstr: ptr cchar_t): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 153 | proc add_wchnstr*(wchstr: ptr cchar_t, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 154 | proc wadd_wchstr*(win: PWindow, wchstr: ptr cchar_t): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 155 | proc wadd_wchnstr*(win: PWindow, wchstr: ptr cchar_t, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 156 | proc mvadd_wchstr*(y, x: cint, wchstr: ptr cchar_t): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 157 | proc mvadd_wchnstr*(y, x: cint, wchstr: ptr cchar_t, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 158 | proc mvwadd_wchstr*(win: PWindow, y, x: cint, wchstr: ptr cchar_t): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 159 | proc mvwadd_wchnstr*(win: PWindow, y, x: cint, wchstr: ptr cchar_t, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 160 | 161 | #addch: Adding a character (with attributes) to a window 162 | proc addch*(character: chtype): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 163 | ## Puts a character into the stdscr at its current window position and then advances 164 | ## the current window position to the next position. 165 | ## @Param: 'character' the character to put into the current window. 166 | ## @Returns: ERR on failure and OK upon successful completion. 167 | proc waddch*(win: PWindow, ch: chtype): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 168 | proc mvaddch*(y,x: cint; character: chtype): cint {.cdecl, importc, discardable, dynlib: libncurses.} 169 | ## Moves the cursor to the specified position and outputs the provided character. 170 | ## The cursor is then advanced to the next position. 171 | ## @Param: 'y' the line to move the cursor to. 172 | ## @Param: 'x' the column to move the cursor to. 173 | ## @Param: 'character' the character to put into the current window. 174 | ## @Returns: ERR on failure and OK upon successful completion. 175 | proc mvwaddch*(win: PWindow, y, x: cint, ch: chtype): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 176 | proc echochar*(ch: chtype): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 177 | proc wechochar*(win: PWindow, ch: chtype): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 178 | 179 | #addchstr: Adding a string of characters (and attributes) to a window 180 | proc addchstr*(chstr: ptr chtype): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 181 | proc addchnstr*(chstr: ptr chtype, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 182 | proc waddchstr*(win: PWindow, chstr: ptr chtype): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 183 | proc waddchnstr*(win: PWindow, chstr: ptr chtype, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 184 | proc mvaddchstr*(y, x: cint, chstr: ptr chtype): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 185 | proc mvaddchnstr*(y, x: cint, chstr: ptr chtype, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 186 | proc mvwaddchstr*(win: PWindow, y, x: cint, chstr: ptr chtype): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 187 | proc mvwaddchnstr*(win: PWindow, y, x: cint, chstr: ptr chtype, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 188 | 189 | #addstr: Adding a string of characters to a window (cstring) 190 | proc addstr*(str: cstring): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 191 | ## Adds a string of characters the the stdscr and advances the cursor. 192 | ## @Param: The string to add the stdscr. 193 | ## @Returns: ERR on failure and OK upon successful completion. 194 | proc addnstr*(str: cstring, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 195 | proc waddstr*(win: PWindow; str: cstring): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 196 | ## Writes a string to the specified window. 197 | ## @Param: 'destinationWindow' the window to write the string to. 198 | ## @Param: 'stringToWrite' 199 | ## @Returns: ERR on failure and OK upon successful completion. 200 | proc waddnstr*(win: PWindow, str: cstring, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 201 | proc mvaddstr*(y, x: cint; str: cstring): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 202 | ## Moves the cursor to the specified position and outputs the provided string. 203 | ## The cursor is then advanced to the next position. 204 | ## @Param: 'y' the line to move the cursor to. 205 | ## @Param: 'x' the column to move the cursor to. 206 | ## @Param: 'stringToOutput' the string to put into the current window. 207 | ## @Returns: ERR on failure and OK upon successful completion. 208 | proc mvaddnstr*(y, x: cint, str: cstring, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 209 | proc mvwaddstr*(win: PWindow, y, x: cint, str: cstring): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 210 | proc mvwaddnstr*(win: PWindow, y, x: cint, str: cstring, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 211 | 212 | #addwstr: Adding a string of wide characters to a window (WideCString) ## Not used? 213 | #[ 214 | proc addwstr(wstr: WideCString): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 215 | proc addnwstr(wstr: WideCString, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 216 | proc waddwstr(win: PWindow, wstr: WideCString): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 217 | proc waddnwstr(win: PWindow, wstr: WideCString, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 218 | proc mvaddwstr(y, x: cint, win: PWindow, wstr: WideCString): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 219 | proc mvaddnwstr(y, x: cint, win: PWindow, wstr: WideCString, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 220 | proc mvwaddwstr(win: PWindow, y, x: cint, wstr: WideCString): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 221 | proc mvwaddnwstr(win: PWindow, y, x: cint, wstr: WideCString, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 222 | ]# 223 | 224 | #new_pair: Color-pair functions 225 | proc alloc_pair*(fg, bg: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 226 | proc find_pair*(fg, bg: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 227 | proc free_pair*(pair: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 228 | 229 | #default_colors: Use terminal's default colors 230 | proc use_default_colors*(): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 231 | proc assume_default_colors*(fg, bg: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 232 | 233 | #attr: Character and attribute control routines 234 | const 235 | u1: uint = 1 236 | A_NORMAL* = (u1 - u1) 237 | A_ATTRIBUTES* = NCURSES_BITS(not (u1 - u1), 0) 238 | A_CHAR_TEXT* = (NCURSES_BITS(u1, 0) - u1.chtype) 239 | A_COLOR* = NCURSES_BITS((u1 shl 8) - u1, 0) 240 | A_STANDOUT* = NCURSES_BITS(u1, 8) 241 | A_UNDERLINE* = NCURSES_BITS(u1, 9) 242 | A_REVERSE* = NCURSES_BITS(u1, 10) 243 | A_BLINK* = NCURSES_BITS(u1, 11) 244 | A_DIM* = NCURSES_BITS(u1, 12) 245 | A_BOLD* = NCURSES_BITS(u1, 13) 246 | A_ALT_CHARSET* = NCURSES_BITS(u1, 14) 247 | A_INVIS* = NCURSES_BITS(u1, 15) 248 | A_PROTECT* = NCURSES_BITS(u1, 16) 249 | A_HORIZONTAL* = NCURSES_BITS(u1, 17) 250 | A_LEFT* = NCURSES_BITS(u1, 18) 251 | A_LOW* = NCURSES_BITS(u1, 19) 252 | A_RIGHT* = NCURSES_BITS(u1, 20) 253 | A_TOP* = NCURSES_BITS(u1, 21) 254 | A_VERTICAL* = NCURSES_BITS(u1, 22) 255 | A_ITALIC* = NCURSES_BITS(u1, 23) 256 | 257 | proc attr_get*(attrs: ptr attr_t, pair: ptr cshort, opts: pointer): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 258 | proc wattr_get*(win: PWindow, attrs: ptr attr_t, pair: ptr cshort, opts: pointer): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 259 | proc attr_set*(attrs: attr_t, pair: cshort, opts: pointer): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 260 | proc wattr_set*(win: PWindow, attrs: attr_t, pair: cshort, opts: pointer): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 261 | proc attr_off*(attrs: attr_t, opts: pointer): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 262 | proc wattr_off*(win: PWindow, attrs: attr_t, opts: pointer): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 263 | proc attr_on*(attrs: attr_t, opts: pointer): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 264 | proc wattr_on*(win: PWindow, attrs: attr_t, opts: pointer): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 265 | proc attroff*(attrs: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 266 | ## Turns off the named attributes without affecting any other attributes. 267 | ## @Param: 'attributes' the attributes to turn off for the current window. 268 | ## @Returns: An integer value, but the returned value does not have any meaning and can 269 | ## thus be ignored. 270 | proc wattroff*(win: PWindow, attrs: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 271 | proc attron*(attrs: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 272 | ## Turns on the named attributes without affecting any other attributes. 273 | ## @Param: 'attributes' the attributes to turn on for the current window. 274 | ## @Returns: An integer value, but the returned value does not have any meaning and can 275 | ## thus be ignored. 276 | proc wattron*(win: PWindow, attrs: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 277 | proc attrset*(attrs: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 278 | ## Sets the current attributes of the given window to the provided attributes. 279 | ## @Param: 'attributes', the attributes to apply to the current window. 280 | ## @Returns: An integer value, but the returned value does not have any meaning and can 281 | ## thus be ignored. 282 | proc wattrset*(win: PWindow, attrs: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 283 | proc chgat*(n: cint, attr: attr_t, pair: cshort, opts: pointer): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 284 | proc wchgat*(win: PWindow, n: cint, attr: attr_t, pair: cshort, opts: pointer): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 285 | proc mvchgat*(y, x: cint, n: cint, attr: attr_t, pair: cshort, opts: pointer): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 286 | proc mvwchgat*(win: PWindow, y, x: cint, n: cint, attr: attr_t, pair: cshort, opts: pointer): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 287 | proc color_set*(pair: cshort, opts: pointer): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 288 | proc wcolor_set*(win: PWindow, pair: cshort, opts: pointer): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 289 | #proc standend(): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} ## Not used? 290 | proc wstandend*(win: PWindow): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 291 | proc standout*(): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 292 | proc wstandout*(win: PWindow): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 293 | 294 | #termattrs: Enviroment query routines 295 | proc baudrate*(): cint {.cdecl, importc, discardable, dynlib: libncurses.} 296 | proc erasechar*() {.cdecl, importc, discardable, dynlib: libncurses.} 297 | proc erasewchar*(ch: WideCString) {.cdecl, importc, discardable, dynlib: libncurses.} 298 | proc has_ic*(): bool {.cdecl, importc, discardable, dynlib: libncurses.} 299 | proc has_il*(): bool {.cdecl, importc, discardable, dynlib: libncurses.} 300 | proc killchar*(): cchar {.cdecl, importc, discardable, dynlib: libncurses.} 301 | proc killwchar*(ch: WideCString): cchar {.cdecl, importc, discardable, dynlib: libncurses.} 302 | proc longname*(): cstring {.cdecl, importc, discardable, dynlib: libncurses.} 303 | proc term_attrs*(): attr_t {.cdecl, importc, discardable, dynlib: libncurses.} 304 | proc term_attrs_ch*(): chtype {.cdecl, importc: "termattrs", discardable, dynlib: libncurses.} ## Previously termattrs 305 | proc termname*(): cstring {.cdecl, importc, discardable, dynlib: libncurses.} 306 | 307 | #beep: Bell and screen flash routines 308 | proc beep*(): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 309 | proc flash*(): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 310 | ## Flashes the screen and if that is not possible it sounds the alert. If this is not possible 311 | ## nothing happens. 312 | ## @Returns: ERR on failure and OK upon successfully flashing. 313 | 314 | #bkgd: Window background manipulation routines 315 | proc bkgdset*(ch: chtype): void {.cdecl, importc, discardable, dynlib: libncurses.} 316 | proc wbkgdset*(win: PWindow, ch: chtype): void {.cdecl, importc, discardable, dynlib: libncurses.} 317 | proc bkgd*(ch: chtype): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 318 | ## Sets the background property of the current window and apply this setting to every 319 | ## character position in the window. 320 | ## @Param: 'background' the background property to apply. 321 | proc wbkgd*(win: PWindow, ch: chtype): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 322 | proc getbkgd*(win: PWindow): chtype {.cdecl, importc, discardable, dynlib: libncurses.} 323 | 324 | #bkgrnd: Window complex background manipulation routines 325 | proc bkgrnd*(wch: cchar_t): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 326 | proc wbkgrnd*(win: PWindow, wch: cchar_t): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 327 | proc bkgrndset*(wch: cchar_t): void {.cdecl, importc, discardable, dynlib: libncurses.} 328 | proc wbkgrndset*(win: PWindow, wch: cchar_t): void {.cdecl, importc, discardable, dynlib: libncurses.} 329 | proc getbkgrnd*(wch: cchar_t): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 330 | proc wgetbkgrnd*(win: PWindow, wch: cchar_t): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 331 | 332 | #border: Create borders, horizontal and vertical lines 333 | proc border*(ls, rs, ts, bs, tl, tr, bl, br: chtype): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 334 | proc wborder*(win: PWindow, ls, rs, ts, bs, tl, tr, bl, br: chtype): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 335 | proc box*(win: PWindow, verch, horch: chtype): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 336 | proc hline*(ch: chtype, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 337 | proc whline*(win: PWindow, ch: chtype, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 338 | proc vline*(ch: chtype, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 339 | proc wvline*(win: PWindow, ch: chtype, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 340 | proc mvhline*(y, x: cint, ch: chtype, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 341 | proc mvwhline*(win: PWindow, y, x: cint, ch: chtype, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 342 | proc mvvline*(y, x: cint, ch: chtype, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 343 | proc mvwvline*(win: PWindow, y, x: cint, ch: chtype, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 344 | 345 | #borderset: Create borders or lines using complex characters and renditions 346 | proc border_set*(ls, rs, ts, bs, tl, tr, bl, br: cchar_t): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 347 | proc wborder_set*(win: PWindow, ls, rs, ts, bs, tl, tr, bl, br: cchar_t): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 348 | proc box_set*(win: PWindow, verch, horch: cchar_t): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 349 | proc hline_set*(wch: cchar_t, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 350 | proc whline_set*(win: PWindow, wch: cchar_t, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 351 | proc mvhline_set*(y,x: cint, wch: cchar_t, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 352 | proc mvwhline_set*(win: PWindow, y,x: cint, wch: cchar_t, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 353 | proc vline_set*(wch: cchar_t, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 354 | proc wvline_set*(win: PWindow, wch: cchar_t, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 355 | proc mvvline_set*(y,x: cint, wch: cchar_t, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 356 | proc mvwvline_set*(win: PWindow, y,x: cint, wch: cchar_t, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 357 | 358 | #inopts: Input options 359 | proc cbreak*(): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 360 | ## The cbreak routine disables line buffering and erase/kill character-processing 361 | ## (interrupt and flow control characters are unaffected), making characters typed by 362 | ## the user immediately available to the program. 363 | ## @Returns: ERR on failure and OK upon successful completion. 364 | proc nocbreak*(): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 365 | ## Returns the terminal to normal (cooked mode). 366 | ## @Returns: ERR on failure and OK upon successful completion. 367 | proc noecho*(): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 368 | proc onecho*(): ErrCode {.cdecl, discardable, dynlib: libncurses, importc: "echo".} ## Previously echo 369 | proc halfdelay*(tenths: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 370 | proc keypad*(win: PWindow, bf: bool): cint {.cdecl, importc, discardable, dynlib: libncurses.} 371 | proc meta*(win: PWindow, bf: bool): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 372 | proc nodelay*(win: PWindow, bf: bool): cint {.cdecl, importc, discardable, dynlib: libncurses.} 373 | proc raw*(): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 374 | proc noraw*(): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 375 | proc noqiflush*(): void {.cdecl, importc, discardable, dynlib: libncurses.} 376 | proc qiflush*(): void {.cdecl, importc, discardable, dynlib: libncurses.} 377 | proc notimeout*(): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 378 | proc timeout*(delay: cint): void {.cdecl, importc, discardable, dynlib: libncurses.} 379 | proc wtimeout*(win: PWindow, delay: cint): void {.cdecl, importc, discardable, dynlib: libncurses.} 380 | proc typeahead*(fd: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 381 | 382 | #clear: Clear all or part of a window 383 | proc erase*(): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 384 | proc werase*(win: PWindow): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 385 | proc clear*(): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 386 | proc wclear*(win: PWindow): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 387 | proc clrtobot*(): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 388 | proc wclrtobot*(win: PWindow): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 389 | proc clrtoeol*(): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 390 | proc wclrtoeol*(win: PWindow): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 391 | 392 | #outopts: Output options 393 | proc clearok*(win: PWindow, bf: bool): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 394 | proc idlok*(win: PWindow, bf: bool): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 395 | proc idcok*(win: PWindow, bf: bool): void {.cdecl, importc, discardable, dynlib: libncurses.} 396 | proc immedok*(win: PWindow, bf: bool): void {.cdecl, importc, discardable, dynlib: libncurses.} 397 | proc leaveok*(win: PWindow, bf: bool): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 398 | proc setscrreg*(top, bot: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 399 | proc wsetscrreg*(win: PWindow, top, bot: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 400 | proc scrollok*(win: PWindow, bf: bool): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 401 | proc nl*(): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 402 | proc nonl*(): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 403 | 404 | #overlay: overlay and manipulate overlapped windows 405 | proc overlay*(srcwin, dstwin: PWindow): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 406 | proc overwrite*(srcwin, dstwin: PWindow): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 407 | proc copywin*(srcwin, dstwin: PWindow, 408 | sminrow, smincol, 409 | dminrow, dmincol, 410 | dmaxrow, dmaxcol: cint 411 | ): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 412 | 413 | #kernel: low-level routines (all except cur_set will always return OK) 414 | proc def_prog_mode*(): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 415 | proc def_shell_mode*(): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 416 | proc reset_prog_mode*(): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 417 | proc reset_shell_mode*(): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 418 | proc resetty*(): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 419 | proc savetty*(): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 420 | proc getsyx*(y,x: cint): void {.cdecl, importc, discardable, dynlib: libncurses.} 421 | proc setsyx*(y,x: cint): void {.cdecl, importc, discardable, dynlib: libncurses.} 422 | proc ripoffline*(line: cint, init: proc(win: PWindow, cols: cint): cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 423 | proc curs_set*(visibility: cint): cint {.cdecl, importc, discardable, dynlib: libncurses.} 424 | proc napms*(ms: cint): cint {.cdecl, importc, discardable, dynlib: libncurses.} 425 | ## Used to sleep for the specified milliseconds. 426 | ## @Params: 'milliseconds' the number of milliseconds to sleep for. 427 | ## @Returns: ERR on failure and OK upon successful completion. 428 | 429 | #extend: misc extensions 430 | proc curses_version*(): cstring {.cdecl, importc, discardable, dynlib: libncurses.} 431 | proc use_extended_names*(enable: bool): cint {.cdecl, importc, discardable, dynlib: libncurses.} 432 | 433 | #define_key: define a keycode 434 | proc define_key*(definition: cstring, keycode: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 435 | 436 | #terminfo: interfaces to terminfo database 437 | var 438 | cur_term*: ptr Terminal 439 | boolnames*, boolcodes*, boolfnames*: cstringArray 440 | numnames*, numcodes*, numfnames*: cstringArray 441 | strnames*, strcodes*, strfnames*: cstringArray 442 | proc setupterm*(term: cstring; filedes: cint; errret: ptr cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 443 | proc setterm*(term: cstring): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 444 | proc set_curterm*(nterm: ptr Terminal): ptr Terminal {.cdecl, importc, discardable, dynlib: libncurses.} 445 | proc del_curterm*(oterm: ptr Terminal): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 446 | proc restartterm*(term: cstring; filedes: cint; errret: ptr cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 447 | proc tparm*(str: cstring): cstring {.varargs, cdecl, importc, discardable, dynlib: libncurses.} 448 | proc putp*(str: cstring): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 449 | proc vid_puts_ch*(attrs: chtype; putc: proc(ch: cint): cint): ErrCode {.cdecl, importc: "vidputs", discardable, dynlib: libncurses.} 450 | proc vid_attr_ch*(attrs: chtype): ErrCode {.cdecl, importc: "vidattr", discardable, dynlib: libncurses.} 451 | proc vid_puts*(attrs: attr_t; pair: cshort; opts: pointer; putc: proc(ch: cint): cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 452 | proc vid_attr*(attrs: attr_t; pair: cshort; opts: pointer): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 453 | proc mvcur*(oldrow, oldcol, newrow, newcol: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 454 | proc tigetflag*(capname: cstring): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 455 | proc tigetnum*(capname: cstring): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 456 | proc tigetstr*(capname: cstring): cstring {.cdecl, importc, discardable, dynlib: libncurses.} 457 | proc tiparm*(str: cstring): cstring {.varargs, cdecl, importc, discardable, dynlib: libncurses.} 458 | 459 | #util: misc utility routines 460 | proc unctrl*(c: chtype): cstring {.cdecl, importc, discardable, dynlib: libncurses.} 461 | proc wunctrl*(c: ptr cchar_t): WideCString {.cdecl, importc, discardable, dynlib: libncurses.} 462 | proc keyname*(c: cint): cstring {.cdecl, importc, discardable, dynlib: libncurses.} 463 | proc keyname_wch*(w: WideCString): cstring {.cdecl, discardable, dynlib: libncurses, importc: "key_name".} ## previously key_name, had to be renamed. 464 | proc filter*(): void {.cdecl, importc, discardable, dynlib: libncurses.} 465 | proc nofilter*(): void {.cdecl, importc, discardable, dynlib: libncurses.} 466 | proc use_env*(f: bool): void {.cdecl, importc, discardable, dynlib: libncurses.} 467 | proc use_tioctl*(f: bool): void {.cdecl, importc, discardable, dynlib: libncurses.} 468 | proc putwin*(win: PWindow, filep: File): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 469 | proc getwin*(filep: File): PWindow {.cdecl, importc, discardable, dynlib: libncurses.} 470 | proc delay_output*(ms: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 471 | proc flushinp*(): cint {.cdecl, importc, discardable, dynlib: libncurses.} 472 | 473 | #delch: delete character under the cursor in a window 474 | proc delch*(): cint {.cdecl, importc, discardable, dynlib: libncurses.} 475 | ## Delete the character under the cursor in the stdscr. 476 | ## @Returns: ERR on failure and OK upon successfully flashing. 477 | proc wdelch*(win: PWindow): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 478 | proc mvdelch*(y,x: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 479 | proc mvwdelch*(win: PWindow, y,x: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 480 | 481 | #deleteln: delete and insert lines in a window 482 | proc deleteln*(): cint {.cdecl, importc, discardable, dynlib: libncurses.} 483 | ## Deletes the line under the cursor in the stdscr. All lines below the current line are moved up one line. 484 | ## The bottom line of the window is cleared and the cursor position does not change. 485 | ## @Returns: ERR on failure and OK upon successful completion. 486 | proc wdeleteln*(win: PWindow): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 487 | proc insdeln*(): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 488 | proc winsdeln*(win: PWindow, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 489 | proc insertln*(): cint {.cdecl, importc, discardable, dynlib: libncurses.} 490 | ## Inserts a blank line above the current line in stdscr and the bottom line is lost. 491 | ## @Returns: ERR on failure and OK upon successful completion. 492 | proc winsertln*(win: PWindow): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 493 | 494 | #initscr: screen initialization and manipulation routines 495 | proc initscr*(): PWindow {.cdecl, importc, discardable, dynlib: libncurses.} 496 | ## Usually the first curses routine to be called when initialising a program 497 | ## The initscr code determines the terminal type and initialises all curses data structures. initscr also causes the 498 | ## first call to refresh to clear the screen. 499 | ## @Returns: A pointer to stdscr is returned if the operation is successful. 500 | ## @Note: If errors occur, initscr writes an appropriate error message to 501 | ## standard error and exits. 502 | proc endwin*(): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 503 | ## A program should always call endwin before exiting or escaping from curses mode temporarily. This routine 504 | ## restores tty modes, moves the cursor to the lower left-hand corner of the screen and resets the terminal into the 505 | ## proper non-visual mode. Calling refresh or doupdate after a temporary escape causes the program to resume visual mode. 506 | ## @Returns: ERR on failure and OK upon successful completion. 507 | proc isendwin*(): bool {.cdecl, importc, discardable, dynlib: libncurses.} 508 | proc newterm*(`type`: cstring, outfd, infd: File): PScreen {.cdecl, importc, discardable, dynlib: libncurses.} 509 | proc set_term*(`new`: PScreen): PScreen {.cdecl, importc, discardable, dynlib: libncurses.} 510 | proc delscreen*(sp: PScreen): void {.cdecl, importc, discardable, dynlib: libncurses.} 511 | 512 | #window: create a window 513 | proc newwin*(nlines, ncols, begin_y, begin_x: cint): PWindow {.cdecl, importc, discardable, dynlib: libncurses.} 514 | proc delwin*(win: PWindow): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 515 | proc mvwin*(win: PWindow, y,x: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 516 | proc subwin*(orig: PWindow, nlines, ncols, begin_y, begin_x: cint): PWindow {.cdecl, importc, discardable, dynlib: libncurses.} 517 | proc derwin*(orig: PWindow, nlines, ncols, begin_y, begin_x: cint): PWindow {.cdecl, importc, discardable, dynlib: libncurses.} 518 | proc mvderwin*(win: PWindow, par_y, par_x: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 519 | proc dupwin*(win: PWindow): PWindow {.cdecl, importc, discardable, dynlib: libncurses.} 520 | proc wsyncup*(win: PWindow): void {.cdecl, importc, discardable, dynlib: libncurses.} 521 | proc syncok*(win: PWindow, bf: bool): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 522 | proc wcursyncup*(win: PWindow): void {.cdecl, importc, discardable, dynlib: libncurses.} 523 | proc wsyncdown*(win: PWindow): void {.cdecl, importc, discardable, dynlib: libncurses.} 524 | 525 | #refresh: refresh windows and lines 526 | proc refresh*(): cint {.cdecl, importc, discardable, dynlib: libncurses.} 527 | ## Must be called to get actual output to the terminal. refresh uses stdscr has the default window. 528 | ## @Returns: ERR on failure and OK upon successful completion. 529 | proc wrefresh*(win: PWindow): cint {.cdecl, importc, discardable, dynlib: libncurses.} 530 | proc wnoutrefresh*(win: PWindow): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 531 | proc doupdate*(): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 532 | proc redrawwin*(win: PWindow): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 533 | proc wredrawln*(win: PWindow, beg_lines, num_lines: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 534 | 535 | #slk: soft label routines 536 | proc slk_init*(fmt: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 537 | proc slk_set*(labnum: cint, label: WideCString, fmt: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 538 | proc slk_wset*(labnum: cint, label: WideCString, fmt: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 539 | proc slk_label*(labnum: cint): cstring {.cdecl, importc, discardable, dynlib: libncurses.} 540 | proc slk_refresh*(): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 541 | proc slk_noutrefresh*(): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 542 | proc slk_clear*(): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 543 | proc slk_restore*(): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 544 | proc slk_touch*(): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 545 | proc slk_attron_ch*(attrs: chtype): ErrCode {.cdecl, importc: "slk_attron", discardable, dynlib: libncurses.} ## Previously slk_attron 546 | proc slk_attroff_ch*(attrs: chtype): ErrCode {.cdecl, importc: "slk_attroff", discardable, dynlib: libncurses.} ## Previously slk_attroff 547 | proc slk_attrset_ch*(attrs: chtype): ErrCode {.cdecl, importc: "slk_attrset", discardable, dynlib: libncurses.} ## Previously slk_attrset 548 | proc slk_attr_on*(attrs: attr_t, opts: pointer): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 549 | proc slk_attr_off*(attrs: attr_t, opts: pointer): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 550 | proc slk_attr_set*(attrs: attr_t, pair: cshort, opts: pointer): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 551 | proc slk_attr*(): attr_t {.cdecl, importc, discardable, dynlib: libncurses.} 552 | proc slk_color*(pair: cshort): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 553 | proc extended_slk_color*(pair: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 554 | 555 | #get_wch: get (or push back) a wide character from a terminal keyboard 556 | proc get_wch*(wch: WideCString): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 557 | proc wget_wch*(win: PWindow, wch: WideCString): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 558 | proc mvget_wch*(y,x: cint, wch: WideCString): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 559 | proc mvwget_wch*(win: PWindow, y,x: cint, wch: WideCString): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 560 | proc unget_wch*(wch: WideCString): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 561 | 562 | #get_wstr: get an array of wide characters from a terminal keyboard 563 | proc get_wstr*(wstr: WideCString): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 564 | proc getn_wstr*(wstr: WideCString, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 565 | proc wget_wstr*(win: PWindow, wstr: WideCString): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 566 | proc wgetn_wstr*(win: PWindow, wstr: WideCString, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 567 | proc mvget_wstr*(y,x: cint, wstr: WideCString): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 568 | proc mvgetn_wstr*(y,x: cint, wstr: WideCString, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 569 | proc mvwget_wstr*(win: PWindow, y,x: cint, wstr: WideCString): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 570 | proc mvwgetn_wstr*(win: PWindow, y,x: cint, wstr: WideCString, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 571 | 572 | #legacy: get cursor and window coordinates, attributes 573 | proc getattrs*(win: PWindow): cint {.cdecl, importc, discardable, dynlib: libncurses.} 574 | proc getbegx*(win: PWindow): cint {.cdecl, importc, discardable, dynlib: libncurses.} 575 | proc getbegy*(win: PWindow): cint {.cdecl, importc, discardable, dynlib: libncurses.} 576 | proc getcurx*(win: PWindow): cint {.cdecl, importc, discardable, dynlib: libncurses.} 577 | proc getcury*(win: PWindow): cint {.cdecl, importc, discardable, dynlib: libncurses.} 578 | proc getmaxx*(win: PWindow): cint {.cdecl, importc, discardable, dynlib: libncurses.} 579 | proc getmaxy*(win: PWindow): cint {.cdecl, importc, discardable, dynlib: libncurses.} 580 | proc getparx*(win: PWindow): cint {.cdecl, importc, discardable, dynlib: libncurses.} 581 | proc getpary*(win: PWindow): cint {.cdecl, importc, discardable, dynlib: libncurses.} 582 | 583 | #getyx: get curses cursor and window coordinates (these are implemented as macros in ncurses.h) 584 | template getyx*(win: PWindow, y, x: cint): untyped= 585 | ## Reads the logical cursor location from the specified window. 586 | ## @Param: 'win' the window to get the cursor location from. 587 | ## @Param: 'y' stores the height of the window. 588 | ## @Param: 'x' stores the width of the window. 589 | (y = getcury(win); x = getcurx(win)) ## testing 590 | template getbegyx*(win: PWindow, y, x: cint): untyped= 591 | (y = getbegy(win); x = getbegx(win)) 592 | template getmaxyx*(win: PWindow, y, x: cint): untyped= 593 | ## retrieves the size of the specified window in the provided y and x parameters. 594 | ## @Param: 'win' the window to measure. 595 | ## @Param: 'y' stores the height of the window. 596 | ## @Param: 'x' stores the width of the window. 597 | (y = getmaxy(win); x = getmaxx(win)) 598 | template getparyx*(win: PWindow, y, x: cint): untyped= 599 | (y = getpary(win); x = getparx(win)) 600 | 601 | #getcchar: Get a wide character string and rendition from cchar_t or set a cchar_t from a wide-character string 602 | proc getcchar*(wcval: ptr cchar_t, wch: WideCString, attrs: ptr attr_t, color_pair: ptr cshort, opts: pointer): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 603 | proc setcchar*(wcval: ptr cchar_t, wch: WideCString, attrs: attr_t, color_pair: cshort, opts: pointer): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 604 | 605 | #getch: get (or push back) characters from the terminal keyboard 606 | proc getch*(): cint {.cdecl, importc, discardable, dynlib: libncurses.} 607 | ## Read a character from the stdscr window. 608 | ## @Returns: ERR on failure and OK upon successful completion. 609 | proc wgetch*(win: PWindow): cint {.cdecl, importc, discardable, dynlib: libncurses.} 610 | ## Read a character from the specified window. 611 | ## @Param: 'sourceWindow' the window to read a character from. 612 | ## @Returns: ERR on failure and OK upon successful completion. 613 | proc mvgetch*(y,x: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 614 | proc mvwgetch*(win: PWindow, y,x: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 615 | proc ungetch*(ch: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 616 | proc has_key*(ch: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 617 | 618 | #mouse: mouse interface 619 | proc has_mouse*(): bool {.cdecl, importc, discardable, dynlib: libncurses.} 620 | proc getmouse*(event: ptr Mevent): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 621 | proc ungetmouse*(event: ptr Mevent): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 622 | proc mousemask*(newmask: mmask_t, oldmask: ptr mmask_t): mmask_t {.cdecl, importc, discardable, dynlib: libncurses.} 623 | proc wenclose*(win: PWindow, y, x: cint): bool {.cdecl, importc, discardable, dynlib: libncurses.} 624 | proc mouse_trafo*(y,x: ptr cint, to_screen: bool): bool {.cdecl, importc, discardable, dynlib: libncurses.} 625 | proc wmouse_trafo*(win: PWindow, y,x: ptr cint, to_screen: bool): bool {.cdecl, importc, discardable, dynlib: libncurses.} 626 | proc mouseinterval*(erval: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 627 | 628 | #getstr: accept character strings from terminal keyboard 629 | proc getstr*(str: cstring): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 630 | ## Reads the inputted characters into the provided string. 631 | ## @Param: 'inputString' the variable to read the input into. 632 | ## @Returns: ERR on failure and OK upon successful completion. 633 | proc getnstr*(str: cstring; n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 634 | ## Reads at most the specified number of characters into the provided string. 635 | ## @Param: 'inputString' the variable to read the input into. 636 | ## @Param: 'numberOfCharacters' the maximum number of characters to read. 637 | ## @Returns: ERR on failure and OK upon successful completion. 638 | proc wgetstr*(win: PWindow, str: cstring): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 639 | proc wgetnstr*(win: PWindow, str: cstring, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 640 | proc mvgetstr*(y,x: cint, str: cstring): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 641 | proc mvgetnstr*(y,x: cint, str: cstring, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 642 | proc mvwgetstr*(win: PWindow, y,x: cint, str: cstring): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 643 | proc mvwgetnstr*(win: PWindow, y,x: cint, str: cstring, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 644 | 645 | #in_wch: extract a complex character and rendition from a window 646 | proc in_wch*(wcval: ptr cchar_t): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 647 | proc mvinwch*(y,x: cint, wcval: ptr cchar_t): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 648 | proc mvwin_wch*(win: PWindow, y,x: cint, wcval: ptr cchar_t): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 649 | proc win_wch*(win: PWindow, wcval: ptr cchar_t): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 650 | 651 | #in_wchstr: get an array of complex characters and renditions from a window 652 | proc in_wchstr*(wchstr: ptr cchar_t): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 653 | proc in_wchnstr*(wchstr: ptr cchar_t, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 654 | proc win_wchstr*(win: PWindow, wchstr: ptr cchar_t): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 655 | proc win_wchnstr*(win: PWindow, wchstr: ptr cchar_t, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 656 | proc mvin_wchstr*(y,x: cint, wchstr: ptr cchar_t): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 657 | proc mvin_wchnstr*(y,x: cint, wchstr: ptr cchar_t, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 658 | proc mvwin_wchstr*(win: PWindow, y,x: cint, wchstr: ptr cchar_t): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 659 | proc mvwin_wchnstr*(win: PWindow; y,x: cint, wchstr: ptr cchar_t, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 660 | 661 | #inch: get a character and attributes from a window 662 | proc inch*(): chtype {.cdecl, importc, discardable, dynlib: libncurses.} 663 | proc winch*(win: PWindow): chtype {.cdecl, importc, discardable, dynlib: libncurses.} 664 | proc mvinch*(y,x: cint): chtype {.cdecl, importc, discardable, dynlib: libncurses.} 665 | proc mvwinch*(win: PWindow; y,x: cint): chtype {.cdecl, importc, discardable, dynlib: libncurses.} 666 | 667 | #inchstr: get a string of characters (and attributes) from a window 668 | proc inchstr*(chstr: ptr chtype): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 669 | proc inchnstr*(chstr: ptr chtype; n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 670 | proc winchstr*(win: PWindow; chstr: ptr chtype): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 671 | proc winchnstr*(win: PWindow; chstr: ptr chtype; n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 672 | proc mvinchstr*(y,x: cint; chstr: ptr chtype): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 673 | proc mvinchnstr*(y,x: cint; chstr: ptr chtype; n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 674 | proc mvwinchstr*(win: PWindow, y,x: cint; chstr: ptr chtype): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 675 | proc mvwinchnstr*(win: PWindow, y,x: cint; chstr: ptr chtype; n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 676 | 677 | #instr: get a string of characters from a window 678 | proc instr*(str: cstring): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 679 | proc innstr*(str: cstring, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 680 | proc winstr*(win: PWindow, str: cstring): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 681 | proc winnstr*(win: PWindow, str: cstring, n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 682 | proc mvinstr*(): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 683 | proc mvinnstr*(): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 684 | proc mvwinstr*(): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 685 | proc mvwinnstr*(): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 686 | 687 | #inwstr: get a string of wchar_t characters from a window 688 | proc inwstr*(wstr: WideCString): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 689 | proc innwstr*(wstr: WideCString; n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 690 | proc winwstr*(win: PWindow; wstr: WideCString): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 691 | proc winnwstr*(win: PWindow; wstr: WideCString; n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 692 | proc mvinwstr*(y,x: cint; wstr: WideCString): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 693 | proc mvinnwstr*(y,x: cint; wstr: WideCString; n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 694 | proc mvwinwstr*(win: PWindow; y,x: cint; wstr: WideCString): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 695 | proc mvwinnwstr*(win: PWindow; y,x: cint; wstr: WideCString; n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 696 | 697 | #ins_wstr: insert a wide-character string into a window 698 | proc ins_wstr*(wstr: WideCString): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 699 | proc ins_nwstr*(wstr: WideCString; n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 700 | proc wins_wstr*(win: PWindow; wstr: WideCString): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 701 | proc wins_nwstr*(win: PWindow; wstr: WideCString; n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 702 | proc mvins_wstr*(y,x: cint; wstr: WideCString): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 703 | proc mvins_nwstr*(y,x: cint; wstr: WideCString; n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 704 | proc mvwins_wstr*(win: PWindow; y,x: cint; wstr: WideCString): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 705 | proc mvwins_nwstr*(win: PWindow; y,x: cint; wstr: WideCString; n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 706 | 707 | #ins_wch: insert a complex character and rendition into a window 708 | proc ins_wch*(wch: ptr cchar_t): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 709 | proc wins_wch*(win: PWindow; wch: ptr cchar_t): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 710 | proc mvins_wch*(y,x: cint; wch: ptr cchar_t): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 711 | proc mvwins_wch*(win: PWindow; y,x: cint; wch: ptr cchar_t): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 712 | 713 | #insch: insert a character before cursor in a window 714 | proc insch*(ch: chtype): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 715 | ## Inserts a character before the cursor in the stdscr. 716 | ## @Param: 'character' the character to insert. 717 | ## @Returns: ERR on failure and OK upon successful completion. 718 | proc winsch*(win: PWindow; ch: chtype): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 719 | proc mvinsch*(y,x: cint; ch: chtype): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 720 | proc mvwinsch*(win: PWindow; y,x: cint; ch: chtype): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 721 | 722 | #insstr: insert string before cursor in a window 723 | proc insstr*(str: cstring): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 724 | proc insnstr*(str: cstring; n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 725 | proc winsstr*(win: PWindow; str: cstring): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 726 | proc winsnstr*(win: PWindow; str: cstring; n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 727 | proc mvinsstr*(y,x: cint; str: cstring): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 728 | proc mvinsnstr*(y,x: cint; str: cstring; n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 729 | proc mvwinsstr*(win: Pwindow; y,x: cint; str: cstring): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 730 | proc mvwinsnstr*(win: Pwindow; y,x: cint; str: cstring; n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 731 | 732 | #opaque: window properties 733 | proc is_cleared*(win: PWindow): bool {.cdecl, importc, discardable, dynlib: libncurses.} 734 | ## returns the value set in clearok 735 | proc is_idcok*(win: PWindow): bool {.cdecl, importc, discardable, dynlib: libncurses.} 736 | ## returns the value set in is_idcok 737 | proc is_idlok*(win: PWindow): bool {.cdecl, importc, discardable, dynlib: libncurses.} 738 | ## returns the value set in is_idlok 739 | proc is_immedok*(win: PWindow): bool {.cdecl, importc, discardable, dynlib: libncurses.} 740 | ## returns the value set in is_immedok 741 | proc is_keypad*(win: PWindow): bool {.cdecl, importc, discardable, dynlib: libncurses.} 742 | ## returns the value set in is_keypad 743 | proc is_leaveok*(win: PWindow): bool {.cdecl, importc, discardable, dynlib: libncurses.} 744 | ## returns the value set in is_leaveok 745 | proc is_nodelay*(win: PWindow): bool {.cdecl, importc, discardable, dynlib: libncurses.} 746 | ## returns the value set in is_nodelay 747 | proc is_notimeout*(win: PWindow): bool {.cdecl, importc, discardable, dynlib: libncurses.} 748 | ## returns the value set in is_notimeout 749 | proc is_pad*(win: PWindow): bool {.cdecl, importc, discardable, dynlib: libncurses.} 750 | ## returns TRUE if the window is a pad i.e., created by newpad 751 | proc is_scrollok*(win: PWindow): bool {.cdecl, importc, discardable, dynlib: libncurses.} 752 | ## returns the value set in is_scrollok 753 | proc is_subwin*(win: PWindow): bool {.cdecl, importc, discardable, dynlib: libncurses.} 754 | ## returns TRUE if the window is a subwindow, i.e., created by subwin 755 | ## or derwin 756 | proc is_syncok*(win: PWindow): bool {.cdecl, importc, discardable, dynlib: libncurses.} 757 | ## returns the value set in is_syncok 758 | proc wgetparent*(win: PWindow): PWindow {.cdecl, importc, discardable, dynlib: libncurses.} 759 | ## returns the parent WINDOW pointer for subwindows, or NULL for 760 | ## windows with no parent 761 | proc wgetdelay*(win: PWindow): cint {.cdecl, importc, discardable, dynlib: libncurses.} 762 | ## returns the delay timeout as set in wtimeout 763 | proc wgetscrreg*(win: PWindow; top, bottom: cint): cint {.cdecl, importc, discardable, dynlib: libncurses.} 764 | ## returns the top and bottom rows for the scrolling margin as set in 765 | ## wsetscrreg 766 | 767 | #touch: refresh control routines 768 | proc touchwin*(win: PWindow): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 769 | ## Throws away all optimization information about which parts of the window 770 | ## have been touched, by pretending that the entire window has been drawn on. 771 | ## This is sometimes necessary when using overlapping windows, since a change 772 | ## to one window affects the other window, but the records of which lines 773 | ## have been changed in the other window do not reflect the change. 774 | proc touchline*(win: PWindow; start, count: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 775 | ## The same as touchwin, except it only pretends that count lines have been 776 | ## changed, beginning with line start. 777 | proc untouchwin*(win: PWindow): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 778 | ## Marks all lines in the window as unchanged since the last call to wrefresh. 779 | proc wtouchln*(win: PWindow; y, n, changed: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 780 | ## Makes n lines in the window, starting at line y, look as if they have 781 | ## (changed=1) or have not (changed=0) been changed since the last call to 782 | ## wrefresh. 783 | proc is_wintouched*(win: PWindow): bool {.cdecl, importc, discardable, dynlib: libncurses.} 784 | ## Returns TRUE if the specified window was modified since the last call to 785 | ## wrefresh 786 | proc is_linetouched*(win: PWindow; line: cint): bool {.cdecl, importc, discardable, dynlib: libncurses.} 787 | ## The same as is_wintouched, In addition, returns ERR if line is not valid 788 | ## for the given window. 789 | 790 | #resizeterm: change the curses terminal size 791 | proc is_term_resized*(lines, columns: cint): bool {.cdecl, importc, discardable, dynlib: libncurses.} 792 | ## Checks if the resize_term function would modify the window structures. 793 | ## returns TRUE if the windows would be modified, and FALSE otherwise. 794 | proc resize_term*(lines, columns: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 795 | ## Resizes the standard and current windows to the specified dimensions, 796 | ## and adjusts other bookkeeping data used by the ncurses library that 797 | ## record the window dimensions such as the LINES and COLS variables. 798 | proc resize_term_ext*(lines, columns: cint): ErrCode {.cdecl, discardable, dynlib: libncurses, importc: "resize_term".} 799 | ## Blank-fills the areas that are extended. The calling application should 800 | ## fill in these areas with appropriate data. The resize_term function 801 | ## attempts to resize all windows. However, due to the calling convention of 802 | ## pads, it is not possible to resize these without additional interaction 803 | ## with the application. 804 | 805 | #key_defined: check if a keycode is defined 806 | proc key_defined*(definition: cstring): cint {.cdecl, importc, discardable, dynlib: libncurses.} 807 | ## If the string is bound to a keycode, its value (greater than zero) is 808 | ## returned. If no keycode is bound, zero is returned. If the string 809 | ## conflicts with longer strings which are bound to keys, -1 is returned. 810 | 811 | #keybound: return definition of keycode 812 | proc keybound*(keycode, count: cint): cstring {.cdecl, importc, discardable, dynlib: libncurses.} 813 | ## The keycode parameter must be greater than zero, else NULL is returned. 814 | ## If it does not correspond to a defined key, then NULL is returned. The 815 | ## count parameter is used to allow the application to iterate through 816 | ## multiple definitions, counting from zero. When successful, the function 817 | ## returns a string which must be freed by the caller. 818 | 819 | #keyok: enable or disable a keycode 820 | #[ 821 | proc keyok(keycode: cint; enable: bool): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} ## Not used? 822 | ## The keycode must be greater than zero, else ERR is returned. If it 823 | ## does not correspond to a defined key, then ERR is returned. If the 824 | ## enable parameter is true, then the key must have been disabled, and 825 | ## vice versa. Otherwise, the function returns OK. 826 | ]# 827 | 828 | #mcprint: ship binary data to printer 829 | proc mcprint*(data: cstring; len: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 830 | 831 | #move: move window cursor 832 | proc move*(y, x: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 833 | ## Moves the cursor of stdscr to the specified coordinates. 834 | ## @Param: 'y' the line to move the cursor to. 835 | ## @Param: 'x' the column to move the cursor to. 836 | ## @Returns: ERR on failure and OK upon successful completion. 837 | proc wmove*(win: PWindow; y,x: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 838 | 839 | #printw: print formatted output in windows 840 | proc printw*(fmt: cstring): ErrCode {.cdecl, importc, discardable, dynlib: libncurses, varargs.} 841 | ## Prints out a formatted string to the stdscr. 842 | ## @Param: 'formattedString' the string with formatting to be output to stdscr. 843 | ## @Returns: ERR on failure and OK upon successful completion. 844 | proc wprintw*(win: PWindow, fmt: cstring): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 845 | proc mvprintw*(y, x: cint; fmt: cstring): ErrCode {.cdecl, importc, discardable, dynlib: libncurses, varargs.} 846 | ## Prints out a formatted string to the stdscr at the specified row and column. 847 | ## @Param: 'y' the line to move the cursor to. 848 | ## @Param: 'x' the column to move the cursor to. 849 | ## @Param: 'formattedString' the string with formatting to be output to stdscr. 850 | ## @Returns: ERR on failure and OK upon successful completion. 851 | proc mvwprintw*(win: PWindow; y,x: cint; fmt: cstring): ErrCode {.cdecl, importc, discardable, dynlib: libncurses, varargs.} 852 | ## Prints out a formatted string to the specified window at the specified row and column. 853 | ## @Param: 'destinationWindow' the window to write the string to. 854 | ## @Param: 'y' the line to move the cursor to. 855 | ## @Param: 'x' the column to move the cursor to. 856 | ## @Param: 'formattedString' the string with formatting to be output to stdscr. 857 | ## @Returns: ERR on failure and OK upon successful completion. 858 | proc vw_printw*(win: PWindow; fmt: cstring; varglist: varargs[cstring]): ErrCode {.cdecl, importc, discardable, dynlib: libncurses} 859 | 860 | #scanw: convert formatted input from a window 861 | proc scanw*(fmt: cstring): ErrCode {.cdecl, importc, discardable, dynlib: libncurses, varargs.} 862 | ## Converts formatted input from the stdscr. 863 | ## @Param: 'formattedInput' Contains the fields for the input to be mapped to. 864 | ## @Returns: The number of fields that were mapped in the call. 865 | proc wscanw*(win: PWindow; fmt: cstring): ErrCode {.cdecl, importc, discardable, dynlib: libncurses, varargs.} 866 | proc mvscanw*(y,x: cint; fmt: cstring): ErrCode {.cdecl, importc, discardable, dynlib: libncurses, varargs.} 867 | proc mvwscanw*(win: PWindow; y,x: cint; fmt: cstring): ErrCode {.cdecl, importc, discardable, dynlib: libncurses, varargs.} 868 | proc vw_scanw*(win: PWindow; fmt: cstring; varglist: varargs[cstring]): ErrCode {.cdecl, importc, discardable, dynlib: libncurses, varargs,.} 869 | 870 | #pad: create and display pads 871 | proc newpad*(nlines, ncols: cint): PWindow {.cdecl, importc, discardable, dynlib: libncurses.} 872 | proc subpad*(orig: PWindow; lines, columns, begin_y, begin_x: cint): PWindow {.cdecl, importc, discardable, dynlib: libncurses.} 873 | proc prefresh*(pad: PWindow; 874 | pminrow, pmincol, 875 | sminrow, smincol, 876 | smaxrow, smaxcol: cint 877 | ): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 878 | proc pnoutrefersh*(pad: PWindow; 879 | pminrow, pmincol, 880 | sminrow, smincol, 881 | smaxrow, smaxcol: cint 882 | ): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 883 | proc pechochar*(pad: PWindow; ch: chtype): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 884 | proc pecho_wchar*(pad: PWindow; wch: WideCString): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 885 | 886 | #scr_dump: read (write) a screen from (to) a file 887 | proc scr_dump*(filename: cstring): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 888 | proc scr_restore*(filename: cstring): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 889 | proc scr_init*(filename: cstring): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 890 | proc scr_set*(filename: cstring): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 891 | 892 | #scroll: scroll a window 893 | proc scroll*(win: PWindow): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 894 | proc scrl*(n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 895 | proc wscrl*(win: PWindow; n: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 896 | 897 | #termcap: direct interface to the terminfo capability database 898 | var 899 | PC* {.importc, dynlib: libncurses.}: cchar 900 | ## Set by tgetent to the terminfo entry's pad_char value. 901 | ## Used in the tdelay_output function. 902 | UP* {.importc, dynlib: libncurses.}: ptr cchar 903 | ## Set by tgetent to the terminfo entry's cursor_up value. 904 | ## Not used by ncurses. 905 | BC* {.importc, dynlib: libncurses.}: ptr cchar 906 | ## Set by tgetent to the terminfo entry's backspace_if_not_bs value. 907 | ## Used in the tgoto() emulation. 908 | ospeed* {.importc, dynlib: libncurses.}: cshort 909 | ## Set by ncurses in a system-specific coding to reflect the terminal speed. 910 | proc tgetent*(np, name: cstring): cint {.cdecl, importc, discardable, dynlib: libncurses.} 911 | proc tgetflag*(id: cstring): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 912 | proc tgetnum*(id: cstring): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 913 | proc tgetstr*(id: cstring; area: cstringArray ): cstring {.cdecl, importc, discardable, dynlib: libncurses.} 914 | proc tgoto*(cap: cstring; col, row: cint): cstring {.cdecl, importc, discardable, dynlib: libncurses.} 915 | proc tputs*(str: cstring; affcnt: cint; putc: ptr proc(ch: cint): cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 916 | 917 | #legacy_coding: override locale-encoding checks 918 | proc use_legacy_coding*(level: cint): cint {.cdecl, importc, discardable, dynlib: libncurses.} 919 | ## If the screen has not been initialized, or the level parameter is out 920 | ## of range, the function returns ERR. Otherwise, it returns the previous 921 | ## level: 0, 1 or 2. 922 | 923 | #wresize: resize a curses window 924 | proc wresize*(win: PWindow; line, column: cint): ErrCode {.cdecl, importc, discardable, dynlib: libncurses.} 925 | 926 | # mouse interface 927 | template NCURSES_MOUSE_MASK(b, m: untyped): untyped = ((m) shl (((b) - 1) * 5)) 928 | template BUTTON_RELEASE*(e, x: untyped): untyped = 929 | ((e) and NCURSES_MOUSE_MASK(x, NCURSES_BUTTON_RELEASED)) 930 | template BUTTON_PRESS*(e, x: untyped): untyped = 931 | ((e) and NCURSES_MOUSE_MASK(x, NCURSES_BUTTON_PRESSED)) 932 | template BUTTON_CLICK*(e, x: untyped): untyped = 933 | ((e) and NCURSES_MOUSE_MASK(x, NCURSES_BUTTON_CLICKED)) 934 | template BUTTON_DOUBLE_CLICK*(e, x: untyped): untyped = 935 | ((e) and NCURSES_MOUSE_MASK(x, NCURSES_DOUBLE_CLICKED)) 936 | template BUTTON_TRIPLE_CLICK*(e, x: untyped): untyped = 937 | ((e) and NCURSES_MOUSE_MASK(x, NCURSES_TRIPLE_CLICKED)) 938 | template BUTTON_RESERVED_EVENT*(e, x: untyped): untyped = 939 | ((e) and NCURSES_MOUSE_MASK(x, NCURSES_RESERVED_EVENT)) 940 | 941 | const 942 | NCURSES_BUTTON_RELEASED* = 0o01'i32 943 | NCURSES_BUTTON_PRESSED* = 0o02'i32 944 | NCURSES_BUTTON_CLICKED* = 0o04'i32 945 | NCURSES_DOUBLE_CLICKED* = 0o10'i32 946 | NCURSES_TRIPLE_CLICKED* = 0o20'i32 947 | NCURSES_RESERVED_EVENT* = 0o40'i32 948 | 949 | # event masks 950 | BUTTON1_RELEASED* = NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_RELEASED) 951 | BUTTON1_PRESSED* = NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_PRESSED) 952 | BUTTON1_CLICKED* = NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_CLICKED) 953 | BUTTON1_DOUBLE_CLICKED* = NCURSES_MOUSE_MASK(1, NCURSES_DOUBLE_CLICKED) 954 | BUTTON1_TRIPLE_CLICKED* = NCURSES_MOUSE_MASK(1, NCURSES_TRIPLE_CLICKED) 955 | BUTTON2_RELEASED* = NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_RELEASED) 956 | BUTTON2_PRESSED* = NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_PRESSED) 957 | BUTTON2_CLICKED* = NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_CLICKED) 958 | BUTTON2_DOUBLE_CLICKED* = NCURSES_MOUSE_MASK(2, NCURSES_DOUBLE_CLICKED) 959 | BUTTON2_TRIPLE_CLICKED* = NCURSES_MOUSE_MASK(2, NCURSES_TRIPLE_CLICKED) 960 | BUTTON3_RELEASED* = NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_RELEASED) 961 | BUTTON3_PRESSED* = NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_PRESSED) 962 | BUTTON3_CLICKED* = NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_CLICKED) 963 | BUTTON3_DOUBLE_CLICKED* = NCURSES_MOUSE_MASK(3, NCURSES_DOUBLE_CLICKED) 964 | BUTTON3_TRIPLE_CLICKED* = NCURSES_MOUSE_MASK(3, NCURSES_TRIPLE_CLICKED) 965 | BUTTON4_RELEASED* = NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_RELEASED) 966 | BUTTON4_PRESSED* = NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_PRESSED) 967 | BUTTON4_CLICKED* = NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_CLICKED) 968 | BUTTON4_DOUBLE_CLICKED* = NCURSES_MOUSE_MASK(4, NCURSES_DOUBLE_CLICKED) 969 | BUTTON4_TRIPLE_CLICKED* = NCURSES_MOUSE_MASK(4, NCURSES_TRIPLE_CLICKED) 970 | BUTTON5_RELEASED* = NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_RELEASED) 971 | BUTTON5_PRESSED* = NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_PRESSED) 972 | BUTTON5_CLICKED* = NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_CLICKED) 973 | BUTTON5_DOUBLE_CLICKED* = NCURSES_MOUSE_MASK(5, NCURSES_DOUBLE_CLICKED) 974 | BUTTON5_TRIPLE_CLICKED* = NCURSES_MOUSE_MASK(5, NCURSES_TRIPLE_CLICKED) 975 | BUTTON_CTRL* = NCURSES_MOUSE_MASK(6, 1) 976 | BUTTON_SHIFT* = NCURSES_MOUSE_MASK(6, 2) 977 | BUTTON_ALT* = NCURSES_MOUSE_MASK(6, 4) 978 | 979 | # keys 980 | KEY_CODE_YES* = 0o400 ## A wchar_t contains a key code 981 | KEY_MIN* = 0o401 ## Minimum curses key 982 | KEY_BREAK* = 0o401 ## Break key (unreliable) 983 | KEY_SRESET* = 0o530 ## Soft (partial) reset (unreliable) 984 | KEY_RESET* = 0o531 ## Reset or hard reset (unreliable) 985 | 986 | KEY_DOWN* = 0o402 ## down-arrow key 987 | KEY_UP* = 0o403 ## up-arrow key 988 | KEY_LEFT* = 0o404 ## left-arrow key 989 | KEY_RIGHT* = 0o405 ## right-arrow key 990 | KEY_HOME* = 0o406 ## home key 991 | KEY_BACKSPACE* = 0o407 ## backspace key 992 | KEY_F0* = 0o410 ## Function keys. Space for 64 993 | KEY_DL* = 0o510 ## delete-line key 994 | KEY_IL* = 0o511 ## insert-line key 995 | KEY_DC* = 0o512 ## delete-character key 996 | KEY_IC* = 0o513 ## insert-character key 997 | KEY_EIC* = 0o514 ## sent by rmir or smir in insert mode 998 | KEY_CLEAR* = 0o515 ## clear-screen or erase key 999 | KEY_EOS* = 0o516 ## clear-to-end-of-screen key 1000 | KEY_EOL* = 0o517 ## clear-to-end-of-line key 1001 | KEY_SF* = 0o520 ## scroll-forward key 1002 | KEY_SR* = 0o521 ## scroll-backward key 1003 | KEY_NPAGE* = 0o522 ## next-page key 1004 | KEY_PPAGE* = 0o523 ## previous-page key 1005 | KEY_STAB* = 0o524 ## set-tab key 1006 | KEY_CTAB* = 0o525 ## clear-tab key 1007 | KEY_CATAB* = 0o526 ## clear-all-tabs key 1008 | KEY_ENTER* = 0o527 ## enter/send key 1009 | KEY_PRINT* = 0o532 ## print key 1010 | KEY_LL* = 0o533 ## lower-left key (home down) 1011 | KEY_A1* = 0o534 ## upper left of keypad 1012 | KEY_A3* = 0o535 ## upper right of keypad 1013 | KEY_B2* = 0o536 ## center of keypad 1014 | KEY_C1* = 0o537 ## lower left of keypad 1015 | KEY_C3* = 0o540 ## lower right of keypad 1016 | KEY_BTAB* = 0o541 ## back-tab key 1017 | KEY_BEG* = 0o542 ## begin key 1018 | KEY_CANCEL* = 0o543 ## cancel key 1019 | KEY_CLOSE* = 0o544 ## close key 1020 | KEY_COMMAND* = 0o545 ## command key 1021 | KEY_COPY* = 0o546 ## copy key 1022 | KEY_CREATE* = 0o547 ## create key 1023 | KEY_END* = 0o550 ## end key 1024 | KEY_EXIT* = 0o551 ## exit key 1025 | KEY_FIND* = 0o552 ## find key 1026 | KEY_HELP* = 0o553 ## help key 1027 | KEY_MARK* = 0o554 ## mark key 1028 | KEY_MESSAGE* = 0o555 ## message key 1029 | KEY_MOVE* = 0o556 ## move key 1030 | KEY_NEXT* = 0o557 ## next key 1031 | KEY_OPEN* = 0o560 ## open key 1032 | KEY_OPTIONS* = 0o561 ## options key 1033 | KEY_PREVIOUS* = 0o562 ## previous key 1034 | KEY_REDO* = 0o563 ## redo key 1035 | KEY_REFERENCE* = 0o564 ## reference key 1036 | KEY_REFRESH* = 0o565 ## refresh key 1037 | KEY_REPLACE* = 0o566 ## replace key 1038 | KEY_RESTART* = 0o567 ## restart key 1039 | KEY_RESUME* = 0o570 ## resume key 1040 | KEY_SAVE* = 0o571 ## save key 1041 | KEY_SBEG* = 0o572 ## shifted begin key 1042 | KEY_SCANCEL* = 0o573 ## shifted cancel key 1043 | KEY_SCOMMAND* = 0o574 ## shifted command key 1044 | KEY_SCOPY* = 0o575 ## shifted copy key 1045 | KEY_SCREATE* = 0o576 ## shifted create key 1046 | KEY_SDC* = 0o577 ## shifted delete-character key 1047 | KEY_SDL* = 0o600 ## shifted delete-line key 1048 | KEY_SELECT* = 0o601 ## select key 1049 | KEY_SEND* = 0o602 ## shifted end key 1050 | KEY_SEOL* = 0o603 ## shifted clear-to-end-of-line key 1051 | KEY_SEXIT* = 0o604 ## shifted exit key 1052 | KEY_SFIND* = 0o605 ## shifted find key 1053 | KEY_SHELP* = 0o606 ## shifted help key 1054 | KEY_SHOME* = 0o607 ## shifted home key 1055 | KEY_SIC* = 0o610 ## shifted insert-character key 1056 | KEY_SLEFT* = 0o611 ## shifted left-arrow key 1057 | KEY_SMESSAGE* = 0o612 ## shifted message key 1058 | KEY_SMOVE* = 0o613 ## shifted move key 1059 | KEY_SNEXT* = 0o614 ## shifted next key 1060 | KEY_SOPTIONS* = 0o615 ## shifted options key 1061 | KEY_SPREVIOUS* = 0o616 ## shifted previous key 1062 | KEY_SPRINT* = 0o617 ## shifted print key 1063 | KEY_SREDO* = 0o620 ## shifted redo key 1064 | KEY_SREPLACE* = 0o621 ## shifted replace key 1065 | KEY_SRIGHT* = 0o622 ## shifted right-arrow key 1066 | KEY_SRSUME* = 0o623 ## shifted resume key 1067 | KEY_SSAVE* = 0o624 ## shifted save key 1068 | KEY_SSUSPEND* = 0o625 ## shifted suspend key 1069 | KEY_SUNDO* = 0o626 ## shifted undo key 1070 | KEY_SUSPEND* = 0o627 ## suspend key 1071 | KEY_UNDO* = 0o630 ## undo key 1072 | KEY_MOUSE* = 0o631 ## Mouse event has occurred 1073 | KEY_RESIZE* = 0o632 ## Terminal resize event 1074 | KEY_EVENT* = 0o633 ## We were interrupted by an event 1075 | template KEY_F*(n: untyped): untyped= (KEY_F0+(n)) ## Value of function key n 1076 | -------------------------------------------------------------------------------- /ncurses.nimble: -------------------------------------------------------------------------------- 1 | # Package 2 | name = "ncurses" 3 | version = "1.0.0" 4 | author = "Raymond Nowley" 5 | description = "A wrapper for NCurses" 6 | license = "MIT" 7 | 8 | # Dependencies 9 | requires "nim >= 0.10.0" 10 | --------------------------------------------------------------------------------