class

NCurses::Window

Inherits Reference < Object

Constructors

new(window : LibNCurses::Window)
Source
new(height = nil, width = nil, y = 0, x = 0)

Create a new window with given size

Wrapper for newwin()

Source

Instance methods

add_char(chr, pos_y, pos_x)

Alias for #add_char

Source
add_char(chr, position = nil)

Draw a character

Wrapper for waddch() and mvwaddch() (addch() and mvaddch())

Source
attr_get

Get the current attributes and color pair as a named tuple with attr and color

Wrapper for wattr_get() (attr_get())

Source
attr_off(attr : Attribute)

Turn off attribute(s)

Wrapper for wattr_off() (attr_off())

Source
attr_on(attr : Attribute)

Turn on attribute(s)

Wrapper for wattr_on() (attr_on())

Source
attribute_off(attr : Attribute)

Alias for #attr_off

Source
attribute_on(attr : Attribute)

Alias for #attr_on

Source
border(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

Source
border(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

Source
box(ver : Char = BORDER_DEFAULT, hor : Char = BORDER_DEFAULT)

Alias for #border

Same as #border(ver, hor, BORDER_DEFAULT)

Source
change_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())

Source
change_background(char)

Change the background

Source
clear

Clear window, also causes repaint

Wrapper for wclear() (clear())

Source
clear_to_bot

Clear window from cursor to the rest of the whole window

Wrapper for wclrtobot() (clrtoeol())

Source
clear_to_eol

Clear window from cursor position to the end of the current line

Wrapper for wclrtoeol() (clrtoeol())

Source
clearok(v : Bool = true)

Wrapper for clearok()

Source
col

Alias for #x

Source
cols

Alias for #max_x

Source
delete_window

Delete the window

Wrapper for delwin()

Source
draw_hline(length : Int)

Alias for #draw_hline

Source
draw_hline(char = nil, length = nil)

Draw a horizontal line

Default char is - and default length is width

Source
draw_vline(height : Int)

Alias for #draw_vline

Source
draw_vline(char = nil, height = nil)

Draw a vertical line

Source
enclose?(y, x) : Bool

If a mouse position is in this window

Wrapper for wenclose()

Source
enclose?(yx : NamedTuple) : Bool
Source
enclose?(mouse_event : MouseEvent) : Bool

If a mouse event took place within this window

Source
enclose?(yx) : Bool
Source
erase

Clear window

Wrapper for werase() (erase())

Source
get_attribute

Alias for #attr_get

Source
get_background

Get the character and attributes from the current background

Source
get_char

Get a character input

Returned as Key if recognised, Char otherwise

Wrapper for wgetch() (getch())

Source
get_char

Get a character input for main loop

Source
height

Alias for #max_y

Source
idcok(v : Bool = true)

Wrapper for idcok()

Source
idlok(v : Bool = true)

Wrapper for idlok()

Source
immedok(v : Bool = true)

Wrapper for immedok()

Source
keypad(enable)

Enable or disable capturing function keys

Source
leaveok(v : Bool = true)

Wrapper for leaveok()

Source
lines

Alias for #max_y

Source
max_dimensions

Max height and width as tuple (y,x)

Source
max_dimensions_named

Max height and width as named tuple

Source
max_x

Return width

Wrapper for getmaxx()

Source
max_y

Return height

Wrapper for getmaxy()

Source
move(y, x)

Move cursor to new position

Wrapper for wmove() (move())

Source
move(new_pos : Tuple)

Alias for #move

Source
move(new_pos : NamedTuple)

Alias for '#move'

Source
move_window(y, x)

Move window relative to whole screen

TODO: Tuple version

Wrapper for mvwin()

Source
no_border

Erase around the edge of a window

Source
no_box
Source
no_delay

Do not wait for input, return ERR

Wrapper for nodelay()

Source
no_timeout

Wait for input, no errors should be returned

Wrapper for notimeout()

Source
non_relative(event : MouseEvent) : MouseEvent
Source
pos

Cursor current position as tuple (y,x)

Simulates ncurses macro getyx

Source
pos_named

Cursor current position as named tuple

Source
position

Alias for #pos

Source
position_named

Alias for #pos_named

Source
refresh

Refresh window

Wrapper for wrefresh() (refresh())

Source
relative(event : MouseEvent) : MouseEvent

Returns a new MouseEvent with coordinates relative to the window

To convert back user #non_relative

Source
row

Alias for #y

Source
scrollok(v : Bool = true)

Wrapper for scrollok()

Source
set_attr(attr : Attribute = Attribute::Normal, color_pair = 0)

Replace attribute(s) and color with these

Wrapper for wattr_set() (attr_set())

Source
set_attribute(attr : Attribute = Attribute::Normal, color_pair = 0)

Alias for #set_attr

Source
set_background(char)

Sets a new background and applies it everywhere

Source
set_color(color_pair = 0)

Set this window's default color pair

Wrapper for wcolor_set() (color_set())

Source
set_pos(y, x)

Alias for #move

Source
set_pos(new_pos : Tuple)

Alias for #move

Source
set_pos(new_pos : NamedTuple)

Alias for '#move'

Source
setscrreg(top, bot)

Wrapper for wsetscrreg() & setscrreg()

Source
timeout=(value)

Set input timeout

Wrapper for wtimeout() (timeout())

Source
to_unsafe
Source
width

Alias for #max_x

Source
with_attr(attrs : Attribute, &)

Block with attribute(s) turned on

Source
with_attribute(attrs : Attribute, &)

Alias for #with_attr

Source
x

Returns cursor current x position

Wrapper for getcurx()

Source
y

Returns cursor current y position

Wrapper for getcury()

Source