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