use std::cell::Cell;
use newt_sys::*;
use crate::component::Component;
use crate::private::funcs::*;
#[derive(Component)]
pub struct Scale {
co: Cell<newtComponent>,
added_to_parent: Cell<bool>
}
impl Scale {
pub fn new(left: i32, top: i32, width: i32, maximum: i64) -> Scale {
unsafe {
let co = newtScale(left, top, width, maximum);
if co.is_null() {
malloc_failure();
}
Scale {
co: Cell::new(co),
added_to_parent: Cell::new(false)
}
}
}
pub fn set(&self, amount: u64) {
unsafe { newtScaleSet(self.co(), amount); }
}
pub fn set_colors(&self, empty: i32, full: i32) {
unsafe { newtScaleSetColors(self.co(), empty, full); }
}
}