gsk4/
shadow_node.rs

1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use glib::translate::*;
4
5use crate::{ffi, RenderNodeType, Shadow, ShadowNode};
6
7define_render_node!(ShadowNode, ffi::GskShadowNode, RenderNodeType::ShadowNode);
8
9impl ShadowNode {
10    /// Retrieves the shadow data at the given index @i.
11    /// ## `i`
12    /// the given index
13    ///
14    /// # Returns
15    ///
16    /// the shadow data
17    #[doc(alias = "gsk_shadow_node_get_shadow")]
18    #[doc(alias = "get_shadow")]
19    pub fn shadow(&self, i: usize) -> Shadow {
20        assert!(i < self.n_shadows());
21        unsafe { from_glib_none(ffi::gsk_shadow_node_get_shadow(self.to_glib_none().0, i)) }
22    }
23}
24
25impl std::fmt::Debug for ShadowNode {
26    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
27        f.debug_struct("ShadowNode")
28            .field("n_shadows", &self.n_shadows())
29            .field("child", &self.child())
30            .finish()
31    }
32}