gsk4/auto/isolation_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::{Isolation, RenderNode, ffi};
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9 /// A render node that isolates its child from surrounding rendernodes.
10 #[doc(alias = "GskIsolationNode")]
11 pub struct IsolationNode(Shared<ffi::GskIsolationNode>);
12
13 match fn {
14 ref => |ptr| ffi::gsk_render_node_ref(ptr as *mut ffi::GskRenderNode),
15 unref => |ptr| ffi::gsk_render_node_unref(ptr as *mut ffi::GskRenderNode),
16 }
17}
18
19impl StaticType for IsolationNode {
20 fn static_type() -> glib::Type {
21 unsafe { from_glib(ffi::gsk_isolation_node_get_type()) }
22 }
23}
24
25impl IsolationNode {
26 /// ~(GSK_ISOLATION_BACKGROUND | GSK_ISOLATION_COPY_PASTE)`
27 /// will isolate everything but background and copy/paste.
28 ///
29 /// For the available isolations, see [`Isolation`][crate::Isolation].
30 /// ## `child`
31 /// The child
32 /// ## `isolations`
33 /// features to isolate
34 ///
35 /// # Returns
36 ///
37 /// A new [`RenderNode`][crate::RenderNode]
38 #[doc(alias = "gsk_isolation_node_new")]
39 pub fn new(child: impl AsRef<RenderNode>, isolations: Isolation) -> IsolationNode {
40 skip_assert_initialized!();
41 unsafe {
42 from_glib_full(ffi::gsk_isolation_node_new(
43 child.as_ref().to_glib_none().0,
44 isolations.into_glib(),
45 ))
46 }
47 }
48
49 /// Gets the child node that is getting drawn by the given @self.
50 ///
51 /// # Returns
52 ///
53 /// the child [`RenderNode`][crate::RenderNode]
54 #[doc(alias = "gsk_isolation_node_get_child")]
55 #[doc(alias = "get_child")]
56 pub fn child(&self) -> RenderNode {
57 unsafe { from_glib_none(ffi::gsk_isolation_node_get_child(self.to_glib_none().0)) }
58 }
59
60 /// Gets the isolation features that are enforced by this node.
61 ///
62 /// # Returns
63 ///
64 /// the isolation features
65 #[doc(alias = "gsk_isolation_node_get_isolations")]
66 #[doc(alias = "get_isolations")]
67 pub fn isolations(&self) -> Isolation {
68 unsafe {
69 from_glib(ffi::gsk_isolation_node_get_isolations(
70 self.to_glib_none().0,
71 ))
72 }
73 }
74}