[go: up one dir, main page]

gtk4/auto/
text_child_anchor.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, Widget};
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9    #[doc(alias = "GtkTextChildAnchor")]
10    pub struct TextChildAnchor(Object<ffi::GtkTextChildAnchor, ffi::GtkTextChildAnchorClass>);
11
12    match fn {
13        type_ => || ffi::gtk_text_child_anchor_get_type(),
14    }
15}
16
17impl TextChildAnchor {
18    pub const NONE: Option<&'static TextChildAnchor> = None;
19
20    #[doc(alias = "gtk_text_child_anchor_new")]
21    pub fn new() -> TextChildAnchor {
22        assert_initialized_main_thread!();
23        unsafe { from_glib_full(ffi::gtk_text_child_anchor_new()) }
24    }
25
26    #[cfg(feature = "v4_6")]
27    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
28    #[doc(alias = "gtk_text_child_anchor_new_with_replacement")]
29    #[doc(alias = "new_with_replacement")]
30    pub fn with_replacement(character: &str) -> TextChildAnchor {
31        assert_initialized_main_thread!();
32        unsafe {
33            from_glib_full(ffi::gtk_text_child_anchor_new_with_replacement(
34                character.to_glib_none().0,
35            ))
36        }
37    }
38}
39
40impl Default for TextChildAnchor {
41    fn default() -> Self {
42        Self::new()
43    }
44}
45
46pub trait TextChildAnchorExt: IsA<TextChildAnchor> + 'static {
47    #[doc(alias = "gtk_text_child_anchor_get_deleted")]
48    #[doc(alias = "get_deleted")]
49    fn is_deleted(&self) -> bool {
50        unsafe {
51            from_glib(ffi::gtk_text_child_anchor_get_deleted(
52                self.as_ref().to_glib_none().0,
53            ))
54        }
55    }
56
57    #[doc(alias = "gtk_text_child_anchor_get_widgets")]
58    #[doc(alias = "get_widgets")]
59    fn widgets(&self) -> Vec<Widget> {
60        unsafe {
61            let mut out_len = std::mem::MaybeUninit::uninit();
62            let ret = FromGlibContainer::from_glib_container_num(
63                ffi::gtk_text_child_anchor_get_widgets(
64                    self.as_ref().to_glib_none().0,
65                    out_len.as_mut_ptr(),
66                ),
67                out_len.assume_init() as _,
68            );
69            ret
70        }
71    }
72}
73
74impl<O: IsA<TextChildAnchor>> TextChildAnchorExt for O {}