gtk4/auto/
grid_layout_child.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::{ffi, LayoutChild};
6use glib::{
7    prelude::*,
8    signal::{connect_raw, SignalHandlerId},
9    translate::*,
10};
11use std::boxed::Box as Box_;
12
13glib::wrapper! {
14    #[doc(alias = "GtkGridLayoutChild")]
15    pub struct GridLayoutChild(Object<ffi::GtkGridLayoutChild, ffi::GtkGridLayoutChildClass>) @extends LayoutChild;
16
17    match fn {
18        type_ => || ffi::gtk_grid_layout_child_get_type(),
19    }
20}
21
22impl GridLayoutChild {
23    #[doc(alias = "gtk_grid_layout_child_get_column")]
24    #[doc(alias = "get_column")]
25    pub fn column(&self) -> i32 {
26        unsafe { ffi::gtk_grid_layout_child_get_column(self.to_glib_none().0) }
27    }
28
29    #[doc(alias = "gtk_grid_layout_child_get_column_span")]
30    #[doc(alias = "get_column_span")]
31    #[doc(alias = "column-span")]
32    pub fn column_span(&self) -> i32 {
33        unsafe { ffi::gtk_grid_layout_child_get_column_span(self.to_glib_none().0) }
34    }
35
36    #[doc(alias = "gtk_grid_layout_child_get_row")]
37    #[doc(alias = "get_row")]
38    pub fn row(&self) -> i32 {
39        unsafe { ffi::gtk_grid_layout_child_get_row(self.to_glib_none().0) }
40    }
41
42    #[doc(alias = "gtk_grid_layout_child_get_row_span")]
43    #[doc(alias = "get_row_span")]
44    #[doc(alias = "row-span")]
45    pub fn row_span(&self) -> i32 {
46        unsafe { ffi::gtk_grid_layout_child_get_row_span(self.to_glib_none().0) }
47    }
48
49    #[doc(alias = "gtk_grid_layout_child_set_column")]
50    #[doc(alias = "column")]
51    pub fn set_column(&self, column: i32) {
52        unsafe {
53            ffi::gtk_grid_layout_child_set_column(self.to_glib_none().0, column);
54        }
55    }
56
57    #[doc(alias = "gtk_grid_layout_child_set_column_span")]
58    #[doc(alias = "column-span")]
59    pub fn set_column_span(&self, span: i32) {
60        unsafe {
61            ffi::gtk_grid_layout_child_set_column_span(self.to_glib_none().0, span);
62        }
63    }
64
65    #[doc(alias = "gtk_grid_layout_child_set_row")]
66    #[doc(alias = "row")]
67    pub fn set_row(&self, row: i32) {
68        unsafe {
69            ffi::gtk_grid_layout_child_set_row(self.to_glib_none().0, row);
70        }
71    }
72
73    #[doc(alias = "gtk_grid_layout_child_set_row_span")]
74    #[doc(alias = "row-span")]
75    pub fn set_row_span(&self, span: i32) {
76        unsafe {
77            ffi::gtk_grid_layout_child_set_row_span(self.to_glib_none().0, span);
78        }
79    }
80
81    #[doc(alias = "column")]
82    pub fn connect_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
83        unsafe extern "C" fn notify_column_trampoline<F: Fn(&GridLayoutChild) + 'static>(
84            this: *mut ffi::GtkGridLayoutChild,
85            _param_spec: glib::ffi::gpointer,
86            f: glib::ffi::gpointer,
87        ) {
88            let f: &F = &*(f as *const F);
89            f(&from_glib_borrow(this))
90        }
91        unsafe {
92            let f: Box_<F> = Box_::new(f);
93            connect_raw(
94                self.as_ptr() as *mut _,
95                c"notify::column".as_ptr() as *const _,
96                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
97                    notify_column_trampoline::<F> as *const (),
98                )),
99                Box_::into_raw(f),
100            )
101        }
102    }
103
104    #[doc(alias = "column-span")]
105    pub fn connect_column_span_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
106        unsafe extern "C" fn notify_column_span_trampoline<F: Fn(&GridLayoutChild) + 'static>(
107            this: *mut ffi::GtkGridLayoutChild,
108            _param_spec: glib::ffi::gpointer,
109            f: glib::ffi::gpointer,
110        ) {
111            let f: &F = &*(f as *const F);
112            f(&from_glib_borrow(this))
113        }
114        unsafe {
115            let f: Box_<F> = Box_::new(f);
116            connect_raw(
117                self.as_ptr() as *mut _,
118                c"notify::column-span".as_ptr() as *const _,
119                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
120                    notify_column_span_trampoline::<F> as *const (),
121                )),
122                Box_::into_raw(f),
123            )
124        }
125    }
126
127    #[doc(alias = "row")]
128    pub fn connect_row_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
129        unsafe extern "C" fn notify_row_trampoline<F: Fn(&GridLayoutChild) + 'static>(
130            this: *mut ffi::GtkGridLayoutChild,
131            _param_spec: glib::ffi::gpointer,
132            f: glib::ffi::gpointer,
133        ) {
134            let f: &F = &*(f as *const F);
135            f(&from_glib_borrow(this))
136        }
137        unsafe {
138            let f: Box_<F> = Box_::new(f);
139            connect_raw(
140                self.as_ptr() as *mut _,
141                c"notify::row".as_ptr() as *const _,
142                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
143                    notify_row_trampoline::<F> as *const (),
144                )),
145                Box_::into_raw(f),
146            )
147        }
148    }
149
150    #[doc(alias = "row-span")]
151    pub fn connect_row_span_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
152        unsafe extern "C" fn notify_row_span_trampoline<F: Fn(&GridLayoutChild) + 'static>(
153            this: *mut ffi::GtkGridLayoutChild,
154            _param_spec: glib::ffi::gpointer,
155            f: glib::ffi::gpointer,
156        ) {
157            let f: &F = &*(f as *const F);
158            f(&from_glib_borrow(this))
159        }
160        unsafe {
161            let f: Box_<F> = Box_::new(f);
162            connect_raw(
163                self.as_ptr() as *mut _,
164                c"notify::row-span".as_ptr() as *const _,
165                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
166                    notify_row_span_trampoline::<F> as *const (),
167                )),
168                Box_::into_raw(f),
169            )
170        }
171    }
172}