1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Take a look at the license at the top of the repository in the LICENSE file.

use crate::{RenderNodeType, Shadow, ShadowNode};
use glib::translate::*;

define_render_node!(ShadowNode, ffi::GskShadowNode, RenderNodeType::ShadowNode);

impl ShadowNode {
    /// Retrieves the shadow data at the given index @i.
    /// ## `i`
    /// the given index
    ///
    /// # Returns
    ///
    /// the shadow data
    #[doc(alias = "gsk_shadow_node_get_shadow")]
    #[doc(alias = "get_shadow")]
    pub fn shadow(&self, i: usize) -> Shadow {
        assert!(i < self.n_shadows());
        unsafe { from_glib_none(ffi::gsk_shadow_node_get_shadow(self.to_glib_none().0, i)) }
    }
}

impl std::fmt::Debug for ShadowNode {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        f.debug_struct("ShadowNode")
            .field("n_shadows", &self.n_shadows())
            .field("child", &self.child())
            .finish()
    }
}