use std::cell::Cell;
use newt_sys::*;
use crate::component::Component;
use crate::private::funcs::*;
#[derive(Component)]
pub struct VerticalScrollbar {
co: Cell<newtComponent>,
added_to_parent: Cell<bool>
}
impl VerticalScrollbar {
pub fn new(left: i32, top: i32, height: i32, normal_colorset: i32,
thumb_colorset: i32) -> VerticalScrollbar
{
unsafe {
let co = newtVerticalScrollbar(
left,
top,
height,
normal_colorset,
thumb_colorset
);
if co.is_null() {
malloc_failure();
}
VerticalScrollbar {
co: Cell::new(co),
added_to_parent: Cell::new(false)
}
}
}
pub fn set(&self, where_: i32, total: i32) {
unsafe {
newtScrollbarSet(self.co(), where_, total);
}
}
pub fn set_colors(&self, normal: i32, thumb: i32) {
unsafe {
newtScrollbarSetColors(self.co(), normal, thumb);
}
}
}