Skip to main content

gtk4/auto/
grid.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
5#[cfg(feature = "v4_10")]
6#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
7use crate::Accessible;
8use crate::{
9    AccessibleRole, Align, BaselinePosition, Buildable, ConstraintTarget, LayoutManager,
10    Orientable, Orientation, Overflow, PositionType, Widget, ffi,
11};
12use glib::{
13    prelude::*,
14    signal::{SignalHandlerId, connect_raw},
15    translate::*,
16};
17use std::boxed::Box as Box_;
18
19#[cfg(feature = "v4_10")]
20#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
21glib::wrapper! {
22    /// Arranges its child widgets in rows and columns.
23    ///
24    /// <picture>
25    ///   <source srcset="grid-dark.png" media="(prefers-color-scheme: dark)">
26    ///   <img alt="An example GtkGrid" src="grid.png">
27    /// </picture>
28    ///
29    /// It supports arbitrary positions and horizontal/vertical spans.
30    ///
31    /// Children are added using [`GridExt::attach()`][crate::prelude::GridExt::attach()]. They can span multiple
32    /// rows or columns. It is also possible to add a child next to an existing
33    /// child, using [`GridExt::attach_next_to()`][crate::prelude::GridExt::attach_next_to()]. To remove a child from the
34    /// grid, use [`GridExt::remove()`][crate::prelude::GridExt::remove()].
35    ///
36    /// The behaviour of [`Grid`][crate::Grid] when several children occupy the same grid
37    /// cell is undefined.
38    ///
39    /// # GtkGrid as GtkBuildable
40    ///
41    /// Every child in a [`Grid`][crate::Grid] has access to a custom [`Buildable`][crate::Buildable]
42    /// element, called `<layout>`. It can by used to specify a position in the
43    /// grid and optionally spans. All properties that can be used in the `<layout>`
44    /// element are implemented by [`GridLayoutChild`][crate::GridLayoutChild].
45    ///
46    /// It is implemented by [`Widget`][crate::Widget] using [`LayoutManager`][crate::LayoutManager].
47    ///
48    /// To showcase it, here is a simple example:
49    ///
50    /// ```xml
51    /// <object class="GtkGrid" id="my_grid">
52    ///   <child>
53    ///     <object class="GtkButton" id="button1">
54    ///       <property name="label">Button 1</property>
55    ///       <layout>
56    ///         <property name="column">0</property>
57    ///         <property name="row">0</property>
58    ///       </layout>
59    ///     </object>
60    ///   </child>
61    ///   <child>
62    ///     <object class="GtkButton" id="button2">
63    ///       <property name="label">Button 2</property>
64    ///       <layout>
65    ///         <property name="column">1</property>
66    ///         <property name="row">0</property>
67    ///       </layout>
68    ///     </object>
69    ///   </child>
70    ///   <child>
71    ///     <object class="GtkButton" id="button3">
72    ///       <property name="label">Button 3</property>
73    ///       <layout>
74    ///         <property name="column">2</property>
75    ///         <property name="row">0</property>
76    ///         <property name="row-span">2</property>
77    ///       </layout>
78    ///     </object>
79    ///   </child>
80    ///   <child>
81    ///     <object class="GtkButton" id="button4">
82    ///       <property name="label">Button 4</property>
83    ///       <layout>
84    ///         <property name="column">0</property>
85    ///         <property name="row">1</property>
86    ///         <property name="column-span">2</property>
87    ///       </layout>
88    ///     </object>
89    ///   </child>
90    /// </object>
91    /// ```
92    ///
93    /// It organizes the first two buttons side-by-side in one cell each.
94    /// The third button is in the last column but spans across two rows.
95    /// This is defined by the `row-span` property. The last button is
96    /// located in the second row and spans across two columns, which is
97    /// defined by the `column-span` property.
98    ///
99    /// # CSS nodes
100    ///
101    /// [`Grid`][crate::Grid] uses a single CSS node with name `grid`.
102    ///
103    /// # Accessibility
104    ///
105    /// Until GTK 4.10, [`Grid`][crate::Grid] used the [enum@Gtk.AccessibleRole.group] role.
106    ///
107    /// Starting from GTK 4.12, [`Grid`][crate::Grid] uses the [enum@Gtk.AccessibleRole.generic] role.
108    ///
109    /// ## Properties
110    ///
111    ///
112    /// #### `baseline-row`
113    ///  The row to align to the baseline when valign is using baseline alignment.
114    ///
115    /// Readable | Writable
116    ///
117    ///
118    /// #### `column-homogeneous`
119    ///  If [`true`], the columns are all the same width.
120    ///
121    /// Readable | Writable
122    ///
123    ///
124    /// #### `column-spacing`
125    ///  The amount of space between two consecutive columns.
126    ///
127    /// Readable | Writable
128    ///
129    ///
130    /// #### `row-homogeneous`
131    ///  If [`true`], the rows are all the same height.
132    ///
133    /// Readable | Writable
134    ///
135    ///
136    /// #### `row-spacing`
137    ///  The amount of space between two consecutive rows.
138    ///
139    /// Readable | Writable
140    /// <details><summary><h4>Widget</h4></summary>
141    ///
142    ///
143    /// #### `can-focus`
144    ///  Whether the widget or any of its descendents can accept
145    /// the input focus.
146    ///
147    /// This property is meant to be set by widget implementations,
148    /// typically in their instance init function.
149    ///
150    /// Readable | Writable
151    ///
152    ///
153    /// #### `can-target`
154    ///  Whether the widget can receive pointer events.
155    ///
156    /// Readable | Writable
157    ///
158    ///
159    /// #### `css-classes`
160    ///  A list of css classes applied to this widget.
161    ///
162    /// Readable | Writable
163    ///
164    ///
165    /// #### `css-name`
166    ///  The name of this widget in the CSS tree.
167    ///
168    /// This property is meant to be set by widget implementations,
169    /// typically in their instance init function.
170    ///
171    /// Readable | Writable | Construct Only
172    ///
173    ///
174    /// #### `cursor`
175    ///  The cursor used by @widget.
176    ///
177    /// Readable | Writable
178    ///
179    ///
180    /// #### `focus-on-click`
181    ///  Whether the widget should grab focus when it is clicked with the mouse.
182    ///
183    /// This property is only relevant for widgets that can take focus.
184    ///
185    /// Readable | Writable
186    ///
187    ///
188    /// #### `focusable`
189    ///  Whether this widget itself will accept the input focus.
190    ///
191    /// Readable | Writable
192    ///
193    ///
194    /// #### `halign`
195    ///  How to distribute horizontal space if widget gets extra space.
196    ///
197    /// Readable | Writable
198    ///
199    ///
200    /// #### `has-default`
201    ///  Whether the widget is the default widget.
202    ///
203    /// Readable
204    ///
205    ///
206    /// #### `has-focus`
207    ///  Whether the widget has the input focus.
208    ///
209    /// Readable
210    ///
211    ///
212    /// #### `has-tooltip`
213    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
214    /// signal on @widget.
215    ///
216    /// A true value indicates that @widget can have a tooltip, in this case
217    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
218    /// determine whether it will provide a tooltip or not.
219    ///
220    /// Readable | Writable
221    ///
222    ///
223    /// #### `height-request`
224    ///  Overrides for height request of the widget.
225    ///
226    /// If this is -1, the natural request will be used.
227    ///
228    /// Readable | Writable
229    ///
230    ///
231    /// #### `hexpand`
232    ///  Whether to expand horizontally.
233    ///
234    /// Readable | Writable
235    ///
236    ///
237    /// #### `hexpand-set`
238    ///  Whether to use the `hexpand` property.
239    ///
240    /// Readable | Writable
241    ///
242    ///
243    /// #### `layout-manager`
244    ///  The [`LayoutManager`][crate::LayoutManager] instance to use to compute
245    /// the preferred size of the widget, and allocate its children.
246    ///
247    /// This property is meant to be set by widget implementations,
248    /// typically in their instance init function.
249    ///
250    /// Readable | Writable
251    ///
252    ///
253    /// #### `limit-events`
254    ///  Makes this widget act like a modal dialog, with respect to
255    /// event delivery.
256    ///
257    /// Global event controllers will not handle events with targets
258    /// inside the widget, unless they are set up to ignore propagation
259    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
260    ///
261    /// Readable | Writable
262    ///
263    ///
264    /// #### `margin-bottom`
265    ///  Margin on bottom side of widget.
266    ///
267    /// This property adds margin outside of the widget's normal size
268    /// request, the margin will be added in addition to the size from
269    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
270    ///
271    /// Readable | Writable
272    ///
273    ///
274    /// #### `margin-end`
275    ///  Margin on end of widget, horizontally.
276    ///
277    /// This property supports left-to-right and right-to-left text
278    /// directions.
279    ///
280    /// This property adds margin outside of the widget's normal size
281    /// request, the margin will be added in addition to the size from
282    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
283    ///
284    /// Readable | Writable
285    ///
286    ///
287    /// #### `margin-start`
288    ///  Margin on start of widget, horizontally.
289    ///
290    /// This property supports left-to-right and right-to-left text
291    /// directions.
292    ///
293    /// This property adds margin outside of the widget's normal size
294    /// request, the margin will be added in addition to the size from
295    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
296    ///
297    /// Readable | Writable
298    ///
299    ///
300    /// #### `margin-top`
301    ///  Margin on top side of widget.
302    ///
303    /// This property adds margin outside of the widget's normal size
304    /// request, the margin will be added in addition to the size from
305    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
306    ///
307    /// Readable | Writable
308    ///
309    ///
310    /// #### `name`
311    ///  The name of the widget.
312    ///
313    /// Readable | Writable
314    ///
315    ///
316    /// #### `opacity`
317    ///  The requested opacity of the widget.
318    ///
319    /// Readable | Writable
320    ///
321    ///
322    /// #### `overflow`
323    ///  How content outside the widget's content area is treated.
324    ///
325    /// This property is meant to be set by widget implementations,
326    /// typically in their instance init function.
327    ///
328    /// Readable | Writable
329    ///
330    ///
331    /// #### `parent`
332    ///  The parent widget of this widget.
333    ///
334    /// Readable
335    ///
336    ///
337    /// #### `receives-default`
338    ///  Whether the widget will receive the default action when it is focused.
339    ///
340    /// Readable | Writable
341    ///
342    ///
343    /// #### `root`
344    ///  The [`Root`][crate::Root] widget of the widget tree containing this widget.
345    ///
346    /// This will be `NULL` if the widget is not contained in a root widget.
347    ///
348    /// Readable
349    ///
350    ///
351    /// #### `scale-factor`
352    ///  The scale factor of the widget.
353    ///
354    /// Readable
355    ///
356    ///
357    /// #### `sensitive`
358    ///  Whether the widget responds to input.
359    ///
360    /// Readable | Writable
361    ///
362    ///
363    /// #### `tooltip-markup`
364    ///  Sets the text of tooltip to be the given string, which is marked up
365    /// with Pango markup.
366    ///
367    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
368    ///
369    /// This is a convenience property which will take care of getting the
370    /// tooltip shown if the given string is not `NULL`:
371    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
372    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
373    /// the default signal handler.
374    ///
375    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
376    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
377    ///
378    /// Readable | Writable
379    ///
380    ///
381    /// #### `tooltip-text`
382    ///  Sets the text of tooltip to be the given string.
383    ///
384    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
385    ///
386    /// This is a convenience property which will take care of getting the
387    /// tooltip shown if the given string is not `NULL`:
388    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
389    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
390    /// the default signal handler.
391    ///
392    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
393    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
394    ///
395    /// Readable | Writable
396    ///
397    ///
398    /// #### `valign`
399    ///  How to distribute vertical space if widget gets extra space.
400    ///
401    /// Readable | Writable
402    ///
403    ///
404    /// #### `vexpand`
405    ///  Whether to expand vertically.
406    ///
407    /// Readable | Writable
408    ///
409    ///
410    /// #### `vexpand-set`
411    ///  Whether to use the `vexpand` property.
412    ///
413    /// Readable | Writable
414    ///
415    ///
416    /// #### `visible`
417    ///  Whether the widget is visible.
418    ///
419    /// Readable | Writable
420    ///
421    ///
422    /// #### `width-request`
423    ///  Overrides for width request of the widget.
424    ///
425    /// If this is -1, the natural request will be used.
426    ///
427    /// Readable | Writable
428    /// </details>
429    /// <details><summary><h4>Accessible</h4></summary>
430    ///
431    ///
432    /// #### `accessible-role`
433    ///  The accessible role of the given [`Accessible`][crate::Accessible] implementation.
434    ///
435    /// The accessible role cannot be changed once set.
436    ///
437    /// Readable | Writable
438    /// </details>
439    /// <details><summary><h4>Orientable</h4></summary>
440    ///
441    ///
442    /// #### `orientation`
443    ///  The orientation of the orientable.
444    ///
445    /// Readable | Writable
446    /// </details>
447    ///
448    /// # Implements
449    ///
450    /// [`GridExt`][trait@crate::prelude::GridExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ConstraintTargetExt`][trait@crate::prelude::ConstraintTargetExt], [`OrientableExt`][trait@crate::prelude::OrientableExt], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual]
451    #[doc(alias = "GtkGrid")]
452    pub struct Grid(Object<ffi::GtkGrid, ffi::GtkGridClass>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget, Orientable;
453
454    match fn {
455        type_ => || ffi::gtk_grid_get_type(),
456    }
457}
458
459#[cfg(not(feature = "v4_10"))]
460glib::wrapper! {
461    #[doc(alias = "GtkGrid")]
462    pub struct Grid(Object<ffi::GtkGrid, ffi::GtkGridClass>) @extends Widget, @implements Buildable, ConstraintTarget, Orientable;
463
464    match fn {
465        type_ => || ffi::gtk_grid_get_type(),
466    }
467}
468
469impl Grid {
470    pub const NONE: Option<&'static Grid> = None;
471
472    /// Creates a new grid widget.
473    ///
474    /// # Returns
475    ///
476    /// the new [`Grid`][crate::Grid]
477    #[doc(alias = "gtk_grid_new")]
478    pub fn new() -> Grid {
479        assert_initialized_main_thread!();
480        unsafe { Widget::from_glib_none(ffi::gtk_grid_new()).unsafe_cast() }
481    }
482
483    // rustdoc-stripper-ignore-next
484    /// Creates a new builder-pattern struct instance to construct [`Grid`] objects.
485    ///
486    /// This method returns an instance of [`GridBuilder`](crate::builders::GridBuilder) which can be used to create [`Grid`] objects.
487    pub fn builder() -> GridBuilder {
488        GridBuilder::new()
489    }
490}
491
492impl Default for Grid {
493    fn default() -> Self {
494        Self::new()
495    }
496}
497
498// rustdoc-stripper-ignore-next
499/// A [builder-pattern] type to construct [`Grid`] objects.
500///
501/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
502#[must_use = "The builder must be built to be used"]
503pub struct GridBuilder {
504    builder: glib::object::ObjectBuilder<'static, Grid>,
505}
506
507impl GridBuilder {
508    fn new() -> Self {
509        Self {
510            builder: glib::object::Object::builder(),
511        }
512    }
513
514    /// The row to align to the baseline when valign is using baseline alignment.
515    pub fn baseline_row(self, baseline_row: i32) -> Self {
516        Self {
517            builder: self.builder.property("baseline-row", baseline_row),
518        }
519    }
520
521    /// If [`true`], the columns are all the same width.
522    pub fn column_homogeneous(self, column_homogeneous: bool) -> Self {
523        Self {
524            builder: self
525                .builder
526                .property("column-homogeneous", column_homogeneous),
527        }
528    }
529
530    /// The amount of space between two consecutive columns.
531    pub fn column_spacing(self, column_spacing: i32) -> Self {
532        Self {
533            builder: self.builder.property("column-spacing", column_spacing),
534        }
535    }
536
537    /// If [`true`], the rows are all the same height.
538    pub fn row_homogeneous(self, row_homogeneous: bool) -> Self {
539        Self {
540            builder: self.builder.property("row-homogeneous", row_homogeneous),
541        }
542    }
543
544    /// The amount of space between two consecutive rows.
545    pub fn row_spacing(self, row_spacing: i32) -> Self {
546        Self {
547            builder: self.builder.property("row-spacing", row_spacing),
548        }
549    }
550
551    /// Whether the widget or any of its descendents can accept
552    /// the input focus.
553    ///
554    /// This property is meant to be set by widget implementations,
555    /// typically in their instance init function.
556    pub fn can_focus(self, can_focus: bool) -> Self {
557        Self {
558            builder: self.builder.property("can-focus", can_focus),
559        }
560    }
561
562    /// Whether the widget can receive pointer events.
563    pub fn can_target(self, can_target: bool) -> Self {
564        Self {
565            builder: self.builder.property("can-target", can_target),
566        }
567    }
568
569    /// A list of css classes applied to this widget.
570    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
571        Self {
572            builder: self.builder.property("css-classes", css_classes.into()),
573        }
574    }
575
576    /// The name of this widget in the CSS tree.
577    ///
578    /// This property is meant to be set by widget implementations,
579    /// typically in their instance init function.
580    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
581        Self {
582            builder: self.builder.property("css-name", css_name.into()),
583        }
584    }
585
586    /// The cursor used by @widget.
587    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
588        Self {
589            builder: self.builder.property("cursor", cursor.clone()),
590        }
591    }
592
593    /// Whether the widget should grab focus when it is clicked with the mouse.
594    ///
595    /// This property is only relevant for widgets that can take focus.
596    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
597        Self {
598            builder: self.builder.property("focus-on-click", focus_on_click),
599        }
600    }
601
602    /// Whether this widget itself will accept the input focus.
603    pub fn focusable(self, focusable: bool) -> Self {
604        Self {
605            builder: self.builder.property("focusable", focusable),
606        }
607    }
608
609    /// How to distribute horizontal space if widget gets extra space.
610    pub fn halign(self, halign: Align) -> Self {
611        Self {
612            builder: self.builder.property("halign", halign),
613        }
614    }
615
616    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
617    /// signal on @widget.
618    ///
619    /// A true value indicates that @widget can have a tooltip, in this case
620    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
621    /// determine whether it will provide a tooltip or not.
622    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
623        Self {
624            builder: self.builder.property("has-tooltip", has_tooltip),
625        }
626    }
627
628    /// Overrides for height request of the widget.
629    ///
630    /// If this is -1, the natural request will be used.
631    pub fn height_request(self, height_request: i32) -> Self {
632        Self {
633            builder: self.builder.property("height-request", height_request),
634        }
635    }
636
637    /// Whether to expand horizontally.
638    pub fn hexpand(self, hexpand: bool) -> Self {
639        Self {
640            builder: self.builder.property("hexpand", hexpand),
641        }
642    }
643
644    /// Whether to use the `hexpand` property.
645    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
646        Self {
647            builder: self.builder.property("hexpand-set", hexpand_set),
648        }
649    }
650
651    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
652    /// the preferred size of the widget, and allocate its children.
653    ///
654    /// This property is meant to be set by widget implementations,
655    /// typically in their instance init function.
656    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
657        Self {
658            builder: self
659                .builder
660                .property("layout-manager", layout_manager.clone().upcast()),
661        }
662    }
663
664    /// Makes this widget act like a modal dialog, with respect to
665    /// event delivery.
666    ///
667    /// Global event controllers will not handle events with targets
668    /// inside the widget, unless they are set up to ignore propagation
669    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
670    #[cfg(feature = "v4_18")]
671    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
672    pub fn limit_events(self, limit_events: bool) -> Self {
673        Self {
674            builder: self.builder.property("limit-events", limit_events),
675        }
676    }
677
678    /// Margin on bottom side of widget.
679    ///
680    /// This property adds margin outside of the widget's normal size
681    /// request, the margin will be added in addition to the size from
682    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
683    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
684        Self {
685            builder: self.builder.property("margin-bottom", margin_bottom),
686        }
687    }
688
689    /// Margin on end of widget, horizontally.
690    ///
691    /// This property supports left-to-right and right-to-left text
692    /// directions.
693    ///
694    /// This property adds margin outside of the widget's normal size
695    /// request, the margin will be added in addition to the size from
696    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
697    pub fn margin_end(self, margin_end: i32) -> Self {
698        Self {
699            builder: self.builder.property("margin-end", margin_end),
700        }
701    }
702
703    /// Margin on start of widget, horizontally.
704    ///
705    /// This property supports left-to-right and right-to-left text
706    /// directions.
707    ///
708    /// This property adds margin outside of the widget's normal size
709    /// request, the margin will be added in addition to the size from
710    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
711    pub fn margin_start(self, margin_start: i32) -> Self {
712        Self {
713            builder: self.builder.property("margin-start", margin_start),
714        }
715    }
716
717    /// Margin on top side of widget.
718    ///
719    /// This property adds margin outside of the widget's normal size
720    /// request, the margin will be added in addition to the size from
721    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
722    pub fn margin_top(self, margin_top: i32) -> Self {
723        Self {
724            builder: self.builder.property("margin-top", margin_top),
725        }
726    }
727
728    /// The name of the widget.
729    pub fn name(self, name: impl Into<glib::GString>) -> Self {
730        Self {
731            builder: self.builder.property("name", name.into()),
732        }
733    }
734
735    /// The requested opacity of the widget.
736    pub fn opacity(self, opacity: f64) -> Self {
737        Self {
738            builder: self.builder.property("opacity", opacity),
739        }
740    }
741
742    /// How content outside the widget's content area is treated.
743    ///
744    /// This property is meant to be set by widget implementations,
745    /// typically in their instance init function.
746    pub fn overflow(self, overflow: Overflow) -> Self {
747        Self {
748            builder: self.builder.property("overflow", overflow),
749        }
750    }
751
752    /// Whether the widget will receive the default action when it is focused.
753    pub fn receives_default(self, receives_default: bool) -> Self {
754        Self {
755            builder: self.builder.property("receives-default", receives_default),
756        }
757    }
758
759    /// Whether the widget responds to input.
760    pub fn sensitive(self, sensitive: bool) -> Self {
761        Self {
762            builder: self.builder.property("sensitive", sensitive),
763        }
764    }
765
766    /// Sets the text of tooltip to be the given string, which is marked up
767    /// with Pango markup.
768    ///
769    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
770    ///
771    /// This is a convenience property which will take care of getting the
772    /// tooltip shown if the given string is not `NULL`:
773    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
774    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
775    /// the default signal handler.
776    ///
777    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
778    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
779    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
780        Self {
781            builder: self
782                .builder
783                .property("tooltip-markup", tooltip_markup.into()),
784        }
785    }
786
787    /// Sets the text of tooltip to be the given string.
788    ///
789    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
790    ///
791    /// This is a convenience property which will take care of getting the
792    /// tooltip shown if the given string is not `NULL`:
793    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
794    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
795    /// the default signal handler.
796    ///
797    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
798    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
799    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
800        Self {
801            builder: self.builder.property("tooltip-text", tooltip_text.into()),
802        }
803    }
804
805    /// How to distribute vertical space if widget gets extra space.
806    pub fn valign(self, valign: Align) -> Self {
807        Self {
808            builder: self.builder.property("valign", valign),
809        }
810    }
811
812    /// Whether to expand vertically.
813    pub fn vexpand(self, vexpand: bool) -> Self {
814        Self {
815            builder: self.builder.property("vexpand", vexpand),
816        }
817    }
818
819    /// Whether to use the `vexpand` property.
820    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
821        Self {
822            builder: self.builder.property("vexpand-set", vexpand_set),
823        }
824    }
825
826    /// Whether the widget is visible.
827    pub fn visible(self, visible: bool) -> Self {
828        Self {
829            builder: self.builder.property("visible", visible),
830        }
831    }
832
833    /// Overrides for width request of the widget.
834    ///
835    /// If this is -1, the natural request will be used.
836    pub fn width_request(self, width_request: i32) -> Self {
837        Self {
838            builder: self.builder.property("width-request", width_request),
839        }
840    }
841
842    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
843    ///
844    /// The accessible role cannot be changed once set.
845    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
846        Self {
847            builder: self.builder.property("accessible-role", accessible_role),
848        }
849    }
850
851    /// The orientation of the orientable.
852    pub fn orientation(self, orientation: Orientation) -> Self {
853        Self {
854            builder: self.builder.property("orientation", orientation),
855        }
856    }
857
858    // rustdoc-stripper-ignore-next
859    /// Build the [`Grid`].
860    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
861    pub fn build(self) -> Grid {
862        assert_initialized_main_thread!();
863        self.builder.build()
864    }
865}
866
867/// Trait containing all [`struct@Grid`] methods.
868///
869/// # Implementors
870///
871/// [`Grid`][struct@crate::Grid]
872pub trait GridExt: IsA<Grid> + 'static {
873    /// Adds a widget to the grid.
874    ///
875    /// The position of @child is determined by @column and @row.
876    /// The number of “cells” that @child will occupy is determined
877    /// by @width and @height.
878    /// ## `child`
879    /// the widget to add
880    /// ## `column`
881    /// the column number to attach the left side of @child to
882    /// ## `row`
883    /// the row number to attach the top side of @child to
884    /// ## `width`
885    /// the number of columns that @child will span
886    /// ## `height`
887    /// the number of rows that @child will span
888    #[doc(alias = "gtk_grid_attach")]
889    fn attach(&self, child: &impl IsA<Widget>, column: i32, row: i32, width: i32, height: i32) {
890        unsafe {
891            ffi::gtk_grid_attach(
892                self.as_ref().to_glib_none().0,
893                child.as_ref().to_glib_none().0,
894                column,
895                row,
896                width,
897                height,
898            );
899        }
900    }
901
902    /// Adds a widget to the grid.
903    ///
904    /// The widget is placed next to @sibling, on the side determined by
905    /// @side. When @sibling is [`None`], the widget is placed in row (for
906    /// left or right placement) or column 0 (for top or bottom placement),
907    /// at the end indicated by @side.
908    ///
909    /// Attaching widgets labeled `[1]`, `[2]`, `[3]` with `@sibling == [`None`]` and
910    /// `@side == [`PositionType::Left`][crate::PositionType::Left]` yields a layout of `[3][2][1]`.
911    /// ## `child`
912    /// the widget to add
913    /// ## `sibling`
914    /// the child of @self that @child will be placed
915    ///   next to, or [`None`] to place @child at the beginning or end
916    /// ## `side`
917    /// the side of @sibling that @child is positioned next to
918    /// ## `width`
919    /// the number of columns that @child will span
920    /// ## `height`
921    /// the number of rows that @child will span
922    #[doc(alias = "gtk_grid_attach_next_to")]
923    fn attach_next_to(
924        &self,
925        child: &impl IsA<Widget>,
926        sibling: Option<&impl IsA<Widget>>,
927        side: PositionType,
928        width: i32,
929        height: i32,
930    ) {
931        unsafe {
932            ffi::gtk_grid_attach_next_to(
933                self.as_ref().to_glib_none().0,
934                child.as_ref().to_glib_none().0,
935                sibling.map(|p| p.as_ref()).to_glib_none().0,
936                side.into_glib(),
937                width,
938                height,
939            );
940        }
941    }
942
943    /// Returns which row defines the global baseline of @self.
944    ///
945    /// # Returns
946    ///
947    /// the row index defining the global baseline
948    #[doc(alias = "gtk_grid_get_baseline_row")]
949    #[doc(alias = "get_baseline_row")]
950    #[doc(alias = "baseline-row")]
951    fn baseline_row(&self) -> i32 {
952        unsafe { ffi::gtk_grid_get_baseline_row(self.as_ref().to_glib_none().0) }
953    }
954
955    /// Gets the child of @self whose area covers the grid
956    /// cell at @column, @row.
957    /// ## `column`
958    /// the left edge of the cell
959    /// ## `row`
960    /// the top edge of the cell
961    ///
962    /// # Returns
963    ///
964    /// the child at the given position
965    #[doc(alias = "gtk_grid_get_child_at")]
966    #[doc(alias = "get_child_at")]
967    fn child_at(&self, column: i32, row: i32) -> Option<Widget> {
968        unsafe {
969            from_glib_none(ffi::gtk_grid_get_child_at(
970                self.as_ref().to_glib_none().0,
971                column,
972                row,
973            ))
974        }
975    }
976
977    /// Returns whether all columns of @self have the same width.
978    ///
979    /// # Returns
980    ///
981    /// whether all columns of @self have the same width.
982    #[doc(alias = "gtk_grid_get_column_homogeneous")]
983    #[doc(alias = "get_column_homogeneous")]
984    #[doc(alias = "column-homogeneous")]
985    fn is_column_homogeneous(&self) -> bool {
986        unsafe {
987            from_glib(ffi::gtk_grid_get_column_homogeneous(
988                self.as_ref().to_glib_none().0,
989            ))
990        }
991    }
992
993    /// Returns the amount of space between the columns of @self.
994    ///
995    /// # Returns
996    ///
997    /// the column spacing of @self
998    #[doc(alias = "gtk_grid_get_column_spacing")]
999    #[doc(alias = "get_column_spacing")]
1000    #[doc(alias = "column-spacing")]
1001    fn column_spacing(&self) -> u32 {
1002        unsafe { ffi::gtk_grid_get_column_spacing(self.as_ref().to_glib_none().0) }
1003    }
1004
1005    /// Returns the baseline position of @row.
1006    ///
1007    /// See [`set_row_baseline_position()`][Self::set_row_baseline_position()].
1008    /// ## `row`
1009    /// a row index
1010    ///
1011    /// # Returns
1012    ///
1013    /// the baseline position of @row
1014    #[doc(alias = "gtk_grid_get_row_baseline_position")]
1015    #[doc(alias = "get_row_baseline_position")]
1016    fn row_baseline_position(&self, row: i32) -> BaselinePosition {
1017        unsafe {
1018            from_glib(ffi::gtk_grid_get_row_baseline_position(
1019                self.as_ref().to_glib_none().0,
1020                row,
1021            ))
1022        }
1023    }
1024
1025    /// Returns whether all rows of @self have the same height.
1026    ///
1027    /// # Returns
1028    ///
1029    /// whether all rows of @self have the same height.
1030    #[doc(alias = "gtk_grid_get_row_homogeneous")]
1031    #[doc(alias = "get_row_homogeneous")]
1032    #[doc(alias = "row-homogeneous")]
1033    fn is_row_homogeneous(&self) -> bool {
1034        unsafe {
1035            from_glib(ffi::gtk_grid_get_row_homogeneous(
1036                self.as_ref().to_glib_none().0,
1037            ))
1038        }
1039    }
1040
1041    /// Returns the amount of space between the rows of @self.
1042    ///
1043    /// # Returns
1044    ///
1045    /// the row spacing of @self
1046    #[doc(alias = "gtk_grid_get_row_spacing")]
1047    #[doc(alias = "get_row_spacing")]
1048    #[doc(alias = "row-spacing")]
1049    fn row_spacing(&self) -> u32 {
1050        unsafe { ffi::gtk_grid_get_row_spacing(self.as_ref().to_glib_none().0) }
1051    }
1052
1053    /// Inserts a column at the specified position.
1054    ///
1055    /// Children which are attached at or to the right of this position
1056    /// are moved one column to the right. Children which span across this
1057    /// position are grown to span the new column.
1058    /// ## `position`
1059    /// the position to insert the column at
1060    #[doc(alias = "gtk_grid_insert_column")]
1061    fn insert_column(&self, position: i32) {
1062        unsafe {
1063            ffi::gtk_grid_insert_column(self.as_ref().to_glib_none().0, position);
1064        }
1065    }
1066
1067    /// Inserts a row or column at the specified position.
1068    ///
1069    /// The new row or column is placed next to @sibling, on the side
1070    /// determined by @side. If @side is [`PositionType::Top`][crate::PositionType::Top] or [`PositionType::Bottom`][crate::PositionType::Bottom],
1071    /// a row is inserted. If @side is [`PositionType::Left`][crate::PositionType::Left] of [`PositionType::Right`][crate::PositionType::Right],
1072    /// a column is inserted.
1073    /// ## `sibling`
1074    /// the child of @self that the new row or column will be
1075    ///   placed next to
1076    /// ## `side`
1077    /// the side of @sibling that @child is positioned next to
1078    #[doc(alias = "gtk_grid_insert_next_to")]
1079    fn insert_next_to(&self, sibling: &impl IsA<Widget>, side: PositionType) {
1080        unsafe {
1081            ffi::gtk_grid_insert_next_to(
1082                self.as_ref().to_glib_none().0,
1083                sibling.as_ref().to_glib_none().0,
1084                side.into_glib(),
1085            );
1086        }
1087    }
1088
1089    /// Inserts a row at the specified position.
1090    ///
1091    /// Children which are attached at or below this position
1092    /// are moved one row down. Children which span across this
1093    /// position are grown to span the new row.
1094    /// ## `position`
1095    /// the position to insert the row at
1096    #[doc(alias = "gtk_grid_insert_row")]
1097    fn insert_row(&self, position: i32) {
1098        unsafe {
1099            ffi::gtk_grid_insert_row(self.as_ref().to_glib_none().0, position);
1100        }
1101    }
1102
1103    /// Queries the attach points and spans of @child inside the given [`Grid`][crate::Grid].
1104    /// ## `child`
1105    /// a [`Widget`][crate::Widget] child of @self
1106    ///
1107    /// # Returns
1108    ///
1109    ///
1110    /// ## `column`
1111    /// the column used to attach the left side of @child
1112    ///
1113    /// ## `row`
1114    /// the row used to attach the top side of @child
1115    ///
1116    /// ## `width`
1117    /// the number of columns @child spans
1118    ///
1119    /// ## `height`
1120    /// the number of rows @child spans
1121    #[doc(alias = "gtk_grid_query_child")]
1122    fn query_child(&self, child: &impl IsA<Widget>) -> (i32, i32, i32, i32) {
1123        unsafe {
1124            let mut column = std::mem::MaybeUninit::uninit();
1125            let mut row = std::mem::MaybeUninit::uninit();
1126            let mut width = std::mem::MaybeUninit::uninit();
1127            let mut height = std::mem::MaybeUninit::uninit();
1128            ffi::gtk_grid_query_child(
1129                self.as_ref().to_glib_none().0,
1130                child.as_ref().to_glib_none().0,
1131                column.as_mut_ptr(),
1132                row.as_mut_ptr(),
1133                width.as_mut_ptr(),
1134                height.as_mut_ptr(),
1135            );
1136            (
1137                column.assume_init(),
1138                row.assume_init(),
1139                width.assume_init(),
1140                height.assume_init(),
1141            )
1142        }
1143    }
1144
1145    /// Removes a child from @self.
1146    ///
1147    /// The child must have been added with
1148    /// [`attach()`][Self::attach()] or [`attach_next_to()`][Self::attach_next_to()].
1149    /// ## `child`
1150    /// the child widget to remove
1151    #[doc(alias = "gtk_grid_remove")]
1152    fn remove(&self, child: &impl IsA<Widget>) {
1153        unsafe {
1154            ffi::gtk_grid_remove(
1155                self.as_ref().to_glib_none().0,
1156                child.as_ref().to_glib_none().0,
1157            );
1158        }
1159    }
1160
1161    /// Removes a column from the grid.
1162    ///
1163    /// Children that are placed in this column are removed,
1164    /// spanning children that overlap this column have their
1165    /// width reduced by one, and children after the column
1166    /// are moved to the left.
1167    /// ## `position`
1168    /// the position of the column to remove
1169    #[doc(alias = "gtk_grid_remove_column")]
1170    fn remove_column(&self, position: i32) {
1171        unsafe {
1172            ffi::gtk_grid_remove_column(self.as_ref().to_glib_none().0, position);
1173        }
1174    }
1175
1176    /// Removes a row from the grid.
1177    ///
1178    /// Children that are placed in this row are removed,
1179    /// spanning children that overlap this row have their
1180    /// height reduced by one, and children below the row
1181    /// are moved up.
1182    /// ## `position`
1183    /// the position of the row to remove
1184    #[doc(alias = "gtk_grid_remove_row")]
1185    fn remove_row(&self, position: i32) {
1186        unsafe {
1187            ffi::gtk_grid_remove_row(self.as_ref().to_glib_none().0, position);
1188        }
1189    }
1190
1191    /// Sets which row defines the global baseline for the entire grid.
1192    ///
1193    /// Each row in the grid can have its own local baseline, but only
1194    /// one of those is global, meaning it will be the baseline in the
1195    /// parent of the @self.
1196    /// ## `row`
1197    /// the row index
1198    #[doc(alias = "gtk_grid_set_baseline_row")]
1199    #[doc(alias = "baseline-row")]
1200    fn set_baseline_row(&self, row: i32) {
1201        unsafe {
1202            ffi::gtk_grid_set_baseline_row(self.as_ref().to_glib_none().0, row);
1203        }
1204    }
1205
1206    /// Sets whether all columns of @self will have the same width.
1207    /// ## `homogeneous`
1208    /// [`true`] to make columns homogeneous
1209    #[doc(alias = "gtk_grid_set_column_homogeneous")]
1210    #[doc(alias = "column-homogeneous")]
1211    fn set_column_homogeneous(&self, homogeneous: bool) {
1212        unsafe {
1213            ffi::gtk_grid_set_column_homogeneous(
1214                self.as_ref().to_glib_none().0,
1215                homogeneous.into_glib(),
1216            );
1217        }
1218    }
1219
1220    /// Sets the amount of space between columns of @self.
1221    /// ## `spacing`
1222    /// the amount of space to insert between columns
1223    #[doc(alias = "gtk_grid_set_column_spacing")]
1224    #[doc(alias = "column-spacing")]
1225    fn set_column_spacing(&self, spacing: u32) {
1226        unsafe {
1227            ffi::gtk_grid_set_column_spacing(self.as_ref().to_glib_none().0, spacing);
1228        }
1229    }
1230
1231    /// Sets how the baseline should be positioned on @row of the
1232    /// grid, in case that row is assigned more space than is requested.
1233    ///
1234    /// The default baseline position is [`BaselinePosition::Center`][crate::BaselinePosition::Center].
1235    /// ## `row`
1236    /// a row index
1237    /// ## `pos`
1238    /// a [`BaselinePosition`][crate::BaselinePosition]
1239    #[doc(alias = "gtk_grid_set_row_baseline_position")]
1240    fn set_row_baseline_position(&self, row: i32, pos: BaselinePosition) {
1241        unsafe {
1242            ffi::gtk_grid_set_row_baseline_position(
1243                self.as_ref().to_glib_none().0,
1244                row,
1245                pos.into_glib(),
1246            );
1247        }
1248    }
1249
1250    /// Sets whether all rows of @self will have the same height.
1251    /// ## `homogeneous`
1252    /// [`true`] to make rows homogeneous
1253    #[doc(alias = "gtk_grid_set_row_homogeneous")]
1254    #[doc(alias = "row-homogeneous")]
1255    fn set_row_homogeneous(&self, homogeneous: bool) {
1256        unsafe {
1257            ffi::gtk_grid_set_row_homogeneous(
1258                self.as_ref().to_glib_none().0,
1259                homogeneous.into_glib(),
1260            );
1261        }
1262    }
1263
1264    /// Sets the amount of space between rows of @self.
1265    /// ## `spacing`
1266    /// the amount of space to insert between rows
1267    #[doc(alias = "gtk_grid_set_row_spacing")]
1268    #[doc(alias = "row-spacing")]
1269    fn set_row_spacing(&self, spacing: u32) {
1270        unsafe {
1271            ffi::gtk_grid_set_row_spacing(self.as_ref().to_glib_none().0, spacing);
1272        }
1273    }
1274
1275    #[doc(alias = "baseline-row")]
1276    fn connect_baseline_row_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1277        unsafe extern "C" fn notify_baseline_row_trampoline<P: IsA<Grid>, F: Fn(&P) + 'static>(
1278            this: *mut ffi::GtkGrid,
1279            _param_spec: glib::ffi::gpointer,
1280            f: glib::ffi::gpointer,
1281        ) {
1282            unsafe {
1283                let f: &F = &*(f as *const F);
1284                f(Grid::from_glib_borrow(this).unsafe_cast_ref())
1285            }
1286        }
1287        unsafe {
1288            let f: Box_<F> = Box_::new(f);
1289            connect_raw(
1290                self.as_ptr() as *mut _,
1291                c"notify::baseline-row".as_ptr(),
1292                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1293                    notify_baseline_row_trampoline::<Self, F> as *const (),
1294                )),
1295                Box_::into_raw(f),
1296            )
1297        }
1298    }
1299
1300    #[doc(alias = "column-homogeneous")]
1301    fn connect_column_homogeneous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1302        unsafe extern "C" fn notify_column_homogeneous_trampoline<
1303            P: IsA<Grid>,
1304            F: Fn(&P) + 'static,
1305        >(
1306            this: *mut ffi::GtkGrid,
1307            _param_spec: glib::ffi::gpointer,
1308            f: glib::ffi::gpointer,
1309        ) {
1310            unsafe {
1311                let f: &F = &*(f as *const F);
1312                f(Grid::from_glib_borrow(this).unsafe_cast_ref())
1313            }
1314        }
1315        unsafe {
1316            let f: Box_<F> = Box_::new(f);
1317            connect_raw(
1318                self.as_ptr() as *mut _,
1319                c"notify::column-homogeneous".as_ptr(),
1320                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1321                    notify_column_homogeneous_trampoline::<Self, F> as *const (),
1322                )),
1323                Box_::into_raw(f),
1324            )
1325        }
1326    }
1327
1328    #[doc(alias = "column-spacing")]
1329    fn connect_column_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1330        unsafe extern "C" fn notify_column_spacing_trampoline<P: IsA<Grid>, F: Fn(&P) + 'static>(
1331            this: *mut ffi::GtkGrid,
1332            _param_spec: glib::ffi::gpointer,
1333            f: glib::ffi::gpointer,
1334        ) {
1335            unsafe {
1336                let f: &F = &*(f as *const F);
1337                f(Grid::from_glib_borrow(this).unsafe_cast_ref())
1338            }
1339        }
1340        unsafe {
1341            let f: Box_<F> = Box_::new(f);
1342            connect_raw(
1343                self.as_ptr() as *mut _,
1344                c"notify::column-spacing".as_ptr(),
1345                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1346                    notify_column_spacing_trampoline::<Self, F> as *const (),
1347                )),
1348                Box_::into_raw(f),
1349            )
1350        }
1351    }
1352
1353    #[doc(alias = "row-homogeneous")]
1354    fn connect_row_homogeneous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1355        unsafe extern "C" fn notify_row_homogeneous_trampoline<
1356            P: IsA<Grid>,
1357            F: Fn(&P) + 'static,
1358        >(
1359            this: *mut ffi::GtkGrid,
1360            _param_spec: glib::ffi::gpointer,
1361            f: glib::ffi::gpointer,
1362        ) {
1363            unsafe {
1364                let f: &F = &*(f as *const F);
1365                f(Grid::from_glib_borrow(this).unsafe_cast_ref())
1366            }
1367        }
1368        unsafe {
1369            let f: Box_<F> = Box_::new(f);
1370            connect_raw(
1371                self.as_ptr() as *mut _,
1372                c"notify::row-homogeneous".as_ptr(),
1373                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1374                    notify_row_homogeneous_trampoline::<Self, F> as *const (),
1375                )),
1376                Box_::into_raw(f),
1377            )
1378        }
1379    }
1380
1381    #[doc(alias = "row-spacing")]
1382    fn connect_row_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1383        unsafe extern "C" fn notify_row_spacing_trampoline<P: IsA<Grid>, F: Fn(&P) + 'static>(
1384            this: *mut ffi::GtkGrid,
1385            _param_spec: glib::ffi::gpointer,
1386            f: glib::ffi::gpointer,
1387        ) {
1388            unsafe {
1389                let f: &F = &*(f as *const F);
1390                f(Grid::from_glib_borrow(this).unsafe_cast_ref())
1391            }
1392        }
1393        unsafe {
1394            let f: Box_<F> = Box_::new(f);
1395            connect_raw(
1396                self.as_ptr() as *mut _,
1397                c"notify::row-spacing".as_ptr(),
1398                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1399                    notify_row_spacing_trampoline::<Self, F> as *const (),
1400                )),
1401                Box_::into_raw(f),
1402            )
1403        }
1404    }
1405}
1406
1407impl<O: IsA<Grid>> GridExt for O {}