Instance methods
add_char(chr, pos_y, pos_x)
Sourceadd_char(chr, position = nil)
Draw a character
Wrapper for waddch() and mvwaddch() (addch() and mvaddch())
Sourceattr_get
Get the current attributes and color pair
as a named tuple with attr and color
Wrapper for wattr_get() (attr_get())
Sourceattr_off(attr : Attribute)
Turn off attribute(s)
Wrapper for wattr_off() (attr_off())
Sourceattr_on(attr : Attribute)
Turn on attribute(s)
Wrapper for wattr_on() (attr_on())
Sourceattribute_off(attr : Attribute)
Sourceattribute_on(attr : Attribute)
Sourceborder(ls : Char, rs : Char, ts : Char, bs : Char, tl : Char, tr : Char, bl : Char, br : Char)
Draw a box around the edge of a window
ls - char to be used on left side
rs - char to be used on right side
ts - char to be used on top side
bs - char to be used on bottom side
tl - char to be used on top left-hand corner
tr - char to be used on top right-hand corner
bl - char to be used on bottom left-hand corner
br - char to be used on bottom right-hand corner
Sourceborder(ver : Char = BORDER_DEFAULT, hor : Char = BORDER_DEFAULT, cor : Char | Nil = nil)
Alias for #border
Uses hor for horizontal lines, ver for vertical lines, and cor for corners
Sourcebox(ver : Char = BORDER_DEFAULT, hor : Char = BORDER_DEFAULT)
Alias for #border
Same as #border(ver, hor, BORDER_DEFAULT)
Sourcechange_attribute(attr : Attribute = Attribute::Normal, color_pair = 0, length = -1, y = nil, x = nil)
attr is the Attribute enum.
color_pair is the color pair number (0 is the default white on black.)
length defaults to -1, but represents the number of characters to change, up to EOL.
If y and x are set, the cursor location is moved before changing attributes.
Wrapper for wchgat() and mvwchgat() (chgat() and mvchgat())
Sourceclear
Clear window, also causes repaint
Wrapper for wclear() (clear())
Sourceclear_to_bot
Clear window from cursor to the rest of the whole window
Wrapper for wclrtobot() (clrtoeol())
Sourceclear_to_eol
Clear window from cursor position to the end of the current line
Wrapper for wclrtoeol() (clrtoeol())
Sourceclearok(v : Bool = true)
Sourcedelete_window
Delete the window
Wrapper for delwin()
Sourcedraw_hline(length : Int)
Sourcedraw_hline(char = nil, length = nil)
Draw a horizontal line
Default char is - and default length is width
Sourcedraw_vline(height : Int)
Sourcedraw_vline(char = nil, height = nil)
Sourceenclose?(y, x) : Bool
If a mouse position is in this window
Wrapper for wenclose()
Sourceenclose?(yx : NamedTuple) : Bool
Sourceenclose?(mouse_event : MouseEvent) : Bool
If a mouse event took place within this window
Sourceerase
Clear window
Wrapper for werase() (erase())
Sourceget_background
Get the character and attributes from the current background
Sourceget_char
Get a character input
Returned as Key if recognised, Char otherwise
Wrapper for wgetch() (getch())
Sourceget_char
Get a character input for main loop
Sourceimmedok(v : Bool = true)
Sourcekeypad(enable)
Enable or disable capturing function keys
Sourceleaveok(v : Bool = true)
Sourcemax_dimensions
Max height and width as tuple (y,x)
Sourcemax_dimensions_named
Max height and width as named tuple
Sourcemax_x
Return width
Wrapper for getmaxx()
Sourcemax_y
Return height
Wrapper for getmaxy()
Sourcemove(y, x)
Move cursor to new position
Wrapper for wmove() (move())
Sourcemove(new_pos : NamedTuple)
Sourcemove_window(y, x)
Move window relative to whole screen
TODO: Tuple version
Wrapper for mvwin()
Sourceno_border
Erase around the edge of a window
Sourceno_delay
Do not wait for input, return ERR
Wrapper for nodelay()
Sourceno_timeout
Wait for input, no errors should be returned
Wrapper for notimeout()
Sourcenon_relative(event : MouseEvent) : MouseEvent
Sourcepos
Cursor current position as tuple (y,x)
Simulates ncurses macro getyx
Sourcepos_named
Cursor current position as named tuple
Sourceprint(message, pos_y, pos_x)
Sourceprint(message, row : Int)
Sourceprint(message, position = nil)
Write a string
Wrapper for wprintw() and mvwprintw() (printw() and mvprintw())
Sourcerefresh
Refresh window
Wrapper for wrefresh() (refresh())
Sourcerelative(event : MouseEvent) : MouseEvent
Returns a new MouseEvent with coordinates relative to the window
To convert back user #non_relative
Sourceset_attr(attr : Attribute = Attribute::Normal, color_pair = 0)
Replace attribute(s) and color with these
Wrapper for wattr_set() (attr_set())
Sourceset_attribute(attr : Attribute = Attribute::Normal, color_pair = 0)
Sourceset_background(char)
Sets a new background and applies it everywhere
Sourceset_color(color_pair = 0)
Set this window's default color pair
Wrapper for wcolor_set() (color_set())
Sourceset_pos(new_pos : Tuple)
Sourceset_pos(new_pos : NamedTuple)
Sourcesetscrreg(top, bot)
Wrapper for wsetscrreg() & setscrreg()
Sourcetimeout=(value)
Set input timeout
Wrapper for wtimeout() (timeout())
Sourcewith_attr(attrs : Attribute, &)
Block with attribute(s) turned on
Sourcewith_attribute(attrs : Attribute, &)
Sourcex
Returns cursor current x position
Wrapper for getcurx()
Sourcey
Returns cursor current y position
Wrapper for getcury()
Source