use crate::event::Event;
use crate::theme;
use crate::Vec2;
use unicode_width::UnicodeWidthStr;
#[cfg(unix)]
mod resize;
pub mod dummy;
pub mod blt;
pub mod crossterm;
pub mod curses;
pub mod puppet;
pub mod termion;
pub trait Backend {
fn poll_event(&mut self) -> Option<Event>;
fn finish(&mut self);
fn refresh(&mut self);
fn has_colors(&self) -> bool;
fn screen_size(&self) -> Vec2;
fn print_at(&self, pos: Vec2, text: &str);
fn print_at_rep(&self, pos: Vec2, repetitions: usize, text: &str) {
if repetitions > 0 {
self.print_at(pos, text);
let width = text.width();
let mut pos = pos;
let mut dupes_left = repetitions - 1;
while dupes_left > 0 {
pos = pos.saturating_add((width, 0));
self.print_at(pos, text);
dupes_left -= 1;
}
}
}
fn clear(&self, color: theme::Color);
fn set_color(&self, colors: theme::ColorPair) -> theme::ColorPair;
fn set_effect(&self, effect: theme::Effect);
fn unset_effect(&self, effect: theme::Effect);
fn name(&self) -> &str {
"unknown"
}
}