gtk4 0.5.5

Rust bindings of the GTK 4 library
Documentation
// 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;
use glib::object::ObjectType as ObjectType_;
use glib::signal::connect_raw;
use glib::signal::SignalHandlerId;
use glib::translate::*;
use std::boxed::Box as Box_;
use std::fmt;
use std::mem::transmute;

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")]
    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")]
    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")]
    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")]
    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")]
    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")]
    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,
        ) {
            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 _,
                b"notify::column\0".as_ptr() as *const _,
                Some(transmute::<_, 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,
        ) {
            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 _,
                b"notify::column-span\0".as_ptr() as *const _,
                Some(transmute::<_, 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,
        ) {
            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 _,
                b"notify::row\0".as_ptr() as *const _,
                Some(transmute::<_, 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,
        ) {
            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 _,
                b"notify::row-span\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_row_span_trampoline::<F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }
}

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