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

use crate::{ListItem, Widget, ffi};
use glib::{prelude::*, translate::*};

glib::wrapper! {
    #[doc(alias = "GtkColumnViewCell")]
    pub struct ColumnViewCell(Object<ffi::GtkColumnViewCell, ffi::GtkColumnViewCellClass>) @extends ListItem;

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

impl ColumnViewCell {
    // rustdoc-stripper-ignore-next
    /// Creates a new builder-pattern struct instance to construct [`ColumnViewCell`] objects.
    ///
    /// This method returns an instance of [`ColumnViewCellBuilder`](crate::builders::ColumnViewCellBuilder) which can be used to create [`ColumnViewCell`] objects.
    pub fn builder() -> ColumnViewCellBuilder {
        ColumnViewCellBuilder::new()
    }

    #[doc(alias = "gtk_column_view_cell_get_child")]
    #[doc(alias = "get_child")]
    pub fn child(&self) -> Option<Widget> {
        unsafe { from_glib_none(ffi::gtk_column_view_cell_get_child(self.to_glib_none().0)) }
    }

    #[cfg(not(feature = "v4_12"))]
    #[cfg_attr(docsrs, doc(cfg(not(feature = "v4_12"))))]
    #[doc(alias = "gtk_column_view_cell_get_focusable")]
    #[doc(alias = "get_focusable")]
    #[doc(alias = "focusable")]
    pub fn is_focusable(&self) -> bool {
        unsafe {
            from_glib(ffi::gtk_column_view_cell_get_focusable(
                self.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "gtk_column_view_cell_get_item")]
    #[doc(alias = "get_item")]
    pub fn item(&self) -> Option<glib::Object> {
        unsafe { from_glib_none(ffi::gtk_column_view_cell_get_item(self.to_glib_none().0)) }
    }

    #[doc(alias = "gtk_column_view_cell_get_position")]
    #[doc(alias = "get_position")]
    pub fn position(&self) -> u32 {
        unsafe { ffi::gtk_column_view_cell_get_position(self.to_glib_none().0) }
    }

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

    #[doc(alias = "gtk_column_view_cell_set_child")]
    #[doc(alias = "child")]
    pub fn set_child(&self, child: Option<&impl IsA<Widget>>) {
        unsafe {
            ffi::gtk_column_view_cell_set_child(
                self.to_glib_none().0,
                child.map(|p| p.as_ref()).to_glib_none().0,
            );
        }
    }

    #[cfg(not(feature = "v4_12"))]
    #[cfg_attr(docsrs, doc(cfg(not(feature = "v4_12"))))]
    #[doc(alias = "gtk_column_view_cell_set_focusable")]
    #[doc(alias = "focusable")]
    pub fn set_focusable(&self, focusable: bool) {
        unsafe {
            ffi::gtk_column_view_cell_set_focusable(self.to_glib_none().0, focusable.into_glib());
        }
    }
}

// rustdoc-stripper-ignore-next
/// A [builder-pattern] type to construct [`ColumnViewCell`] objects.
///
/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
#[must_use = "The builder must be built to be used"]
pub struct ColumnViewCellBuilder {
    builder: glib::object::ObjectBuilder<'static, ColumnViewCell>,
}

impl ColumnViewCellBuilder {
    fn new() -> Self {
        Self {
            builder: glib::object::Object::builder(),
        }
    }

    #[cfg(feature = "v4_12")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
    pub fn child(self, child: &impl IsA<Widget>) -> Self {
        Self {
            builder: self.builder.property("child", child.clone().upcast()),
        }
    }

    #[cfg(feature = "v4_12")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
    pub fn focusable(self, focusable: bool) -> Self {
        Self {
            builder: self.builder.property("focusable", focusable),
        }
    }

    #[cfg(feature = "v4_12")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
    pub fn accessible_description(self, accessible_description: impl Into<glib::GString>) -> Self {
        Self {
            builder: self
                .builder
                .property("accessible-description", accessible_description.into()),
        }
    }

    #[cfg(feature = "v4_12")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
    pub fn accessible_label(self, accessible_label: impl Into<glib::GString>) -> Self {
        Self {
            builder: self
                .builder
                .property("accessible-label", accessible_label.into()),
        }
    }

    pub fn activatable(self, activatable: bool) -> Self {
        Self {
            builder: self.builder.property("activatable", activatable),
        }
    }

    pub fn selectable(self, selectable: bool) -> Self {
        Self {
            builder: self.builder.property("selectable", selectable),
        }
    }

    // rustdoc-stripper-ignore-next
    /// Build the [`ColumnViewCell`].
    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
    pub fn build(self) -> ColumnViewCell {
        assert_initialized_main_thread!();
        self.builder.build()
    }
}
