gtk4/auto/
grid_layout_child.rs
1use 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")]
60 pub struct GridLayoutChild(Object<ffi::GtkGridLayoutChild, ffi::GtkGridLayoutChildClass>) @extends LayoutChild;
61
62 match fn {
63 type_ => || ffi::gtk_grid_layout_child_get_type(),
64 }
65}
66
67impl GridLayoutChild {
68 #[doc(alias = "gtk_grid_layout_child_get_column")]
74 #[doc(alias = "get_column")]
75 pub fn column(&self) -> i32 {
76 unsafe { ffi::gtk_grid_layout_child_get_column(self.to_glib_none().0) }
77 }
78
79 #[doc(alias = "gtk_grid_layout_child_get_column_span")]
85 #[doc(alias = "get_column_span")]
86 #[doc(alias = "column-span")]
87 pub fn column_span(&self) -> i32 {
88 unsafe { ffi::gtk_grid_layout_child_get_column_span(self.to_glib_none().0) }
89 }
90
91 #[doc(alias = "gtk_grid_layout_child_get_row")]
97 #[doc(alias = "get_row")]
98 pub fn row(&self) -> i32 {
99 unsafe { ffi::gtk_grid_layout_child_get_row(self.to_glib_none().0) }
100 }
101
102 #[doc(alias = "gtk_grid_layout_child_get_row_span")]
108 #[doc(alias = "get_row_span")]
109 #[doc(alias = "row-span")]
110 pub fn row_span(&self) -> i32 {
111 unsafe { ffi::gtk_grid_layout_child_get_row_span(self.to_glib_none().0) }
112 }
113
114 #[doc(alias = "gtk_grid_layout_child_set_column")]
118 #[doc(alias = "column")]
119 pub fn set_column(&self, column: i32) {
120 unsafe {
121 ffi::gtk_grid_layout_child_set_column(self.to_glib_none().0, column);
122 }
123 }
124
125 #[doc(alias = "gtk_grid_layout_child_set_column_span")]
129 #[doc(alias = "column-span")]
130 pub fn set_column_span(&self, span: i32) {
131 unsafe {
132 ffi::gtk_grid_layout_child_set_column_span(self.to_glib_none().0, span);
133 }
134 }
135
136 #[doc(alias = "gtk_grid_layout_child_set_row")]
140 #[doc(alias = "row")]
141 pub fn set_row(&self, row: i32) {
142 unsafe {
143 ffi::gtk_grid_layout_child_set_row(self.to_glib_none().0, row);
144 }
145 }
146
147 #[doc(alias = "gtk_grid_layout_child_set_row_span")]
151 #[doc(alias = "row-span")]
152 pub fn set_row_span(&self, span: i32) {
153 unsafe {
154 ffi::gtk_grid_layout_child_set_row_span(self.to_glib_none().0, span);
155 }
156 }
157
158 #[doc(alias = "column")]
159 pub fn connect_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
160 unsafe extern "C" fn notify_column_trampoline<F: Fn(&GridLayoutChild) + 'static>(
161 this: *mut ffi::GtkGridLayoutChild,
162 _param_spec: glib::ffi::gpointer,
163 f: glib::ffi::gpointer,
164 ) {
165 let f: &F = &*(f as *const F);
166 f(&from_glib_borrow(this))
167 }
168 unsafe {
169 let f: Box_<F> = Box_::new(f);
170 connect_raw(
171 self.as_ptr() as *mut _,
172 b"notify::column\0".as_ptr() as *const _,
173 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
174 notify_column_trampoline::<F> as *const (),
175 )),
176 Box_::into_raw(f),
177 )
178 }
179 }
180
181 #[doc(alias = "column-span")]
182 pub fn connect_column_span_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
183 unsafe extern "C" fn notify_column_span_trampoline<F: Fn(&GridLayoutChild) + 'static>(
184 this: *mut ffi::GtkGridLayoutChild,
185 _param_spec: glib::ffi::gpointer,
186 f: glib::ffi::gpointer,
187 ) {
188 let f: &F = &*(f as *const F);
189 f(&from_glib_borrow(this))
190 }
191 unsafe {
192 let f: Box_<F> = Box_::new(f);
193 connect_raw(
194 self.as_ptr() as *mut _,
195 b"notify::column-span\0".as_ptr() as *const _,
196 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
197 notify_column_span_trampoline::<F> as *const (),
198 )),
199 Box_::into_raw(f),
200 )
201 }
202 }
203
204 #[doc(alias = "row")]
205 pub fn connect_row_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
206 unsafe extern "C" fn notify_row_trampoline<F: Fn(&GridLayoutChild) + 'static>(
207 this: *mut ffi::GtkGridLayoutChild,
208 _param_spec: glib::ffi::gpointer,
209 f: glib::ffi::gpointer,
210 ) {
211 let f: &F = &*(f as *const F);
212 f(&from_glib_borrow(this))
213 }
214 unsafe {
215 let f: Box_<F> = Box_::new(f);
216 connect_raw(
217 self.as_ptr() as *mut _,
218 b"notify::row\0".as_ptr() as *const _,
219 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
220 notify_row_trampoline::<F> as *const (),
221 )),
222 Box_::into_raw(f),
223 )
224 }
225 }
226
227 #[doc(alias = "row-span")]
228 pub fn connect_row_span_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
229 unsafe extern "C" fn notify_row_span_trampoline<F: Fn(&GridLayoutChild) + 'static>(
230 this: *mut ffi::GtkGridLayoutChild,
231 _param_spec: glib::ffi::gpointer,
232 f: glib::ffi::gpointer,
233 ) {
234 let f: &F = &*(f as *const F);
235 f(&from_glib_borrow(this))
236 }
237 unsafe {
238 let f: Box_<F> = Box_::new(f);
239 connect_raw(
240 self.as_ptr() as *mut _,
241 b"notify::row-span\0".as_ptr() as *const _,
242 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
243 notify_row_span_trampoline::<F> as *const (),
244 )),
245 Box_::into_raw(f),
246 )
247 }
248 }
249}