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    /// [`LayoutChild`][crate::LayoutChild] subclass for children in a [`GridLayout`][crate::GridLayout].
15    ///
16    /// ## Properties
17    ///
18    ///
19    /// #### `column`
20    ///  The column to place the child in.
21    ///
22    /// Readable | Writeable
23    ///
24    ///
25    /// #### `column-span`
26    ///  The number of columns the child spans to.
27    ///
28    /// Readable | Writeable
29    ///
30    ///
31    /// #### `row`
32    ///  The row to place the child in.
33    ///
34    /// Readable | Writeable
35    ///
36    ///
37    /// #### `row-span`
38    ///  The number of rows the child spans to.
39    ///
40    /// Readable | Writeable
41    /// <details><summary><h4>LayoutChild</h4></summary>
42    ///
43    ///
44    /// #### `child-widget`
45    ///  The widget that is associated to the [`LayoutChild`][crate::LayoutChild] instance.
46    ///
47    /// Readable | Writeable | Construct Only
48    ///
49    ///
50    /// #### `layout-manager`
51    ///  The layout manager that created the [`LayoutChild`][crate::LayoutChild] instance.
52    ///
53    /// Readable | Writeable | Construct Only
54    /// </details>
55    ///
56    /// # Implements
57    ///
58    /// [`LayoutChildExt`][trait@crate::prelude::LayoutChildExt], [`trait@glib::ObjectExt`]
59    #[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    /// Retrieves the column number to which @self attaches its left side.
69    ///
70    /// # Returns
71    ///
72    /// the column number
73    #[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    /// Retrieves the number of columns that @self spans to.
80    ///
81    /// # Returns
82    ///
83    /// the number of columns
84    #[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    /// Retrieves the row number to which @self attaches its top side.
92    ///
93    /// # Returns
94    ///
95    /// the row number
96    #[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    /// Retrieves the number of rows that @self spans to.
103    ///
104    /// # Returns
105    ///
106    /// the number of row
107    #[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    /// Sets the column number to attach the left side of @self.
115    /// ## `column`
116    /// the attach point for @self
117    #[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    /// Sets the number of columns @self spans to.
126    /// ## `span`
127    /// the span of @self
128    #[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    /// Sets the row to place @self in.
137    /// ## `row`
138    /// the row for @self
139    #[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    /// Sets the number of rows @self spans to.
148    /// ## `span`
149    /// the span of @self
150    #[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}