#![allow(deprecated)]
use crate::{
FlapFoldPolicy, FlapTransitionType, FoldThresholdPolicy, SpringParams, Swipeable, ffi,
};
use glib::{
prelude::*,
signal::{SignalHandlerId, connect_raw},
translate::*,
};
use std::boxed::Box as Box_;
glib::wrapper! {
#[doc(alias = "AdwFlap")]
pub struct Flap(Object<ffi::AdwFlap, ffi::AdwFlapClass>) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, Swipeable, gtk::Orientable;
match fn {
type_ => || ffi::adw_flap_get_type(),
}
}
impl Flap {
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_flap_new")]
pub fn new() -> Flap {
assert_initialized_main_thread!();
unsafe { gtk::Widget::from_glib_none(ffi::adw_flap_new()).unsafe_cast() }
}
pub fn builder() -> FlapBuilder {
FlapBuilder::new()
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_flap_get_content")]
#[doc(alias = "get_content")]
pub fn content(&self) -> Option<gtk::Widget> {
unsafe { from_glib_none(ffi::adw_flap_get_content(self.to_glib_none().0)) }
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_flap_get_flap")]
#[doc(alias = "get_flap")]
pub fn flap(&self) -> Option<gtk::Widget> {
unsafe { from_glib_none(ffi::adw_flap_get_flap(self.to_glib_none().0)) }
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_flap_get_flap_position")]
#[doc(alias = "get_flap_position")]
#[doc(alias = "flap-position")]
pub fn flap_position(&self) -> gtk::PackType {
unsafe { from_glib(ffi::adw_flap_get_flap_position(self.to_glib_none().0)) }
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_flap_get_fold_duration")]
#[doc(alias = "get_fold_duration")]
#[doc(alias = "fold-duration")]
pub fn fold_duration(&self) -> u32 {
unsafe { ffi::adw_flap_get_fold_duration(self.to_glib_none().0) }
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_flap_get_fold_policy")]
#[doc(alias = "get_fold_policy")]
#[doc(alias = "fold-policy")]
pub fn fold_policy(&self) -> FlapFoldPolicy {
unsafe { from_glib(ffi::adw_flap_get_fold_policy(self.to_glib_none().0)) }
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_flap_get_fold_threshold_policy")]
#[doc(alias = "get_fold_threshold_policy")]
#[doc(alias = "fold-threshold-policy")]
pub fn fold_threshold_policy(&self) -> FoldThresholdPolicy {
unsafe {
from_glib(ffi::adw_flap_get_fold_threshold_policy(
self.to_glib_none().0,
))
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_flap_get_folded")]
#[doc(alias = "get_folded")]
#[doc(alias = "folded")]
pub fn is_folded(&self) -> bool {
unsafe { from_glib(ffi::adw_flap_get_folded(self.to_glib_none().0)) }
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_flap_get_locked")]
#[doc(alias = "get_locked")]
#[doc(alias = "locked")]
pub fn is_locked(&self) -> bool {
unsafe { from_glib(ffi::adw_flap_get_locked(self.to_glib_none().0)) }
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_flap_get_modal")]
#[doc(alias = "get_modal")]
#[doc(alias = "modal")]
pub fn is_modal(&self) -> bool {
unsafe { from_glib(ffi::adw_flap_get_modal(self.to_glib_none().0)) }
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_flap_get_reveal_flap")]
#[doc(alias = "get_reveal_flap")]
#[doc(alias = "reveal-flap")]
pub fn reveals_flap(&self) -> bool {
unsafe { from_glib(ffi::adw_flap_get_reveal_flap(self.to_glib_none().0)) }
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_flap_get_reveal_params")]
#[doc(alias = "get_reveal_params")]
#[doc(alias = "reveal-params")]
pub fn reveal_params(&self) -> SpringParams {
unsafe { from_glib_full(ffi::adw_flap_get_reveal_params(self.to_glib_none().0)) }
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_flap_get_reveal_progress")]
#[doc(alias = "get_reveal_progress")]
#[doc(alias = "reveal-progress")]
pub fn reveal_progress(&self) -> f64 {
unsafe { ffi::adw_flap_get_reveal_progress(self.to_glib_none().0) }
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_flap_get_separator")]
#[doc(alias = "get_separator")]
pub fn separator(&self) -> Option<gtk::Widget> {
unsafe { from_glib_none(ffi::adw_flap_get_separator(self.to_glib_none().0)) }
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_flap_get_swipe_to_close")]
#[doc(alias = "get_swipe_to_close")]
#[doc(alias = "swipe-to-close")]
pub fn is_swipe_to_close(&self) -> bool {
unsafe { from_glib(ffi::adw_flap_get_swipe_to_close(self.to_glib_none().0)) }
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_flap_get_swipe_to_open")]
#[doc(alias = "get_swipe_to_open")]
#[doc(alias = "swipe-to-open")]
pub fn is_swipe_to_open(&self) -> bool {
unsafe { from_glib(ffi::adw_flap_get_swipe_to_open(self.to_glib_none().0)) }
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_flap_get_transition_type")]
#[doc(alias = "get_transition_type")]
#[doc(alias = "transition-type")]
pub fn transition_type(&self) -> FlapTransitionType {
unsafe { from_glib(ffi::adw_flap_get_transition_type(self.to_glib_none().0)) }
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_flap_set_content")]
#[doc(alias = "content")]
pub fn set_content(&self, content: Option<&impl IsA<gtk::Widget>>) {
unsafe {
ffi::adw_flap_set_content(
self.to_glib_none().0,
content.map(|p| p.as_ref()).to_glib_none().0,
);
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_flap_set_flap")]
#[doc(alias = "flap")]
pub fn set_flap(&self, flap: Option<&impl IsA<gtk::Widget>>) {
unsafe {
ffi::adw_flap_set_flap(
self.to_glib_none().0,
flap.map(|p| p.as_ref()).to_glib_none().0,
);
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_flap_set_flap_position")]
#[doc(alias = "flap-position")]
pub fn set_flap_position(&self, position: gtk::PackType) {
unsafe {
ffi::adw_flap_set_flap_position(self.to_glib_none().0, position.into_glib());
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_flap_set_fold_duration")]
#[doc(alias = "fold-duration")]
pub fn set_fold_duration(&self, duration: u32) {
unsafe {
ffi::adw_flap_set_fold_duration(self.to_glib_none().0, duration);
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_flap_set_fold_policy")]
#[doc(alias = "fold-policy")]
pub fn set_fold_policy(&self, policy: FlapFoldPolicy) {
unsafe {
ffi::adw_flap_set_fold_policy(self.to_glib_none().0, policy.into_glib());
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_flap_set_fold_threshold_policy")]
#[doc(alias = "fold-threshold-policy")]
pub fn set_fold_threshold_policy(&self, policy: FoldThresholdPolicy) {
unsafe {
ffi::adw_flap_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_flap_set_locked")]
#[doc(alias = "locked")]
pub fn set_locked(&self, locked: bool) {
unsafe {
ffi::adw_flap_set_locked(self.to_glib_none().0, locked.into_glib());
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_flap_set_modal")]
#[doc(alias = "modal")]
pub fn set_modal(&self, modal: bool) {
unsafe {
ffi::adw_flap_set_modal(self.to_glib_none().0, modal.into_glib());
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_flap_set_reveal_flap")]
#[doc(alias = "reveal-flap")]
pub fn set_reveal_flap(&self, reveal_flap: bool) {
unsafe {
ffi::adw_flap_set_reveal_flap(self.to_glib_none().0, reveal_flap.into_glib());
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_flap_set_reveal_params")]
#[doc(alias = "reveal-params")]
pub fn set_reveal_params(&self, params: &SpringParams) {
unsafe {
ffi::adw_flap_set_reveal_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_flap_set_separator")]
#[doc(alias = "separator")]
pub fn set_separator(&self, separator: Option<&impl IsA<gtk::Widget>>) {
unsafe {
ffi::adw_flap_set_separator(
self.to_glib_none().0,
separator.map(|p| p.as_ref()).to_glib_none().0,
);
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_flap_set_swipe_to_close")]
#[doc(alias = "swipe-to-close")]
pub fn set_swipe_to_close(&self, swipe_to_close: bool) {
unsafe {
ffi::adw_flap_set_swipe_to_close(self.to_glib_none().0, swipe_to_close.into_glib());
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_flap_set_swipe_to_open")]
#[doc(alias = "swipe-to-open")]
pub fn set_swipe_to_open(&self, swipe_to_open: bool) {
unsafe {
ffi::adw_flap_set_swipe_to_open(self.to_glib_none().0, swipe_to_open.into_glib());
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[allow(deprecated)]
#[doc(alias = "adw_flap_set_transition_type")]
#[doc(alias = "transition-type")]
pub fn set_transition_type(&self, transition_type: FlapTransitionType) {
unsafe {
ffi::adw_flap_set_transition_type(self.to_glib_none().0, transition_type.into_glib());
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[doc(alias = "content")]
pub fn connect_content_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_content_trampoline<F: Fn(&Flap) + 'static>(
this: *mut ffi::AdwFlap,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
unsafe {
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 _,
c"notify::content".as_ptr(),
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_content_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[doc(alias = "flap")]
pub fn connect_flap_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_flap_trampoline<F: Fn(&Flap) + 'static>(
this: *mut ffi::AdwFlap,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
unsafe {
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 _,
c"notify::flap".as_ptr(),
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_flap_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[doc(alias = "flap-position")]
pub fn connect_flap_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_flap_position_trampoline<F: Fn(&Flap) + 'static>(
this: *mut ffi::AdwFlap,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
unsafe {
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 _,
c"notify::flap-position".as_ptr(),
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_flap_position_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[doc(alias = "fold-duration")]
pub fn connect_fold_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_fold_duration_trampoline<F: Fn(&Flap) + 'static>(
this: *mut ffi::AdwFlap,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
unsafe {
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 _,
c"notify::fold-duration".as_ptr(),
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_fold_duration_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[doc(alias = "fold-policy")]
pub fn connect_fold_policy_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_fold_policy_trampoline<F: Fn(&Flap) + 'static>(
this: *mut ffi::AdwFlap,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
unsafe {
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 _,
c"notify::fold-policy".as_ptr(),
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_fold_policy_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(&Flap) + 'static>(
this: *mut ffi::AdwFlap,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
unsafe {
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 _,
c"notify::fold-threshold-policy".as_ptr(),
Some(std::mem::transmute::<*const (), 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(&Flap) + 'static>(
this: *mut ffi::AdwFlap,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
unsafe {
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 _,
c"notify::folded".as_ptr(),
Some(std::mem::transmute::<*const (), 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 = "locked")]
pub fn connect_locked_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_locked_trampoline<F: Fn(&Flap) + 'static>(
this: *mut ffi::AdwFlap,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
unsafe {
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 _,
c"notify::locked".as_ptr(),
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_locked_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[doc(alias = "modal")]
pub fn connect_modal_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_modal_trampoline<F: Fn(&Flap) + 'static>(
this: *mut ffi::AdwFlap,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
unsafe {
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 _,
c"notify::modal".as_ptr(),
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_modal_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[doc(alias = "reveal-flap")]
pub fn connect_reveal_flap_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_reveal_flap_trampoline<F: Fn(&Flap) + 'static>(
this: *mut ffi::AdwFlap,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
unsafe {
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 _,
c"notify::reveal-flap".as_ptr(),
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_reveal_flap_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[doc(alias = "reveal-params")]
pub fn connect_reveal_params_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_reveal_params_trampoline<F: Fn(&Flap) + 'static>(
this: *mut ffi::AdwFlap,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
unsafe {
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 _,
c"notify::reveal-params".as_ptr(),
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_reveal_params_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[doc(alias = "reveal-progress")]
pub fn connect_reveal_progress_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_reveal_progress_trampoline<F: Fn(&Flap) + 'static>(
this: *mut ffi::AdwFlap,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
unsafe {
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 _,
c"notify::reveal-progress".as_ptr(),
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_reveal_progress_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[doc(alias = "separator")]
pub fn connect_separator_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_separator_trampoline<F: Fn(&Flap) + 'static>(
this: *mut ffi::AdwFlap,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
unsafe {
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 _,
c"notify::separator".as_ptr(),
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_separator_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[doc(alias = "swipe-to-close")]
pub fn connect_swipe_to_close_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_swipe_to_close_trampoline<F: Fn(&Flap) + 'static>(
this: *mut ffi::AdwFlap,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
unsafe {
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 _,
c"notify::swipe-to-close".as_ptr(),
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_swipe_to_close_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
#[doc(alias = "swipe-to-open")]
pub fn connect_swipe_to_open_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_swipe_to_open_trampoline<F: Fn(&Flap) + 'static>(
this: *mut ffi::AdwFlap,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
unsafe {
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 _,
c"notify::swipe-to-open".as_ptr(),
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_swipe_to_open_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(&Flap) + 'static>(
this: *mut ffi::AdwFlap,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
unsafe {
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 _,
c"notify::transition-type".as_ptr(),
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_transition_type_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
}
impl Default for Flap {
fn default() -> Self {
Self::new()
}
}
#[must_use = "The builder must be built to be used"]
pub struct FlapBuilder {
builder: glib::object::ObjectBuilder<'static, Flap>,
}
impl FlapBuilder {
fn new() -> Self {
Self {
builder: glib::object::Object::builder(),
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
pub fn content(self, content: &impl IsA<gtk::Widget>) -> Self {
Self {
builder: self.builder.property("content", content.clone().upcast()),
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
pub fn flap(self, flap: &impl IsA<gtk::Widget>) -> Self {
Self {
builder: self.builder.property("flap", flap.clone().upcast()),
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
pub fn flap_position(self, flap_position: gtk::PackType) -> Self {
Self {
builder: self.builder.property("flap-position", flap_position),
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
pub fn fold_duration(self, fold_duration: u32) -> Self {
Self {
builder: self.builder.property("fold-duration", fold_duration),
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
pub fn fold_policy(self, fold_policy: FlapFoldPolicy) -> Self {
Self {
builder: self.builder.property("fold-policy", fold_policy),
}
}
#[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 locked(self, locked: bool) -> Self {
Self {
builder: self.builder.property("locked", locked),
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
pub fn modal(self, modal: bool) -> Self {
Self {
builder: self.builder.property("modal", modal),
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
pub fn reveal_flap(self, reveal_flap: bool) -> Self {
Self {
builder: self.builder.property("reveal-flap", reveal_flap),
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
pub fn reveal_params(self, reveal_params: &SpringParams) -> Self {
Self {
builder: self
.builder
.property("reveal-params", reveal_params.clone()),
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
pub fn separator(self, separator: &impl IsA<gtk::Widget>) -> Self {
Self {
builder: self
.builder
.property("separator", separator.clone().upcast()),
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
pub fn swipe_to_close(self, swipe_to_close: bool) -> Self {
Self {
builder: self.builder.property("swipe-to-close", swipe_to_close),
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
pub fn swipe_to_open(self, swipe_to_open: bool) -> Self {
Self {
builder: self.builder.property("swipe-to-open", swipe_to_open),
}
}
#[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
pub fn transition_type(self, transition_type: FlapTransitionType) -> Self {
Self {
builder: self.builder.property("transition-type", transition_type),
}
}
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()),
}
}
#[cfg(feature = "gtk_v4_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))]
pub fn limit_events(self, limit_events: bool) -> Self {
Self {
builder: self.builder.property("limit-events", limit_events),
}
}
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) -> Flap {
assert_initialized_main_thread!();
self.builder.build()
}
}