class NCurses::Window

Defined in:

ncurses.cr
ncurses/window.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(window : LibNCurses::Window) #

[View source]
def self.new(height = nil, width = nil, y = 0, x = 0) #

Create a new window with given size

Wrapper for newwin()


[View source]

Instance Method Detail

def add_char(chr, pos_y, pos_x) #

Alias for #add_char


[View source]
def add_char(chr, position = nil) #

Draw a character

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


[View source]
def attr_get #

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

Wrapper for wattr_get() (#attr_get())


[View source]
def attr_off(attr : Attribute) #

Turn off attribute(s)

Wrapper for wattr_off() (#attr_off())


[View source]
def attr_on(attr : Attribute) #

Turn on attribute(s)

Wrapper for wattr_on() (#attr_on())


[View source]
def attribute_off(attr : Attribute) #

Alias for #attr_off


[View source]
def attribute_on(attr : Attribute) #

Alias for #attr_on


[View source]
def 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


[View source]
def border(ver : Char = BORDER_DEFAULT, hor : Char = BORDER_DEFAULT, cor : Char? = nil) #

Alias for #border

Uses hor for horizontal lines, ver for vertical lines, and cor for corners


[View source]
def box(ver : Char = BORDER_DEFAULT, hor : Char = BORDER_DEFAULT) #

[View source]
def 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())


[View source]
def change_background(char) #

Change the background


[View source]
def clear #

Clear window, also causes repaint

Wrapper for wclear() (#clear())


[View source]
def clear_to_bot #

Clear window from cursor to the rest of the whole window

Wrapper for wclrtobot() (clrtoeol())


[View source]
def clear_to_eol #

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

Wrapper for wclrtoeol() (clrtoeol())


[View source]
def clearok(v : Bool = true) #

Wrapper for #clearok()


[View source]
def col #

Alias for #x


[View source]
def cols #

Alias for #max_x


[View source]
def delete_window #

Delete the window

Wrapper for delwin()


[View source]
def draw_hline(char = nil, length = nil) #

Draw a horizontal line

Default char is - and default length is #width


[View source]
def draw_hline(length : Int) #

Alias for #draw_hline


[View source]
def draw_vline(char = nil, height = nil) #

Draw a vertical line


[View source]
def draw_vline(height : Int) #

Alias for #draw_vline


[View source]
def enclose?(yx : NamedTuple) : Bool #

[View source]
def enclose?(yx) : Bool #

[View source]
def enclose?(y, x) : Bool #

If a mouse position is in this window

Wrapper for wenclose()


[View source]
def enclose?(mouse_event : MouseEvent) : Bool #

If a mouse event took place within this window


[View source]
def erase #

Clear window

Wrapper for werase() (#erase())


[View source]
def get_attribute #

Alias for #attr_get


[View source]
def get_background #

Get the character and attributes from the current background


[View source]
def get_char(&) #

Get a character input for main loop


[View source]
def get_char : Key | Char | Nil #

Get a character input

Returned as Key if recognised, Char otherwise

Wrapper for wgetch() (getch())


[View source]
def height #

Alias for #max_y


[View source]
def idcok(v : Bool = true) #

Wrapper for #idcok()


[View source]
def idlok(v : Bool = true) #

Wrapper for #idlok()


[View source]
def immedok(v : Bool = true) #

Wrapper for #immedok()


[View source]
def keypad(enable) #

Enable or disable capturing function keys


[View source]
def leaveok(v : Bool = true) #

Wrapper for #leaveok()


[View source]
def lines #

Alias for #max_y


[View source]
def max_dimensions #

Max height and width as tuple (y,x)


[View source]
def max_dimensions_named #

Max height and width as named tuple


[View source]
def max_x #

Return width

Wrapper for getmaxx()


[View source]
def max_y #

Return height

Wrapper for getmaxy()


[View source]
def move(new_pos : NamedTuple) #

Alias for '#move'


[View source]
def move(y, x) #

Move cursor to new position

Wrapper for wmove() (#move())


[View source]
def move(new_pos : Tuple) #

Alias for #move


[View source]
def move_window(y, x) #

Move window relative to whole screen

TODO Tuple version

Wrapper for mvwin()


[View source]
def no_border #

Erase around the edge of a window


[View source]
def no_box #

[View source]
def no_delay #

Do not wait for input, return ERR

Wrapper for nodelay()


[View source]
def no_timeout #

Wait for input, no errors should be returned

Wrapper for notimeout()


[View source]
def non_relative(event : MouseEvent) : MouseEvent #

[View source]
def pos #

Cursor current position as tuple (y,x)

Simulates ncurses macro getyx


[View source]
def pos_named #

Cursor current position as named tuple


[View source]
def position #

Alias for #pos


[View source]
def position_named #

Alias for #pos_named


[View source]
def print(message, position = nil) #

Write a string

Wrapper for wprintw() and mvwprintw() (printw() and mvprintw())


[View source]
def print(message, row : Int) #

Alias for #print


[View source]
def print(message, pos_y, pos_x) #

Alias for #print


[View source]
def refresh #

Refresh window

Wrapper for wrefresh() (#refresh())


[View source]
def relative(event : MouseEvent) : MouseEvent #

Returns a new MouseEvent with coordinates relative to the window

To convert back user #non_relative


[View source]
def row #

Alias for #y


[View source]
def scrollok(v : Bool = true) #

Wrapper for #scrollok()


[View source]
def set_attr(attr : Attribute = Attribute::Normal, color_pair = 0) #

Replace attribute(s) and color with these

Wrapper for wattr_set() (attr_set())


[View source]
def set_attribute(attr : Attribute = Attribute::Normal, color_pair = 0) #

Alias for #set_attr


[View source]
def set_background(char) #

Sets a new background and applies it everywhere


[View source]
def set_color(color_pair = 0) #

Set this window's default color pair

Wrapper for wcolor_set() (color_set())


[View source]
def set_pos(y, x) #

Alias for #move


[View source]
def set_pos(new_pos : Tuple) #

Alias for #move


[View source]
def set_pos(new_pos : NamedTuple) #

Alias for '#move'


[View source]
def setscrreg(top, bot) #

Wrapper for wsetscrreg() & #setscrreg()


[View source]
def timeout=(value) #

Set input timeout

Wrapper for wtimeout() (timeout())


[View source]
def to_unsafe : LibNCurses::Window #

[View source]
def width #

Alias for #max_x


[View source]
def with_attr(attrs : Attribute, &) #

Block with attribute(s) turned on


[View source]
def with_attribute(attrs : Attribute, &) #

Alias for #with_attr


[View source]
def x #

Returns cursor current x position

Wrapper for getcurx()


[View source]
def y #

Returns cursor current y position

Wrapper for getcury()


[View source]