// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use cairo; use glib::translate::*; use gtk_sys; use pango; use std::fmt; use std::mem; use PageSetup; glib_wrapper! { pub struct PrintContext(Object); match fn { get_type => || gtk_sys::gtk_print_context_get_type(), } } impl PrintContext { pub fn create_pango_context(&self) -> Option { unsafe { from_glib_full(gtk_sys::gtk_print_context_create_pango_context( self.to_glib_none().0, )) } } pub fn create_pango_layout(&self) -> Option { unsafe { from_glib_full(gtk_sys::gtk_print_context_create_pango_layout( self.to_glib_none().0, )) } } pub fn get_cairo_context(&self) -> Option { unsafe { from_glib_none(gtk_sys::gtk_print_context_get_cairo_context( self.to_glib_none().0, )) } } pub fn get_dpi_x(&self) -> f64 { unsafe { gtk_sys::gtk_print_context_get_dpi_x(self.to_glib_none().0) } } pub fn get_dpi_y(&self) -> f64 { unsafe { gtk_sys::gtk_print_context_get_dpi_y(self.to_glib_none().0) } } pub fn get_hard_margins(&self) -> Option<(f64, f64, f64, f64)> { unsafe { let mut top = mem::MaybeUninit::uninit(); let mut bottom = mem::MaybeUninit::uninit(); let mut left = mem::MaybeUninit::uninit(); let mut right = mem::MaybeUninit::uninit(); let ret = from_glib(gtk_sys::gtk_print_context_get_hard_margins( self.to_glib_none().0, top.as_mut_ptr(), bottom.as_mut_ptr(), left.as_mut_ptr(), right.as_mut_ptr(), )); let top = top.assume_init(); let bottom = bottom.assume_init(); let left = left.assume_init(); let right = right.assume_init(); if ret { Some((top, bottom, left, right)) } else { None } } } pub fn get_height(&self) -> f64 { unsafe { gtk_sys::gtk_print_context_get_height(self.to_glib_none().0) } } pub fn get_page_setup(&self) -> Option { unsafe { from_glib_none(gtk_sys::gtk_print_context_get_page_setup( self.to_glib_none().0, )) } } pub fn get_pango_fontmap(&self) -> Option { unsafe { from_glib_none(gtk_sys::gtk_print_context_get_pango_fontmap( self.to_glib_none().0, )) } } pub fn get_width(&self) -> f64 { unsafe { gtk_sys::gtk_print_context_get_width(self.to_glib_none().0) } } pub fn set_cairo_context(&self, cr: &cairo::Context, dpi_x: f64, dpi_y: f64) { unsafe { gtk_sys::gtk_print_context_set_cairo_context( self.to_glib_none().0, mut_override(cr.to_glib_none().0), dpi_x, dpi_y, ); } } } impl fmt::Display for PrintContext { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "PrintContext") } }