use std::collections::HashMap;
use ::window::Window;
pub struct Context {
pub win: HashMap<String, Window>
}
impl Drop for Context {
fn drop(&mut self){
unsafe {
echo();
curs_set(1);
nocbreak();
endwin();
}
}
}
#[link(name="ncurses")]
extern {
fn initscr();
fn endwin();
fn refresh();
fn cbreak();
fn nocbreak();
fn curs_set(on: u64);
fn echo();
fn noecho();
}
pub fn init() -> Context {
unsafe {
initscr();
refresh();
cbreak();
noecho();
curs_set(0);
}
Context { win: HashMap::new() }
}