gtk4/auto/
grid_layout_child.rs1use crate::{LayoutChild, ffi};
6use glib::{
7 prelude::*,
8 signal::{SignalHandlerId, connect_raw},
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 unsafe {
166 let f: &F = &*(f as *const F);
167 f(&from_glib_borrow(this))
168 }
169 }
170 unsafe {
171 let f: Box_<F> = Box_::new(f);
172 connect_raw(
173 self.as_ptr() as *mut _,
174 c"notify::column".as_ptr() as *const _,
175 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
176 notify_column_trampoline::<F> as *const (),
177 )),
178 Box_::into_raw(f),
179 )
180 }
181 }
182
183 #[doc(alias = "column-span")]
184 pub fn connect_column_span_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
185 unsafe extern "C" fn notify_column_span_trampoline<F: Fn(&GridLayoutChild) + 'static>(
186 this: *mut ffi::GtkGridLayoutChild,
187 _param_spec: glib::ffi::gpointer,
188 f: glib::ffi::gpointer,
189 ) {
190 unsafe {
191 let f: &F = &*(f as *const F);
192 f(&from_glib_borrow(this))
193 }
194 }
195 unsafe {
196 let f: Box_<F> = Box_::new(f);
197 connect_raw(
198 self.as_ptr() as *mut _,
199 c"notify::column-span".as_ptr() as *const _,
200 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
201 notify_column_span_trampoline::<F> as *const (),
202 )),
203 Box_::into_raw(f),
204 )
205 }
206 }
207
208 #[doc(alias = "row")]
209 pub fn connect_row_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
210 unsafe extern "C" fn notify_row_trampoline<F: Fn(&GridLayoutChild) + 'static>(
211 this: *mut ffi::GtkGridLayoutChild,
212 _param_spec: glib::ffi::gpointer,
213 f: glib::ffi::gpointer,
214 ) {
215 unsafe {
216 let f: &F = &*(f as *const F);
217 f(&from_glib_borrow(this))
218 }
219 }
220 unsafe {
221 let f: Box_<F> = Box_::new(f);
222 connect_raw(
223 self.as_ptr() as *mut _,
224 c"notify::row".as_ptr() as *const _,
225 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
226 notify_row_trampoline::<F> as *const (),
227 )),
228 Box_::into_raw(f),
229 )
230 }
231 }
232
233 #[doc(alias = "row-span")]
234 pub fn connect_row_span_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
235 unsafe extern "C" fn notify_row_span_trampoline<F: Fn(&GridLayoutChild) + 'static>(
236 this: *mut ffi::GtkGridLayoutChild,
237 _param_spec: glib::ffi::gpointer,
238 f: glib::ffi::gpointer,
239 ) {
240 unsafe {
241 let f: &F = &*(f as *const F);
242 f(&from_glib_borrow(this))
243 }
244 }
245 unsafe {
246 let f: Box_<F> = Box_::new(f);
247 connect_raw(
248 self.as_ptr() as *mut _,
249 c"notify::row-span".as_ptr() as *const _,
250 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
251 notify_row_span_trampoline::<F> as *const (),
252 )),
253 Box_::into_raw(f),
254 )
255 }
256 }
257}