gtk4/auto/
paned.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::AccessibleRange;
8use crate::{
9    ffi, Accessible, AccessibleRole, Align, Buildable, ConstraintTarget, LayoutManager, Orientable,
10    Orientation, Overflow, ScrollType, Widget,
11};
12use glib::{
13    object::ObjectType as _,
14    prelude::*,
15    signal::{connect_raw, SignalHandlerId},
16    translate::*,
17};
18use std::boxed::Box as Box_;
19
20#[cfg(feature = "v4_10")]
21#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
22glib::wrapper! {
23    /// A widget with two panes, arranged either horizontally or vertically.
24    ///
25    /// ![An example GtkPaned](panes.png)
26    ///
27    /// The division between the two panes is adjustable by the user
28    /// by dragging a handle.
29    ///
30    /// Child widgets are added to the panes of the widget with
31    /// [`set_start_child()`][Self::set_start_child()] and [`set_end_child()`][Self::set_end_child()].
32    /// The division between the two children is set by default from the size
33    /// requests of the children, but it can be adjusted by the user.
34    ///
35    /// A paned widget draws a separator between the two child widgets and a
36    /// small handle that the user can drag to adjust the division. It does not
37    /// draw any relief around the children or around the separator. (The space
38    /// in which the separator is called the gutter.) Often, it is useful to put
39    /// each child inside a [`Frame`][crate::Frame] so that the gutter appears as a
40    /// ridge. No separator is drawn if one of the children is missing.
41    ///
42    /// Each child has two options that can be set, "resize" and "shrink". If
43    /// "resize" is true then, when the [`Paned`][crate::Paned] is resized, that child will
44    /// expand or shrink along with the paned widget. If "shrink" is true, then
45    /// that child can be made smaller than its requisition by the user.
46    /// Setting "shrink" to false allows the application to set a minimum size.
47    /// If "resize" is false for both children, then this is treated as if
48    /// "resize" is true for both children.
49    ///
50    /// The application can set the position of the slider as if it were set
51    /// by the user, by calling [`set_position()`][Self::set_position()].
52    ///
53    /// # Shortcuts and Gestures
54    ///
55    /// The following signals have default keybindings:
56    ///
57    /// - [`accept-position`][struct@crate::Paned#accept-position]
58    /// - [`cancel-position`][struct@crate::Paned#cancel-position]
59    /// - [`cycle-child-focus`][struct@crate::Paned#cycle-child-focus]
60    /// - [`cycle-handle-focus`][struct@crate::Paned#cycle-handle-focus]
61    /// - [`move-handle`][struct@crate::Paned#move-handle]
62    /// - [`toggle-handle-focus`][struct@crate::Paned#toggle-handle-focus]
63    ///
64    /// # CSS nodes
65    ///
66    /// ```text
67    /// paned
68    /// ├── <child>
69    /// ├── separator[.wide]
70    /// ╰── <child>
71    /// ```
72    ///
73    /// [`Paned`][crate::Paned] has a main CSS node with name paned, and a subnode for
74    /// the separator with name separator. The subnode gets a .wide style
75    /// class when the paned is supposed to be wide.
76    ///
77    /// In horizontal orientation, the nodes are arranged based on the text
78    /// direction, so in left-to-right mode, :first-child will select the
79    /// leftmost child, while it will select the rightmost child in
80    /// RTL layouts.
81    ///
82    /// ## Creating a paned widget with minimum sizes.
83    ///
84    /// **⚠️ The following code is in c ⚠️**
85    ///
86    /// ```c
87    /// GtkWidget *hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
88    /// GtkWidget *frame1 = gtk_frame_new (NULL);
89    /// GtkWidget *frame2 = gtk_frame_new (NULL);
90    ///
91    /// gtk_widget_set_size_request (hpaned, 200, -1);
92    ///
93    /// gtk_paned_set_start_child (GTK_PANED (hpaned), frame1);
94    /// gtk_paned_set_resize_start_child (GTK_PANED (hpaned), TRUE);
95    /// gtk_paned_set_shrink_start_child (GTK_PANED (hpaned), FALSE);
96    /// gtk_widget_set_size_request (frame1, 50, -1);
97    ///
98    /// gtk_paned_set_end_child (GTK_PANED (hpaned), frame2);
99    /// gtk_paned_set_resize_end_child (GTK_PANED (hpaned), FALSE);
100    /// gtk_paned_set_shrink_end_child (GTK_PANED (hpaned), FALSE);
101    /// gtk_widget_set_size_request (frame2, 50, -1);
102    /// ```
103    ///
104    /// ## Properties
105    ///
106    ///
107    /// #### `end-child`
108    ///  The second child.
109    ///
110    /// Readable | Writeable
111    ///
112    ///
113    /// #### `max-position`
114    ///  The largest possible value for the [`position`][struct@crate::Paned#position]
115    /// property.
116    ///
117    /// This property is derived from the size and shrinkability
118    /// of the widget's children.
119    ///
120    /// Readable
121    ///
122    ///
123    /// #### `min-position`
124    ///  The smallest possible value for the [`position`][struct@crate::Paned#position]
125    /// property.
126    ///
127    /// This property is derived from the size and shrinkability
128    /// of the widget's children.
129    ///
130    /// Readable
131    ///
132    ///
133    /// #### `position`
134    ///  Position of the separator in pixels, from the left/top.
135    ///
136    /// Readable | Writeable
137    ///
138    ///
139    /// #### `position-set`
140    ///  Whether the [`position`][struct@crate::Paned#position] property has been set.
141    ///
142    /// Readable | Writeable
143    ///
144    ///
145    /// #### `resize-end-child`
146    ///  Determines whether the second child expands and shrinks
147    /// along with the paned widget.
148    ///
149    /// Readable | Writeable
150    ///
151    ///
152    /// #### `resize-start-child`
153    ///  Determines whether the first child expands and shrinks
154    /// along with the paned widget.
155    ///
156    /// Readable | Writeable
157    ///
158    ///
159    /// #### `shrink-end-child`
160    ///  Determines whether the second child can be made smaller
161    /// than its requisition.
162    ///
163    /// Readable | Writeable
164    ///
165    ///
166    /// #### `shrink-start-child`
167    ///  Determines whether the first child can be made smaller
168    /// than its requisition.
169    ///
170    /// Readable | Writeable
171    ///
172    ///
173    /// #### `start-child`
174    ///  The first child.
175    ///
176    /// Readable | Writeable
177    ///
178    ///
179    /// #### `wide-handle`
180    ///  Whether the [`Paned`][crate::Paned] should provide a stronger visual separation.
181    ///
182    /// For example, this could be set when a paned contains two
183    /// [`Notebook`][crate::Notebook]s, whose tab rows would otherwise merge visually.
184    ///
185    /// Readable | Writeable
186    /// <details><summary><h4>Widget</h4></summary>
187    ///
188    ///
189    /// #### `can-focus`
190    ///  Whether the widget or any of its descendents can accept
191    /// the input focus.
192    ///
193    /// This property is meant to be set by widget implementations,
194    /// typically in their instance init function.
195    ///
196    /// Readable | Writeable
197    ///
198    ///
199    /// #### `can-target`
200    ///  Whether the widget can receive pointer events.
201    ///
202    /// Readable | Writeable
203    ///
204    ///
205    /// #### `css-classes`
206    ///  A list of css classes applied to this widget.
207    ///
208    /// Readable | Writeable
209    ///
210    ///
211    /// #### `css-name`
212    ///  The name of this widget in the CSS tree.
213    ///
214    /// This property is meant to be set by widget implementations,
215    /// typically in their instance init function.
216    ///
217    /// Readable | Writeable | Construct Only
218    ///
219    ///
220    /// #### `cursor`
221    ///  The cursor used by @widget.
222    ///
223    /// Readable | Writeable
224    ///
225    ///
226    /// #### `focus-on-click`
227    ///  Whether the widget should grab focus when it is clicked with the mouse.
228    ///
229    /// This property is only relevant for widgets that can take focus.
230    ///
231    /// Readable | Writeable
232    ///
233    ///
234    /// #### `focusable`
235    ///  Whether this widget itself will accept the input focus.
236    ///
237    /// Readable | Writeable
238    ///
239    ///
240    /// #### `halign`
241    ///  How to distribute horizontal space if widget gets extra space.
242    ///
243    /// Readable | Writeable
244    ///
245    ///
246    /// #### `has-default`
247    ///  Whether the widget is the default widget.
248    ///
249    /// Readable
250    ///
251    ///
252    /// #### `has-focus`
253    ///  Whether the widget has the input focus.
254    ///
255    /// Readable
256    ///
257    ///
258    /// #### `has-tooltip`
259    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
260    /// signal on @widget.
261    ///
262    /// A true value indicates that @widget can have a tooltip, in this case
263    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
264    /// determine whether it will provide a tooltip or not.
265    ///
266    /// Readable | Writeable
267    ///
268    ///
269    /// #### `height-request`
270    ///  Overrides for height request of the widget.
271    ///
272    /// If this is -1, the natural request will be used.
273    ///
274    /// Readable | Writeable
275    ///
276    ///
277    /// #### `hexpand`
278    ///  Whether to expand horizontally.
279    ///
280    /// Readable | Writeable
281    ///
282    ///
283    /// #### `hexpand-set`
284    ///  Whether to use the `hexpand` property.
285    ///
286    /// Readable | Writeable
287    ///
288    ///
289    /// #### `layout-manager`
290    ///  The [`LayoutManager`][crate::LayoutManager] instance to use to compute
291    /// the preferred size of the widget, and allocate its children.
292    ///
293    /// This property is meant to be set by widget implementations,
294    /// typically in their instance init function.
295    ///
296    /// Readable | Writeable
297    ///
298    ///
299    /// #### `limit-events`
300    ///  Makes this widget act like a modal dialog, with respect to
301    /// event delivery.
302    ///
303    /// Global event controllers will not handle events with targets
304    /// inside the widget, unless they are set up to ignore propagation
305    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
306    ///
307    /// Readable | Writeable
308    ///
309    ///
310    /// #### `margin-bottom`
311    ///  Margin on bottom side of widget.
312    ///
313    /// This property adds margin outside of the widget's normal size
314    /// request, the margin will be added in addition to the size from
315    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
316    ///
317    /// Readable | Writeable
318    ///
319    ///
320    /// #### `margin-end`
321    ///  Margin on end of widget, horizontally.
322    ///
323    /// This property supports left-to-right and right-to-left text
324    /// directions.
325    ///
326    /// This property adds margin outside of the widget's normal size
327    /// request, the margin will be added in addition to the size from
328    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
329    ///
330    /// Readable | Writeable
331    ///
332    ///
333    /// #### `margin-start`
334    ///  Margin on start of widget, horizontally.
335    ///
336    /// This property supports left-to-right and right-to-left text
337    /// directions.
338    ///
339    /// This property adds margin outside of the widget's normal size
340    /// request, the margin will be added in addition to the size from
341    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
342    ///
343    /// Readable | Writeable
344    ///
345    ///
346    /// #### `margin-top`
347    ///  Margin on top side of widget.
348    ///
349    /// This property adds margin outside of the widget's normal size
350    /// request, the margin will be added in addition to the size from
351    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
352    ///
353    /// Readable | Writeable
354    ///
355    ///
356    /// #### `name`
357    ///  The name of the widget.
358    ///
359    /// Readable | Writeable
360    ///
361    ///
362    /// #### `opacity`
363    ///  The requested opacity of the widget.
364    ///
365    /// Readable | Writeable
366    ///
367    ///
368    /// #### `overflow`
369    ///  How content outside the widget's content area is treated.
370    ///
371    /// This property is meant to be set by widget implementations,
372    /// typically in their instance init function.
373    ///
374    /// Readable | Writeable
375    ///
376    ///
377    /// #### `parent`
378    ///  The parent widget of this widget.
379    ///
380    /// Readable
381    ///
382    ///
383    /// #### `receives-default`
384    ///  Whether the widget will receive the default action when it is focused.
385    ///
386    /// Readable | Writeable
387    ///
388    ///
389    /// #### `root`
390    ///  The [`Root`][crate::Root] widget of the widget tree containing this widget.
391    ///
392    /// This will be `NULL` if the widget is not contained in a root widget.
393    ///
394    /// Readable
395    ///
396    ///
397    /// #### `scale-factor`
398    ///  The scale factor of the widget.
399    ///
400    /// Readable
401    ///
402    ///
403    /// #### `sensitive`
404    ///  Whether the widget responds to input.
405    ///
406    /// Readable | Writeable
407    ///
408    ///
409    /// #### `tooltip-markup`
410    ///  Sets the text of tooltip to be the given string, which is marked up
411    /// with Pango markup.
412    ///
413    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
414    ///
415    /// This is a convenience property which will take care of getting the
416    /// tooltip shown if the given string is not `NULL`:
417    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
418    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
419    /// the default signal handler.
420    ///
421    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
422    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
423    ///
424    /// Readable | Writeable
425    ///
426    ///
427    /// #### `tooltip-text`
428    ///  Sets the text of tooltip to be the given string.
429    ///
430    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
431    ///
432    /// This is a convenience property which will take care of getting the
433    /// tooltip shown if the given string is not `NULL`:
434    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
435    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
436    /// the default signal handler.
437    ///
438    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
439    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
440    ///
441    /// Readable | Writeable
442    ///
443    ///
444    /// #### `valign`
445    ///  How to distribute vertical space if widget gets extra space.
446    ///
447    /// Readable | Writeable
448    ///
449    ///
450    /// #### `vexpand`
451    ///  Whether to expand vertically.
452    ///
453    /// Readable | Writeable
454    ///
455    ///
456    /// #### `vexpand-set`
457    ///  Whether to use the `vexpand` property.
458    ///
459    /// Readable | Writeable
460    ///
461    ///
462    /// #### `visible`
463    ///  Whether the widget is visible.
464    ///
465    /// Readable | Writeable
466    ///
467    ///
468    /// #### `width-request`
469    ///  Overrides for width request of the widget.
470    ///
471    /// If this is -1, the natural request will be used.
472    ///
473    /// Readable | Writeable
474    /// </details>
475    /// <details><summary><h4>Accessible</h4></summary>
476    ///
477    ///
478    /// #### `accessible-role`
479    ///  The accessible role of the given [`Accessible`][crate::Accessible] implementation.
480    ///
481    /// The accessible role cannot be changed once set.
482    ///
483    /// Readable | Writeable
484    /// </details>
485    /// <details><summary><h4>Orientable</h4></summary>
486    ///
487    ///
488    /// #### `orientation`
489    ///  The orientation of the orientable.
490    ///
491    /// Readable | Writeable
492    /// </details>
493    ///
494    /// ## Signals
495    ///
496    ///
497    /// #### `accept-position`
498    ///  Emitted to accept the current position of the handle when
499    /// moving it using key bindings.
500    ///
501    /// This is a [keybinding signal](class.SignalAction.html).
502    ///
503    /// The default binding for this signal is <kbd>Return</kbd> or
504    /// <kbd>Space</kbd>.
505    ///
506    /// Action
507    ///
508    ///
509    /// #### `cancel-position`
510    ///  Emitted to cancel moving the position of the handle using key
511    /// bindings.
512    ///
513    /// The position of the handle will be reset to the value prior to
514    /// moving it.
515    ///
516    /// This is a [keybinding signal](class.SignalAction.html).
517    ///
518    /// The default binding for this signal is <kbd>Escape</kbd>.
519    ///
520    /// Action
521    ///
522    ///
523    /// #### `cycle-child-focus`
524    ///  Emitted to cycle the focus between the children of the paned.
525    ///
526    /// This is a [keybinding signal](class.SignalAction.html).
527    ///
528    /// The default binding is <kbd>F6</kbd>.
529    ///
530    /// Action
531    ///
532    ///
533    /// #### `cycle-handle-focus`
534    ///  Emitted to cycle whether the paned should grab focus to allow
535    /// the user to change position of the handle by using key bindings.
536    ///
537    /// This is a [keybinding signal](class.SignalAction.html).
538    ///
539    /// The default binding for this signal is <kbd>F8</kbd>.
540    ///
541    /// Action
542    ///
543    ///
544    /// #### `move-handle`
545    ///  Emitted to move the handle with key bindings.
546    ///
547    /// This is a [keybinding signal](class.SignalAction.html).
548    ///
549    /// The default bindings for this signal are
550    /// <kbd>Ctrl</kbd>+<kbd>←</kbd>, <kbd>←</kbd>,
551    /// <kbd>Ctrl</kbd>+<kbd>→</kbd>, <kbd>→</kbd>,
552    /// <kbd>Ctrl</kbd>+<kbd>↑</kbd>, <kbd>↑</kbd>,
553    /// <kbd>Ctrl</kbd>+<kbd>↓</kbd>, <kbd>↓</kbd>,
554    /// <kbd>PgUp</kbd>, <kbd>PgDn</kbd>, <kbd>Home</kbd>, <kbd>End</kbd>.
555    ///
556    /// Action
557    ///
558    ///
559    /// #### `toggle-handle-focus`
560    ///  Emitted to accept the current position of the handle and then
561    /// move focus to the next widget in the focus chain.
562    ///
563    /// This is a [keybinding signal](class.SignalAction.html).
564    ///
565    /// The default binding is <kbd>Tab</kbd>.
566    ///
567    /// Action
568    /// <details><summary><h4>Widget</h4></summary>
569    ///
570    ///
571    /// #### `destroy`
572    ///  Signals that all holders of a reference to the widget should release
573    /// the reference that they hold.
574    ///
575    /// May result in finalization of the widget if all references are released.
576    ///
577    /// This signal is not suitable for saving widget state.
578    ///
579    ///
580    ///
581    ///
582    /// #### `direction-changed`
583    ///  Emitted when the text direction of a widget changes.
584    ///
585    ///
586    ///
587    ///
588    /// #### `hide`
589    ///  Emitted when @widget is hidden.
590    ///
591    ///
592    ///
593    ///
594    /// #### `keynav-failed`
595    ///  Emitted if keyboard navigation fails.
596    ///
597    /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
598    ///
599    ///
600    ///
601    ///
602    /// #### `map`
603    ///  Emitted when @widget is going to be mapped.
604    ///
605    /// A widget is mapped when the widget is visible (which is controlled with
606    /// [`visible`][struct@crate::Widget#visible]) and all its parents up to the toplevel widget
607    /// are also visible.
608    ///
609    /// The `::map` signal can be used to determine whether a widget will be drawn,
610    /// for instance it can resume an animation that was stopped during the
611    /// emission of [`unmap`][struct@crate::Widget#unmap].
612    ///
613    ///
614    ///
615    ///
616    /// #### `mnemonic-activate`
617    ///  Emitted when a widget is activated via a mnemonic.
618    ///
619    /// The default handler for this signal activates @widget if @group_cycling
620    /// is false, or just makes @widget grab focus if @group_cycling is true.
621    ///
622    ///
623    ///
624    ///
625    /// #### `move-focus`
626    ///  Emitted when the focus is moved.
627    ///
628    /// The `::move-focus` signal is a [keybinding signal](class.SignalAction.html).
629    ///
630    /// The default bindings for this signal are <kbd>Tab</kbd> to move forward,
631    /// and <kbd>Shift</kbd>+<kbd>Tab</kbd> to move backward.
632    ///
633    /// Action
634    ///
635    ///
636    /// #### `query-tooltip`
637    ///  Emitted when the widget’s tooltip is about to be shown.
638    ///
639    /// This happens when the [`has-tooltip`][struct@crate::Widget#has-tooltip] property
640    /// is true and the hover timeout has expired with the cursor hovering
641    /// above @widget; or emitted when @widget got focus in keyboard mode.
642    ///
643    /// Using the given coordinates, the signal handler should determine
644    /// whether a tooltip should be shown for @widget. If this is the case
645    /// true should be returned, false otherwise. Note that if @keyboard_mode
646    /// is true, the values of @x and @y are undefined and should not be used.
647    ///
648    /// The signal handler is free to manipulate @tooltip with the therefore
649    /// destined function calls.
650    ///
651    ///
652    ///
653    ///
654    /// #### `realize`
655    ///  Emitted when @widget is associated with a [`gdk::Surface`][crate::gdk::Surface].
656    ///
657    /// This means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called
658    /// or the widget has been mapped (that is, it is going to be drawn).
659    ///
660    ///
661    ///
662    ///
663    /// #### `show`
664    ///  Emitted when @widget is shown.
665    ///
666    ///
667    ///
668    ///
669    /// #### `state-flags-changed`
670    ///  Emitted when the widget state changes.
671    ///
672    /// See [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
673    ///
674    ///
675    ///
676    ///
677    /// #### `unmap`
678    ///  Emitted when @widget is going to be unmapped.
679    ///
680    /// A widget is unmapped when either it or any of its parents up to the
681    /// toplevel widget have been set as hidden.
682    ///
683    /// As `::unmap` indicates that a widget will not be shown any longer,
684    /// it can be used to, for example, stop an animation on the widget.
685    ///
686    ///
687    ///
688    ///
689    /// #### `unrealize`
690    ///  Emitted when the [`gdk::Surface`][crate::gdk::Surface] associated with @widget is destroyed.
691    ///
692    /// This means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been called
693    /// or the widget has been unmapped (that is, it is going to be hidden).
694    ///
695    ///
696    /// </details>
697    ///
698    /// # Implements
699    ///
700    /// [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ConstraintTargetExt`][trait@crate::prelude::ConstraintTargetExt], [`AccessibleRangeExt`][trait@crate::prelude::AccessibleRangeExt], [`OrientableExt`][trait@crate::prelude::OrientableExt], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual]
701    #[doc(alias = "GtkPaned")]
702    pub struct Paned(Object<ffi::GtkPaned>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget, AccessibleRange, Orientable;
703
704    match fn {
705        type_ => || ffi::gtk_paned_get_type(),
706    }
707}
708
709#[cfg(not(any(feature = "v4_10")))]
710glib::wrapper! {
711    #[doc(alias = "GtkPaned")]
712    pub struct Paned(Object<ffi::GtkPaned>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget, Orientable;
713
714    match fn {
715        type_ => || ffi::gtk_paned_get_type(),
716    }
717}
718
719impl Paned {
720    /// Creates a new [`Paned`][crate::Paned] widget.
721    /// ## `orientation`
722    /// the paned’s orientation.
723    ///
724    /// # Returns
725    ///
726    /// the newly created paned widget
727    #[doc(alias = "gtk_paned_new")]
728    pub fn new(orientation: Orientation) -> Paned {
729        assert_initialized_main_thread!();
730        unsafe { Widget::from_glib_none(ffi::gtk_paned_new(orientation.into_glib())).unsafe_cast() }
731    }
732
733    // rustdoc-stripper-ignore-next
734    /// Creates a new builder-pattern struct instance to construct [`Paned`] objects.
735    ///
736    /// This method returns an instance of [`PanedBuilder`](crate::builders::PanedBuilder) which can be used to create [`Paned`] objects.
737    pub fn builder() -> PanedBuilder {
738        PanedBuilder::new()
739    }
740
741    /// Retrieves the end child of the given [`Paned`][crate::Paned].
742    ///
743    /// # Returns
744    ///
745    /// the end child widget
746    #[doc(alias = "gtk_paned_get_end_child")]
747    #[doc(alias = "get_end_child")]
748    #[doc(alias = "end-child")]
749    pub fn end_child(&self) -> Option<Widget> {
750        unsafe { from_glib_none(ffi::gtk_paned_get_end_child(self.to_glib_none().0)) }
751    }
752
753    /// Obtains the position of the divider between the two panes.
754    ///
755    /// # Returns
756    ///
757    /// the position of the divider, in pixels
758    #[doc(alias = "gtk_paned_get_position")]
759    #[doc(alias = "get_position")]
760    pub fn position(&self) -> i32 {
761        unsafe { ffi::gtk_paned_get_position(self.to_glib_none().0) }
762    }
763
764    /// Returns whether the [`end-child`][struct@crate::Paned#end-child] can be resized.
765    ///
766    /// # Returns
767    ///
768    /// true if the end child is resizable
769    #[doc(alias = "gtk_paned_get_resize_end_child")]
770    #[doc(alias = "get_resize_end_child")]
771    #[doc(alias = "resize-end-child")]
772    pub fn resizes_end_child(&self) -> bool {
773        unsafe { from_glib(ffi::gtk_paned_get_resize_end_child(self.to_glib_none().0)) }
774    }
775
776    /// Returns whether the [`start-child`][struct@crate::Paned#start-child] can be resized.
777    ///
778    /// # Returns
779    ///
780    /// true if the start child is resizable
781    #[doc(alias = "gtk_paned_get_resize_start_child")]
782    #[doc(alias = "get_resize_start_child")]
783    #[doc(alias = "resize-start-child")]
784    pub fn resizes_start_child(&self) -> bool {
785        unsafe { from_glib(ffi::gtk_paned_get_resize_start_child(self.to_glib_none().0)) }
786    }
787
788    /// Returns whether the [`end-child`][struct@crate::Paned#end-child] can shrink.
789    ///
790    /// # Returns
791    ///
792    /// true if the end child is shrinkable
793    #[doc(alias = "gtk_paned_get_shrink_end_child")]
794    #[doc(alias = "get_shrink_end_child")]
795    #[doc(alias = "shrink-end-child")]
796    pub fn shrinks_end_child(&self) -> bool {
797        unsafe { from_glib(ffi::gtk_paned_get_shrink_end_child(self.to_glib_none().0)) }
798    }
799
800    /// Returns whether the [`start-child`][struct@crate::Paned#start-child] can shrink.
801    ///
802    /// # Returns
803    ///
804    /// true if the start child is shrinkable
805    #[doc(alias = "gtk_paned_get_shrink_start_child")]
806    #[doc(alias = "get_shrink_start_child")]
807    #[doc(alias = "shrink-start-child")]
808    pub fn shrinks_start_child(&self) -> bool {
809        unsafe { from_glib(ffi::gtk_paned_get_shrink_start_child(self.to_glib_none().0)) }
810    }
811
812    /// Retrieves the start child of the given [`Paned`][crate::Paned].
813    ///
814    /// # Returns
815    ///
816    /// the start child widget
817    #[doc(alias = "gtk_paned_get_start_child")]
818    #[doc(alias = "get_start_child")]
819    #[doc(alias = "start-child")]
820    pub fn start_child(&self) -> Option<Widget> {
821        unsafe { from_glib_none(ffi::gtk_paned_get_start_child(self.to_glib_none().0)) }
822    }
823
824    /// Gets whether the separator should be wide.
825    ///
826    /// # Returns
827    ///
828    /// [`true`] if the paned should have a wide handle
829    #[doc(alias = "gtk_paned_get_wide_handle")]
830    #[doc(alias = "get_wide_handle")]
831    #[doc(alias = "wide-handle")]
832    pub fn is_wide_handle(&self) -> bool {
833        unsafe { from_glib(ffi::gtk_paned_get_wide_handle(self.to_glib_none().0)) }
834    }
835
836    /// Sets the end child of @self to @child.
837    ///
838    /// If @child is `NULL`, the existing child will be removed.
839    /// ## `child`
840    /// the widget to add
841    #[doc(alias = "gtk_paned_set_end_child")]
842    #[doc(alias = "end-child")]
843    pub fn set_end_child(&self, child: Option<&impl IsA<Widget>>) {
844        unsafe {
845            ffi::gtk_paned_set_end_child(
846                self.to_glib_none().0,
847                child.map(|p| p.as_ref()).to_glib_none().0,
848            );
849        }
850    }
851
852    /// Sets the position of the divider between the two panes.
853    /// ## `position`
854    /// pixel position of divider, a negative value means that the position
855    ///   is unset
856    #[doc(alias = "gtk_paned_set_position")]
857    #[doc(alias = "position")]
858    pub fn set_position(&self, position: i32) {
859        unsafe {
860            ffi::gtk_paned_set_position(self.to_glib_none().0, position);
861        }
862    }
863
864    /// Sets whether the [`end-child`][struct@crate::Paned#end-child] can be resized.
865    /// ## `resize`
866    /// true to let the end child be resized
867    #[doc(alias = "gtk_paned_set_resize_end_child")]
868    #[doc(alias = "resize-end-child")]
869    pub fn set_resize_end_child(&self, resize: bool) {
870        unsafe {
871            ffi::gtk_paned_set_resize_end_child(self.to_glib_none().0, resize.into_glib());
872        }
873    }
874
875    /// Sets whether the [`start-child`][struct@crate::Paned#start-child] can be resized.
876    /// ## `resize`
877    /// true to let the start child be resized
878    #[doc(alias = "gtk_paned_set_resize_start_child")]
879    #[doc(alias = "resize-start-child")]
880    pub fn set_resize_start_child(&self, resize: bool) {
881        unsafe {
882            ffi::gtk_paned_set_resize_start_child(self.to_glib_none().0, resize.into_glib());
883        }
884    }
885
886    /// Sets whether the [`end-child`][struct@crate::Paned#end-child] can shrink.
887    /// ## `resize`
888    /// true to let the end child be shrunk
889    #[doc(alias = "gtk_paned_set_shrink_end_child")]
890    #[doc(alias = "shrink-end-child")]
891    pub fn set_shrink_end_child(&self, resize: bool) {
892        unsafe {
893            ffi::gtk_paned_set_shrink_end_child(self.to_glib_none().0, resize.into_glib());
894        }
895    }
896
897    /// Sets whether the [`start-child`][struct@crate::Paned#start-child] can shrink.
898    /// ## `resize`
899    /// true to let the start child be shrunk
900    #[doc(alias = "gtk_paned_set_shrink_start_child")]
901    #[doc(alias = "shrink-start-child")]
902    pub fn set_shrink_start_child(&self, resize: bool) {
903        unsafe {
904            ffi::gtk_paned_set_shrink_start_child(self.to_glib_none().0, resize.into_glib());
905        }
906    }
907
908    /// Sets the start child of @self to @child.
909    ///
910    /// If @child is `NULL`, the existing child will be removed.
911    /// ## `child`
912    /// the widget to add
913    #[doc(alias = "gtk_paned_set_start_child")]
914    #[doc(alias = "start-child")]
915    pub fn set_start_child(&self, child: Option<&impl IsA<Widget>>) {
916        unsafe {
917            ffi::gtk_paned_set_start_child(
918                self.to_glib_none().0,
919                child.map(|p| p.as_ref()).to_glib_none().0,
920            );
921        }
922    }
923
924    /// Sets whether the separator should be wide.
925    /// ## `wide`
926    /// the new value for the [`wide-handle`][struct@crate::Paned#wide-handle] property
927    #[doc(alias = "gtk_paned_set_wide_handle")]
928    #[doc(alias = "wide-handle")]
929    pub fn set_wide_handle(&self, wide: bool) {
930        unsafe {
931            ffi::gtk_paned_set_wide_handle(self.to_glib_none().0, wide.into_glib());
932        }
933    }
934
935    /// The largest possible value for the [`position`][struct@crate::Paned#position]
936    /// property.
937    ///
938    /// This property is derived from the size and shrinkability
939    /// of the widget's children.
940    #[doc(alias = "max-position")]
941    pub fn max_position(&self) -> i32 {
942        ObjectExt::property(self, "max-position")
943    }
944
945    /// The smallest possible value for the [`position`][struct@crate::Paned#position]
946    /// property.
947    ///
948    /// This property is derived from the size and shrinkability
949    /// of the widget's children.
950    #[doc(alias = "min-position")]
951    pub fn min_position(&self) -> i32 {
952        ObjectExt::property(self, "min-position")
953    }
954
955    /// Whether the [`position`][struct@crate::Paned#position] property has been set.
956    #[doc(alias = "position-set")]
957    pub fn is_position_set(&self) -> bool {
958        ObjectExt::property(self, "position-set")
959    }
960
961    /// Emitted to accept the current position of the handle when
962    /// moving it using key bindings.
963    ///
964    /// This is a [keybinding signal](class.SignalAction.html).
965    ///
966    /// The default binding for this signal is <kbd>Return</kbd> or
967    /// <kbd>Space</kbd>.
968    ///
969    /// # Returns
970    ///
971    /// whether the position was accepted
972    #[doc(alias = "accept-position")]
973    pub fn connect_accept_position<F: Fn(&Self) -> bool + 'static>(&self, f: F) -> SignalHandlerId {
974        unsafe extern "C" fn accept_position_trampoline<F: Fn(&Paned) -> bool + 'static>(
975            this: *mut ffi::GtkPaned,
976            f: glib::ffi::gpointer,
977        ) -> glib::ffi::gboolean {
978            let f: &F = &*(f as *const F);
979            f(&from_glib_borrow(this)).into_glib()
980        }
981        unsafe {
982            let f: Box_<F> = Box_::new(f);
983            connect_raw(
984                self.as_ptr() as *mut _,
985                b"accept-position\0".as_ptr() as *const _,
986                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
987                    accept_position_trampoline::<F> as *const (),
988                )),
989                Box_::into_raw(f),
990            )
991        }
992    }
993
994    pub fn emit_accept_position(&self) -> bool {
995        self.emit_by_name("accept-position", &[])
996    }
997
998    /// Emitted to cancel moving the position of the handle using key
999    /// bindings.
1000    ///
1001    /// The position of the handle will be reset to the value prior to
1002    /// moving it.
1003    ///
1004    /// This is a [keybinding signal](class.SignalAction.html).
1005    ///
1006    /// The default binding for this signal is <kbd>Escape</kbd>.
1007    ///
1008    /// # Returns
1009    ///
1010    /// whether the position was canceled
1011    #[doc(alias = "cancel-position")]
1012    pub fn connect_cancel_position<F: Fn(&Self) -> bool + 'static>(&self, f: F) -> SignalHandlerId {
1013        unsafe extern "C" fn cancel_position_trampoline<F: Fn(&Paned) -> bool + 'static>(
1014            this: *mut ffi::GtkPaned,
1015            f: glib::ffi::gpointer,
1016        ) -> glib::ffi::gboolean {
1017            let f: &F = &*(f as *const F);
1018            f(&from_glib_borrow(this)).into_glib()
1019        }
1020        unsafe {
1021            let f: Box_<F> = Box_::new(f);
1022            connect_raw(
1023                self.as_ptr() as *mut _,
1024                b"cancel-position\0".as_ptr() as *const _,
1025                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1026                    cancel_position_trampoline::<F> as *const (),
1027                )),
1028                Box_::into_raw(f),
1029            )
1030        }
1031    }
1032
1033    pub fn emit_cancel_position(&self) -> bool {
1034        self.emit_by_name("cancel-position", &[])
1035    }
1036
1037    /// Emitted to cycle the focus between the children of the paned.
1038    ///
1039    /// This is a [keybinding signal](class.SignalAction.html).
1040    ///
1041    /// The default binding is <kbd>F6</kbd>.
1042    /// ## `reversed`
1043    /// whether cycling backward or forward
1044    ///
1045    /// # Returns
1046    ///
1047    /// whether the behavior was cycled
1048    #[doc(alias = "cycle-child-focus")]
1049    pub fn connect_cycle_child_focus<F: Fn(&Self, bool) -> bool + 'static>(
1050        &self,
1051        f: F,
1052    ) -> SignalHandlerId {
1053        unsafe extern "C" fn cycle_child_focus_trampoline<F: Fn(&Paned, bool) -> bool + 'static>(
1054            this: *mut ffi::GtkPaned,
1055            reversed: glib::ffi::gboolean,
1056            f: glib::ffi::gpointer,
1057        ) -> glib::ffi::gboolean {
1058            let f: &F = &*(f as *const F);
1059            f(&from_glib_borrow(this), from_glib(reversed)).into_glib()
1060        }
1061        unsafe {
1062            let f: Box_<F> = Box_::new(f);
1063            connect_raw(
1064                self.as_ptr() as *mut _,
1065                b"cycle-child-focus\0".as_ptr() as *const _,
1066                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1067                    cycle_child_focus_trampoline::<F> as *const (),
1068                )),
1069                Box_::into_raw(f),
1070            )
1071        }
1072    }
1073
1074    pub fn emit_cycle_child_focus(&self, reversed: bool) -> bool {
1075        self.emit_by_name("cycle-child-focus", &[&reversed])
1076    }
1077
1078    /// Emitted to cycle whether the paned should grab focus to allow
1079    /// the user to change position of the handle by using key bindings.
1080    ///
1081    /// This is a [keybinding signal](class.SignalAction.html).
1082    ///
1083    /// The default binding for this signal is <kbd>F8</kbd>.
1084    /// ## `reversed`
1085    /// whether cycling backward or forward
1086    ///
1087    /// # Returns
1088    ///
1089    /// whether the behavior was cycled
1090    #[doc(alias = "cycle-handle-focus")]
1091    pub fn connect_cycle_handle_focus<F: Fn(&Self, bool) -> bool + 'static>(
1092        &self,
1093        f: F,
1094    ) -> SignalHandlerId {
1095        unsafe extern "C" fn cycle_handle_focus_trampoline<
1096            F: Fn(&Paned, bool) -> bool + 'static,
1097        >(
1098            this: *mut ffi::GtkPaned,
1099            reversed: glib::ffi::gboolean,
1100            f: glib::ffi::gpointer,
1101        ) -> glib::ffi::gboolean {
1102            let f: &F = &*(f as *const F);
1103            f(&from_glib_borrow(this), from_glib(reversed)).into_glib()
1104        }
1105        unsafe {
1106            let f: Box_<F> = Box_::new(f);
1107            connect_raw(
1108                self.as_ptr() as *mut _,
1109                b"cycle-handle-focus\0".as_ptr() as *const _,
1110                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1111                    cycle_handle_focus_trampoline::<F> as *const (),
1112                )),
1113                Box_::into_raw(f),
1114            )
1115        }
1116    }
1117
1118    pub fn emit_cycle_handle_focus(&self, reversed: bool) -> bool {
1119        self.emit_by_name("cycle-handle-focus", &[&reversed])
1120    }
1121
1122    /// Emitted to move the handle with key bindings.
1123    ///
1124    /// This is a [keybinding signal](class.SignalAction.html).
1125    ///
1126    /// The default bindings for this signal are
1127    /// <kbd>Ctrl</kbd>+<kbd>←</kbd>, <kbd>←</kbd>,
1128    /// <kbd>Ctrl</kbd>+<kbd>→</kbd>, <kbd>→</kbd>,
1129    /// <kbd>Ctrl</kbd>+<kbd>↑</kbd>, <kbd>↑</kbd>,
1130    /// <kbd>Ctrl</kbd>+<kbd>↓</kbd>, <kbd>↓</kbd>,
1131    /// <kbd>PgUp</kbd>, <kbd>PgDn</kbd>, <kbd>Home</kbd>, <kbd>End</kbd>.
1132    /// ## `scroll_type`
1133    /// a [`ScrollType`][crate::ScrollType]
1134    ///
1135    /// # Returns
1136    ///
1137    /// whether the handle was moved
1138    #[doc(alias = "move-handle")]
1139    pub fn connect_move_handle<F: Fn(&Self, ScrollType) -> bool + 'static>(
1140        &self,
1141        f: F,
1142    ) -> SignalHandlerId {
1143        unsafe extern "C" fn move_handle_trampoline<F: Fn(&Paned, ScrollType) -> bool + 'static>(
1144            this: *mut ffi::GtkPaned,
1145            scroll_type: ffi::GtkScrollType,
1146            f: glib::ffi::gpointer,
1147        ) -> glib::ffi::gboolean {
1148            let f: &F = &*(f as *const F);
1149            f(&from_glib_borrow(this), from_glib(scroll_type)).into_glib()
1150        }
1151        unsafe {
1152            let f: Box_<F> = Box_::new(f);
1153            connect_raw(
1154                self.as_ptr() as *mut _,
1155                b"move-handle\0".as_ptr() as *const _,
1156                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1157                    move_handle_trampoline::<F> as *const (),
1158                )),
1159                Box_::into_raw(f),
1160            )
1161        }
1162    }
1163
1164    pub fn emit_move_handle(&self, scroll_type: ScrollType) -> bool {
1165        self.emit_by_name("move-handle", &[&scroll_type])
1166    }
1167
1168    /// Emitted to accept the current position of the handle and then
1169    /// move focus to the next widget in the focus chain.
1170    ///
1171    /// This is a [keybinding signal](class.SignalAction.html).
1172    ///
1173    /// The default binding is <kbd>Tab</kbd>.
1174    ///
1175    /// # Returns
1176    ///
1177    /// whether handle focus was toggled
1178    #[doc(alias = "toggle-handle-focus")]
1179    pub fn connect_toggle_handle_focus<F: Fn(&Self) -> bool + 'static>(
1180        &self,
1181        f: F,
1182    ) -> SignalHandlerId {
1183        unsafe extern "C" fn toggle_handle_focus_trampoline<F: Fn(&Paned) -> bool + 'static>(
1184            this: *mut ffi::GtkPaned,
1185            f: glib::ffi::gpointer,
1186        ) -> glib::ffi::gboolean {
1187            let f: &F = &*(f as *const F);
1188            f(&from_glib_borrow(this)).into_glib()
1189        }
1190        unsafe {
1191            let f: Box_<F> = Box_::new(f);
1192            connect_raw(
1193                self.as_ptr() as *mut _,
1194                b"toggle-handle-focus\0".as_ptr() as *const _,
1195                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1196                    toggle_handle_focus_trampoline::<F> as *const (),
1197                )),
1198                Box_::into_raw(f),
1199            )
1200        }
1201    }
1202
1203    pub fn emit_toggle_handle_focus(&self) -> bool {
1204        self.emit_by_name("toggle-handle-focus", &[])
1205    }
1206
1207    #[doc(alias = "end-child")]
1208    pub fn connect_end_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1209        unsafe extern "C" fn notify_end_child_trampoline<F: Fn(&Paned) + 'static>(
1210            this: *mut ffi::GtkPaned,
1211            _param_spec: glib::ffi::gpointer,
1212            f: glib::ffi::gpointer,
1213        ) {
1214            let f: &F = &*(f as *const F);
1215            f(&from_glib_borrow(this))
1216        }
1217        unsafe {
1218            let f: Box_<F> = Box_::new(f);
1219            connect_raw(
1220                self.as_ptr() as *mut _,
1221                b"notify::end-child\0".as_ptr() as *const _,
1222                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1223                    notify_end_child_trampoline::<F> as *const (),
1224                )),
1225                Box_::into_raw(f),
1226            )
1227        }
1228    }
1229
1230    #[doc(alias = "max-position")]
1231    pub fn connect_max_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1232        unsafe extern "C" fn notify_max_position_trampoline<F: Fn(&Paned) + 'static>(
1233            this: *mut ffi::GtkPaned,
1234            _param_spec: glib::ffi::gpointer,
1235            f: glib::ffi::gpointer,
1236        ) {
1237            let f: &F = &*(f as *const F);
1238            f(&from_glib_borrow(this))
1239        }
1240        unsafe {
1241            let f: Box_<F> = Box_::new(f);
1242            connect_raw(
1243                self.as_ptr() as *mut _,
1244                b"notify::max-position\0".as_ptr() as *const _,
1245                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1246                    notify_max_position_trampoline::<F> as *const (),
1247                )),
1248                Box_::into_raw(f),
1249            )
1250        }
1251    }
1252
1253    #[doc(alias = "min-position")]
1254    pub fn connect_min_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1255        unsafe extern "C" fn notify_min_position_trampoline<F: Fn(&Paned) + 'static>(
1256            this: *mut ffi::GtkPaned,
1257            _param_spec: glib::ffi::gpointer,
1258            f: glib::ffi::gpointer,
1259        ) {
1260            let f: &F = &*(f as *const F);
1261            f(&from_glib_borrow(this))
1262        }
1263        unsafe {
1264            let f: Box_<F> = Box_::new(f);
1265            connect_raw(
1266                self.as_ptr() as *mut _,
1267                b"notify::min-position\0".as_ptr() as *const _,
1268                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1269                    notify_min_position_trampoline::<F> as *const (),
1270                )),
1271                Box_::into_raw(f),
1272            )
1273        }
1274    }
1275
1276    #[doc(alias = "position")]
1277    pub fn connect_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1278        unsafe extern "C" fn notify_position_trampoline<F: Fn(&Paned) + 'static>(
1279            this: *mut ffi::GtkPaned,
1280            _param_spec: glib::ffi::gpointer,
1281            f: glib::ffi::gpointer,
1282        ) {
1283            let f: &F = &*(f as *const F);
1284            f(&from_glib_borrow(this))
1285        }
1286        unsafe {
1287            let f: Box_<F> = Box_::new(f);
1288            connect_raw(
1289                self.as_ptr() as *mut _,
1290                b"notify::position\0".as_ptr() as *const _,
1291                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1292                    notify_position_trampoline::<F> as *const (),
1293                )),
1294                Box_::into_raw(f),
1295            )
1296        }
1297    }
1298
1299    #[doc(alias = "position-set")]
1300    pub fn connect_position_set_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1301        unsafe extern "C" fn notify_position_set_trampoline<F: Fn(&Paned) + 'static>(
1302            this: *mut ffi::GtkPaned,
1303            _param_spec: glib::ffi::gpointer,
1304            f: glib::ffi::gpointer,
1305        ) {
1306            let f: &F = &*(f as *const F);
1307            f(&from_glib_borrow(this))
1308        }
1309        unsafe {
1310            let f: Box_<F> = Box_::new(f);
1311            connect_raw(
1312                self.as_ptr() as *mut _,
1313                b"notify::position-set\0".as_ptr() as *const _,
1314                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1315                    notify_position_set_trampoline::<F> as *const (),
1316                )),
1317                Box_::into_raw(f),
1318            )
1319        }
1320    }
1321
1322    #[doc(alias = "resize-end-child")]
1323    pub fn connect_resize_end_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1324        unsafe extern "C" fn notify_resize_end_child_trampoline<F: Fn(&Paned) + 'static>(
1325            this: *mut ffi::GtkPaned,
1326            _param_spec: glib::ffi::gpointer,
1327            f: glib::ffi::gpointer,
1328        ) {
1329            let f: &F = &*(f as *const F);
1330            f(&from_glib_borrow(this))
1331        }
1332        unsafe {
1333            let f: Box_<F> = Box_::new(f);
1334            connect_raw(
1335                self.as_ptr() as *mut _,
1336                b"notify::resize-end-child\0".as_ptr() as *const _,
1337                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1338                    notify_resize_end_child_trampoline::<F> as *const (),
1339                )),
1340                Box_::into_raw(f),
1341            )
1342        }
1343    }
1344
1345    #[doc(alias = "resize-start-child")]
1346    pub fn connect_resize_start_child_notify<F: Fn(&Self) + 'static>(
1347        &self,
1348        f: F,
1349    ) -> SignalHandlerId {
1350        unsafe extern "C" fn notify_resize_start_child_trampoline<F: Fn(&Paned) + 'static>(
1351            this: *mut ffi::GtkPaned,
1352            _param_spec: glib::ffi::gpointer,
1353            f: glib::ffi::gpointer,
1354        ) {
1355            let f: &F = &*(f as *const F);
1356            f(&from_glib_borrow(this))
1357        }
1358        unsafe {
1359            let f: Box_<F> = Box_::new(f);
1360            connect_raw(
1361                self.as_ptr() as *mut _,
1362                b"notify::resize-start-child\0".as_ptr() as *const _,
1363                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1364                    notify_resize_start_child_trampoline::<F> as *const (),
1365                )),
1366                Box_::into_raw(f),
1367            )
1368        }
1369    }
1370
1371    #[doc(alias = "shrink-end-child")]
1372    pub fn connect_shrink_end_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1373        unsafe extern "C" fn notify_shrink_end_child_trampoline<F: Fn(&Paned) + 'static>(
1374            this: *mut ffi::GtkPaned,
1375            _param_spec: glib::ffi::gpointer,
1376            f: glib::ffi::gpointer,
1377        ) {
1378            let f: &F = &*(f as *const F);
1379            f(&from_glib_borrow(this))
1380        }
1381        unsafe {
1382            let f: Box_<F> = Box_::new(f);
1383            connect_raw(
1384                self.as_ptr() as *mut _,
1385                b"notify::shrink-end-child\0".as_ptr() as *const _,
1386                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1387                    notify_shrink_end_child_trampoline::<F> as *const (),
1388                )),
1389                Box_::into_raw(f),
1390            )
1391        }
1392    }
1393
1394    #[doc(alias = "shrink-start-child")]
1395    pub fn connect_shrink_start_child_notify<F: Fn(&Self) + 'static>(
1396        &self,
1397        f: F,
1398    ) -> SignalHandlerId {
1399        unsafe extern "C" fn notify_shrink_start_child_trampoline<F: Fn(&Paned) + 'static>(
1400            this: *mut ffi::GtkPaned,
1401            _param_spec: glib::ffi::gpointer,
1402            f: glib::ffi::gpointer,
1403        ) {
1404            let f: &F = &*(f as *const F);
1405            f(&from_glib_borrow(this))
1406        }
1407        unsafe {
1408            let f: Box_<F> = Box_::new(f);
1409            connect_raw(
1410                self.as_ptr() as *mut _,
1411                b"notify::shrink-start-child\0".as_ptr() as *const _,
1412                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1413                    notify_shrink_start_child_trampoline::<F> as *const (),
1414                )),
1415                Box_::into_raw(f),
1416            )
1417        }
1418    }
1419
1420    #[doc(alias = "start-child")]
1421    pub fn connect_start_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1422        unsafe extern "C" fn notify_start_child_trampoline<F: Fn(&Paned) + 'static>(
1423            this: *mut ffi::GtkPaned,
1424            _param_spec: glib::ffi::gpointer,
1425            f: glib::ffi::gpointer,
1426        ) {
1427            let f: &F = &*(f as *const F);
1428            f(&from_glib_borrow(this))
1429        }
1430        unsafe {
1431            let f: Box_<F> = Box_::new(f);
1432            connect_raw(
1433                self.as_ptr() as *mut _,
1434                b"notify::start-child\0".as_ptr() as *const _,
1435                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1436                    notify_start_child_trampoline::<F> as *const (),
1437                )),
1438                Box_::into_raw(f),
1439            )
1440        }
1441    }
1442
1443    #[doc(alias = "wide-handle")]
1444    pub fn connect_wide_handle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1445        unsafe extern "C" fn notify_wide_handle_trampoline<F: Fn(&Paned) + 'static>(
1446            this: *mut ffi::GtkPaned,
1447            _param_spec: glib::ffi::gpointer,
1448            f: glib::ffi::gpointer,
1449        ) {
1450            let f: &F = &*(f as *const F);
1451            f(&from_glib_borrow(this))
1452        }
1453        unsafe {
1454            let f: Box_<F> = Box_::new(f);
1455            connect_raw(
1456                self.as_ptr() as *mut _,
1457                b"notify::wide-handle\0".as_ptr() as *const _,
1458                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1459                    notify_wide_handle_trampoline::<F> as *const (),
1460                )),
1461                Box_::into_raw(f),
1462            )
1463        }
1464    }
1465}
1466
1467impl Default for Paned {
1468    fn default() -> Self {
1469        glib::object::Object::new::<Self>()
1470    }
1471}
1472
1473// rustdoc-stripper-ignore-next
1474/// A [builder-pattern] type to construct [`Paned`] objects.
1475///
1476/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1477#[must_use = "The builder must be built to be used"]
1478pub struct PanedBuilder {
1479    builder: glib::object::ObjectBuilder<'static, Paned>,
1480}
1481
1482impl PanedBuilder {
1483    fn new() -> Self {
1484        Self {
1485            builder: glib::object::Object::builder(),
1486        }
1487    }
1488
1489    /// The second child.
1490    pub fn end_child(self, end_child: &impl IsA<Widget>) -> Self {
1491        Self {
1492            builder: self
1493                .builder
1494                .property("end-child", end_child.clone().upcast()),
1495        }
1496    }
1497
1498    /// Position of the separator in pixels, from the left/top.
1499    pub fn position(self, position: i32) -> Self {
1500        Self {
1501            builder: self.builder.property("position", position),
1502        }
1503    }
1504
1505    /// Whether the [`position`][struct@crate::Paned#position] property has been set.
1506    pub fn position_set(self, position_set: bool) -> Self {
1507        Self {
1508            builder: self.builder.property("position-set", position_set),
1509        }
1510    }
1511
1512    /// Determines whether the second child expands and shrinks
1513    /// along with the paned widget.
1514    pub fn resize_end_child(self, resize_end_child: bool) -> Self {
1515        Self {
1516            builder: self.builder.property("resize-end-child", resize_end_child),
1517        }
1518    }
1519
1520    /// Determines whether the first child expands and shrinks
1521    /// along with the paned widget.
1522    pub fn resize_start_child(self, resize_start_child: bool) -> Self {
1523        Self {
1524            builder: self
1525                .builder
1526                .property("resize-start-child", resize_start_child),
1527        }
1528    }
1529
1530    /// Determines whether the second child can be made smaller
1531    /// than its requisition.
1532    pub fn shrink_end_child(self, shrink_end_child: bool) -> Self {
1533        Self {
1534            builder: self.builder.property("shrink-end-child", shrink_end_child),
1535        }
1536    }
1537
1538    /// Determines whether the first child can be made smaller
1539    /// than its requisition.
1540    pub fn shrink_start_child(self, shrink_start_child: bool) -> Self {
1541        Self {
1542            builder: self
1543                .builder
1544                .property("shrink-start-child", shrink_start_child),
1545        }
1546    }
1547
1548    /// The first child.
1549    pub fn start_child(self, start_child: &impl IsA<Widget>) -> Self {
1550        Self {
1551            builder: self
1552                .builder
1553                .property("start-child", start_child.clone().upcast()),
1554        }
1555    }
1556
1557    /// Whether the [`Paned`][crate::Paned] should provide a stronger visual separation.
1558    ///
1559    /// For example, this could be set when a paned contains two
1560    /// [`Notebook`][crate::Notebook]s, whose tab rows would otherwise merge visually.
1561    pub fn wide_handle(self, wide_handle: bool) -> Self {
1562        Self {
1563            builder: self.builder.property("wide-handle", wide_handle),
1564        }
1565    }
1566
1567    /// Whether the widget or any of its descendents can accept
1568    /// the input focus.
1569    ///
1570    /// This property is meant to be set by widget implementations,
1571    /// typically in their instance init function.
1572    pub fn can_focus(self, can_focus: bool) -> Self {
1573        Self {
1574            builder: self.builder.property("can-focus", can_focus),
1575        }
1576    }
1577
1578    /// Whether the widget can receive pointer events.
1579    pub fn can_target(self, can_target: bool) -> Self {
1580        Self {
1581            builder: self.builder.property("can-target", can_target),
1582        }
1583    }
1584
1585    /// A list of css classes applied to this widget.
1586    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1587        Self {
1588            builder: self.builder.property("css-classes", css_classes.into()),
1589        }
1590    }
1591
1592    /// The name of this widget in the CSS tree.
1593    ///
1594    /// This property is meant to be set by widget implementations,
1595    /// typically in their instance init function.
1596    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1597        Self {
1598            builder: self.builder.property("css-name", css_name.into()),
1599        }
1600    }
1601
1602    /// The cursor used by @widget.
1603    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1604        Self {
1605            builder: self.builder.property("cursor", cursor.clone()),
1606        }
1607    }
1608
1609    /// Whether the widget should grab focus when it is clicked with the mouse.
1610    ///
1611    /// This property is only relevant for widgets that can take focus.
1612    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1613        Self {
1614            builder: self.builder.property("focus-on-click", focus_on_click),
1615        }
1616    }
1617
1618    /// Whether this widget itself will accept the input focus.
1619    pub fn focusable(self, focusable: bool) -> Self {
1620        Self {
1621            builder: self.builder.property("focusable", focusable),
1622        }
1623    }
1624
1625    /// How to distribute horizontal space if widget gets extra space.
1626    pub fn halign(self, halign: Align) -> Self {
1627        Self {
1628            builder: self.builder.property("halign", halign),
1629        }
1630    }
1631
1632    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
1633    /// signal on @widget.
1634    ///
1635    /// A true value indicates that @widget can have a tooltip, in this case
1636    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
1637    /// determine whether it will provide a tooltip or not.
1638    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1639        Self {
1640            builder: self.builder.property("has-tooltip", has_tooltip),
1641        }
1642    }
1643
1644    /// Overrides for height request of the widget.
1645    ///
1646    /// If this is -1, the natural request will be used.
1647    pub fn height_request(self, height_request: i32) -> Self {
1648        Self {
1649            builder: self.builder.property("height-request", height_request),
1650        }
1651    }
1652
1653    /// Whether to expand horizontally.
1654    pub fn hexpand(self, hexpand: bool) -> Self {
1655        Self {
1656            builder: self.builder.property("hexpand", hexpand),
1657        }
1658    }
1659
1660    /// Whether to use the `hexpand` property.
1661    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1662        Self {
1663            builder: self.builder.property("hexpand-set", hexpand_set),
1664        }
1665    }
1666
1667    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
1668    /// the preferred size of the widget, and allocate its children.
1669    ///
1670    /// This property is meant to be set by widget implementations,
1671    /// typically in their instance init function.
1672    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1673        Self {
1674            builder: self
1675                .builder
1676                .property("layout-manager", layout_manager.clone().upcast()),
1677        }
1678    }
1679
1680    /// Makes this widget act like a modal dialog, with respect to
1681    /// event delivery.
1682    ///
1683    /// Global event controllers will not handle events with targets
1684    /// inside the widget, unless they are set up to ignore propagation
1685    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
1686    #[cfg(feature = "v4_18")]
1687    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1688    pub fn limit_events(self, limit_events: bool) -> Self {
1689        Self {
1690            builder: self.builder.property("limit-events", limit_events),
1691        }
1692    }
1693
1694    /// Margin on bottom side of widget.
1695    ///
1696    /// This property adds margin outside of the widget's normal size
1697    /// request, the margin will be added in addition to the size from
1698    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1699    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1700        Self {
1701            builder: self.builder.property("margin-bottom", margin_bottom),
1702        }
1703    }
1704
1705    /// Margin on end of widget, horizontally.
1706    ///
1707    /// This property supports left-to-right and right-to-left text
1708    /// directions.
1709    ///
1710    /// This property adds margin outside of the widget's normal size
1711    /// request, the margin will be added in addition to the size from
1712    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1713    pub fn margin_end(self, margin_end: i32) -> Self {
1714        Self {
1715            builder: self.builder.property("margin-end", margin_end),
1716        }
1717    }
1718
1719    /// Margin on start of widget, horizontally.
1720    ///
1721    /// This property supports left-to-right and right-to-left text
1722    /// directions.
1723    ///
1724    /// This property adds margin outside of the widget's normal size
1725    /// request, the margin will be added in addition to the size from
1726    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1727    pub fn margin_start(self, margin_start: i32) -> Self {
1728        Self {
1729            builder: self.builder.property("margin-start", margin_start),
1730        }
1731    }
1732
1733    /// Margin on top side of widget.
1734    ///
1735    /// This property adds margin outside of the widget's normal size
1736    /// request, the margin will be added in addition to the size from
1737    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1738    pub fn margin_top(self, margin_top: i32) -> Self {
1739        Self {
1740            builder: self.builder.property("margin-top", margin_top),
1741        }
1742    }
1743
1744    /// The name of the widget.
1745    pub fn name(self, name: impl Into<glib::GString>) -> Self {
1746        Self {
1747            builder: self.builder.property("name", name.into()),
1748        }
1749    }
1750
1751    /// The requested opacity of the widget.
1752    pub fn opacity(self, opacity: f64) -> Self {
1753        Self {
1754            builder: self.builder.property("opacity", opacity),
1755        }
1756    }
1757
1758    /// How content outside the widget's content area is treated.
1759    ///
1760    /// This property is meant to be set by widget implementations,
1761    /// typically in their instance init function.
1762    pub fn overflow(self, overflow: Overflow) -> Self {
1763        Self {
1764            builder: self.builder.property("overflow", overflow),
1765        }
1766    }
1767
1768    /// Whether the widget will receive the default action when it is focused.
1769    pub fn receives_default(self, receives_default: bool) -> Self {
1770        Self {
1771            builder: self.builder.property("receives-default", receives_default),
1772        }
1773    }
1774
1775    /// Whether the widget responds to input.
1776    pub fn sensitive(self, sensitive: bool) -> Self {
1777        Self {
1778            builder: self.builder.property("sensitive", sensitive),
1779        }
1780    }
1781
1782    /// Sets the text of tooltip to be the given string, which is marked up
1783    /// with Pango markup.
1784    ///
1785    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1786    ///
1787    /// This is a convenience property which will take care of getting the
1788    /// tooltip shown if the given string is not `NULL`:
1789    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1790    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1791    /// the default signal handler.
1792    ///
1793    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1794    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1795    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1796        Self {
1797            builder: self
1798                .builder
1799                .property("tooltip-markup", tooltip_markup.into()),
1800        }
1801    }
1802
1803    /// Sets the text of tooltip to be the given string.
1804    ///
1805    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1806    ///
1807    /// This is a convenience property which will take care of getting the
1808    /// tooltip shown if the given string is not `NULL`:
1809    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1810    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1811    /// the default signal handler.
1812    ///
1813    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1814    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1815    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1816        Self {
1817            builder: self.builder.property("tooltip-text", tooltip_text.into()),
1818        }
1819    }
1820
1821    /// How to distribute vertical space if widget gets extra space.
1822    pub fn valign(self, valign: Align) -> Self {
1823        Self {
1824            builder: self.builder.property("valign", valign),
1825        }
1826    }
1827
1828    /// Whether to expand vertically.
1829    pub fn vexpand(self, vexpand: bool) -> Self {
1830        Self {
1831            builder: self.builder.property("vexpand", vexpand),
1832        }
1833    }
1834
1835    /// Whether to use the `vexpand` property.
1836    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1837        Self {
1838            builder: self.builder.property("vexpand-set", vexpand_set),
1839        }
1840    }
1841
1842    /// Whether the widget is visible.
1843    pub fn visible(self, visible: bool) -> Self {
1844        Self {
1845            builder: self.builder.property("visible", visible),
1846        }
1847    }
1848
1849    /// Overrides for width request of the widget.
1850    ///
1851    /// If this is -1, the natural request will be used.
1852    pub fn width_request(self, width_request: i32) -> Self {
1853        Self {
1854            builder: self.builder.property("width-request", width_request),
1855        }
1856    }
1857
1858    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
1859    ///
1860    /// The accessible role cannot be changed once set.
1861    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
1862        Self {
1863            builder: self.builder.property("accessible-role", accessible_role),
1864        }
1865    }
1866
1867    /// The orientation of the orientable.
1868    pub fn orientation(self, orientation: Orientation) -> Self {
1869        Self {
1870            builder: self.builder.property("orientation", orientation),
1871        }
1872    }
1873
1874    // rustdoc-stripper-ignore-next
1875    /// Build the [`Paned`].
1876    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1877    pub fn build(self) -> Paned {
1878        assert_initialized_main_thread!();
1879        self.builder.build()
1880    }
1881}