cursive/src/backend/mod.rs

41 lines
1.1 KiB
Rust
Raw Normal View History

use event;
use theme;
2016-10-09 23:42:55 +00:00
#[cfg(feature = "termion")]
mod termion;
2016-10-11 23:23:08 +00:00
#[cfg(feature = "bear-lib-terminal")]
mod blt;
2016-10-12 07:47:20 +00:00
#[cfg(any(feature = "ncurses", feature = "pancurses"))]
mod curses;
#[cfg(feature = "bear-lib-terminal")]
pub use self::blt::*;
2016-10-12 07:47:20 +00:00
#[cfg(any(feature = "ncurses", feature = "pancurses"))]
pub use self::curses::*;
2016-10-09 23:42:55 +00:00
#[cfg(feature = "termion")]
pub use self::termion::*;
pub trait Backend {
fn init() -> Self;
// TODO: take `self` by value?
fn finish(&mut self);
2016-10-09 22:47:06 +00:00
fn clear(&self);
fn refresh(&mut self);
fn has_colors(&self) -> bool;
fn init_color_style(&mut self, style: theme::ColorStyle,
foreground: &theme::Color, background: &theme::Color);
fn print_at(&self, (usize, usize), &str);
fn poll_event(&self) -> event::Event;
fn set_refresh_rate(&mut self, fps: u32);
fn screen_size(&self) -> (usize, usize);
// TODO: unify those into a single method?
fn with_color<F: FnOnce()>(&self, color: theme::ColorStyle, f: F);
fn with_effect<F: FnOnce()>(&self, effect: theme::Effect, f: F);
}