// 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
#![allow(deprecated)]

use crate::Swipeable;
use glib::{prelude::*, translate::*};
use std::fmt;

glib::wrapper! {
    #[doc(alias = "HdySwipeGroup")]
    pub struct SwipeGroup(Object<ffi::HdySwipeGroup, ffi::HdySwipeGroupClass>) @implements gtk::Buildable;

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

impl SwipeGroup {
    #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
    #[allow(deprecated)]
    #[doc(alias = "hdy_swipe_group_new")]
    pub fn new() -> SwipeGroup {
        assert_initialized_main_thread!();
        unsafe { from_glib_full(ffi::hdy_swipe_group_new()) }
    }

    #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
    #[allow(deprecated)]
    #[doc(alias = "hdy_swipe_group_add_swipeable")]
    pub fn add_swipeable(&self, swipeable: &impl IsA<Swipeable>) {
        unsafe {
            ffi::hdy_swipe_group_add_swipeable(
                self.to_glib_none().0,
                swipeable.as_ref().to_glib_none().0,
            );
        }
    }

    #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
    #[allow(deprecated)]
    #[doc(alias = "hdy_swipe_group_get_swipeables")]
    #[doc(alias = "get_swipeables")]
    pub fn swipeables(&self) -> Vec<Swipeable> {
        unsafe {
            FromGlibPtrContainer::from_glib_none(ffi::hdy_swipe_group_get_swipeables(
                self.to_glib_none().0,
            ))
        }
    }

    #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
    #[allow(deprecated)]
    #[doc(alias = "hdy_swipe_group_remove_swipeable")]
    pub fn remove_swipeable(&self, swipeable: &impl IsA<Swipeable>) {
        unsafe {
            ffi::hdy_swipe_group_remove_swipeable(
                self.to_glib_none().0,
                swipeable.as_ref().to_glib_none().0,
            );
        }
    }
}

impl Default for SwipeGroup {
    fn default() -> Self {
        Self::new()
    }
}

impl fmt::Display for SwipeGroup {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        f.write_str("SwipeGroup")
    }
}
