Struct pancurses_result::Curses
source · pub struct Curses { /* private fields */ }
Expand description
The curses instance. To initialize the curses instance, call initscr
.
Implementations
sourceimpl Curses
impl Curses
sourcepub fn window_mut(&mut self) -> &mut Window
pub fn window_mut(&mut self) -> &mut Window
Get a mutable reference to the main Window
of the cursees instance.
sourcepub fn output_rate(&self) -> BitsPerSecond
pub fn output_rate(&self) -> BitsPerSecond
Get the output rate of the terminal in bits per second.
sourcepub fn has_colors(&self) -> bool
pub fn has_colors(&self) -> bool
Check if the terminal has support for colors.
sourcepub fn start_color(&mut self) -> Result<&mut Color, ()>
pub fn start_color(&mut self) -> Result<&mut Color, ()>
Start the color subsystem
sourcepub fn enable_cbreak(&mut self) -> Result<(), ()>
pub fn enable_cbreak(&mut self) -> Result<(), ()>
Enable cbreak mode, causing input to immediately be ready for
read
after it is typed.
This overrides raw
.
sourcepub fn disable_cbreak(&mut self) -> Result<(), ()>
pub fn disable_cbreak(&mut self) -> Result<(), ()>
Disable cbreak mode, causing input to be buffered after it is typed until a newline or carriage return.
This overrides raw
.
sourcepub fn set_cursor_visibility(
&mut self,
visibility: CursorVisibility
) -> Result<(), ()>
pub fn set_cursor_visibility(
&mut self,
visibility: CursorVisibility
) -> Result<(), ()>
Set the visibility of the cursor.
sourcepub fn define_program_mode(&mut self) -> Result<(), ()>
pub fn define_program_mode(&mut self) -> Result<(), ()>
Save the current terminal state as program mode (in curses).
This is done automatically by initscr
.
sourcepub fn define_shell_mode(&mut self) -> Result<(), ()>
pub fn define_shell_mode(&mut self) -> Result<(), ()>
Save the current terminal state as shell mode (not in curses).
This is done automatically by initscr
.
sourcepub fn delay_output(&mut self, time: Milliseconds) -> Result<(), ()>
pub fn delay_output(&mut self, time: Milliseconds) -> Result<(), ()>
Insert a millisecond pause in output. Don’t use this extensively.
sourcepub fn update(&mut self) -> Result<(), ()>
pub fn update(&mut self) -> Result<(), ()>
Push updates from the virtual screen to the physical screen.
This is the corollary of doupdate
.
sourcepub fn enable_echo(&mut self) -> Result<(), ()>
pub fn enable_echo(&mut self) -> Result<(), ()>
Characters typed by the user are written to the screen as they are typed.
sourcepub fn disable_echo(&mut self) -> Result<(), ()>
pub fn disable_echo(&mut self) -> Result<(), ()>
Characters typed by the user are interpretted by the program and not echoed to the screen.
sourcepub fn end_window(self) -> Result<(), ()>
pub fn end_window(self) -> Result<(), ()>
Dispose of this window.
This allows for the user to deal with error conditions instead
of Result::unwrap
being called.
This is the corollary of endwin
.
sourcepub fn flash(&mut self) -> Result<(), ()>
pub fn flash(&mut self) -> Result<(), ()>
Flash the terminal screen. If not possible, an alert is sounded.
Returns Ok
if flashing succeeds, and Err
otherwise.
sourcepub fn key_name(&self, key_code: i32) -> Option<String>
pub fn key_name(&self, key_code: i32) -> Option<String>
Get a string representing a key code.
This is the corollary of keyname
.
sourcepub fn mouse_read(&self) -> Result<MEVENT, ()>
pub fn mouse_read(&self) -> Result<MEVENT, ()>
Get the status of the mouse.
This is the corollary of getmouse
.
sourcepub fn mouse_interval(&self) -> Milliseconds
pub fn mouse_interval(&self) -> Milliseconds
Get the maximum time between press and release events for it to be recognized as a click.
This is the corollary of mouseinterval(-1)
.
sourcepub fn set_mouse_interval(&mut self, interval: Milliseconds) -> Result<(), ()>
pub fn set_mouse_interval(&mut self, interval: Milliseconds) -> Result<(), ()>
Set the maximum time between press and release events for it to be recognized as a click.
As of right now this will always succeed, but it is possible this behavior will change in the future.
This is the corollary of mouseinterval
.
sourcepub fn set_mouse_mask(
&mut self,
mask: mmask_t,
old_mask: Option<&mut mmask_t>
) -> Result<mmask_t, ()>
pub fn set_mouse_mask(
&mut self,
mask: mmask_t,
old_mask: Option<&mut mmask_t>
) -> Result<mmask_t, ()>
Set the mouse events to be reported.
Returns the masks that were applied.
As of right now this will always succeed, but it is possible this behavior will change in the future.
If mask == 0
then the mouse pointer may be turned off.
This is the corollary of mousemask
.
sourcepub fn suspend_milliseconds(&mut self, duration: Milliseconds) -> Result<(), ()>
pub fn suspend_milliseconds(&mut self, duration: Milliseconds) -> Result<(), ()>
Sleep for a certain number of milliseconds.
This is the corollary of napms
.
sourcepub fn enable_new_line_translations(&mut self) -> Result<(), ()>
pub fn enable_new_line_translations(&mut self) -> Result<(), ()>
Enable new line translations.
When enabled, the return key is translated into newline on input and return and line-feed on output.
This is enabled by default. Disabling this can cause curses
to make better use of the line-feed capability, will have
faster cursor motion, and will detect the return key (see
Input::KeyEnter
).
This is the corollary of nl
.
sourcepub fn disable_new_line_translations(&mut self) -> Result<(), ()>
pub fn disable_new_line_translations(&mut self) -> Result<(), ()>
sourcepub fn enable_raw_input_mode(&mut self) -> Result<(), ()>
pub fn enable_raw_input_mode(&mut self) -> Result<(), ()>
Enable raw input mode. Characters are immediately passed through to the user program and no signals are generated.
This is similar to cbreak mode (see enable_cbreak
).
This is the corollary of raw
.
sourcepub fn disable_raw_input_mode(&mut self) -> Result<(), ()>
pub fn disable_raw_input_mode(&mut self) -> Result<(), ()>
Disable raw input mode.
For discussion of how raw mode works, see enable_raw_input_mode
.
This is the corollary of noraw
.
sourcepub fn restore_program_mode(&mut self) -> Result<(), ()>
pub fn restore_program_mode(&mut self) -> Result<(), ()>
Restore the terminal to program mode (in curses).
This is the corollary of reset_prog_mode
.
sourcepub fn restore_shell_mode(&mut self) -> Result<(), ()>
pub fn restore_shell_mode(&mut self) -> Result<(), ()>
Restore the terminal to program mode (not in curses).
This is the corollary of reset_shell_mode
.
sourcepub fn resize_terminal(&mut self, rows: i32, columns: i32) -> Result<(), ()>
pub fn resize_terminal(&mut self, rows: i32, columns: i32) -> Result<(), ()>
Attempt to resize the terminal.
This is the corollary of resize_term
.
sourcepub fn enable_force_blink(&mut self) -> Result<(), ()>
pub fn enable_force_blink(&mut self) -> Result<(), ()>
Force the screen to actually blink instead of setting a high intensity background.
This is only supported on Windows.
This is the corollary of set_blink(true)
sourcepub fn disable_force_blink(&mut self) -> Result<(), ()>
pub fn disable_force_blink(&mut self) -> Result<(), ()>
Allow the terminal to either actually blink or set a high
intensity background when blink
is called.
This is the corollary of set_blink(false)