gdk4/auto/
draw_context.rs1#![allow(deprecated)]
5
6use crate::{ffi, Display, Surface};
7use glib::{prelude::*, translate::*};
8
9glib::wrapper! {
10 #[doc(alias = "GdkDrawContext")]
11 pub struct DrawContext(Object<ffi::GdkDrawContext>);
12
13 match fn {
14 type_ => || ffi::gdk_draw_context_get_type(),
15 }
16}
17
18impl DrawContext {
19 pub const NONE: Option<&'static DrawContext> = None;
20}
21
22pub trait DrawContextExt: IsA<DrawContext> + 'static {
23 #[cfg_attr(feature = "v4_16", deprecated = "Since 4.16")]
24 #[allow(deprecated)]
25 #[doc(alias = "gdk_draw_context_begin_frame")]
26 fn begin_frame(&self, region: &cairo::Region) {
27 unsafe {
28 ffi::gdk_draw_context_begin_frame(
29 self.as_ref().to_glib_none().0,
30 region.to_glib_none().0,
31 );
32 }
33 }
34
35 #[cfg_attr(feature = "v4_16", deprecated = "Since 4.16")]
36 #[allow(deprecated)]
37 #[doc(alias = "gdk_draw_context_end_frame")]
38 fn end_frame(&self) {
39 unsafe {
40 ffi::gdk_draw_context_end_frame(self.as_ref().to_glib_none().0);
41 }
42 }
43
44 #[doc(alias = "gdk_draw_context_get_display")]
45 #[doc(alias = "get_display")]
46 fn display(&self) -> Option<Display> {
47 unsafe {
48 from_glib_none(ffi::gdk_draw_context_get_display(
49 self.as_ref().to_glib_none().0,
50 ))
51 }
52 }
53
54 #[doc(alias = "gdk_draw_context_get_surface")]
55 #[doc(alias = "get_surface")]
56 fn surface(&self) -> Option<Surface> {
57 unsafe {
58 from_glib_none(ffi::gdk_draw_context_get_surface(
59 self.as_ref().to_glib_none().0,
60 ))
61 }
62 }
63
64 #[cfg_attr(feature = "v4_16", deprecated = "Since 4.16")]
65 #[allow(deprecated)]
66 #[doc(alias = "gdk_draw_context_is_in_frame")]
67 fn is_in_frame(&self) -> bool {
68 unsafe {
69 from_glib(ffi::gdk_draw_context_is_in_frame(
70 self.as_ref().to_glib_none().0,
71 ))
72 }
73 }
74}
75
76impl<O: IsA<DrawContext>> DrawContextExt for O {}