Struct pancurses::Window
[−]
[src]
pub struct Window { // some fields omitted }
Methods
impl Window
[src]
fn addch<T: ToChtype>(&self, ch: T) -> i32
fn addstr(&self, string: &str) -> i32
fn attron(&self, attributes: chtype) -> i32
fn attrset(&self, attributes: chtype) -> i32
Sets the current attributes of the given window to attributes.
fn bkgd(&self, ch: chtype) -> i32
Not only change the background, but apply it immediately to every cell in the window.
fn derwin(&self, nlines: i32, ncols: i32, begy: i32, begx: i32) -> Result<Window, i32>
The same as subwin(), except that begy and begx are relative to the origin of the window rather than the screen.
There is no difference between subwindows and derived windows.
fn draw_box<T: ToChtype>(&self, verch: T, horch: T) -> i32
fn erase(&self) -> i32
Copies blanks (i.e. the background chtype) to every cell of the window.
fn get_beg_y(&self) -> i32
Get the upper-left y coordinate of this window
fn get_beg_x(&self) -> i32
fn get_beg_yx(&self) -> (i32, i32)
Get the upper-left y and x coordinates of this window
fn getch(&self) -> Option<Input>
Read a character from the terminal associated with the window.
In nodelay mode, if there is no input waiting, None is returned. In delay mode, the program will hang until the system passes text through to the program. Depending on the setting of cbreak(), this will be after one character or after the first newline. Unless noecho() has been set, the character will also be echoed into the designated window.
If keypad() is TRUE, and a function key is pressed, the token for that function key will be returned instead of the raw characters. If nodelay(win, TRUE) has been called on the window and no input is waiting, None is returned.
fn get_max_x(&self) -> i32
Return the maximum x value of this Window, in other words the number of columns.
fn get_max_y(&self) -> i32
Return the maximum y value of this Window, in other words the number of rows.
fn get_max_yx(&self) -> (i32, i32)
Return the maximum y and x value of this Window
fn keypad(&self, use_keypad: bool) -> i32
Controls whether getch() returns function/special keys as single key codes (e.g., the left arrow key as KEY_LEFT).
Per X/Open, the default for keypad mode is OFF. You'll probably want it on. With keypad mode off, if a special key is pressed, getch() does nothing or returns ERR.
fn mv(&self, y: i32, x: i32) -> i32
The cursor associated with the window is moved to the given location.
This does not move the physical cursor of the terminal until refresh() is called. The position specified is relative to the upper left corner of the window, which is (0,0).
fn mvaddch<T: ToChtype>(&self, y: i32, x: i32, ch: T) -> i32
moves the cursor to the specified position and adds ch to the specified window
fn mvaddstr(&self, y: i32, x: i32, string: &str) -> i32
Write all the characters of the string str to the given window. The functionality is similar to calling waddch() once for each character in the string.
fn mvinch(&self, y: i32, x: i32) -> chtype
Retrieves the character and attribute from the specified window position, in the form of a chtype.
fn nodelay(&self, enabled: bool) -> i32
Controls whether wgetch() is a non-blocking call. If the option is enabled, and no input is ready, wgetch() will return ERR. If disabled, wgetch() will hang until input is ready.
fn printw(&self, string: &str) -> i32
Add a string to the window at the current cursor position.
fn refresh(&self) -> i32
Copies the named window to the physical terminal screen, taking into account what is already there in order to optimize cursor movement.
This function must be called to get any output on the terminal, as other routines only manipulate data structures. Unless leaveok() has been enabled, the physical cursor of the terminal is left at the location of the window's cursor.
fn subwin(&self, nlines: i32, ncols: i32, begy: i32, begx: i32) -> Result<Window, i32>
Creates a new subwindow within a window.
The dimensions of the subwindow are nlines lines and ncols columns. The subwindow is at position (begy, begx) on the screen. This position is relative to the screen, and not to the window orig. Changes made to either window will affect both. When using this routine, you will often need to call touchwin() before calling wrefresh().
fn timeout(&self, milliseconds: i32)
Set blocking or non-blocking reads for the specified window.
The delay is measured in milliseconds. If it's negative, a blocking read is used; if zero, then non-blocking reads are done -- if no input is waiting, ERR is returned immediately. If the delay is positive, the read blocks for the delay period; if the period expires, ERR is returned.
fn ungetch(&self, input: &Input) -> i32
Places ch back onto the input queue to be returned by the next call to getch().