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 32 33 34 35 36 37 38 39
// Take a look at the license at the top of the repository in the LICENSE file.
use crate::{ContainerNode, RenderNode, RenderNodeType};
use glib::translate::*;
define_render_node!(
ContainerNode,
ffi::GskContainerNode,
RenderNodeType::ContainerNode
);
impl ContainerNode {
/// Gets one of the children of @container.
/// ## `idx`
/// the position of the child to get
///
/// # Returns
///
/// the @idx'th child of @container
#[doc(alias = "gsk_container_node_get_child")]
#[doc(alias = "get_child")]
pub fn child(&self, idx: u32) -> RenderNode {
assert!(idx < self.n_children());
unsafe {
from_glib_none(ffi::gsk_container_node_get_child(
self.to_glib_none().0,
idx,
))
}
}
}
impl std::fmt::Debug for ContainerNode {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ContainerNode")
.field("n_children", &self.n_children())
.finish()
}
}