use {
crate::{sys, DocumentRef},
std::marker::PhantomData,
};
#[derive(Debug)]
pub struct PageRef<'a> {
ptr: *mut sys::zathura_page_t,
_p: PhantomData<&'a mut ()>,
}
impl PageRef<'_> {
pub unsafe fn from_raw(ptr: *mut sys::zathura_page_t) -> Self {
Self {
ptr,
_p: PhantomData,
}
}
pub fn document<'a>(&'a mut self) -> DocumentRef<'a> {
unsafe { DocumentRef::from_raw(sys::zathura_page_get_document(self.ptr)) }
}
pub fn index(&self) -> usize {
unsafe { sys::zathura_page_get_index(self.ptr) as usize }
}
pub fn width(&self) -> f64 {
unsafe { sys::zathura_page_get_width(self.ptr) }
}
pub fn set_width(&mut self, width: f64) {
unsafe { sys::zathura_page_set_width(self.ptr, width) }
}
pub fn height(&self) -> f64 {
unsafe { sys::zathura_page_get_height(self.ptr) }
}
pub fn set_height(&mut self, height: f64) {
unsafe { sys::zathura_page_set_height(self.ptr, height) }
}
pub fn plugin_data(&self) -> *mut () {
unsafe { sys::zathura_page_get_data(self.ptr) as *mut () }
}
pub unsafe fn set_plugin_data(&mut self, data: *mut ()) {
sys::zathura_page_set_data(self.ptr, data as *mut _)
}
}