use ::context::Context;
pub struct Window {
height: u64,
width: u64,
x: u64,
y: u64,
pub ptr: *const u64
}
#[link(name="ncurses")]
extern {
fn newwin(lines: u64, cols: u64, x: u64, y: u64) -> *const u64;
fn delwin(ptr: *const u64);
fn wrefresh(ptr: *const u64);
}
impl Window {
pub fn create_win(name: String, height:u64, width:u64, x:u64, y:u64, context: &mut Context) {
unsafe {
let ptr = newwin(height, width, x, y);
wrefresh(ptr);
context.win.insert(name.clone(), Window { height, width, x, y, ptr} );
}
}
}
impl Drop for Window {
fn drop(&mut self) {
unsafe { delwin(self.ptr); }
}
}