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