cursive/src/backend/dummy.rs
Alexandre Bury 6135b0df79 Refactor input system
* Moves from chan to crossbeam-channel
* Moves from chan_signal to signal-hook
2018-07-08 12:49:12 -07:00

53 lines
1.0 KiB
Rust

//! Dummy backend
use backend;
use event;
use theme;
use vec::Vec2;
use crossbeam_channel::{Sender};
pub struct Backend;
impl Backend {
pub fn init() -> Box<backend::Backend>
where
Self: Sized,
{
Box::new(Backend)
}
}
impl backend::Backend for Backend {
fn finish(&mut self) {}
fn refresh(&mut self) {}
fn has_colors(&self) -> bool {
false
}
fn screen_size(&self) -> Vec2 {
(1, 1).into()
}
fn prepare_input(
&mut self, event_sink: &Sender<Option<event::Event>>,
_input_request: backend::InputRequest,
) {
event_sink.send(Some(event::Event::Exit))
}
fn print_at(&self, _: Vec2, _: &str) {}
fn clear(&self, _: theme::Color) {}
// This sets the Colours and returns the previous colours
// to allow you to set them back when you're done.
fn set_color(&self, colors: theme::ColorPair) -> theme::ColorPair {
colors
}
fn set_effect(&self, _: theme::Effect) {}
fn unset_effect(&self, _: theme::Effect) {}
}