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 Accessible, AccessibleRole, Align, Buildable, ConstraintTarget, LayoutManager, Orientable,
10 Orientation, Overflow, ScrollType, Widget, ffi,
11};
12use glib::{
13 object::ObjectType as _,
14 prelude::*,
15 signal::{SignalHandlerId, connect_raw},
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 unsafe {
982 let f: &F = &*(f as *const F);
983 f(&from_glib_borrow(this)).into_glib()
984 }
985 }
986 unsafe {
987 let f: Box_<F> = Box_::new(f);
988 connect_raw(
989 self.as_ptr() as *mut _,
990 c"accept-position".as_ptr() as *const _,
991 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
992 accept_position_trampoline::<F> as *const (),
993 )),
994 Box_::into_raw(f),
995 )
996 }
997 }
998
999 pub fn emit_accept_position(&self) -> bool {
1000 self.emit_by_name("accept-position", &[])
1001 }
1002
1003 /// Emitted to cancel moving the position of the handle using key
1004 /// bindings.
1005 ///
1006 /// The position of the handle will be reset to the value prior to
1007 /// moving it.
1008 ///
1009 /// This is a [keybinding signal](class.SignalAction.html).
1010 ///
1011 /// The default binding for this signal is <kbd>Escape</kbd>.
1012 ///
1013 /// # Returns
1014 ///
1015 /// whether the position was canceled
1016 #[doc(alias = "cancel-position")]
1017 pub fn connect_cancel_position<F: Fn(&Self) -> bool + 'static>(&self, f: F) -> SignalHandlerId {
1018 unsafe extern "C" fn cancel_position_trampoline<F: Fn(&Paned) -> bool + 'static>(
1019 this: *mut ffi::GtkPaned,
1020 f: glib::ffi::gpointer,
1021 ) -> glib::ffi::gboolean {
1022 unsafe {
1023 let f: &F = &*(f as *const F);
1024 f(&from_glib_borrow(this)).into_glib()
1025 }
1026 }
1027 unsafe {
1028 let f: Box_<F> = Box_::new(f);
1029 connect_raw(
1030 self.as_ptr() as *mut _,
1031 c"cancel-position".as_ptr() as *const _,
1032 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1033 cancel_position_trampoline::<F> as *const (),
1034 )),
1035 Box_::into_raw(f),
1036 )
1037 }
1038 }
1039
1040 pub fn emit_cancel_position(&self) -> bool {
1041 self.emit_by_name("cancel-position", &[])
1042 }
1043
1044 /// Emitted to cycle the focus between the children of the paned.
1045 ///
1046 /// This is a [keybinding signal](class.SignalAction.html).
1047 ///
1048 /// The default binding is <kbd>F6</kbd>.
1049 /// ## `reversed`
1050 /// whether cycling backward or forward
1051 ///
1052 /// # Returns
1053 ///
1054 /// whether the behavior was cycled
1055 #[doc(alias = "cycle-child-focus")]
1056 pub fn connect_cycle_child_focus<F: Fn(&Self, bool) -> bool + 'static>(
1057 &self,
1058 f: F,
1059 ) -> SignalHandlerId {
1060 unsafe extern "C" fn cycle_child_focus_trampoline<F: Fn(&Paned, bool) -> bool + 'static>(
1061 this: *mut ffi::GtkPaned,
1062 reversed: glib::ffi::gboolean,
1063 f: glib::ffi::gpointer,
1064 ) -> glib::ffi::gboolean {
1065 unsafe {
1066 let f: &F = &*(f as *const F);
1067 f(&from_glib_borrow(this), from_glib(reversed)).into_glib()
1068 }
1069 }
1070 unsafe {
1071 let f: Box_<F> = Box_::new(f);
1072 connect_raw(
1073 self.as_ptr() as *mut _,
1074 c"cycle-child-focus".as_ptr() as *const _,
1075 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1076 cycle_child_focus_trampoline::<F> as *const (),
1077 )),
1078 Box_::into_raw(f),
1079 )
1080 }
1081 }
1082
1083 pub fn emit_cycle_child_focus(&self, reversed: bool) -> bool {
1084 self.emit_by_name("cycle-child-focus", &[&reversed])
1085 }
1086
1087 /// Emitted to cycle whether the paned should grab focus to allow
1088 /// the user to change position of the handle by using key bindings.
1089 ///
1090 /// This is a [keybinding signal](class.SignalAction.html).
1091 ///
1092 /// The default binding for this signal is <kbd>F8</kbd>.
1093 /// ## `reversed`
1094 /// whether cycling backward or forward
1095 ///
1096 /// # Returns
1097 ///
1098 /// whether the behavior was cycled
1099 #[doc(alias = "cycle-handle-focus")]
1100 pub fn connect_cycle_handle_focus<F: Fn(&Self, bool) -> bool + 'static>(
1101 &self,
1102 f: F,
1103 ) -> SignalHandlerId {
1104 unsafe extern "C" fn cycle_handle_focus_trampoline<
1105 F: Fn(&Paned, bool) -> bool + 'static,
1106 >(
1107 this: *mut ffi::GtkPaned,
1108 reversed: glib::ffi::gboolean,
1109 f: glib::ffi::gpointer,
1110 ) -> glib::ffi::gboolean {
1111 unsafe {
1112 let f: &F = &*(f as *const F);
1113 f(&from_glib_borrow(this), from_glib(reversed)).into_glib()
1114 }
1115 }
1116 unsafe {
1117 let f: Box_<F> = Box_::new(f);
1118 connect_raw(
1119 self.as_ptr() as *mut _,
1120 c"cycle-handle-focus".as_ptr() as *const _,
1121 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1122 cycle_handle_focus_trampoline::<F> as *const (),
1123 )),
1124 Box_::into_raw(f),
1125 )
1126 }
1127 }
1128
1129 pub fn emit_cycle_handle_focus(&self, reversed: bool) -> bool {
1130 self.emit_by_name("cycle-handle-focus", &[&reversed])
1131 }
1132
1133 /// Emitted to move the handle with key bindings.
1134 ///
1135 /// This is a [keybinding signal](class.SignalAction.html).
1136 ///
1137 /// The default bindings for this signal are
1138 /// <kbd>Ctrl</kbd>+<kbd>←</kbd>, <kbd>←</kbd>,
1139 /// <kbd>Ctrl</kbd>+<kbd>→</kbd>, <kbd>→</kbd>,
1140 /// <kbd>Ctrl</kbd>+<kbd>↑</kbd>, <kbd>↑</kbd>,
1141 /// <kbd>Ctrl</kbd>+<kbd>↓</kbd>, <kbd>↓</kbd>,
1142 /// <kbd>PgUp</kbd>, <kbd>PgDn</kbd>, <kbd>Home</kbd>, <kbd>End</kbd>.
1143 /// ## `scroll_type`
1144 /// a [`ScrollType`][crate::ScrollType]
1145 ///
1146 /// # Returns
1147 ///
1148 /// whether the handle was moved
1149 #[doc(alias = "move-handle")]
1150 pub fn connect_move_handle<F: Fn(&Self, ScrollType) -> bool + 'static>(
1151 &self,
1152 f: F,
1153 ) -> SignalHandlerId {
1154 unsafe extern "C" fn move_handle_trampoline<F: Fn(&Paned, ScrollType) -> bool + 'static>(
1155 this: *mut ffi::GtkPaned,
1156 scroll_type: ffi::GtkScrollType,
1157 f: glib::ffi::gpointer,
1158 ) -> glib::ffi::gboolean {
1159 unsafe {
1160 let f: &F = &*(f as *const F);
1161 f(&from_glib_borrow(this), from_glib(scroll_type)).into_glib()
1162 }
1163 }
1164 unsafe {
1165 let f: Box_<F> = Box_::new(f);
1166 connect_raw(
1167 self.as_ptr() as *mut _,
1168 c"move-handle".as_ptr() as *const _,
1169 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1170 move_handle_trampoline::<F> as *const (),
1171 )),
1172 Box_::into_raw(f),
1173 )
1174 }
1175 }
1176
1177 pub fn emit_move_handle(&self, scroll_type: ScrollType) -> bool {
1178 self.emit_by_name("move-handle", &[&scroll_type])
1179 }
1180
1181 /// Emitted to accept the current position of the handle and then
1182 /// move focus to the next widget in the focus chain.
1183 ///
1184 /// This is a [keybinding signal](class.SignalAction.html).
1185 ///
1186 /// The default binding is <kbd>Tab</kbd>.
1187 ///
1188 /// # Returns
1189 ///
1190 /// whether handle focus was toggled
1191 #[doc(alias = "toggle-handle-focus")]
1192 pub fn connect_toggle_handle_focus<F: Fn(&Self) -> bool + 'static>(
1193 &self,
1194 f: F,
1195 ) -> SignalHandlerId {
1196 unsafe extern "C" fn toggle_handle_focus_trampoline<F: Fn(&Paned) -> bool + 'static>(
1197 this: *mut ffi::GtkPaned,
1198 f: glib::ffi::gpointer,
1199 ) -> glib::ffi::gboolean {
1200 unsafe {
1201 let f: &F = &*(f as *const F);
1202 f(&from_glib_borrow(this)).into_glib()
1203 }
1204 }
1205 unsafe {
1206 let f: Box_<F> = Box_::new(f);
1207 connect_raw(
1208 self.as_ptr() as *mut _,
1209 c"toggle-handle-focus".as_ptr() as *const _,
1210 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1211 toggle_handle_focus_trampoline::<F> as *const (),
1212 )),
1213 Box_::into_raw(f),
1214 )
1215 }
1216 }
1217
1218 pub fn emit_toggle_handle_focus(&self) -> bool {
1219 self.emit_by_name("toggle-handle-focus", &[])
1220 }
1221
1222 #[doc(alias = "end-child")]
1223 pub fn connect_end_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1224 unsafe extern "C" fn notify_end_child_trampoline<F: Fn(&Paned) + 'static>(
1225 this: *mut ffi::GtkPaned,
1226 _param_spec: glib::ffi::gpointer,
1227 f: glib::ffi::gpointer,
1228 ) {
1229 unsafe {
1230 let f: &F = &*(f as *const F);
1231 f(&from_glib_borrow(this))
1232 }
1233 }
1234 unsafe {
1235 let f: Box_<F> = Box_::new(f);
1236 connect_raw(
1237 self.as_ptr() as *mut _,
1238 c"notify::end-child".as_ptr() as *const _,
1239 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1240 notify_end_child_trampoline::<F> as *const (),
1241 )),
1242 Box_::into_raw(f),
1243 )
1244 }
1245 }
1246
1247 #[doc(alias = "max-position")]
1248 pub fn connect_max_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1249 unsafe extern "C" fn notify_max_position_trampoline<F: Fn(&Paned) + 'static>(
1250 this: *mut ffi::GtkPaned,
1251 _param_spec: glib::ffi::gpointer,
1252 f: glib::ffi::gpointer,
1253 ) {
1254 unsafe {
1255 let f: &F = &*(f as *const F);
1256 f(&from_glib_borrow(this))
1257 }
1258 }
1259 unsafe {
1260 let f: Box_<F> = Box_::new(f);
1261 connect_raw(
1262 self.as_ptr() as *mut _,
1263 c"notify::max-position".as_ptr() as *const _,
1264 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1265 notify_max_position_trampoline::<F> as *const (),
1266 )),
1267 Box_::into_raw(f),
1268 )
1269 }
1270 }
1271
1272 #[doc(alias = "min-position")]
1273 pub fn connect_min_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1274 unsafe extern "C" fn notify_min_position_trampoline<F: Fn(&Paned) + 'static>(
1275 this: *mut ffi::GtkPaned,
1276 _param_spec: glib::ffi::gpointer,
1277 f: glib::ffi::gpointer,
1278 ) {
1279 unsafe {
1280 let f: &F = &*(f as *const F);
1281 f(&from_glib_borrow(this))
1282 }
1283 }
1284 unsafe {
1285 let f: Box_<F> = Box_::new(f);
1286 connect_raw(
1287 self.as_ptr() as *mut _,
1288 c"notify::min-position".as_ptr() as *const _,
1289 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1290 notify_min_position_trampoline::<F> as *const (),
1291 )),
1292 Box_::into_raw(f),
1293 )
1294 }
1295 }
1296
1297 #[doc(alias = "position")]
1298 pub fn connect_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1299 unsafe extern "C" fn notify_position_trampoline<F: Fn(&Paned) + 'static>(
1300 this: *mut ffi::GtkPaned,
1301 _param_spec: glib::ffi::gpointer,
1302 f: glib::ffi::gpointer,
1303 ) {
1304 unsafe {
1305 let f: &F = &*(f as *const F);
1306 f(&from_glib_borrow(this))
1307 }
1308 }
1309 unsafe {
1310 let f: Box_<F> = Box_::new(f);
1311 connect_raw(
1312 self.as_ptr() as *mut _,
1313 c"notify::position".as_ptr() as *const _,
1314 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1315 notify_position_trampoline::<F> as *const (),
1316 )),
1317 Box_::into_raw(f),
1318 )
1319 }
1320 }
1321
1322 #[doc(alias = "position-set")]
1323 pub fn connect_position_set_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1324 unsafe extern "C" fn notify_position_set_trampoline<F: Fn(&Paned) + 'static>(
1325 this: *mut ffi::GtkPaned,
1326 _param_spec: glib::ffi::gpointer,
1327 f: glib::ffi::gpointer,
1328 ) {
1329 unsafe {
1330 let f: &F = &*(f as *const F);
1331 f(&from_glib_borrow(this))
1332 }
1333 }
1334 unsafe {
1335 let f: Box_<F> = Box_::new(f);
1336 connect_raw(
1337 self.as_ptr() as *mut _,
1338 c"notify::position-set".as_ptr() as *const _,
1339 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1340 notify_position_set_trampoline::<F> as *const (),
1341 )),
1342 Box_::into_raw(f),
1343 )
1344 }
1345 }
1346
1347 #[doc(alias = "resize-end-child")]
1348 pub fn connect_resize_end_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1349 unsafe extern "C" fn notify_resize_end_child_trampoline<F: Fn(&Paned) + 'static>(
1350 this: *mut ffi::GtkPaned,
1351 _param_spec: glib::ffi::gpointer,
1352 f: glib::ffi::gpointer,
1353 ) {
1354 unsafe {
1355 let f: &F = &*(f as *const F);
1356 f(&from_glib_borrow(this))
1357 }
1358 }
1359 unsafe {
1360 let f: Box_<F> = Box_::new(f);
1361 connect_raw(
1362 self.as_ptr() as *mut _,
1363 c"notify::resize-end-child".as_ptr() as *const _,
1364 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1365 notify_resize_end_child_trampoline::<F> as *const (),
1366 )),
1367 Box_::into_raw(f),
1368 )
1369 }
1370 }
1371
1372 #[doc(alias = "resize-start-child")]
1373 pub fn connect_resize_start_child_notify<F: Fn(&Self) + 'static>(
1374 &self,
1375 f: F,
1376 ) -> SignalHandlerId {
1377 unsafe extern "C" fn notify_resize_start_child_trampoline<F: Fn(&Paned) + 'static>(
1378 this: *mut ffi::GtkPaned,
1379 _param_spec: glib::ffi::gpointer,
1380 f: glib::ffi::gpointer,
1381 ) {
1382 unsafe {
1383 let f: &F = &*(f as *const F);
1384 f(&from_glib_borrow(this))
1385 }
1386 }
1387 unsafe {
1388 let f: Box_<F> = Box_::new(f);
1389 connect_raw(
1390 self.as_ptr() as *mut _,
1391 c"notify::resize-start-child".as_ptr() as *const _,
1392 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1393 notify_resize_start_child_trampoline::<F> as *const (),
1394 )),
1395 Box_::into_raw(f),
1396 )
1397 }
1398 }
1399
1400 #[doc(alias = "shrink-end-child")]
1401 pub fn connect_shrink_end_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1402 unsafe extern "C" fn notify_shrink_end_child_trampoline<F: Fn(&Paned) + 'static>(
1403 this: *mut ffi::GtkPaned,
1404 _param_spec: glib::ffi::gpointer,
1405 f: glib::ffi::gpointer,
1406 ) {
1407 unsafe {
1408 let f: &F = &*(f as *const F);
1409 f(&from_glib_borrow(this))
1410 }
1411 }
1412 unsafe {
1413 let f: Box_<F> = Box_::new(f);
1414 connect_raw(
1415 self.as_ptr() as *mut _,
1416 c"notify::shrink-end-child".as_ptr() as *const _,
1417 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1418 notify_shrink_end_child_trampoline::<F> as *const (),
1419 )),
1420 Box_::into_raw(f),
1421 )
1422 }
1423 }
1424
1425 #[doc(alias = "shrink-start-child")]
1426 pub fn connect_shrink_start_child_notify<F: Fn(&Self) + 'static>(
1427 &self,
1428 f: F,
1429 ) -> SignalHandlerId {
1430 unsafe extern "C" fn notify_shrink_start_child_trampoline<F: Fn(&Paned) + 'static>(
1431 this: *mut ffi::GtkPaned,
1432 _param_spec: glib::ffi::gpointer,
1433 f: glib::ffi::gpointer,
1434 ) {
1435 unsafe {
1436 let f: &F = &*(f as *const F);
1437 f(&from_glib_borrow(this))
1438 }
1439 }
1440 unsafe {
1441 let f: Box_<F> = Box_::new(f);
1442 connect_raw(
1443 self.as_ptr() as *mut _,
1444 c"notify::shrink-start-child".as_ptr() as *const _,
1445 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1446 notify_shrink_start_child_trampoline::<F> as *const (),
1447 )),
1448 Box_::into_raw(f),
1449 )
1450 }
1451 }
1452
1453 #[doc(alias = "start-child")]
1454 pub fn connect_start_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1455 unsafe extern "C" fn notify_start_child_trampoline<F: Fn(&Paned) + 'static>(
1456 this: *mut ffi::GtkPaned,
1457 _param_spec: glib::ffi::gpointer,
1458 f: glib::ffi::gpointer,
1459 ) {
1460 unsafe {
1461 let f: &F = &*(f as *const F);
1462 f(&from_glib_borrow(this))
1463 }
1464 }
1465 unsafe {
1466 let f: Box_<F> = Box_::new(f);
1467 connect_raw(
1468 self.as_ptr() as *mut _,
1469 c"notify::start-child".as_ptr() as *const _,
1470 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1471 notify_start_child_trampoline::<F> as *const (),
1472 )),
1473 Box_::into_raw(f),
1474 )
1475 }
1476 }
1477
1478 #[doc(alias = "wide-handle")]
1479 pub fn connect_wide_handle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1480 unsafe extern "C" fn notify_wide_handle_trampoline<F: Fn(&Paned) + 'static>(
1481 this: *mut ffi::GtkPaned,
1482 _param_spec: glib::ffi::gpointer,
1483 f: glib::ffi::gpointer,
1484 ) {
1485 unsafe {
1486 let f: &F = &*(f as *const F);
1487 f(&from_glib_borrow(this))
1488 }
1489 }
1490 unsafe {
1491 let f: Box_<F> = Box_::new(f);
1492 connect_raw(
1493 self.as_ptr() as *mut _,
1494 c"notify::wide-handle".as_ptr() as *const _,
1495 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1496 notify_wide_handle_trampoline::<F> as *const (),
1497 )),
1498 Box_::into_raw(f),
1499 )
1500 }
1501 }
1502}
1503
1504impl Default for Paned {
1505 fn default() -> Self {
1506 glib::object::Object::new::<Self>()
1507 }
1508}
1509
1510// rustdoc-stripper-ignore-next
1511/// A [builder-pattern] type to construct [`Paned`] objects.
1512///
1513/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1514#[must_use = "The builder must be built to be used"]
1515pub struct PanedBuilder {
1516 builder: glib::object::ObjectBuilder<'static, Paned>,
1517}
1518
1519impl PanedBuilder {
1520 fn new() -> Self {
1521 Self {
1522 builder: glib::object::Object::builder(),
1523 }
1524 }
1525
1526 /// The second child.
1527 pub fn end_child(self, end_child: &impl IsA<Widget>) -> Self {
1528 Self {
1529 builder: self
1530 .builder
1531 .property("end-child", end_child.clone().upcast()),
1532 }
1533 }
1534
1535 /// Position of the separator in pixels, from the left/top.
1536 pub fn position(self, position: i32) -> Self {
1537 Self {
1538 builder: self.builder.property("position", position),
1539 }
1540 }
1541
1542 /// Whether the [`position`][struct@crate::Paned#position] property has been set.
1543 pub fn position_set(self, position_set: bool) -> Self {
1544 Self {
1545 builder: self.builder.property("position-set", position_set),
1546 }
1547 }
1548
1549 /// Determines whether the second child expands and shrinks
1550 /// along with the paned widget.
1551 pub fn resize_end_child(self, resize_end_child: bool) -> Self {
1552 Self {
1553 builder: self.builder.property("resize-end-child", resize_end_child),
1554 }
1555 }
1556
1557 /// Determines whether the first child expands and shrinks
1558 /// along with the paned widget.
1559 pub fn resize_start_child(self, resize_start_child: bool) -> Self {
1560 Self {
1561 builder: self
1562 .builder
1563 .property("resize-start-child", resize_start_child),
1564 }
1565 }
1566
1567 /// Determines whether the second child can be made smaller
1568 /// than its requisition.
1569 pub fn shrink_end_child(self, shrink_end_child: bool) -> Self {
1570 Self {
1571 builder: self.builder.property("shrink-end-child", shrink_end_child),
1572 }
1573 }
1574
1575 /// Determines whether the first child can be made smaller
1576 /// than its requisition.
1577 pub fn shrink_start_child(self, shrink_start_child: bool) -> Self {
1578 Self {
1579 builder: self
1580 .builder
1581 .property("shrink-start-child", shrink_start_child),
1582 }
1583 }
1584
1585 /// The first child.
1586 pub fn start_child(self, start_child: &impl IsA<Widget>) -> Self {
1587 Self {
1588 builder: self
1589 .builder
1590 .property("start-child", start_child.clone().upcast()),
1591 }
1592 }
1593
1594 /// Whether the [`Paned`][crate::Paned] should provide a stronger visual separation.
1595 ///
1596 /// For example, this could be set when a paned contains two
1597 /// [`Notebook`][crate::Notebook]s, whose tab rows would otherwise merge visually.
1598 pub fn wide_handle(self, wide_handle: bool) -> Self {
1599 Self {
1600 builder: self.builder.property("wide-handle", wide_handle),
1601 }
1602 }
1603
1604 /// Whether the widget or any of its descendents can accept
1605 /// the input focus.
1606 ///
1607 /// This property is meant to be set by widget implementations,
1608 /// typically in their instance init function.
1609 pub fn can_focus(self, can_focus: bool) -> Self {
1610 Self {
1611 builder: self.builder.property("can-focus", can_focus),
1612 }
1613 }
1614
1615 /// Whether the widget can receive pointer events.
1616 pub fn can_target(self, can_target: bool) -> Self {
1617 Self {
1618 builder: self.builder.property("can-target", can_target),
1619 }
1620 }
1621
1622 /// A list of css classes applied to this widget.
1623 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1624 Self {
1625 builder: self.builder.property("css-classes", css_classes.into()),
1626 }
1627 }
1628
1629 /// The name of this widget in the CSS tree.
1630 ///
1631 /// This property is meant to be set by widget implementations,
1632 /// typically in their instance init function.
1633 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1634 Self {
1635 builder: self.builder.property("css-name", css_name.into()),
1636 }
1637 }
1638
1639 /// The cursor used by @widget.
1640 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1641 Self {
1642 builder: self.builder.property("cursor", cursor.clone()),
1643 }
1644 }
1645
1646 /// Whether the widget should grab focus when it is clicked with the mouse.
1647 ///
1648 /// This property is only relevant for widgets that can take focus.
1649 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1650 Self {
1651 builder: self.builder.property("focus-on-click", focus_on_click),
1652 }
1653 }
1654
1655 /// Whether this widget itself will accept the input focus.
1656 pub fn focusable(self, focusable: bool) -> Self {
1657 Self {
1658 builder: self.builder.property("focusable", focusable),
1659 }
1660 }
1661
1662 /// How to distribute horizontal space if widget gets extra space.
1663 pub fn halign(self, halign: Align) -> Self {
1664 Self {
1665 builder: self.builder.property("halign", halign),
1666 }
1667 }
1668
1669 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
1670 /// signal on @widget.
1671 ///
1672 /// A true value indicates that @widget can have a tooltip, in this case
1673 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
1674 /// determine whether it will provide a tooltip or not.
1675 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1676 Self {
1677 builder: self.builder.property("has-tooltip", has_tooltip),
1678 }
1679 }
1680
1681 /// Overrides for height request of the widget.
1682 ///
1683 /// If this is -1, the natural request will be used.
1684 pub fn height_request(self, height_request: i32) -> Self {
1685 Self {
1686 builder: self.builder.property("height-request", height_request),
1687 }
1688 }
1689
1690 /// Whether to expand horizontally.
1691 pub fn hexpand(self, hexpand: bool) -> Self {
1692 Self {
1693 builder: self.builder.property("hexpand", hexpand),
1694 }
1695 }
1696
1697 /// Whether to use the `hexpand` property.
1698 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1699 Self {
1700 builder: self.builder.property("hexpand-set", hexpand_set),
1701 }
1702 }
1703
1704 /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
1705 /// the preferred size of the widget, and allocate its children.
1706 ///
1707 /// This property is meant to be set by widget implementations,
1708 /// typically in their instance init function.
1709 pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1710 Self {
1711 builder: self
1712 .builder
1713 .property("layout-manager", layout_manager.clone().upcast()),
1714 }
1715 }
1716
1717 /// Makes this widget act like a modal dialog, with respect to
1718 /// event delivery.
1719 ///
1720 /// Global event controllers will not handle events with targets
1721 /// inside the widget, unless they are set up to ignore propagation
1722 /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
1723 #[cfg(feature = "v4_18")]
1724 #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1725 pub fn limit_events(self, limit_events: bool) -> Self {
1726 Self {
1727 builder: self.builder.property("limit-events", limit_events),
1728 }
1729 }
1730
1731 /// Margin on bottom side of widget.
1732 ///
1733 /// This property adds margin outside of the widget's normal size
1734 /// request, the margin will be added in addition to the size from
1735 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1736 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1737 Self {
1738 builder: self.builder.property("margin-bottom", margin_bottom),
1739 }
1740 }
1741
1742 /// Margin on end of widget, horizontally.
1743 ///
1744 /// This property supports left-to-right and right-to-left text
1745 /// directions.
1746 ///
1747 /// This property adds margin outside of the widget's normal size
1748 /// request, the margin will be added in addition to the size from
1749 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1750 pub fn margin_end(self, margin_end: i32) -> Self {
1751 Self {
1752 builder: self.builder.property("margin-end", margin_end),
1753 }
1754 }
1755
1756 /// Margin on start of widget, horizontally.
1757 ///
1758 /// This property supports left-to-right and right-to-left text
1759 /// directions.
1760 ///
1761 /// This property adds margin outside of the widget's normal size
1762 /// request, the margin will be added in addition to the size from
1763 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1764 pub fn margin_start(self, margin_start: i32) -> Self {
1765 Self {
1766 builder: self.builder.property("margin-start", margin_start),
1767 }
1768 }
1769
1770 /// Margin on top side of widget.
1771 ///
1772 /// This property adds margin outside of the widget's normal size
1773 /// request, the margin will be added in addition to the size from
1774 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1775 pub fn margin_top(self, margin_top: i32) -> Self {
1776 Self {
1777 builder: self.builder.property("margin-top", margin_top),
1778 }
1779 }
1780
1781 /// The name of the widget.
1782 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1783 Self {
1784 builder: self.builder.property("name", name.into()),
1785 }
1786 }
1787
1788 /// The requested opacity of the widget.
1789 pub fn opacity(self, opacity: f64) -> Self {
1790 Self {
1791 builder: self.builder.property("opacity", opacity),
1792 }
1793 }
1794
1795 /// How content outside the widget's content area is treated.
1796 ///
1797 /// This property is meant to be set by widget implementations,
1798 /// typically in their instance init function.
1799 pub fn overflow(self, overflow: Overflow) -> Self {
1800 Self {
1801 builder: self.builder.property("overflow", overflow),
1802 }
1803 }
1804
1805 /// Whether the widget will receive the default action when it is focused.
1806 pub fn receives_default(self, receives_default: bool) -> Self {
1807 Self {
1808 builder: self.builder.property("receives-default", receives_default),
1809 }
1810 }
1811
1812 /// Whether the widget responds to input.
1813 pub fn sensitive(self, sensitive: bool) -> Self {
1814 Self {
1815 builder: self.builder.property("sensitive", sensitive),
1816 }
1817 }
1818
1819 /// Sets the text of tooltip to be the given string, which is marked up
1820 /// with Pango markup.
1821 ///
1822 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1823 ///
1824 /// This is a convenience property which will take care of getting the
1825 /// tooltip shown if the given string is not `NULL`:
1826 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1827 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1828 /// the default signal handler.
1829 ///
1830 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1831 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1832 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1833 Self {
1834 builder: self
1835 .builder
1836 .property("tooltip-markup", tooltip_markup.into()),
1837 }
1838 }
1839
1840 /// Sets the text of tooltip to be the given string.
1841 ///
1842 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1843 ///
1844 /// This is a convenience property which will take care of getting the
1845 /// tooltip shown if the given string is not `NULL`:
1846 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1847 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1848 /// the default signal handler.
1849 ///
1850 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1851 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1852 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1853 Self {
1854 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1855 }
1856 }
1857
1858 /// How to distribute vertical space if widget gets extra space.
1859 pub fn valign(self, valign: Align) -> Self {
1860 Self {
1861 builder: self.builder.property("valign", valign),
1862 }
1863 }
1864
1865 /// Whether to expand vertically.
1866 pub fn vexpand(self, vexpand: bool) -> Self {
1867 Self {
1868 builder: self.builder.property("vexpand", vexpand),
1869 }
1870 }
1871
1872 /// Whether to use the `vexpand` property.
1873 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1874 Self {
1875 builder: self.builder.property("vexpand-set", vexpand_set),
1876 }
1877 }
1878
1879 /// Whether the widget is visible.
1880 pub fn visible(self, visible: bool) -> Self {
1881 Self {
1882 builder: self.builder.property("visible", visible),
1883 }
1884 }
1885
1886 /// Overrides for width request of the widget.
1887 ///
1888 /// If this is -1, the natural request will be used.
1889 pub fn width_request(self, width_request: i32) -> Self {
1890 Self {
1891 builder: self.builder.property("width-request", width_request),
1892 }
1893 }
1894
1895 /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
1896 ///
1897 /// The accessible role cannot be changed once set.
1898 pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
1899 Self {
1900 builder: self.builder.property("accessible-role", accessible_role),
1901 }
1902 }
1903
1904 /// The orientation of the orientable.
1905 pub fn orientation(self, orientation: Orientation) -> Self {
1906 Self {
1907 builder: self.builder.property("orientation", orientation),
1908 }
1909 }
1910
1911 // rustdoc-stripper-ignore-next
1912 /// Build the [`Paned`].
1913 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1914 pub fn build(self) -> Paned {
1915 assert_initialized_main_thread!();
1916 self.builder.build()
1917 }
1918}