use crate::{BuilderScope, ListItemFactory};
use glib::{prelude::*, translate::*};
use std::fmt;
glib::wrapper! {
#[doc(alias = "GtkBuilderListItemFactory")]
pub struct BuilderListItemFactory(Object<ffi::GtkBuilderListItemFactory, ffi::GtkBuilderListItemFactoryClass>) @extends ListItemFactory;
match fn {
type_ => || ffi::gtk_builder_list_item_factory_get_type(),
}
}
impl BuilderListItemFactory {
#[doc(alias = "gtk_builder_list_item_factory_new_from_bytes")]
#[doc(alias = "new_from_bytes")]
pub fn from_bytes(
scope: Option<&impl IsA<BuilderScope>>,
bytes: &glib::Bytes,
) -> BuilderListItemFactory {
assert_initialized_main_thread!();
unsafe {
ListItemFactory::from_glib_full(ffi::gtk_builder_list_item_factory_new_from_bytes(
scope.map(|p| p.as_ref()).to_glib_none().0,
bytes.to_glib_none().0,
))
.unsafe_cast()
}
}
#[doc(alias = "gtk_builder_list_item_factory_new_from_resource")]
#[doc(alias = "new_from_resource")]
pub fn from_resource(
scope: Option<&impl IsA<BuilderScope>>,
resource_path: &str,
) -> BuilderListItemFactory {
assert_initialized_main_thread!();
unsafe {
ListItemFactory::from_glib_full(ffi::gtk_builder_list_item_factory_new_from_resource(
scope.map(|p| p.as_ref()).to_glib_none().0,
resource_path.to_glib_none().0,
))
.unsafe_cast()
}
}
#[doc(alias = "gtk_builder_list_item_factory_get_bytes")]
#[doc(alias = "get_bytes")]
pub fn bytes(&self) -> glib::Bytes {
unsafe {
from_glib_none(ffi::gtk_builder_list_item_factory_get_bytes(
self.to_glib_none().0,
))
}
}
#[doc(alias = "gtk_builder_list_item_factory_get_resource")]
#[doc(alias = "get_resource")]
pub fn resource(&self) -> Option<glib::GString> {
unsafe {
from_glib_none(ffi::gtk_builder_list_item_factory_get_resource(
self.to_glib_none().0,
))
}
}
#[doc(alias = "gtk_builder_list_item_factory_get_scope")]
#[doc(alias = "get_scope")]
pub fn scope(&self) -> Option<BuilderScope> {
unsafe {
from_glib_none(ffi::gtk_builder_list_item_factory_get_scope(
self.to_glib_none().0,
))
}
}
}
impl fmt::Display for BuilderListItemFactory {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str("BuilderListItemFactory")
}
}