#![allow(deprecated)]
use crate::{
FoldThresholdPolicy, LeafletPage, LeafletTransitionType, NavigationDirection, SpringParams,
Swipeable,
};
use glib::{
prelude::*,
signal::{connect_raw, SignalHandlerId},
translate::*,
};
use std::boxed::Box as Box_;
glib::wrapper! {
#[doc(alias = "AdwLeaflet")]
pub struct Leaflet(Object<ffi::AdwLeaflet, ffi::AdwLeafletClass>) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, Swipeable, gtk::Orientable;
match fn {
type_ => || ffi::adw_leaflet_get_type(),
}
}
impl Leaflet {
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_leaflet_new")]
pub fn new() -> Leaflet {
assert_initialized_main_thread!();
unsafe { gtk::Widget::from_glib_none(ffi::adw_leaflet_new()).unsafe_cast() }
}
pub fn builder() -> LeafletBuilder {
LeafletBuilder::new()
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_leaflet_append")]
pub fn append(&self, child: &impl IsA<gtk::Widget>) -> LeafletPage {
unsafe {
from_glib_none(ffi::adw_leaflet_append(
self.to_glib_none().0,
child.as_ref().to_glib_none().0,
))
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_leaflet_get_adjacent_child")]
#[doc(alias = "get_adjacent_child")]
pub fn adjacent_child(&self, direction: NavigationDirection) -> Option<gtk::Widget> {
unsafe {
from_glib_none(ffi::adw_leaflet_get_adjacent_child(
self.to_glib_none().0,
direction.into_glib(),
))
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_leaflet_get_can_navigate_back")]
#[doc(alias = "get_can_navigate_back")]
pub fn can_navigate_back(&self) -> bool {
unsafe {
from_glib(ffi::adw_leaflet_get_can_navigate_back(
self.to_glib_none().0,
))
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_leaflet_get_can_navigate_forward")]
#[doc(alias = "get_can_navigate_forward")]
pub fn can_navigate_forward(&self) -> bool {
unsafe {
from_glib(ffi::adw_leaflet_get_can_navigate_forward(
self.to_glib_none().0,
))
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_leaflet_get_can_unfold")]
#[doc(alias = "get_can_unfold")]
pub fn can_unfold(&self) -> bool {
unsafe { from_glib(ffi::adw_leaflet_get_can_unfold(self.to_glib_none().0)) }
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_leaflet_get_child_by_name")]
#[doc(alias = "get_child_by_name")]
pub fn child_by_name(&self, name: &str) -> Option<gtk::Widget> {
unsafe {
from_glib_none(ffi::adw_leaflet_get_child_by_name(
self.to_glib_none().0,
name.to_glib_none().0,
))
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_leaflet_get_child_transition_params")]
#[doc(alias = "get_child_transition_params")]
pub fn child_transition_params(&self) -> SpringParams {
unsafe {
from_glib_full(ffi::adw_leaflet_get_child_transition_params(
self.to_glib_none().0,
))
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_leaflet_get_child_transition_running")]
#[doc(alias = "get_child_transition_running")]
pub fn is_child_transition_running(&self) -> bool {
unsafe {
from_glib(ffi::adw_leaflet_get_child_transition_running(
self.to_glib_none().0,
))
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_leaflet_get_fold_threshold_policy")]
#[doc(alias = "get_fold_threshold_policy")]
pub fn fold_threshold_policy(&self) -> FoldThresholdPolicy {
unsafe {
from_glib(ffi::adw_leaflet_get_fold_threshold_policy(
self.to_glib_none().0,
))
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_leaflet_get_folded")]
#[doc(alias = "get_folded")]
pub fn is_folded(&self) -> bool {
unsafe { from_glib(ffi::adw_leaflet_get_folded(self.to_glib_none().0)) }
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_leaflet_get_homogeneous")]
#[doc(alias = "get_homogeneous")]
pub fn is_homogeneous(&self) -> bool {
unsafe { from_glib(ffi::adw_leaflet_get_homogeneous(self.to_glib_none().0)) }
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_leaflet_get_mode_transition_duration")]
#[doc(alias = "get_mode_transition_duration")]
pub fn mode_transition_duration(&self) -> u32 {
unsafe { ffi::adw_leaflet_get_mode_transition_duration(self.to_glib_none().0) }
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_leaflet_get_page")]
#[doc(alias = "get_page")]
pub fn page(&self, child: &impl IsA<gtk::Widget>) -> LeafletPage {
unsafe {
from_glib_none(ffi::adw_leaflet_get_page(
self.to_glib_none().0,
child.as_ref().to_glib_none().0,
))
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_leaflet_get_pages")]
#[doc(alias = "get_pages")]
pub fn pages(&self) -> gtk::SelectionModel {
unsafe { from_glib_full(ffi::adw_leaflet_get_pages(self.to_glib_none().0)) }
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_leaflet_get_transition_type")]
#[doc(alias = "get_transition_type")]
pub fn transition_type(&self) -> LeafletTransitionType {
unsafe { from_glib(ffi::adw_leaflet_get_transition_type(self.to_glib_none().0)) }
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_leaflet_get_visible_child")]
#[doc(alias = "get_visible_child")]
pub fn visible_child(&self) -> Option<gtk::Widget> {
unsafe { from_glib_none(ffi::adw_leaflet_get_visible_child(self.to_glib_none().0)) }
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_leaflet_get_visible_child_name")]
#[doc(alias = "get_visible_child_name")]
pub fn visible_child_name(&self) -> Option<glib::GString> {
unsafe {
from_glib_none(ffi::adw_leaflet_get_visible_child_name(
self.to_glib_none().0,
))
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_leaflet_insert_child_after")]
pub fn insert_child_after(
&self,
child: &impl IsA<gtk::Widget>,
sibling: Option<&impl IsA<gtk::Widget>>,
) -> LeafletPage {
unsafe {
from_glib_none(ffi::adw_leaflet_insert_child_after(
self.to_glib_none().0,
child.as_ref().to_glib_none().0,
sibling.map(|p| p.as_ref()).to_glib_none().0,
))
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_leaflet_navigate")]
pub fn navigate(&self, direction: NavigationDirection) -> bool {
unsafe {
from_glib(ffi::adw_leaflet_navigate(
self.to_glib_none().0,
direction.into_glib(),
))
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_leaflet_prepend")]
pub fn prepend(&self, child: &impl IsA<gtk::Widget>) -> LeafletPage {
unsafe {
from_glib_none(ffi::adw_leaflet_prepend(
self.to_glib_none().0,
child.as_ref().to_glib_none().0,
))
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_leaflet_remove")]
pub fn remove(&self, child: &impl IsA<gtk::Widget>) {
unsafe {
ffi::adw_leaflet_remove(self.to_glib_none().0, child.as_ref().to_glib_none().0);
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_leaflet_reorder_child_after")]
pub fn reorder_child_after(
&self,
child: &impl IsA<gtk::Widget>,
sibling: Option<&impl IsA<gtk::Widget>>,
) {
unsafe {
ffi::adw_leaflet_reorder_child_after(
self.to_glib_none().0,
child.as_ref().to_glib_none().0,
sibling.map(|p| p.as_ref()).to_glib_none().0,
);
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_leaflet_set_can_navigate_back")]
pub fn set_can_navigate_back(&self, can_navigate_back: bool) {
unsafe {
ffi::adw_leaflet_set_can_navigate_back(
self.to_glib_none().0,
can_navigate_back.into_glib(),
);
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_leaflet_set_can_navigate_forward")]
pub fn set_can_navigate_forward(&self, can_navigate_forward: bool) {
unsafe {
ffi::adw_leaflet_set_can_navigate_forward(
self.to_glib_none().0,
can_navigate_forward.into_glib(),
);
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_leaflet_set_can_unfold")]
pub fn set_can_unfold(&self, can_unfold: bool) {
unsafe {
ffi::adw_leaflet_set_can_unfold(self.to_glib_none().0, can_unfold.into_glib());
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_leaflet_set_child_transition_params")]
pub fn set_child_transition_params(&self, params: &SpringParams) {
unsafe {
ffi::adw_leaflet_set_child_transition_params(
self.to_glib_none().0,
params.to_glib_none().0,
);
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_leaflet_set_fold_threshold_policy")]
pub fn set_fold_threshold_policy(&self, policy: FoldThresholdPolicy) {
unsafe {
ffi::adw_leaflet_set_fold_threshold_policy(self.to_glib_none().0, policy.into_glib());
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_leaflet_set_homogeneous")]
pub fn set_homogeneous(&self, homogeneous: bool) {
unsafe {
ffi::adw_leaflet_set_homogeneous(self.to_glib_none().0, homogeneous.into_glib());
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_leaflet_set_mode_transition_duration")]
pub fn set_mode_transition_duration(&self, duration: u32) {
unsafe {
ffi::adw_leaflet_set_mode_transition_duration(self.to_glib_none().0, duration);
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_leaflet_set_transition_type")]
pub fn set_transition_type(&self, transition: LeafletTransitionType) {
unsafe {
ffi::adw_leaflet_set_transition_type(self.to_glib_none().0, transition.into_glib());
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_leaflet_set_visible_child")]
pub fn set_visible_child(&self, visible_child: &impl IsA<gtk::Widget>) {
unsafe {
ffi::adw_leaflet_set_visible_child(
self.to_glib_none().0,
visible_child.as_ref().to_glib_none().0,
);
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_leaflet_set_visible_child_name")]
pub fn set_visible_child_name(&self, name: &str) {
unsafe {
ffi::adw_leaflet_set_visible_child_name(self.to_glib_none().0, name.to_glib_none().0);
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[doc(alias = "can-navigate-back")]
pub fn connect_can_navigate_back_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_can_navigate_back_trampoline<F: Fn(&Leaflet) + 'static>(
this: *mut ffi::AdwLeaflet,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::can-navigate-back\0".as_ptr() as *const _,
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
notify_can_navigate_back_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[doc(alias = "can-navigate-forward")]
pub fn connect_can_navigate_forward_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_can_navigate_forward_trampoline<F: Fn(&Leaflet) + 'static>(
this: *mut ffi::AdwLeaflet,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::can-navigate-forward\0".as_ptr() as *const _,
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
notify_can_navigate_forward_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[doc(alias = "can-unfold")]
pub fn connect_can_unfold_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_can_unfold_trampoline<F: Fn(&Leaflet) + 'static>(
this: *mut ffi::AdwLeaflet,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::can-unfold\0".as_ptr() as *const _,
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
notify_can_unfold_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[doc(alias = "child-transition-params")]
pub fn connect_child_transition_params_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_child_transition_params_trampoline<
F: Fn(&Leaflet) + 'static,
>(
this: *mut ffi::AdwLeaflet,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::child-transition-params\0".as_ptr() as *const _,
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
notify_child_transition_params_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[doc(alias = "child-transition-running")]
pub fn connect_child_transition_running_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_child_transition_running_trampoline<
F: Fn(&Leaflet) + 'static,
>(
this: *mut ffi::AdwLeaflet,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::child-transition-running\0".as_ptr() as *const _,
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
notify_child_transition_running_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[doc(alias = "fold-threshold-policy")]
pub fn connect_fold_threshold_policy_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_fold_threshold_policy_trampoline<F: Fn(&Leaflet) + 'static>(
this: *mut ffi::AdwLeaflet,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::fold-threshold-policy\0".as_ptr() as *const _,
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
notify_fold_threshold_policy_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[doc(alias = "folded")]
pub fn connect_folded_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_folded_trampoline<F: Fn(&Leaflet) + 'static>(
this: *mut ffi::AdwLeaflet,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::folded\0".as_ptr() as *const _,
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
notify_folded_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[doc(alias = "homogeneous")]
pub fn connect_homogeneous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_homogeneous_trampoline<F: Fn(&Leaflet) + 'static>(
this: *mut ffi::AdwLeaflet,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::homogeneous\0".as_ptr() as *const _,
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
notify_homogeneous_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[doc(alias = "mode-transition-duration")]
pub fn connect_mode_transition_duration_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_mode_transition_duration_trampoline<
F: Fn(&Leaflet) + 'static,
>(
this: *mut ffi::AdwLeaflet,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::mode-transition-duration\0".as_ptr() as *const _,
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
notify_mode_transition_duration_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[doc(alias = "pages")]
pub fn connect_pages_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_pages_trampoline<F: Fn(&Leaflet) + 'static>(
this: *mut ffi::AdwLeaflet,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::pages\0".as_ptr() as *const _,
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
notify_pages_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[doc(alias = "transition-type")]
pub fn connect_transition_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_transition_type_trampoline<F: Fn(&Leaflet) + 'static>(
this: *mut ffi::AdwLeaflet,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::transition-type\0".as_ptr() as *const _,
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
notify_transition_type_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[doc(alias = "visible-child")]
pub fn connect_visible_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_visible_child_trampoline<F: Fn(&Leaflet) + 'static>(
this: *mut ffi::AdwLeaflet,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::visible-child\0".as_ptr() as *const _,
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
notify_visible_child_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[doc(alias = "visible-child-name")]
pub fn connect_visible_child_name_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_visible_child_name_trampoline<F: Fn(&Leaflet) + 'static>(
this: *mut ffi::AdwLeaflet,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::visible-child-name\0".as_ptr() as *const _,
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
notify_visible_child_name_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
}
impl Default for Leaflet {
fn default() -> Self {
Self::new()
}
}
#[must_use = "The builder must be built to be used"]
pub struct LeafletBuilder {
builder: glib::object::ObjectBuilder<'static, Leaflet>,
}
impl LeafletBuilder {
fn new() -> Self {
Self {
builder: glib::object::Object::builder(),
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
pub fn can_navigate_back(self, can_navigate_back: bool) -> Self {
Self {
builder: self
.builder
.property("can-navigate-back", can_navigate_back),
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
pub fn can_navigate_forward(self, can_navigate_forward: bool) -> Self {
Self {
builder: self
.builder
.property("can-navigate-forward", can_navigate_forward),
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
pub fn can_unfold(self, can_unfold: bool) -> Self {
Self {
builder: self.builder.property("can-unfold", can_unfold),
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
pub fn child_transition_params(self, child_transition_params: &SpringParams) -> Self {
Self {
builder: self
.builder
.property("child-transition-params", child_transition_params.clone()),
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
pub fn fold_threshold_policy(self, fold_threshold_policy: FoldThresholdPolicy) -> Self {
Self {
builder: self
.builder
.property("fold-threshold-policy", fold_threshold_policy),
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
pub fn homogeneous(self, homogeneous: bool) -> Self {
Self {
builder: self.builder.property("homogeneous", homogeneous),
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
pub fn mode_transition_duration(self, mode_transition_duration: u32) -> Self {
Self {
builder: self
.builder
.property("mode-transition-duration", mode_transition_duration),
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
pub fn transition_type(self, transition_type: LeafletTransitionType) -> Self {
Self {
builder: self.builder.property("transition-type", transition_type),
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
pub fn visible_child(self, visible_child: &impl IsA<gtk::Widget>) -> Self {
Self {
builder: self
.builder
.property("visible-child", visible_child.clone().upcast()),
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
pub fn visible_child_name(self, visible_child_name: impl Into<glib::GString>) -> Self {
Self {
builder: self
.builder
.property("visible-child-name", visible_child_name.into()),
}
}
pub fn can_focus(self, can_focus: bool) -> Self {
Self {
builder: self.builder.property("can-focus", can_focus),
}
}
pub fn can_target(self, can_target: bool) -> Self {
Self {
builder: self.builder.property("can-target", can_target),
}
}
pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
Self {
builder: self.builder.property("css-classes", css_classes.into()),
}
}
pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
Self {
builder: self.builder.property("css-name", css_name.into()),
}
}
pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
Self {
builder: self.builder.property("cursor", cursor.clone()),
}
}
pub fn focus_on_click(self, focus_on_click: bool) -> Self {
Self {
builder: self.builder.property("focus-on-click", focus_on_click),
}
}
pub fn focusable(self, focusable: bool) -> Self {
Self {
builder: self.builder.property("focusable", focusable),
}
}
pub fn halign(self, halign: gtk::Align) -> Self {
Self {
builder: self.builder.property("halign", halign),
}
}
pub fn has_tooltip(self, has_tooltip: bool) -> Self {
Self {
builder: self.builder.property("has-tooltip", has_tooltip),
}
}
pub fn height_request(self, height_request: i32) -> Self {
Self {
builder: self.builder.property("height-request", height_request),
}
}
pub fn hexpand(self, hexpand: bool) -> Self {
Self {
builder: self.builder.property("hexpand", hexpand),
}
}
pub fn hexpand_set(self, hexpand_set: bool) -> Self {
Self {
builder: self.builder.property("hexpand-set", hexpand_set),
}
}
pub fn layout_manager(self, layout_manager: &impl IsA<gtk::LayoutManager>) -> Self {
Self {
builder: self
.builder
.property("layout-manager", layout_manager.clone().upcast()),
}
}
pub fn margin_bottom(self, margin_bottom: i32) -> Self {
Self {
builder: self.builder.property("margin-bottom", margin_bottom),
}
}
pub fn margin_end(self, margin_end: i32) -> Self {
Self {
builder: self.builder.property("margin-end", margin_end),
}
}
pub fn margin_start(self, margin_start: i32) -> Self {
Self {
builder: self.builder.property("margin-start", margin_start),
}
}
pub fn margin_top(self, margin_top: i32) -> Self {
Self {
builder: self.builder.property("margin-top", margin_top),
}
}
pub fn name(self, name: impl Into<glib::GString>) -> Self {
Self {
builder: self.builder.property("name", name.into()),
}
}
pub fn opacity(self, opacity: f64) -> Self {
Self {
builder: self.builder.property("opacity", opacity),
}
}
pub fn overflow(self, overflow: gtk::Overflow) -> Self {
Self {
builder: self.builder.property("overflow", overflow),
}
}
pub fn receives_default(self, receives_default: bool) -> Self {
Self {
builder: self.builder.property("receives-default", receives_default),
}
}
pub fn sensitive(self, sensitive: bool) -> Self {
Self {
builder: self.builder.property("sensitive", sensitive),
}
}
pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
Self {
builder: self
.builder
.property("tooltip-markup", tooltip_markup.into()),
}
}
pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
Self {
builder: self.builder.property("tooltip-text", tooltip_text.into()),
}
}
pub fn valign(self, valign: gtk::Align) -> Self {
Self {
builder: self.builder.property("valign", valign),
}
}
pub fn vexpand(self, vexpand: bool) -> Self {
Self {
builder: self.builder.property("vexpand", vexpand),
}
}
pub fn vexpand_set(self, vexpand_set: bool) -> Self {
Self {
builder: self.builder.property("vexpand-set", vexpand_set),
}
}
pub fn visible(self, visible: bool) -> Self {
Self {
builder: self.builder.property("visible", visible),
}
}
pub fn width_request(self, width_request: i32) -> Self {
Self {
builder: self.builder.property("width-request", width_request),
}
}
pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self {
Self {
builder: self.builder.property("accessible-role", accessible_role),
}
}
pub fn orientation(self, orientation: gtk::Orientation) -> Self {
Self {
builder: self.builder.property("orientation", orientation),
}
}
#[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
pub fn build(self) -> Leaflet {
self.builder.build()
}
}