1 // This file was generated by gir (https://github.com/gtk-rs/gir) 2 // from gir-files (https://github.com/gtk-rs/gir-files) 3 // DO NOT EDIT 4 5 use crate::Window; 6 use glib::translate::*; 7 use std::fmt; 8 9 glib::wrapper! { 10 #[doc(alias = "GdkDrawingContext")] 11 pub struct DrawingContext(Object<ffi::GdkDrawingContext, ffi::GdkDrawingContextClass>); 12 13 match fn { 14 type_ => || ffi::gdk_drawing_context_get_type(), 15 } 16 } 17 18 impl DrawingContext { 19 #[doc(alias = "gdk_drawing_context_get_cairo_context")] 20 #[doc(alias = "get_cairo_context")] cairo_context(&self) -> Option<cairo::Context>21 pub fn cairo_context(&self) -> Option<cairo::Context> { 22 unsafe { 23 from_glib_none(ffi::gdk_drawing_context_get_cairo_context( 24 self.to_glib_none().0, 25 )) 26 } 27 } 28 29 #[doc(alias = "gdk_drawing_context_get_clip")] 30 #[doc(alias = "get_clip")] clip(&self) -> Option<cairo::Region>31 pub fn clip(&self) -> Option<cairo::Region> { 32 unsafe { from_glib_full(ffi::gdk_drawing_context_get_clip(self.to_glib_none().0)) } 33 } 34 35 #[doc(alias = "gdk_drawing_context_get_window")] 36 #[doc(alias = "get_window")] window(&self) -> Option<Window>37 pub fn window(&self) -> Option<Window> { 38 unsafe { from_glib_none(ffi::gdk_drawing_context_get_window(self.to_glib_none().0)) } 39 } 40 41 #[doc(alias = "gdk_drawing_context_is_valid")] is_valid(&self) -> bool42 pub fn is_valid(&self) -> bool { 43 unsafe { from_glib(ffi::gdk_drawing_context_is_valid(self.to_glib_none().0)) } 44 } 45 } 46 47 impl fmt::Display for DrawingContext { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result48 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 49 f.write_str("DrawingContext") 50 } 51 } 52