#[cfg(any(feature = "v3_22", feature = "dox"))]
use cairo;
use gdk_sys;
use glib::translate::*;
use std::fmt;
#[cfg(any(feature = "v3_22", feature = "dox"))]
use Window;
glib_wrapper! {
pub struct DrawingContext(Object<gdk_sys::GdkDrawingContext, gdk_sys::GdkDrawingContextClass, DrawingContextClass>);
match fn {
get_type => || gdk_sys::gdk_drawing_context_get_type(),
}
}
impl DrawingContext {
#[cfg(any(feature = "v3_22", feature = "dox"))]
pub fn get_cairo_context(&self) -> Option<cairo::Context> {
unsafe {
from_glib_none(gdk_sys::gdk_drawing_context_get_cairo_context(
self.to_glib_none().0,
))
}
}
#[cfg(any(feature = "v3_22", feature = "dox"))]
pub fn get_clip(&self) -> Option<cairo::Region> {
unsafe { from_glib_full(gdk_sys::gdk_drawing_context_get_clip(self.to_glib_none().0)) }
}
#[cfg(any(feature = "v3_22", feature = "dox"))]
pub fn get_window(&self) -> Option<Window> {
unsafe {
from_glib_none(gdk_sys::gdk_drawing_context_get_window(
self.to_glib_none().0,
))
}
}
#[cfg(any(feature = "v3_22", feature = "dox"))]
pub fn is_valid(&self) -> bool {
unsafe { from_glib(gdk_sys::gdk_drawing_context_is_valid(self.to_glib_none().0)) }
}
}
impl fmt::Display for DrawingContext {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "DrawingContext")
}
}