// This file was generated by gir (https://github.com/gtk-rs/gir)
// from
// from gir-files (https://github.com/gtk-rs/gir-files.git)
// DO NOT EDIT

use crate::ffi;
use glib::{
    prelude::*,
    signal::{connect_raw, SignalHandlerId},
    translate::*,
};
use std::boxed::Box as Box_;

glib::wrapper! {
    #[doc(alias = "AdwTabPage")]
    pub struct TabPage(Object<ffi::AdwTabPage, ffi::AdwTabPageClass>) @implements gtk::Accessible;

    match fn {
        type_ => || ffi::adw_tab_page_get_type(),
    }
}

impl TabPage {
    #[doc(alias = "adw_tab_page_get_child")]
    #[doc(alias = "get_child")]
    pub fn child(&self) -> gtk::Widget {
        unsafe { from_glib_none(ffi::adw_tab_page_get_child(self.to_glib_none().0)) }
    }

    #[doc(alias = "adw_tab_page_get_icon")]
    #[doc(alias = "get_icon")]
    pub fn icon(&self) -> Option<gio::Icon> {
        unsafe { from_glib_none(ffi::adw_tab_page_get_icon(self.to_glib_none().0)) }
    }

    #[doc(alias = "adw_tab_page_get_indicator_activatable")]
    #[doc(alias = "get_indicator_activatable")]
    #[doc(alias = "indicator-activatable")]
    pub fn is_indicator_activatable(&self) -> bool {
        unsafe {
            from_glib(ffi::adw_tab_page_get_indicator_activatable(
                self.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "adw_tab_page_get_indicator_icon")]
    #[doc(alias = "get_indicator_icon")]
    #[doc(alias = "indicator-icon")]
    pub fn indicator_icon(&self) -> Option<gio::Icon> {
        unsafe { from_glib_none(ffi::adw_tab_page_get_indicator_icon(self.to_glib_none().0)) }
    }

    #[cfg(feature = "v1_2")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
    #[doc(alias = "adw_tab_page_get_indicator_tooltip")]
    #[doc(alias = "get_indicator_tooltip")]
    #[doc(alias = "indicator-tooltip")]
    pub fn indicator_tooltip(&self) -> glib::GString {
        unsafe {
            from_glib_none(ffi::adw_tab_page_get_indicator_tooltip(
                self.to_glib_none().0,
            ))
        }
    }

    #[cfg(feature = "v1_3")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
    #[doc(alias = "adw_tab_page_get_keyword")]
    #[doc(alias = "get_keyword")]
    pub fn keyword(&self) -> Option<glib::GString> {
        unsafe { from_glib_none(ffi::adw_tab_page_get_keyword(self.to_glib_none().0)) }
    }

    #[cfg(feature = "v1_3")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
    #[doc(alias = "adw_tab_page_get_live_thumbnail")]
    #[doc(alias = "get_live_thumbnail")]
    #[doc(alias = "live-thumbnail")]
    pub fn is_live_thumbnail(&self) -> bool {
        unsafe { from_glib(ffi::adw_tab_page_get_live_thumbnail(self.to_glib_none().0)) }
    }

    #[doc(alias = "adw_tab_page_get_loading")]
    #[doc(alias = "get_loading")]
    #[doc(alias = "loading")]
    pub fn is_loading(&self) -> bool {
        unsafe { from_glib(ffi::adw_tab_page_get_loading(self.to_glib_none().0)) }
    }

    #[doc(alias = "adw_tab_page_get_needs_attention")]
    #[doc(alias = "get_needs_attention")]
    #[doc(alias = "needs-attention")]
    pub fn needs_attention(&self) -> bool {
        unsafe { from_glib(ffi::adw_tab_page_get_needs_attention(self.to_glib_none().0)) }
    }

    #[doc(alias = "adw_tab_page_get_parent")]
    #[doc(alias = "get_parent")]
    #[must_use]
    pub fn parent(&self) -> Option<TabPage> {
        unsafe { from_glib_none(ffi::adw_tab_page_get_parent(self.to_glib_none().0)) }
    }

    #[doc(alias = "adw_tab_page_get_pinned")]
    #[doc(alias = "get_pinned")]
    #[doc(alias = "pinned")]
    pub fn is_pinned(&self) -> bool {
        unsafe { from_glib(ffi::adw_tab_page_get_pinned(self.to_glib_none().0)) }
    }

    #[doc(alias = "adw_tab_page_get_selected")]
    #[doc(alias = "get_selected")]
    #[doc(alias = "selected")]
    pub fn is_selected(&self) -> bool {
        unsafe { from_glib(ffi::adw_tab_page_get_selected(self.to_glib_none().0)) }
    }

    #[cfg(feature = "v1_3")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
    #[doc(alias = "adw_tab_page_get_thumbnail_xalign")]
    #[doc(alias = "get_thumbnail_xalign")]
    #[doc(alias = "thumbnail-xalign")]
    pub fn thumbnail_xalign(&self) -> f32 {
        unsafe { ffi::adw_tab_page_get_thumbnail_xalign(self.to_glib_none().0) }
    }

    #[cfg(feature = "v1_3")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
    #[doc(alias = "adw_tab_page_get_thumbnail_yalign")]
    #[doc(alias = "get_thumbnail_yalign")]
    #[doc(alias = "thumbnail-yalign")]
    pub fn thumbnail_yalign(&self) -> f32 {
        unsafe { ffi::adw_tab_page_get_thumbnail_yalign(self.to_glib_none().0) }
    }

    #[doc(alias = "adw_tab_page_get_title")]
    #[doc(alias = "get_title")]
    pub fn title(&self) -> glib::GString {
        unsafe { from_glib_none(ffi::adw_tab_page_get_title(self.to_glib_none().0)) }
    }

    #[doc(alias = "adw_tab_page_get_tooltip")]
    #[doc(alias = "get_tooltip")]
    pub fn tooltip(&self) -> Option<glib::GString> {
        unsafe { from_glib_none(ffi::adw_tab_page_get_tooltip(self.to_glib_none().0)) }
    }

    #[cfg(feature = "v1_3")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
    #[doc(alias = "adw_tab_page_invalidate_thumbnail")]
    pub fn invalidate_thumbnail(&self) {
        unsafe {
            ffi::adw_tab_page_invalidate_thumbnail(self.to_glib_none().0);
        }
    }

    #[doc(alias = "adw_tab_page_set_icon")]
    #[doc(alias = "icon")]
    pub fn set_icon(&self, icon: Option<&impl IsA<gio::Icon>>) {
        unsafe {
            ffi::adw_tab_page_set_icon(
                self.to_glib_none().0,
                icon.map(|p| p.as_ref()).to_glib_none().0,
            );
        }
    }

    #[doc(alias = "adw_tab_page_set_indicator_activatable")]
    #[doc(alias = "indicator-activatable")]
    pub fn set_indicator_activatable(&self, activatable: bool) {
        unsafe {
            ffi::adw_tab_page_set_indicator_activatable(
                self.to_glib_none().0,
                activatable.into_glib(),
            );
        }
    }

    #[doc(alias = "adw_tab_page_set_indicator_icon")]
    #[doc(alias = "indicator-icon")]
    pub fn set_indicator_icon(&self, indicator_icon: Option<&impl IsA<gio::Icon>>) {
        unsafe {
            ffi::adw_tab_page_set_indicator_icon(
                self.to_glib_none().0,
                indicator_icon.map(|p| p.as_ref()).to_glib_none().0,
            );
        }
    }

    #[cfg(feature = "v1_2")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
    #[doc(alias = "adw_tab_page_set_indicator_tooltip")]
    #[doc(alias = "indicator-tooltip")]
    pub fn set_indicator_tooltip(&self, tooltip: &str) {
        unsafe {
            ffi::adw_tab_page_set_indicator_tooltip(
                self.to_glib_none().0,
                tooltip.to_glib_none().0,
            );
        }
    }

    #[cfg(feature = "v1_3")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
    #[doc(alias = "adw_tab_page_set_keyword")]
    #[doc(alias = "keyword")]
    pub fn set_keyword(&self, keyword: &str) {
        unsafe {
            ffi::adw_tab_page_set_keyword(self.to_glib_none().0, keyword.to_glib_none().0);
        }
    }

    #[cfg(feature = "v1_3")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
    #[doc(alias = "adw_tab_page_set_live_thumbnail")]
    #[doc(alias = "live-thumbnail")]
    pub fn set_live_thumbnail(&self, live_thumbnail: bool) {
        unsafe {
            ffi::adw_tab_page_set_live_thumbnail(self.to_glib_none().0, live_thumbnail.into_glib());
        }
    }

    #[doc(alias = "adw_tab_page_set_loading")]
    #[doc(alias = "loading")]
    pub fn set_loading(&self, loading: bool) {
        unsafe {
            ffi::adw_tab_page_set_loading(self.to_glib_none().0, loading.into_glib());
        }
    }

    #[doc(alias = "adw_tab_page_set_needs_attention")]
    #[doc(alias = "needs-attention")]
    pub fn set_needs_attention(&self, needs_attention: bool) {
        unsafe {
            ffi::adw_tab_page_set_needs_attention(
                self.to_glib_none().0,
                needs_attention.into_glib(),
            );
        }
    }

    #[cfg(feature = "v1_3")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
    #[doc(alias = "adw_tab_page_set_thumbnail_xalign")]
    #[doc(alias = "thumbnail-xalign")]
    pub fn set_thumbnail_xalign(&self, xalign: f32) {
        unsafe {
            ffi::adw_tab_page_set_thumbnail_xalign(self.to_glib_none().0, xalign);
        }
    }

    #[cfg(feature = "v1_3")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
    #[doc(alias = "adw_tab_page_set_thumbnail_yalign")]
    #[doc(alias = "thumbnail-yalign")]
    pub fn set_thumbnail_yalign(&self, yalign: f32) {
        unsafe {
            ffi::adw_tab_page_set_thumbnail_yalign(self.to_glib_none().0, yalign);
        }
    }

    #[doc(alias = "adw_tab_page_set_title")]
    #[doc(alias = "title")]
    pub fn set_title(&self, title: &str) {
        unsafe {
            ffi::adw_tab_page_set_title(self.to_glib_none().0, title.to_glib_none().0);
        }
    }

    #[doc(alias = "adw_tab_page_set_tooltip")]
    #[doc(alias = "tooltip")]
    pub fn set_tooltip(&self, tooltip: &str) {
        unsafe {
            ffi::adw_tab_page_set_tooltip(self.to_glib_none().0, tooltip.to_glib_none().0);
        }
    }

    #[doc(alias = "icon")]
    pub fn connect_icon_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_icon_trampoline<F: Fn(&TabPage) + 'static>(
            this: *mut ffi::AdwTabPage,
            _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 _,
                c"notify::icon".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_icon_trampoline::<F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "indicator-activatable")]
    pub fn connect_indicator_activatable_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_indicator_activatable_trampoline<F: Fn(&TabPage) + 'static>(
            this: *mut ffi::AdwTabPage,
            _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 _,
                c"notify::indicator-activatable".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_indicator_activatable_trampoline::<F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "indicator-icon")]
    pub fn connect_indicator_icon_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_indicator_icon_trampoline<F: Fn(&TabPage) + 'static>(
            this: *mut ffi::AdwTabPage,
            _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 _,
                c"notify::indicator-icon".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_indicator_icon_trampoline::<F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[cfg(feature = "v1_2")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
    #[doc(alias = "indicator-tooltip")]
    pub fn connect_indicator_tooltip_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_indicator_tooltip_trampoline<F: Fn(&TabPage) + 'static>(
            this: *mut ffi::AdwTabPage,
            _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 _,
                c"notify::indicator-tooltip".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_indicator_tooltip_trampoline::<F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[cfg(feature = "v1_3")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
    #[doc(alias = "keyword")]
    pub fn connect_keyword_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_keyword_trampoline<F: Fn(&TabPage) + 'static>(
            this: *mut ffi::AdwTabPage,
            _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 _,
                c"notify::keyword".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_keyword_trampoline::<F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[cfg(feature = "v1_3")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
    #[doc(alias = "live-thumbnail")]
    pub fn connect_live_thumbnail_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_live_thumbnail_trampoline<F: Fn(&TabPage) + 'static>(
            this: *mut ffi::AdwTabPage,
            _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 _,
                c"notify::live-thumbnail".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_live_thumbnail_trampoline::<F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "loading")]
    pub fn connect_loading_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_loading_trampoline<F: Fn(&TabPage) + 'static>(
            this: *mut ffi::AdwTabPage,
            _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 _,
                c"notify::loading".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_loading_trampoline::<F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "needs-attention")]
    pub fn connect_needs_attention_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_needs_attention_trampoline<F: Fn(&TabPage) + 'static>(
            this: *mut ffi::AdwTabPage,
            _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 _,
                c"notify::needs-attention".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_needs_attention_trampoline::<F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "pinned")]
    pub fn connect_pinned_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_pinned_trampoline<F: Fn(&TabPage) + 'static>(
            this: *mut ffi::AdwTabPage,
            _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 _,
                c"notify::pinned".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_pinned_trampoline::<F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "selected")]
    pub fn connect_selected_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_selected_trampoline<F: Fn(&TabPage) + 'static>(
            this: *mut ffi::AdwTabPage,
            _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 _,
                c"notify::selected".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_selected_trampoline::<F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[cfg(feature = "v1_3")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
    #[doc(alias = "thumbnail-xalign")]
    pub fn connect_thumbnail_xalign_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_thumbnail_xalign_trampoline<F: Fn(&TabPage) + 'static>(
            this: *mut ffi::AdwTabPage,
            _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 _,
                c"notify::thumbnail-xalign".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_thumbnail_xalign_trampoline::<F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[cfg(feature = "v1_3")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
    #[doc(alias = "thumbnail-yalign")]
    pub fn connect_thumbnail_yalign_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_thumbnail_yalign_trampoline<F: Fn(&TabPage) + 'static>(
            this: *mut ffi::AdwTabPage,
            _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 _,
                c"notify::thumbnail-yalign".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_thumbnail_yalign_trampoline::<F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "title")]
    pub fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_title_trampoline<F: Fn(&TabPage) + 'static>(
            this: *mut ffi::AdwTabPage,
            _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 _,
                c"notify::title".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_title_trampoline::<F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "tooltip")]
    pub fn connect_tooltip_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_tooltip_trampoline<F: Fn(&TabPage) + 'static>(
            this: *mut ffi::AdwTabPage,
            _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 _,
                c"notify::tooltip".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_tooltip_trampoline::<F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }
}
