gsk4/auto/
copy_node.rs

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
5use crate::{ffi, RenderNode};
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9    /// A render node that copies the current state of the rendering canvas
10    /// so a [`PasteNode`][crate::PasteNode] can draw it.
11    #[doc(alias = "GskCopyNode")]
12    pub struct CopyNode(Shared<ffi::GskCopyNode>);
13
14    match fn {
15        ref => |ptr| ffi::gsk_render_node_ref(ptr as *mut ffi::GskRenderNode),
16        unref => |ptr| ffi::gsk_render_node_unref(ptr as *mut ffi::GskRenderNode),
17    }
18}
19
20impl StaticType for CopyNode {
21    fn static_type() -> glib::Type {
22        unsafe { from_glib(ffi::gsk_copy_node_get_type()) }
23    }
24}
25
26impl CopyNode {
27    /// Creates a [`RenderNode`][crate::RenderNode] that copies the current rendering
28    /// canvas for playback by paste nodes that are part of the child.
29    /// ## `child`
30    /// The child
31    ///
32    /// # Returns
33    ///
34    /// A new [`RenderNode`][crate::RenderNode]
35    #[doc(alias = "gsk_copy_node_new")]
36    pub fn new(child: impl AsRef<RenderNode>) -> CopyNode {
37        skip_assert_initialized!();
38        unsafe { from_glib_full(ffi::gsk_copy_node_new(child.as_ref().to_glib_none().0)) }
39    }
40
41    /// Gets the child node that is getting drawn by the given @self.
42    ///
43    /// # Returns
44    ///
45    /// the child [`RenderNode`][crate::RenderNode]
46    #[doc(alias = "gsk_copy_node_get_child")]
47    #[doc(alias = "get_child")]
48    pub fn child(&self) -> RenderNode {
49        unsafe { from_glib_none(ffi::gsk_copy_node_get_child(self.to_glib_none().0)) }
50    }
51}