gtk4/auto/
builder_list_item_factory.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, BuilderScope, ListItemFactory};
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9    #[doc(alias = "GtkBuilderListItemFactory")]
10    pub struct BuilderListItemFactory(Object<ffi::GtkBuilderListItemFactory, ffi::GtkBuilderListItemFactoryClass>) @extends ListItemFactory;
11
12    match fn {
13        type_ => || ffi::gtk_builder_list_item_factory_get_type(),
14    }
15}
16
17impl BuilderListItemFactory {
18    #[doc(alias = "gtk_builder_list_item_factory_new_from_bytes")]
19    #[doc(alias = "new_from_bytes")]
20    pub fn from_bytes(
21        scope: Option<&impl IsA<BuilderScope>>,
22        bytes: &glib::Bytes,
23    ) -> BuilderListItemFactory {
24        assert_initialized_main_thread!();
25        unsafe {
26            ListItemFactory::from_glib_full(ffi::gtk_builder_list_item_factory_new_from_bytes(
27                scope.map(|p| p.as_ref()).to_glib_none().0,
28                bytes.to_glib_none().0,
29            ))
30            .unsafe_cast()
31        }
32    }
33
34    #[doc(alias = "gtk_builder_list_item_factory_new_from_resource")]
35    #[doc(alias = "new_from_resource")]
36    pub fn from_resource(
37        scope: Option<&impl IsA<BuilderScope>>,
38        resource_path: &str,
39    ) -> BuilderListItemFactory {
40        assert_initialized_main_thread!();
41        unsafe {
42            ListItemFactory::from_glib_full(ffi::gtk_builder_list_item_factory_new_from_resource(
43                scope.map(|p| p.as_ref()).to_glib_none().0,
44                resource_path.to_glib_none().0,
45            ))
46            .unsafe_cast()
47        }
48    }
49
50    #[doc(alias = "gtk_builder_list_item_factory_get_bytes")]
51    #[doc(alias = "get_bytes")]
52    pub fn bytes(&self) -> glib::Bytes {
53        unsafe {
54            from_glib_none(ffi::gtk_builder_list_item_factory_get_bytes(
55                self.to_glib_none().0,
56            ))
57        }
58    }
59
60    #[doc(alias = "gtk_builder_list_item_factory_get_resource")]
61    #[doc(alias = "get_resource")]
62    pub fn resource(&self) -> Option<glib::GString> {
63        unsafe {
64            from_glib_none(ffi::gtk_builder_list_item_factory_get_resource(
65                self.to_glib_none().0,
66            ))
67        }
68    }
69
70    #[doc(alias = "gtk_builder_list_item_factory_get_scope")]
71    #[doc(alias = "get_scope")]
72    pub fn scope(&self) -> Option<BuilderScope> {
73        unsafe {
74            from_glib_none(ffi::gtk_builder_list_item_factory_get_scope(
75                self.to_glib_none().0,
76            ))
77        }
78    }
79}