class NCurses::Window
- NCurses::Window
- Reference
- Object
Defined in:
ncurses.crncurses/window.cr
Constructors
- .new(window : LibNCurses::Window)
-
.new(height = nil, width = nil, y = 0, x = 0)
Create a new window with given size
Instance Method Summary
-
#add_char(chr, pos_y, pos_x)
Alias for
#add_char
-
#add_char(chr, position = nil)
Draw a character
-
#attr_get
Get the current attributes and color pair as a named tuple with attr and color
-
#attr_off(attr : Attribute)
Turn off attribute(s)
-
#attr_on(attr : Attribute)
Turn on attribute(s)
-
#attribute_off(attr : Attribute)
Alias for
#attr_off
-
#attribute_on(attr : Attribute)
Alias for
#attr_on
-
#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
-
#border(ver : Char = BORDER_DEFAULT, hor : Char = BORDER_DEFAULT, cor : Char | Nil = nil)
Alias for
#border
-
#box(ver : Char = BORDER_DEFAULT, hor : Char = BORDER_DEFAULT)
Alias for
#border
-
#change_attribute(attr : Attribute = Attribute::Normal, color_pair = 0, length = -1, y = nil, x = nil)
attr is the
Attribute
enum. -
#change_background(char)
Change the background
-
#clear
Clear window, also causes repaint
-
#clear_to_bot
Clear window from cursor to the rest of the whole window
-
#clear_to_eol
Clear window from cursor position to the end of the current line
-
#clearok(v : Bool = true)
Wrapper for
#clearok()
-
#col
Alias for
#x
-
#cols
Alias for
#max_x
-
#delete_window
Delete the window
-
#draw_hline(length : Int)
Alias for
#draw_hline
-
#draw_hline(char = nil, length = nil)
Draw a horizontal line
-
#draw_vline(height : Int)
Alias for
#draw_vline
-
#draw_vline(char = nil, height = nil)
Draw a vertical line
-
#enclose?(y, x) : Bool
If a mouse position is in this window
- #enclose?(yx : NamedTuple) : Bool
-
#enclose?(mouse_event : MouseEvent) : Bool
If a mouse event took place within this window
- #enclose?(yx) : Bool
-
#erase
Clear window
-
#get_attribute
Alias for
#attr_get
-
#get_background
Get the character and attributes from the current background
-
#get_char : Key | Char | Nil
Get a character input
-
#get_char(&)
Get a character input for main loop
-
#height
Alias for
#max_y
-
#idcok(v : Bool = true)
Wrapper for
#idcok()
-
#idlok(v : Bool = true)
Wrapper for
#idlok()
-
#immedok(v : Bool = true)
Wrapper for
#immedok()
-
#keypad(enable)
Enable or disable capturing function keys
-
#leaveok(v : Bool = true)
Wrapper for
#leaveok()
-
#lines
Alias for
#max_y
-
#max_dimensions
Max height and width as tuple (y,x)
-
#max_dimensions_named
Max height and width as named tuple
-
#max_x
Return width
-
#max_y
Return height
-
#move(y, x)
Move cursor to new position
-
#move(new_pos : Tuple)
Alias for
#move
-
#move(new_pos : NamedTuple)
Alias for '#move'
-
#move_window(y, x)
Move window relative to whole screen
-
#no_border
Erase around the edge of a window
- #no_box
-
#no_delay
Do not wait for input, return ERR
-
#no_timeout
Wait for input, no errors should be returned
- #non_relative(event : MouseEvent) : MouseEvent
-
#pos
Cursor current position as tuple (y,x)
-
#pos_named
Cursor current position as named tuple
-
#position
Alias for
#pos
-
#position_named
Alias for
#pos_named
-
#print(message, pos_y, pos_x)
Alias for
#print
-
#print(message, row : Int)
Alias for
#print
-
#print(message, position = nil)
Write a string
-
#refresh
Refresh window
-
#relative(event : MouseEvent) : MouseEvent
Returns a new
MouseEvent
with coordinates relative to the window -
#row
Alias for
#y
-
#scrollok(v : Bool = true)
Wrapper for
#scrollok()
-
#set_attr(attr : Attribute = Attribute::Normal, color_pair = 0)
Replace attribute(s) and color with these
-
#set_attribute(attr : Attribute = Attribute::Normal, color_pair = 0)
Alias for
#set_attr
-
#set_background(char)
Sets a new background and applies it everywhere
-
#set_color(color_pair = 0)
Set this window's default color pair
-
#set_pos(y, x)
Alias for
#move
-
#set_pos(new_pos : Tuple)
Alias for
#move
-
#set_pos(new_pos : NamedTuple)
Alias for '#move'
-
#setscrreg(top, bot)
Wrapper for
wsetscrreg()
&#setscrreg()
-
#timeout=(value)
Set input timeout
- #to_unsafe : LibNCurses::Window
-
#width
Alias for
#max_x
-
#with_attr(attrs : Attribute, &)
Block with attribute(s) turned on
-
#with_attribute(attrs : Attribute, &)
Alias for
#with_attr
-
#x
Returns cursor current x position
-
#y
Returns cursor current y position
Constructor Detail
Create a new window with given size
Wrapper for newwin()
Instance Method Detail
Draw a character
Wrapper for waddch()
and mvwaddch()
(addch()
and mvaddch()
)
Get the current attributes and color pair as a named tuple with attr and color
Wrapper for wattr_get()
(#attr_get()
)
Turn off attribute(s)
Wrapper for wattr_off()
(#attr_off()
)
Turn on attribute(s)
Wrapper for wattr_on()
(#attr_on()
)
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
Alias for #border
Uses hor for horizontal lines, ver for vertical lines, and cor for corners
Alias for #border
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()
)
Clear window from cursor to the rest of the whole window
Wrapper for wclrtobot()
(clrtoeol()
)
Clear window from cursor position to the end of the current line
Wrapper for wclrtoeol()
(clrtoeol()
)
Draw a horizontal line
Default char is -
and default length is #width
Write a string
Wrapper for wprintw()
and mvwprintw()
(printw()
and mvprintw()
)
Returns a new MouseEvent
with coordinates relative to the window
To convert back user #non_relative
Replace attribute(s) and color with these
Wrapper for wattr_set()
(attr_set()
)
Alias for #set_attr
Set this window's default color pair
Wrapper for wcolor_set()
(color_set()
)