module

CRT::Ncurses

Constants

ALL_OBJECTS = [] of CRT::Ncurses::CRTObjs
ALL_SCREENS = [] of CRT::Ncurses::Screen
BACKCHAR = ctrl('B')
BEGOFLINE = ctrl('A')
BOTTOM = Position::Bottom.value
CENTER = Position::Center.value
COPY = ctrl('Y')
CRT_PATHMAX = 256
CUT = ctrl('X')
DELETE = 127
ENDOFLINE = ctrl('E')
ERASE = ctrl('U')
FORCHAR = ctrl('F')
FULL = Position::Full.value
HORIZONTAL = Direction::Horizontal

Direction convenience constants

KEY_ESC = 27
KEY_RETURN = 10
KEY_TAB = 9
LEFT = Position::Left.value

TODO: Replace these Int32 convenience constants with Int32 | Position union types on constructor x/y params and other mixed-use sites, so users pass Position::Left directly instead of relying on sentinel values.

MAX_BUTTONS = 200
MAX_ITEMS = 2000
NEXT = ctrl('N')
PASTE = ctrl('V')
PREV = ctrl('P')
REFRESH = ctrl('L')
RIGHT = Position::Right.value
TOP = Position::Top.value
TRANSPOSE = ctrl('T')
VERSION = "0.6.1"
VERTICAL = Direction::Vertical

Class methods

alpha?(character : Char) : Bool
Source
beep

Beep and flush

Source
color(fg : Int32, bg : Int32, fill : Char = ' ') : Int32

Build a chtype suitable for background= (space char + color pair + attributes).

CRT::Ncurses.color(7, 4) # white on blue CRT::Ncurses.color("#07/04") # same, hex notation CRT::Ncurses.color("bold #07/04") # bold white on blue

Source
color(spec : String, fill : Char = ' ') : Int32
Source
color_pair(fg : Int32, bg : Int32) : Int32

Allocate or retrieve a color pair for the given fg/bg combination. Colors are 0-255 (terminal palette indices), or -1 for terminal default. Returns the chtype bits for the pair (pair_number << 8).

Source
ctrl(c : Char) : Int32
Source
delete_curses_window(window : NCurses::Window | Nil)

Safely delete a given window

Source
digit?(character : Char) : Bool
Source
erase_curses_window(window : NCurses::Window | Nil)

Safely erase a given window

Source
fmt(string : String) : Array(Int32)

Format a BBCode-style string into a chtype array.

CRT::Ncurses.fmt("[bold #0F]Hello[/] world")

Returns an Array(Int32) of chtype values ready for Draw.write_chtype.

Source
init_colors

Initialize color support (called once, lazily)

Source
is_char?(c : Int32) : Bool
Source
key_f(n : Int32) : Int32
Source
move_curses_window(window : NCurses::Window | Nil, xpos : Int32, ypos : Int32)

Move a given window to an absolute position

Source
set_widget_dimension(parent_dim : Int32, proposed_dim : Int32, adjustment : Int32) : Int32

If the dimension is a negative value, the dimension will be the full height/width of the parent window minus the absolute value. Otherwise, the dimension will be the given value.

Source
style(name : String, definition : String)
Source
styles
Source
subwin(parent : NCurses::Window, height : Int32, width : Int32, y : Int32, x : Int32) : NCurses::Window

Create a subwindow

Source

Nested types