// 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::{LayoutChild, ffi};
use glib::{
    prelude::*,
    signal::{SignalHandlerId, connect_raw},
    translate::*,
};
use std::boxed::Box as Box_;

glib::wrapper! {
    #[doc(alias = "GtkGridLayoutChild")]
    pub struct GridLayoutChild(Object<ffi::GtkGridLayoutChild, ffi::GtkGridLayoutChildClass>) @extends LayoutChild;

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

impl GridLayoutChild {
    #[doc(alias = "gtk_grid_layout_child_get_column")]
    #[doc(alias = "get_column")]
    pub fn column(&self) -> i32 {
        unsafe { ffi::gtk_grid_layout_child_get_column(self.to_glib_none().0) }
    }

    #[doc(alias = "gtk_grid_layout_child_get_column_span")]
    #[doc(alias = "get_column_span")]
    #[doc(alias = "column-span")]
    pub fn column_span(&self) -> i32 {
        unsafe { ffi::gtk_grid_layout_child_get_column_span(self.to_glib_none().0) }
    }

    #[doc(alias = "gtk_grid_layout_child_get_row")]
    #[doc(alias = "get_row")]
    pub fn row(&self) -> i32 {
        unsafe { ffi::gtk_grid_layout_child_get_row(self.to_glib_none().0) }
    }

    #[doc(alias = "gtk_grid_layout_child_get_row_span")]
    #[doc(alias = "get_row_span")]
    #[doc(alias = "row-span")]
    pub fn row_span(&self) -> i32 {
        unsafe { ffi::gtk_grid_layout_child_get_row_span(self.to_glib_none().0) }
    }

    #[doc(alias = "gtk_grid_layout_child_set_column")]
    #[doc(alias = "column")]
    pub fn set_column(&self, column: i32) {
        unsafe {
            ffi::gtk_grid_layout_child_set_column(self.to_glib_none().0, column);
        }
    }

    #[doc(alias = "gtk_grid_layout_child_set_column_span")]
    #[doc(alias = "column-span")]
    pub fn set_column_span(&self, span: i32) {
        unsafe {
            ffi::gtk_grid_layout_child_set_column_span(self.to_glib_none().0, span);
        }
    }

    #[doc(alias = "gtk_grid_layout_child_set_row")]
    #[doc(alias = "row")]
    pub fn set_row(&self, row: i32) {
        unsafe {
            ffi::gtk_grid_layout_child_set_row(self.to_glib_none().0, row);
        }
    }

    #[doc(alias = "gtk_grid_layout_child_set_row_span")]
    #[doc(alias = "row-span")]
    pub fn set_row_span(&self, span: i32) {
        unsafe {
            ffi::gtk_grid_layout_child_set_row_span(self.to_glib_none().0, span);
        }
    }

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

    #[doc(alias = "column-span")]
    pub fn connect_column_span_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_column_span_trampoline<F: Fn(&GridLayoutChild) + 'static>(
            this: *mut ffi::GtkGridLayoutChild,
            _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::column-span".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_column_span_trampoline::<F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

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

    #[doc(alias = "row-span")]
    pub fn connect_row_span_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_row_span_trampoline<F: Fn(&GridLayoutChild) + 'static>(
            this: *mut ffi::GtkGridLayoutChild,
            _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::row-span".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_row_span_trampoline::<F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }
}
