gsk4/auto/debug_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 emits a debugging message when drawing its
10 /// child node.
11 #[doc(alias = "GskDebugNode")]
12 pub struct DebugNode(Shared<ffi::GskDebugNode>);
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 DebugNode {
21 fn static_type() -> glib::Type {
22 unsafe { from_glib(ffi::gsk_debug_node_get_type()) }
23 }
24}
25
26impl DebugNode {
27 /// Creates a [`RenderNode`][crate::RenderNode] that will add debug information about
28 /// the given @child.
29 ///
30 /// Adding this node has no visual effect.
31 /// ## `child`
32 /// The child to add debug info for
33 /// ## `message`
34 /// The debug message
35 ///
36 /// # Returns
37 ///
38 /// A new [`RenderNode`][crate::RenderNode]
39 #[doc(alias = "gsk_debug_node_new")]
40 pub fn new(child: impl AsRef<RenderNode>, message: glib::GString) -> DebugNode {
41 skip_assert_initialized!();
42 unsafe {
43 from_glib_full(ffi::gsk_debug_node_new(
44 child.as_ref().to_glib_none().0,
45 message.into_glib_ptr(),
46 ))
47 }
48 }
49
50 /// Gets the child node that is getting drawn by the given @self.
51 ///
52 /// # Returns
53 ///
54 /// the child [`RenderNode`][crate::RenderNode]
55 #[doc(alias = "gsk_debug_node_get_child")]
56 #[doc(alias = "get_child")]
57 pub fn child(&self) -> RenderNode {
58 unsafe { from_glib_none(ffi::gsk_debug_node_get_child(self.to_glib_none().0)) }
59 }
60
61 /// Gets the debug message that was set on this node
62 ///
63 /// # Returns
64 ///
65 /// The debug message
66 #[doc(alias = "gsk_debug_node_get_message")]
67 #[doc(alias = "get_message")]
68 pub fn message(&self) -> glib::GString {
69 unsafe { from_glib_none(ffi::gsk_debug_node_get_message(self.to_glib_none().0)) }
70 }
71}