libadwaita/auto/flap.rs
1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from
3// from gir-files (https://github.com/gtk-rs/gir-files.git)
4// DO NOT EDIT
5#![allow(deprecated)]
6
7use crate::{
8 ffi, FlapFoldPolicy, FlapTransitionType, FoldThresholdPolicy, SpringParams, Swipeable,
9};
10use glib::{
11 prelude::*,
12 signal::{connect_raw, SignalHandlerId},
13 translate::*,
14};
15use std::boxed::Box as Box_;
16
17glib::wrapper! {
18 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
19 /// An adaptive container acting like a box or an overlay.
20 ///
21 /// <picture>
22 /// <source srcset="flap-wide-dark.png" media="(prefers-color-scheme: dark)">
23 /// <img src="flap-wide.png" alt="flap-wide">
24 /// </picture>
25 /// <picture>
26 /// <source srcset="flap-narrow-dark.png" media="(prefers-color-scheme: dark)">
27 /// <img src="flap-narrow.png" alt="flap-narrow">
28 /// </picture>
29 ///
30 /// The [`Flap`][crate::Flap] widget can display its children like a `Gtk::Box` does or
31 /// like a `Gtk::Overlay` does, according to the
32 /// [`fold-policy`][struct@crate::Flap#fold-policy] value.
33 ///
34 /// [`Flap`][crate::Flap] has at most three children: [`content`][struct@crate::Flap#content],
35 /// [`flap`][struct@crate::Flap#flap] and [`separator`][struct@crate::Flap#separator]. Content is the primary
36 /// child, flap is displayed next to it when unfolded, or overlays it when
37 /// folded. Flap can be shown or hidden by changing the
38 /// [`reveal-flap`][struct@crate::Flap#reveal-flap] value, as well as via swipe gestures if
39 /// [`swipe-to-open`][struct@crate::Flap#swipe-to-open] and/or [`swipe-to-close`][struct@crate::Flap#swipe-to-close] are set
40 /// to `TRUE`.
41 ///
42 /// Optionally, a separator can be provided, which would be displayed between
43 /// the content and the flap when there's no shadow to separate them, depending
44 /// on the transition type.
45 ///
46 /// [`flap`][struct@crate::Flap#flap] is transparent by default; add the
47 /// [`.background`](style-classes.html#background) style class to it if this is
48 /// unwanted.
49 ///
50 /// If [`modal`][struct@crate::Flap#modal] is set to `TRUE`, content becomes completely
51 /// inaccessible when the flap is revealed while folded.
52 ///
53 /// The position of the flap and separator children relative to the content is
54 /// determined by orientation, as well as the [`flap-position`][struct@crate::Flap#flap-position]
55 /// value.
56 ///
57 /// Folding the flap will automatically hide the flap widget, and unfolding it
58 /// will automatically reveal it. If this behavior is not desired, the
59 /// [`locked`][struct@crate::Flap#locked] property can be used to override it.
60 ///
61 /// Common use cases include sidebars, header bars that need to be able to
62 /// overlap the window content (for example, in fullscreen mode) and bottom
63 /// sheets.
64 ///
65 /// ## AdwFlap as GtkBuildable
66 ///
67 /// The [`Flap`][crate::Flap] implementation of the [`gtk::Buildable`][crate::gtk::Buildable] interface supports
68 /// setting the flap child by specifying “flap” as the “type” attribute of a
69 /// `<child>` element, and separator by specifying “separator”. Specifying
70 /// “content” child type or omitting it results in setting the content child.
71 ///
72 /// ## CSS nodes
73 ///
74 /// [`Flap`][crate::Flap] has a single CSS node with name `flap`. The node will get the style
75 /// classes `.folded` when it is folded, and `.unfolded` when it's not.
76 ///
77 /// ## Properties
78 ///
79 ///
80 /// #### `content`
81 /// The content widget.
82 ///
83 /// It's always displayed when unfolded, and partially visible when folded.
84 ///
85 /// Readable | Writeable
86 ///
87 ///
88 /// #### `flap`
89 /// The flap widget.
90 ///
91 /// It's only visible when [`reveal-progress`][struct@crate::Flap#reveal-progress] is greater than 0.
92 ///
93 /// Readable | Writeable
94 ///
95 ///
96 /// #### `flap-position`
97 /// The flap position.
98 ///
99 /// If it's set to [enum@Gtk.PackType.start], the flap is displayed before the
100 /// content, if [enum@Gtk.PackType.end], it's displayed after the content.
101 ///
102 /// Readable | Writeable
103 ///
104 ///
105 /// #### `fold-duration`
106 /// The fold transition animation duration, in milliseconds.
107 ///
108 /// Readable | Writeable
109 ///
110 ///
111 /// #### `fold-policy`
112 /// The fold policy for the flap.
113 ///
114 /// Readable | Writeable
115 ///
116 ///
117 /// #### `fold-threshold-policy`
118 /// Determines when the flap will fold.
119 ///
120 /// If set to [enum@Adw.FoldThresholdPolicy.minimum], flap will only fold when
121 /// the children cannot fit anymore. With [enum@Adw.FoldThresholdPolicy.natural],
122 /// it will fold as soon as children don't get their natural size.
123 ///
124 /// This can be useful if you have a long ellipsizing label and want to let it
125 /// ellipsize instead of immediately folding.
126 ///
127 /// Readable | Writeable
128 ///
129 ///
130 /// #### `folded`
131 /// Whether the flap is currently folded.
132 ///
133 /// See [`fold-policy`][struct@crate::Flap#fold-policy].
134 ///
135 /// Readable
136 ///
137 ///
138 /// #### `locked`
139 /// Whether the flap is locked.
140 ///
141 /// If `FALSE`, folding when the flap is revealed automatically closes it, and
142 /// unfolding it when the flap is not revealed opens it. If `TRUE`,
143 /// [`reveal-flap`][struct@crate::Flap#reveal-flap] value never changes on its own.
144 ///
145 /// Readable | Writeable
146 ///
147 ///
148 /// #### `modal`
149 /// Whether the flap is modal.
150 ///
151 /// If `TRUE`, clicking the content widget while flap is revealed, as well as
152 /// pressing the <kbd>Esc</kbd> key, will close the flap. If `FALSE`, clicks
153 /// are passed through to the content widget.
154 ///
155 /// Readable | Writeable
156 ///
157 ///
158 /// #### `reveal-flap`
159 /// Whether the flap widget is revealed.
160 ///
161 /// Readable | Writeable
162 ///
163 ///
164 /// #### `reveal-params`
165 /// The reveal animation spring parameters.
166 ///
167 /// The default value is equivalent to:
168 ///
169 /// **⚠️ The following code is in c ⚠️**
170 ///
171 /// ```c
172 /// adw_spring_params_new (1, 0.5, 500)
173 /// ```
174 ///
175 /// Readable | Writeable
176 ///
177 ///
178 /// #### `reveal-progress`
179 /// The current reveal transition progress.
180 ///
181 /// 0 means fully hidden, 1 means fully revealed.
182 ///
183 /// See [`reveal-flap`][struct@crate::Flap#reveal-flap].
184 ///
185 /// Readable
186 ///
187 ///
188 /// #### `separator`
189 /// The separator widget.
190 ///
191 /// It's displayed between content and flap when there's no shadow to display.
192 /// When exactly it's visible depends on the [`transition-type`][struct@crate::Flap#transition-type]
193 /// value.
194 ///
195 /// Readable | Writeable
196 ///
197 ///
198 /// #### `swipe-to-close`
199 /// Whether the flap can be closed with a swipe gesture.
200 ///
201 /// The area that can be swiped depends on the [`transition-type`][struct@crate::Flap#transition-type]
202 /// value.
203 ///
204 /// Readable | Writeable
205 ///
206 ///
207 /// #### `swipe-to-open`
208 /// Whether the flap can be opened with a swipe gesture.
209 ///
210 /// The area that can be swiped depends on the [`transition-type`][struct@crate::Flap#transition-type]
211 /// value.
212 ///
213 /// Readable | Writeable
214 ///
215 ///
216 /// #### `transition-type`
217 /// the type of animation used for reveal and fold transitions.
218 ///
219 /// [`flap`][struct@crate::Flap#flap] is transparent by default, which means the content
220 /// will be seen through it with [enum@Adw.FlapTransitionType.over] transitions;
221 /// add the [`.background`](style-classes.html#background) style class to it if
222 /// this is unwanted.
223 ///
224 /// Readable | Writeable
225 /// <details><summary><h4>Widget</h4></summary>
226 ///
227 ///
228 /// #### `can-focus`
229 /// Whether the widget or any of its descendents can accept
230 /// the input focus.
231 ///
232 /// This property is meant to be set by widget implementations,
233 /// typically in their instance init function.
234 ///
235 /// Readable | Writeable
236 ///
237 ///
238 /// #### `can-target`
239 /// Whether the widget can receive pointer events.
240 ///
241 /// Readable | Writeable
242 ///
243 ///
244 /// #### `css-classes`
245 /// A list of css classes applied to this widget.
246 ///
247 /// Readable | Writeable
248 ///
249 ///
250 /// #### `css-name`
251 /// The name of this widget in the CSS tree.
252 ///
253 /// This property is meant to be set by widget implementations,
254 /// typically in their instance init function.
255 ///
256 /// Readable | Writeable | Construct Only
257 ///
258 ///
259 /// #### `cursor`
260 /// The cursor used by @widget.
261 ///
262 /// Readable | Writeable
263 ///
264 ///
265 /// #### `focus-on-click`
266 /// Whether the widget should grab focus when it is clicked with the mouse.
267 ///
268 /// This property is only relevant for widgets that can take focus.
269 ///
270 /// Readable | Writeable
271 ///
272 ///
273 /// #### `focusable`
274 /// Whether this widget itself will accept the input focus.
275 ///
276 /// Readable | Writeable
277 ///
278 ///
279 /// #### `halign`
280 /// How to distribute horizontal space if widget gets extra space.
281 ///
282 /// Readable | Writeable
283 ///
284 ///
285 /// #### `has-default`
286 /// Whether the widget is the default widget.
287 ///
288 /// Readable
289 ///
290 ///
291 /// #### `has-focus`
292 /// Whether the widget has the input focus.
293 ///
294 /// Readable
295 ///
296 ///
297 /// #### `has-tooltip`
298 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip]
299 /// signal on @widget.
300 ///
301 /// A true value indicates that @widget can have a tooltip, in this case
302 /// the widget will be queried using [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] to
303 /// determine whether it will provide a tooltip or not.
304 ///
305 /// Readable | Writeable
306 ///
307 ///
308 /// #### `height-request`
309 /// Overrides for height request of the widget.
310 ///
311 /// If this is -1, the natural request will be used.
312 ///
313 /// Readable | Writeable
314 ///
315 ///
316 /// #### `hexpand`
317 /// Whether to expand horizontally.
318 ///
319 /// Readable | Writeable
320 ///
321 ///
322 /// #### `hexpand-set`
323 /// Whether to use the `hexpand` property.
324 ///
325 /// Readable | Writeable
326 ///
327 ///
328 /// #### `layout-manager`
329 /// The [`gtk::LayoutManager`][crate::gtk::LayoutManager] instance to use to compute
330 /// the preferred size of the widget, and allocate its children.
331 ///
332 /// This property is meant to be set by widget implementations,
333 /// typically in their instance init function.
334 ///
335 /// Readable | Writeable
336 ///
337 ///
338 /// #### `limit-events`
339 /// Makes this widget act like a modal dialog, with respect to
340 /// event delivery.
341 ///
342 /// Global event controllers will not handle events with targets
343 /// inside the widget, unless they are set up to ignore propagation
344 /// limits. See `Gtk::EventController::set_propagation_limit()`.
345 ///
346 /// Readable | Writeable
347 ///
348 ///
349 /// #### `margin-bottom`
350 /// Margin on bottom 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 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
355 ///
356 /// Readable | Writeable
357 ///
358 ///
359 /// #### `margin-end`
360 /// Margin on end of widget, horizontally.
361 ///
362 /// This property supports left-to-right and right-to-left text
363 /// directions.
364 ///
365 /// This property adds margin outside of the widget's normal size
366 /// request, the margin will be added in addition to the size from
367 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
368 ///
369 /// Readable | Writeable
370 ///
371 ///
372 /// #### `margin-start`
373 /// Margin on start of widget, horizontally.
374 ///
375 /// This property supports left-to-right and right-to-left text
376 /// directions.
377 ///
378 /// This property adds margin outside of the widget's normal size
379 /// request, the margin will be added in addition to the size from
380 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
381 ///
382 /// Readable | Writeable
383 ///
384 ///
385 /// #### `margin-top`
386 /// Margin on top side of widget.
387 ///
388 /// This property adds margin outside of the widget's normal size
389 /// request, the margin will be added in addition to the size from
390 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
391 ///
392 /// Readable | Writeable
393 ///
394 ///
395 /// #### `name`
396 /// The name of the widget.
397 ///
398 /// Readable | Writeable
399 ///
400 ///
401 /// #### `opacity`
402 /// The requested opacity of the widget.
403 ///
404 /// Readable | Writeable
405 ///
406 ///
407 /// #### `overflow`
408 /// How content outside the widget's content area is treated.
409 ///
410 /// This property is meant to be set by widget implementations,
411 /// typically in their instance init function.
412 ///
413 /// Readable | Writeable
414 ///
415 ///
416 /// #### `parent`
417 /// The parent widget of this widget.
418 ///
419 /// Readable
420 ///
421 ///
422 /// #### `receives-default`
423 /// Whether the widget will receive the default action when it is focused.
424 ///
425 /// Readable | Writeable
426 ///
427 ///
428 /// #### `root`
429 /// The [`gtk::Root`][crate::gtk::Root] widget of the widget tree containing this widget.
430 ///
431 /// This will be `NULL` if the widget is not contained in a root widget.
432 ///
433 /// Readable
434 ///
435 ///
436 /// #### `scale-factor`
437 /// The scale factor of the widget.
438 ///
439 /// Readable
440 ///
441 ///
442 /// #### `sensitive`
443 /// Whether the widget responds to input.
444 ///
445 /// Readable | Writeable
446 ///
447 ///
448 /// #### `tooltip-markup`
449 /// Sets the text of tooltip to be the given string, which is marked up
450 /// with Pango markup.
451 ///
452 /// Also see `Gtk::Tooltip::set_markup()`.
453 ///
454 /// This is a convenience property which will take care of getting the
455 /// tooltip shown if the given string is not `NULL`:
456 /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
457 /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
458 /// the default signal handler.
459 ///
460 /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
461 /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
462 ///
463 /// Readable | Writeable
464 ///
465 ///
466 /// #### `tooltip-text`
467 /// Sets the text of tooltip to be the given string.
468 ///
469 /// Also see `Gtk::Tooltip::set_text()`.
470 ///
471 /// This is a convenience property which will take care of getting the
472 /// tooltip shown if the given string is not `NULL`:
473 /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
474 /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
475 /// the default signal handler.
476 ///
477 /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
478 /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
479 ///
480 /// Readable | Writeable
481 ///
482 ///
483 /// #### `valign`
484 /// How to distribute vertical space if widget gets extra space.
485 ///
486 /// Readable | Writeable
487 ///
488 ///
489 /// #### `vexpand`
490 /// Whether to expand vertically.
491 ///
492 /// Readable | Writeable
493 ///
494 ///
495 /// #### `vexpand-set`
496 /// Whether to use the `vexpand` property.
497 ///
498 /// Readable | Writeable
499 ///
500 ///
501 /// #### `visible`
502 /// Whether the widget is visible.
503 ///
504 /// Readable | Writeable
505 ///
506 ///
507 /// #### `width-request`
508 /// Overrides for width request of the widget.
509 ///
510 /// If this is -1, the natural request will be used.
511 ///
512 /// Readable | Writeable
513 /// </details>
514 /// <details><summary><h4>Accessible</h4></summary>
515 ///
516 ///
517 /// #### `accessible-role`
518 /// The accessible role of the given [`gtk::Accessible`][crate::gtk::Accessible] implementation.
519 ///
520 /// The accessible role cannot be changed once set.
521 ///
522 /// Readable | Writeable
523 /// </details>
524 /// <details><summary><h4>Orientable</h4></summary>
525 ///
526 ///
527 /// #### `orientation`
528 /// The orientation of the orientable.
529 ///
530 /// Readable | Writeable
531 /// </details>
532 ///
533 /// # Implements
534 ///
535 /// [`trait@gtk::prelude::WidgetExt`], [`trait@glib::ObjectExt`], [`trait@gtk::prelude::AccessibleExt`], [`trait@gtk::prelude::BuildableExt`], [`trait@gtk::prelude::ConstraintTargetExt`], [`SwipeableExt`][trait@crate::prelude::SwipeableExt], [`trait@gtk::prelude::OrientableExt`]
536 #[doc(alias = "AdwFlap")]
537 pub struct Flap(Object<ffi::AdwFlap, ffi::AdwFlapClass>) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, Swipeable, gtk::Orientable;
538
539 match fn {
540 type_ => || ffi::adw_flap_get_type(),
541 }
542}
543
544impl Flap {
545 /// Creates a new [`Flap`][crate::Flap].
546 ///
547 /// # Deprecated since 1.4
548 ///
549 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
550 ///
551 /// # Returns
552 ///
553 /// the newly created [`Flap`][crate::Flap]
554 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
555 #[allow(deprecated)]
556 #[doc(alias = "adw_flap_new")]
557 pub fn new() -> Flap {
558 assert_initialized_main_thread!();
559 unsafe { gtk::Widget::from_glib_none(ffi::adw_flap_new()).unsafe_cast() }
560 }
561
562 // rustdoc-stripper-ignore-next
563 /// Creates a new builder-pattern struct instance to construct [`Flap`] objects.
564 ///
565 /// This method returns an instance of [`FlapBuilder`](crate::builders::FlapBuilder) which can be used to create [`Flap`] objects.
566 pub fn builder() -> FlapBuilder {
567 FlapBuilder::new()
568 }
569
570 /// Gets the content widget for @self.
571 ///
572 /// # Deprecated since 1.4
573 ///
574 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
575 ///
576 /// # Returns
577 ///
578 /// the content widget for @self
579 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
580 #[allow(deprecated)]
581 #[doc(alias = "adw_flap_get_content")]
582 #[doc(alias = "get_content")]
583 pub fn content(&self) -> Option<gtk::Widget> {
584 unsafe { from_glib_none(ffi::adw_flap_get_content(self.to_glib_none().0)) }
585 }
586
587 /// Gets the flap widget for @self.
588 ///
589 /// # Deprecated since 1.4
590 ///
591 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
592 ///
593 /// # Returns
594 ///
595 /// the flap widget for @self
596 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
597 #[allow(deprecated)]
598 #[doc(alias = "adw_flap_get_flap")]
599 #[doc(alias = "get_flap")]
600 pub fn flap(&self) -> Option<gtk::Widget> {
601 unsafe { from_glib_none(ffi::adw_flap_get_flap(self.to_glib_none().0)) }
602 }
603
604 /// Gets the flap position for @self.
605 ///
606 /// # Deprecated since 1.4
607 ///
608 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
609 ///
610 /// # Returns
611 ///
612 /// the flap position for @self
613 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
614 #[allow(deprecated)]
615 #[doc(alias = "adw_flap_get_flap_position")]
616 #[doc(alias = "get_flap_position")]
617 #[doc(alias = "flap-position")]
618 pub fn flap_position(&self) -> gtk::PackType {
619 unsafe { from_glib(ffi::adw_flap_get_flap_position(self.to_glib_none().0)) }
620 }
621
622 /// Gets the fold transition animation duration for @self, in milliseconds.
623 ///
624 /// # Deprecated since 1.4
625 ///
626 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
627 ///
628 /// # Returns
629 ///
630 /// the fold transition duration
631 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
632 #[allow(deprecated)]
633 #[doc(alias = "adw_flap_get_fold_duration")]
634 #[doc(alias = "get_fold_duration")]
635 #[doc(alias = "fold-duration")]
636 pub fn fold_duration(&self) -> u32 {
637 unsafe { ffi::adw_flap_get_fold_duration(self.to_glib_none().0) }
638 }
639
640 /// Gets the fold policy for @self.
641 ///
642 /// # Deprecated since 1.4
643 ///
644 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
645 ///
646 /// # Returns
647 ///
648 /// the fold policy for @self
649 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
650 #[allow(deprecated)]
651 #[doc(alias = "adw_flap_get_fold_policy")]
652 #[doc(alias = "get_fold_policy")]
653 #[doc(alias = "fold-policy")]
654 pub fn fold_policy(&self) -> FlapFoldPolicy {
655 unsafe { from_glib(ffi::adw_flap_get_fold_policy(self.to_glib_none().0)) }
656 }
657
658 /// Gets the fold threshold policy for @self.
659 ///
660 /// # Deprecated since 1.4
661 ///
662 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
663 ///
664 /// # Returns
665 ///
666 /// the fold threshold policy
667 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
668 #[allow(deprecated)]
669 #[doc(alias = "adw_flap_get_fold_threshold_policy")]
670 #[doc(alias = "get_fold_threshold_policy")]
671 #[doc(alias = "fold-threshold-policy")]
672 pub fn fold_threshold_policy(&self) -> FoldThresholdPolicy {
673 unsafe {
674 from_glib(ffi::adw_flap_get_fold_threshold_policy(
675 self.to_glib_none().0,
676 ))
677 }
678 }
679
680 /// Gets whether @self is currently folded.
681 ///
682 /// See [`fold-policy`][struct@crate::Flap#fold-policy].
683 ///
684 /// # Deprecated since 1.4
685 ///
686 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
687 ///
688 /// # Returns
689 ///
690 /// `TRUE` if @self is currently folded
691 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
692 #[allow(deprecated)]
693 #[doc(alias = "adw_flap_get_folded")]
694 #[doc(alias = "get_folded")]
695 #[doc(alias = "folded")]
696 pub fn is_folded(&self) -> bool {
697 unsafe { from_glib(ffi::adw_flap_get_folded(self.to_glib_none().0)) }
698 }
699
700 /// Gets whether @self is locked.
701 ///
702 /// # Deprecated since 1.4
703 ///
704 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
705 ///
706 /// # Returns
707 ///
708 /// `TRUE` if @self is locked
709 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
710 #[allow(deprecated)]
711 #[doc(alias = "adw_flap_get_locked")]
712 #[doc(alias = "get_locked")]
713 #[doc(alias = "locked")]
714 pub fn is_locked(&self) -> bool {
715 unsafe { from_glib(ffi::adw_flap_get_locked(self.to_glib_none().0)) }
716 }
717
718 /// Gets whether @self is modal.
719 ///
720 /// # Deprecated since 1.4
721 ///
722 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
723 ///
724 /// # Returns
725 ///
726 /// `TRUE` if @self is modal
727 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
728 #[allow(deprecated)]
729 #[doc(alias = "adw_flap_get_modal")]
730 #[doc(alias = "get_modal")]
731 #[doc(alias = "modal")]
732 pub fn is_modal(&self) -> bool {
733 unsafe { from_glib(ffi::adw_flap_get_modal(self.to_glib_none().0)) }
734 }
735
736 /// Gets whether the flap widget is revealed for @self.
737 ///
738 /// # Deprecated since 1.4
739 ///
740 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
741 ///
742 /// # Returns
743 ///
744 /// `TRUE` if the flap widget is revealed
745 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
746 #[allow(deprecated)]
747 #[doc(alias = "adw_flap_get_reveal_flap")]
748 #[doc(alias = "get_reveal_flap")]
749 #[doc(alias = "reveal-flap")]
750 pub fn reveals_flap(&self) -> bool {
751 unsafe { from_glib(ffi::adw_flap_get_reveal_flap(self.to_glib_none().0)) }
752 }
753
754 /// Gets the reveal animation spring parameters for @self.
755 ///
756 /// # Deprecated since 1.4
757 ///
758 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
759 ///
760 /// # Returns
761 ///
762 /// the reveal animation parameters
763 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
764 #[allow(deprecated)]
765 #[doc(alias = "adw_flap_get_reveal_params")]
766 #[doc(alias = "get_reveal_params")]
767 #[doc(alias = "reveal-params")]
768 pub fn reveal_params(&self) -> SpringParams {
769 unsafe { from_glib_full(ffi::adw_flap_get_reveal_params(self.to_glib_none().0)) }
770 }
771
772 /// Gets the current reveal progress for @self.
773 ///
774 /// 0 means fully hidden, 1 means fully revealed.
775 ///
776 /// See [`reveal-flap`][struct@crate::Flap#reveal-flap].
777 ///
778 /// # Deprecated since 1.4
779 ///
780 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
781 ///
782 /// # Returns
783 ///
784 /// the current reveal progress for @self
785 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
786 #[allow(deprecated)]
787 #[doc(alias = "adw_flap_get_reveal_progress")]
788 #[doc(alias = "get_reveal_progress")]
789 #[doc(alias = "reveal-progress")]
790 pub fn reveal_progress(&self) -> f64 {
791 unsafe { ffi::adw_flap_get_reveal_progress(self.to_glib_none().0) }
792 }
793
794 /// Gets the separator widget for @self.
795 ///
796 /// # Deprecated since 1.4
797 ///
798 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
799 ///
800 /// # Returns
801 ///
802 /// the separator widget for @self
803 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
804 #[allow(deprecated)]
805 #[doc(alias = "adw_flap_get_separator")]
806 #[doc(alias = "get_separator")]
807 pub fn separator(&self) -> Option<gtk::Widget> {
808 unsafe { from_glib_none(ffi::adw_flap_get_separator(self.to_glib_none().0)) }
809 }
810
811 /// Gets whether @self can be closed with a swipe gesture.
812 ///
813 /// # Deprecated since 1.4
814 ///
815 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
816 ///
817 /// # Returns
818 ///
819 /// `TRUE` if @self can be closed with a swipe gesture
820 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
821 #[allow(deprecated)]
822 #[doc(alias = "adw_flap_get_swipe_to_close")]
823 #[doc(alias = "get_swipe_to_close")]
824 #[doc(alias = "swipe-to-close")]
825 pub fn is_swipe_to_close(&self) -> bool {
826 unsafe { from_glib(ffi::adw_flap_get_swipe_to_close(self.to_glib_none().0)) }
827 }
828
829 /// Gets whether @self can be opened with a swipe gesture.
830 ///
831 /// # Deprecated since 1.4
832 ///
833 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
834 ///
835 /// # Returns
836 ///
837 /// `TRUE` if @self can be opened with a swipe gesture
838 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
839 #[allow(deprecated)]
840 #[doc(alias = "adw_flap_get_swipe_to_open")]
841 #[doc(alias = "get_swipe_to_open")]
842 #[doc(alias = "swipe-to-open")]
843 pub fn is_swipe_to_open(&self) -> bool {
844 unsafe { from_glib(ffi::adw_flap_get_swipe_to_open(self.to_glib_none().0)) }
845 }
846
847 /// Gets the type of animation used for reveal and fold transitions in @self.
848 ///
849 /// # Deprecated since 1.4
850 ///
851 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
852 ///
853 /// # Returns
854 ///
855 /// the current transition type of @self
856 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
857 #[allow(deprecated)]
858 #[doc(alias = "adw_flap_get_transition_type")]
859 #[doc(alias = "get_transition_type")]
860 #[doc(alias = "transition-type")]
861 pub fn transition_type(&self) -> FlapTransitionType {
862 unsafe { from_glib(ffi::adw_flap_get_transition_type(self.to_glib_none().0)) }
863 }
864
865 /// Sets the content widget for @self.
866 ///
867 /// It's always displayed when unfolded, and partially visible when folded.
868 ///
869 /// # Deprecated since 1.4
870 ///
871 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
872 /// ## `content`
873 /// the content widget
874 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
875 #[allow(deprecated)]
876 #[doc(alias = "adw_flap_set_content")]
877 #[doc(alias = "content")]
878 pub fn set_content(&self, content: Option<&impl IsA<gtk::Widget>>) {
879 unsafe {
880 ffi::adw_flap_set_content(
881 self.to_glib_none().0,
882 content.map(|p| p.as_ref()).to_glib_none().0,
883 );
884 }
885 }
886
887 /// Sets the flap widget for @self.
888 ///
889 /// It's only visible when [`reveal-progress`][struct@crate::Flap#reveal-progress] is greater than 0.
890 ///
891 /// # Deprecated since 1.4
892 ///
893 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
894 /// ## `flap`
895 /// the flap widget
896 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
897 #[allow(deprecated)]
898 #[doc(alias = "adw_flap_set_flap")]
899 #[doc(alias = "flap")]
900 pub fn set_flap(&self, flap: Option<&impl IsA<gtk::Widget>>) {
901 unsafe {
902 ffi::adw_flap_set_flap(
903 self.to_glib_none().0,
904 flap.map(|p| p.as_ref()).to_glib_none().0,
905 );
906 }
907 }
908
909 /// Sets the flap position for @self.
910 ///
911 /// If it's set to [enum@Gtk.PackType.start], the flap is displayed before the
912 /// content, if [enum@Gtk.PackType.end], it's displayed after the content.
913 ///
914 /// # Deprecated since 1.4
915 ///
916 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
917 /// ## `position`
918 /// the new value
919 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
920 #[allow(deprecated)]
921 #[doc(alias = "adw_flap_set_flap_position")]
922 #[doc(alias = "flap-position")]
923 pub fn set_flap_position(&self, position: gtk::PackType) {
924 unsafe {
925 ffi::adw_flap_set_flap_position(self.to_glib_none().0, position.into_glib());
926 }
927 }
928
929 /// Sets the fold transition animation duration for @self, in milliseconds.
930 ///
931 /// # Deprecated since 1.4
932 ///
933 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
934 /// ## `duration`
935 /// the new duration, in milliseconds
936 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
937 #[allow(deprecated)]
938 #[doc(alias = "adw_flap_set_fold_duration")]
939 #[doc(alias = "fold-duration")]
940 pub fn set_fold_duration(&self, duration: u32) {
941 unsafe {
942 ffi::adw_flap_set_fold_duration(self.to_glib_none().0, duration);
943 }
944 }
945
946 /// Sets the fold policy for @self.
947 ///
948 /// # Deprecated since 1.4
949 ///
950 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
951 /// ## `policy`
952 /// the fold policy
953 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
954 #[allow(deprecated)]
955 #[doc(alias = "adw_flap_set_fold_policy")]
956 #[doc(alias = "fold-policy")]
957 pub fn set_fold_policy(&self, policy: FlapFoldPolicy) {
958 unsafe {
959 ffi::adw_flap_set_fold_policy(self.to_glib_none().0, policy.into_glib());
960 }
961 }
962
963 /// Sets the fold threshold policy for @self.
964 ///
965 /// If set to [enum@Adw.FoldThresholdPolicy.minimum], flap will only fold when
966 /// the children cannot fit anymore. With [enum@Adw.FoldThresholdPolicy.natural],
967 /// it will fold as soon as children don't get their natural size.
968 ///
969 /// This can be useful if you have a long ellipsizing label and want to let it
970 /// ellipsize instead of immediately folding.
971 ///
972 /// # Deprecated since 1.4
973 ///
974 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
975 /// ## `policy`
976 /// the policy to use
977 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
978 #[allow(deprecated)]
979 #[doc(alias = "adw_flap_set_fold_threshold_policy")]
980 #[doc(alias = "fold-threshold-policy")]
981 pub fn set_fold_threshold_policy(&self, policy: FoldThresholdPolicy) {
982 unsafe {
983 ffi::adw_flap_set_fold_threshold_policy(self.to_glib_none().0, policy.into_glib());
984 }
985 }
986
987 /// Sets whether @self is locked.
988 ///
989 /// If `FALSE`, folding when the flap is revealed automatically closes it, and
990 /// unfolding it when the flap is not revealed opens it. If `TRUE`,
991 /// [`reveal-flap`][struct@crate::Flap#reveal-flap] value never changes on its own.
992 ///
993 /// # Deprecated since 1.4
994 ///
995 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
996 /// ## `locked`
997 /// the new value
998 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
999 #[allow(deprecated)]
1000 #[doc(alias = "adw_flap_set_locked")]
1001 #[doc(alias = "locked")]
1002 pub fn set_locked(&self, locked: bool) {
1003 unsafe {
1004 ffi::adw_flap_set_locked(self.to_glib_none().0, locked.into_glib());
1005 }
1006 }
1007
1008 /// Sets whether @self is modal.
1009 ///
1010 /// If `TRUE`, clicking the content widget while flap is revealed, as well as
1011 /// pressing the <kbd>Esc</kbd> key, will close the flap. If `FALSE`, clicks are
1012 /// passed through to the content widget.
1013 ///
1014 /// # Deprecated since 1.4
1015 ///
1016 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
1017 /// ## `modal`
1018 /// whether @self is modal
1019 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1020 #[allow(deprecated)]
1021 #[doc(alias = "adw_flap_set_modal")]
1022 #[doc(alias = "modal")]
1023 pub fn set_modal(&self, modal: bool) {
1024 unsafe {
1025 ffi::adw_flap_set_modal(self.to_glib_none().0, modal.into_glib());
1026 }
1027 }
1028
1029 /// Sets whether the flap widget is revealed for @self.
1030 ///
1031 /// # Deprecated since 1.4
1032 ///
1033 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
1034 /// ## `reveal_flap`
1035 /// whether to reveal the flap widget
1036 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1037 #[allow(deprecated)]
1038 #[doc(alias = "adw_flap_set_reveal_flap")]
1039 #[doc(alias = "reveal-flap")]
1040 pub fn set_reveal_flap(&self, reveal_flap: bool) {
1041 unsafe {
1042 ffi::adw_flap_set_reveal_flap(self.to_glib_none().0, reveal_flap.into_glib());
1043 }
1044 }
1045
1046 /// Sets the reveal animation spring parameters for @self.
1047 ///
1048 /// The default value is equivalent to:
1049 ///
1050 /// **⚠️ The following code is in c ⚠️**
1051 ///
1052 /// ```c
1053 /// adw_spring_params_new (1, 0.5, 500)
1054 /// ```
1055 ///
1056 /// # Deprecated since 1.4
1057 ///
1058 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
1059 /// ## `params`
1060 /// the new parameters
1061 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1062 #[allow(deprecated)]
1063 #[doc(alias = "adw_flap_set_reveal_params")]
1064 #[doc(alias = "reveal-params")]
1065 pub fn set_reveal_params(&self, params: &SpringParams) {
1066 unsafe {
1067 ffi::adw_flap_set_reveal_params(self.to_glib_none().0, params.to_glib_none().0);
1068 }
1069 }
1070
1071 /// Sets the separator widget for @self.
1072 ///
1073 /// It's displayed between content and flap when there's no shadow to display.
1074 /// When exactly it's visible depends on the [`transition-type`][struct@crate::Flap#transition-type]
1075 /// value.
1076 ///
1077 /// # Deprecated since 1.4
1078 ///
1079 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
1080 /// ## `separator`
1081 /// the separator widget
1082 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1083 #[allow(deprecated)]
1084 #[doc(alias = "adw_flap_set_separator")]
1085 #[doc(alias = "separator")]
1086 pub fn set_separator(&self, separator: Option<&impl IsA<gtk::Widget>>) {
1087 unsafe {
1088 ffi::adw_flap_set_separator(
1089 self.to_glib_none().0,
1090 separator.map(|p| p.as_ref()).to_glib_none().0,
1091 );
1092 }
1093 }
1094
1095 /// Sets whether @self can be closed with a swipe gesture.
1096 ///
1097 /// The area that can be swiped depends on the [`transition-type`][struct@crate::Flap#transition-type]
1098 /// value.
1099 ///
1100 /// # Deprecated since 1.4
1101 ///
1102 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
1103 /// ## `swipe_to_close`
1104 /// whether @self can be closed with a swipe gesture
1105 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1106 #[allow(deprecated)]
1107 #[doc(alias = "adw_flap_set_swipe_to_close")]
1108 #[doc(alias = "swipe-to-close")]
1109 pub fn set_swipe_to_close(&self, swipe_to_close: bool) {
1110 unsafe {
1111 ffi::adw_flap_set_swipe_to_close(self.to_glib_none().0, swipe_to_close.into_glib());
1112 }
1113 }
1114
1115 /// Sets whether @self can be opened with a swipe gesture.
1116 ///
1117 /// The area that can be swiped depends on the [`transition-type`][struct@crate::Flap#transition-type]
1118 /// value.
1119 ///
1120 /// # Deprecated since 1.4
1121 ///
1122 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
1123 /// ## `swipe_to_open`
1124 /// whether @self can be opened with a swipe gesture
1125 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1126 #[allow(deprecated)]
1127 #[doc(alias = "adw_flap_set_swipe_to_open")]
1128 #[doc(alias = "swipe-to-open")]
1129 pub fn set_swipe_to_open(&self, swipe_to_open: bool) {
1130 unsafe {
1131 ffi::adw_flap_set_swipe_to_open(self.to_glib_none().0, swipe_to_open.into_glib());
1132 }
1133 }
1134
1135 /// Sets the type of animation used for reveal and fold transitions in @self.
1136 ///
1137 /// [`flap`][struct@crate::Flap#flap] is transparent by default, which means the content will
1138 /// be seen through it with [enum@Adw.FlapTransitionType.over] transitions; add
1139 /// the [`.background`](style-classes.html#background) style class to it if this
1140 /// is unwanted.
1141 ///
1142 /// # Deprecated since 1.4
1143 ///
1144 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
1145 /// ## `transition_type`
1146 /// the new transition type
1147 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1148 #[allow(deprecated)]
1149 #[doc(alias = "adw_flap_set_transition_type")]
1150 #[doc(alias = "transition-type")]
1151 pub fn set_transition_type(&self, transition_type: FlapTransitionType) {
1152 unsafe {
1153 ffi::adw_flap_set_transition_type(self.to_glib_none().0, transition_type.into_glib());
1154 }
1155 }
1156
1157 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1158 #[doc(alias = "content")]
1159 pub fn connect_content_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1160 unsafe extern "C" fn notify_content_trampoline<F: Fn(&Flap) + 'static>(
1161 this: *mut ffi::AdwFlap,
1162 _param_spec: glib::ffi::gpointer,
1163 f: glib::ffi::gpointer,
1164 ) {
1165 let f: &F = &*(f as *const F);
1166 f(&from_glib_borrow(this))
1167 }
1168 unsafe {
1169 let f: Box_<F> = Box_::new(f);
1170 connect_raw(
1171 self.as_ptr() as *mut _,
1172 c"notify::content".as_ptr() as *const _,
1173 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1174 notify_content_trampoline::<F> as *const (),
1175 )),
1176 Box_::into_raw(f),
1177 )
1178 }
1179 }
1180
1181 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1182 #[doc(alias = "flap")]
1183 pub fn connect_flap_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1184 unsafe extern "C" fn notify_flap_trampoline<F: Fn(&Flap) + 'static>(
1185 this: *mut ffi::AdwFlap,
1186 _param_spec: glib::ffi::gpointer,
1187 f: glib::ffi::gpointer,
1188 ) {
1189 let f: &F = &*(f as *const F);
1190 f(&from_glib_borrow(this))
1191 }
1192 unsafe {
1193 let f: Box_<F> = Box_::new(f);
1194 connect_raw(
1195 self.as_ptr() as *mut _,
1196 c"notify::flap".as_ptr() as *const _,
1197 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1198 notify_flap_trampoline::<F> as *const (),
1199 )),
1200 Box_::into_raw(f),
1201 )
1202 }
1203 }
1204
1205 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1206 #[doc(alias = "flap-position")]
1207 pub fn connect_flap_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1208 unsafe extern "C" fn notify_flap_position_trampoline<F: Fn(&Flap) + 'static>(
1209 this: *mut ffi::AdwFlap,
1210 _param_spec: glib::ffi::gpointer,
1211 f: glib::ffi::gpointer,
1212 ) {
1213 let f: &F = &*(f as *const F);
1214 f(&from_glib_borrow(this))
1215 }
1216 unsafe {
1217 let f: Box_<F> = Box_::new(f);
1218 connect_raw(
1219 self.as_ptr() as *mut _,
1220 c"notify::flap-position".as_ptr() as *const _,
1221 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1222 notify_flap_position_trampoline::<F> as *const (),
1223 )),
1224 Box_::into_raw(f),
1225 )
1226 }
1227 }
1228
1229 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1230 #[doc(alias = "fold-duration")]
1231 pub fn connect_fold_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1232 unsafe extern "C" fn notify_fold_duration_trampoline<F: Fn(&Flap) + 'static>(
1233 this: *mut ffi::AdwFlap,
1234 _param_spec: glib::ffi::gpointer,
1235 f: glib::ffi::gpointer,
1236 ) {
1237 let f: &F = &*(f as *const F);
1238 f(&from_glib_borrow(this))
1239 }
1240 unsafe {
1241 let f: Box_<F> = Box_::new(f);
1242 connect_raw(
1243 self.as_ptr() as *mut _,
1244 c"notify::fold-duration".as_ptr() as *const _,
1245 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1246 notify_fold_duration_trampoline::<F> as *const (),
1247 )),
1248 Box_::into_raw(f),
1249 )
1250 }
1251 }
1252
1253 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1254 #[doc(alias = "fold-policy")]
1255 pub fn connect_fold_policy_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1256 unsafe extern "C" fn notify_fold_policy_trampoline<F: Fn(&Flap) + 'static>(
1257 this: *mut ffi::AdwFlap,
1258 _param_spec: glib::ffi::gpointer,
1259 f: glib::ffi::gpointer,
1260 ) {
1261 let f: &F = &*(f as *const F);
1262 f(&from_glib_borrow(this))
1263 }
1264 unsafe {
1265 let f: Box_<F> = Box_::new(f);
1266 connect_raw(
1267 self.as_ptr() as *mut _,
1268 c"notify::fold-policy".as_ptr() as *const _,
1269 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1270 notify_fold_policy_trampoline::<F> as *const (),
1271 )),
1272 Box_::into_raw(f),
1273 )
1274 }
1275 }
1276
1277 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1278 #[doc(alias = "fold-threshold-policy")]
1279 pub fn connect_fold_threshold_policy_notify<F: Fn(&Self) + 'static>(
1280 &self,
1281 f: F,
1282 ) -> SignalHandlerId {
1283 unsafe extern "C" fn notify_fold_threshold_policy_trampoline<F: Fn(&Flap) + 'static>(
1284 this: *mut ffi::AdwFlap,
1285 _param_spec: glib::ffi::gpointer,
1286 f: glib::ffi::gpointer,
1287 ) {
1288 let f: &F = &*(f as *const F);
1289 f(&from_glib_borrow(this))
1290 }
1291 unsafe {
1292 let f: Box_<F> = Box_::new(f);
1293 connect_raw(
1294 self.as_ptr() as *mut _,
1295 c"notify::fold-threshold-policy".as_ptr() as *const _,
1296 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1297 notify_fold_threshold_policy_trampoline::<F> as *const (),
1298 )),
1299 Box_::into_raw(f),
1300 )
1301 }
1302 }
1303
1304 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1305 #[doc(alias = "folded")]
1306 pub fn connect_folded_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1307 unsafe extern "C" fn notify_folded_trampoline<F: Fn(&Flap) + 'static>(
1308 this: *mut ffi::AdwFlap,
1309 _param_spec: glib::ffi::gpointer,
1310 f: glib::ffi::gpointer,
1311 ) {
1312 let f: &F = &*(f as *const F);
1313 f(&from_glib_borrow(this))
1314 }
1315 unsafe {
1316 let f: Box_<F> = Box_::new(f);
1317 connect_raw(
1318 self.as_ptr() as *mut _,
1319 c"notify::folded".as_ptr() as *const _,
1320 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1321 notify_folded_trampoline::<F> as *const (),
1322 )),
1323 Box_::into_raw(f),
1324 )
1325 }
1326 }
1327
1328 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1329 #[doc(alias = "locked")]
1330 pub fn connect_locked_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1331 unsafe extern "C" fn notify_locked_trampoline<F: Fn(&Flap) + 'static>(
1332 this: *mut ffi::AdwFlap,
1333 _param_spec: glib::ffi::gpointer,
1334 f: glib::ffi::gpointer,
1335 ) {
1336 let f: &F = &*(f as *const F);
1337 f(&from_glib_borrow(this))
1338 }
1339 unsafe {
1340 let f: Box_<F> = Box_::new(f);
1341 connect_raw(
1342 self.as_ptr() as *mut _,
1343 c"notify::locked".as_ptr() as *const _,
1344 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1345 notify_locked_trampoline::<F> as *const (),
1346 )),
1347 Box_::into_raw(f),
1348 )
1349 }
1350 }
1351
1352 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1353 #[doc(alias = "modal")]
1354 pub fn connect_modal_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1355 unsafe extern "C" fn notify_modal_trampoline<F: Fn(&Flap) + 'static>(
1356 this: *mut ffi::AdwFlap,
1357 _param_spec: glib::ffi::gpointer,
1358 f: glib::ffi::gpointer,
1359 ) {
1360 let f: &F = &*(f as *const F);
1361 f(&from_glib_borrow(this))
1362 }
1363 unsafe {
1364 let f: Box_<F> = Box_::new(f);
1365 connect_raw(
1366 self.as_ptr() as *mut _,
1367 c"notify::modal".as_ptr() as *const _,
1368 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1369 notify_modal_trampoline::<F> as *const (),
1370 )),
1371 Box_::into_raw(f),
1372 )
1373 }
1374 }
1375
1376 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1377 #[doc(alias = "reveal-flap")]
1378 pub fn connect_reveal_flap_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1379 unsafe extern "C" fn notify_reveal_flap_trampoline<F: Fn(&Flap) + 'static>(
1380 this: *mut ffi::AdwFlap,
1381 _param_spec: glib::ffi::gpointer,
1382 f: glib::ffi::gpointer,
1383 ) {
1384 let f: &F = &*(f as *const F);
1385 f(&from_glib_borrow(this))
1386 }
1387 unsafe {
1388 let f: Box_<F> = Box_::new(f);
1389 connect_raw(
1390 self.as_ptr() as *mut _,
1391 c"notify::reveal-flap".as_ptr() as *const _,
1392 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1393 notify_reveal_flap_trampoline::<F> as *const (),
1394 )),
1395 Box_::into_raw(f),
1396 )
1397 }
1398 }
1399
1400 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1401 #[doc(alias = "reveal-params")]
1402 pub fn connect_reveal_params_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1403 unsafe extern "C" fn notify_reveal_params_trampoline<F: Fn(&Flap) + 'static>(
1404 this: *mut ffi::AdwFlap,
1405 _param_spec: glib::ffi::gpointer,
1406 f: glib::ffi::gpointer,
1407 ) {
1408 let f: &F = &*(f as *const F);
1409 f(&from_glib_borrow(this))
1410 }
1411 unsafe {
1412 let f: Box_<F> = Box_::new(f);
1413 connect_raw(
1414 self.as_ptr() as *mut _,
1415 c"notify::reveal-params".as_ptr() as *const _,
1416 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1417 notify_reveal_params_trampoline::<F> as *const (),
1418 )),
1419 Box_::into_raw(f),
1420 )
1421 }
1422 }
1423
1424 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1425 #[doc(alias = "reveal-progress")]
1426 pub fn connect_reveal_progress_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1427 unsafe extern "C" fn notify_reveal_progress_trampoline<F: Fn(&Flap) + 'static>(
1428 this: *mut ffi::AdwFlap,
1429 _param_spec: glib::ffi::gpointer,
1430 f: glib::ffi::gpointer,
1431 ) {
1432 let f: &F = &*(f as *const F);
1433 f(&from_glib_borrow(this))
1434 }
1435 unsafe {
1436 let f: Box_<F> = Box_::new(f);
1437 connect_raw(
1438 self.as_ptr() as *mut _,
1439 c"notify::reveal-progress".as_ptr() as *const _,
1440 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1441 notify_reveal_progress_trampoline::<F> as *const (),
1442 )),
1443 Box_::into_raw(f),
1444 )
1445 }
1446 }
1447
1448 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1449 #[doc(alias = "separator")]
1450 pub fn connect_separator_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1451 unsafe extern "C" fn notify_separator_trampoline<F: Fn(&Flap) + 'static>(
1452 this: *mut ffi::AdwFlap,
1453 _param_spec: glib::ffi::gpointer,
1454 f: glib::ffi::gpointer,
1455 ) {
1456 let f: &F = &*(f as *const F);
1457 f(&from_glib_borrow(this))
1458 }
1459 unsafe {
1460 let f: Box_<F> = Box_::new(f);
1461 connect_raw(
1462 self.as_ptr() as *mut _,
1463 c"notify::separator".as_ptr() as *const _,
1464 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1465 notify_separator_trampoline::<F> as *const (),
1466 )),
1467 Box_::into_raw(f),
1468 )
1469 }
1470 }
1471
1472 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1473 #[doc(alias = "swipe-to-close")]
1474 pub fn connect_swipe_to_close_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1475 unsafe extern "C" fn notify_swipe_to_close_trampoline<F: Fn(&Flap) + 'static>(
1476 this: *mut ffi::AdwFlap,
1477 _param_spec: glib::ffi::gpointer,
1478 f: glib::ffi::gpointer,
1479 ) {
1480 let f: &F = &*(f as *const F);
1481 f(&from_glib_borrow(this))
1482 }
1483 unsafe {
1484 let f: Box_<F> = Box_::new(f);
1485 connect_raw(
1486 self.as_ptr() as *mut _,
1487 c"notify::swipe-to-close".as_ptr() as *const _,
1488 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1489 notify_swipe_to_close_trampoline::<F> as *const (),
1490 )),
1491 Box_::into_raw(f),
1492 )
1493 }
1494 }
1495
1496 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1497 #[doc(alias = "swipe-to-open")]
1498 pub fn connect_swipe_to_open_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1499 unsafe extern "C" fn notify_swipe_to_open_trampoline<F: Fn(&Flap) + 'static>(
1500 this: *mut ffi::AdwFlap,
1501 _param_spec: glib::ffi::gpointer,
1502 f: glib::ffi::gpointer,
1503 ) {
1504 let f: &F = &*(f as *const F);
1505 f(&from_glib_borrow(this))
1506 }
1507 unsafe {
1508 let f: Box_<F> = Box_::new(f);
1509 connect_raw(
1510 self.as_ptr() as *mut _,
1511 c"notify::swipe-to-open".as_ptr() as *const _,
1512 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1513 notify_swipe_to_open_trampoline::<F> as *const (),
1514 )),
1515 Box_::into_raw(f),
1516 )
1517 }
1518 }
1519
1520 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1521 #[doc(alias = "transition-type")]
1522 pub fn connect_transition_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1523 unsafe extern "C" fn notify_transition_type_trampoline<F: Fn(&Flap) + 'static>(
1524 this: *mut ffi::AdwFlap,
1525 _param_spec: glib::ffi::gpointer,
1526 f: glib::ffi::gpointer,
1527 ) {
1528 let f: &F = &*(f as *const F);
1529 f(&from_glib_borrow(this))
1530 }
1531 unsafe {
1532 let f: Box_<F> = Box_::new(f);
1533 connect_raw(
1534 self.as_ptr() as *mut _,
1535 c"notify::transition-type".as_ptr() as *const _,
1536 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1537 notify_transition_type_trampoline::<F> as *const (),
1538 )),
1539 Box_::into_raw(f),
1540 )
1541 }
1542 }
1543}
1544
1545impl Default for Flap {
1546 fn default() -> Self {
1547 Self::new()
1548 }
1549}
1550
1551// rustdoc-stripper-ignore-next
1552/// A [builder-pattern] type to construct [`Flap`] objects.
1553///
1554/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1555#[must_use = "The builder must be built to be used"]
1556pub struct FlapBuilder {
1557 builder: glib::object::ObjectBuilder<'static, Flap>,
1558}
1559
1560impl FlapBuilder {
1561 fn new() -> Self {
1562 Self {
1563 builder: glib::object::Object::builder(),
1564 }
1565 }
1566
1567 /// The content widget.
1568 ///
1569 /// It's always displayed when unfolded, and partially visible when folded.
1570 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
1571 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1572 pub fn content(self, content: &impl IsA<gtk::Widget>) -> Self {
1573 Self {
1574 builder: self.builder.property("content", content.clone().upcast()),
1575 }
1576 }
1577
1578 /// The flap widget.
1579 ///
1580 /// It's only visible when [`reveal-progress`][struct@crate::Flap#reveal-progress] is greater than 0.
1581 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
1582 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1583 pub fn flap(self, flap: &impl IsA<gtk::Widget>) -> Self {
1584 Self {
1585 builder: self.builder.property("flap", flap.clone().upcast()),
1586 }
1587 }
1588
1589 /// The flap position.
1590 ///
1591 /// If it's set to [enum@Gtk.PackType.start], the flap is displayed before the
1592 /// content, if [enum@Gtk.PackType.end], it's displayed after the content.
1593 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
1594 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1595 pub fn flap_position(self, flap_position: gtk::PackType) -> Self {
1596 Self {
1597 builder: self.builder.property("flap-position", flap_position),
1598 }
1599 }
1600
1601 /// The fold transition animation duration, in milliseconds.
1602 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
1603 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1604 pub fn fold_duration(self, fold_duration: u32) -> Self {
1605 Self {
1606 builder: self.builder.property("fold-duration", fold_duration),
1607 }
1608 }
1609
1610 /// The fold policy for the flap.
1611 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
1612 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1613 pub fn fold_policy(self, fold_policy: FlapFoldPolicy) -> Self {
1614 Self {
1615 builder: self.builder.property("fold-policy", fold_policy),
1616 }
1617 }
1618
1619 /// Determines when the flap will fold.
1620 ///
1621 /// If set to [enum@Adw.FoldThresholdPolicy.minimum], flap will only fold when
1622 /// the children cannot fit anymore. With [enum@Adw.FoldThresholdPolicy.natural],
1623 /// it will fold as soon as children don't get their natural size.
1624 ///
1625 /// This can be useful if you have a long ellipsizing label and want to let it
1626 /// ellipsize instead of immediately folding.
1627 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
1628 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1629 pub fn fold_threshold_policy(self, fold_threshold_policy: FoldThresholdPolicy) -> Self {
1630 Self {
1631 builder: self
1632 .builder
1633 .property("fold-threshold-policy", fold_threshold_policy),
1634 }
1635 }
1636
1637 /// Whether the flap is locked.
1638 ///
1639 /// If `FALSE`, folding when the flap is revealed automatically closes it, and
1640 /// unfolding it when the flap is not revealed opens it. If `TRUE`,
1641 /// [`reveal-flap`][struct@crate::Flap#reveal-flap] value never changes on its own.
1642 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
1643 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1644 pub fn locked(self, locked: bool) -> Self {
1645 Self {
1646 builder: self.builder.property("locked", locked),
1647 }
1648 }
1649
1650 /// Whether the flap is modal.
1651 ///
1652 /// If `TRUE`, clicking the content widget while flap is revealed, as well as
1653 /// pressing the <kbd>Esc</kbd> key, will close the flap. If `FALSE`, clicks
1654 /// are passed through to the content widget.
1655 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
1656 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1657 pub fn modal(self, modal: bool) -> Self {
1658 Self {
1659 builder: self.builder.property("modal", modal),
1660 }
1661 }
1662
1663 /// Whether the flap widget is revealed.
1664 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
1665 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1666 pub fn reveal_flap(self, reveal_flap: bool) -> Self {
1667 Self {
1668 builder: self.builder.property("reveal-flap", reveal_flap),
1669 }
1670 }
1671
1672 /// The reveal animation spring parameters.
1673 ///
1674 /// The default value is equivalent to:
1675 ///
1676 /// **⚠️ The following code is in c ⚠️**
1677 ///
1678 /// ```c
1679 /// adw_spring_params_new (1, 0.5, 500)
1680 /// ```
1681 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
1682 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1683 pub fn reveal_params(self, reveal_params: &SpringParams) -> Self {
1684 Self {
1685 builder: self
1686 .builder
1687 .property("reveal-params", reveal_params.clone()),
1688 }
1689 }
1690
1691 /// The separator widget.
1692 ///
1693 /// It's displayed between content and flap when there's no shadow to display.
1694 /// When exactly it's visible depends on the [`transition-type`][struct@crate::Flap#transition-type]
1695 /// value.
1696 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
1697 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1698 pub fn separator(self, separator: &impl IsA<gtk::Widget>) -> Self {
1699 Self {
1700 builder: self
1701 .builder
1702 .property("separator", separator.clone().upcast()),
1703 }
1704 }
1705
1706 /// Whether the flap can be closed with a swipe gesture.
1707 ///
1708 /// The area that can be swiped depends on the [`transition-type`][struct@crate::Flap#transition-type]
1709 /// value.
1710 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
1711 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1712 pub fn swipe_to_close(self, swipe_to_close: bool) -> Self {
1713 Self {
1714 builder: self.builder.property("swipe-to-close", swipe_to_close),
1715 }
1716 }
1717
1718 /// Whether the flap can be opened with a swipe gesture.
1719 ///
1720 /// The area that can be swiped depends on the [`transition-type`][struct@crate::Flap#transition-type]
1721 /// value.
1722 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
1723 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1724 pub fn swipe_to_open(self, swipe_to_open: bool) -> Self {
1725 Self {
1726 builder: self.builder.property("swipe-to-open", swipe_to_open),
1727 }
1728 }
1729
1730 /// the type of animation used for reveal and fold transitions.
1731 ///
1732 /// [`flap`][struct@crate::Flap#flap] is transparent by default, which means the content
1733 /// will be seen through it with [enum@Adw.FlapTransitionType.over] transitions;
1734 /// add the [`.background`](style-classes.html#background) style class to it if
1735 /// this is unwanted.
1736 /// See [the migration guide](migrating-to-breakpoints.html#replace-adwflap)
1737 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1738 pub fn transition_type(self, transition_type: FlapTransitionType) -> Self {
1739 Self {
1740 builder: self.builder.property("transition-type", transition_type),
1741 }
1742 }
1743
1744 /// Whether the widget or any of its descendents can accept
1745 /// the input focus.
1746 ///
1747 /// This property is meant to be set by widget implementations,
1748 /// typically in their instance init function.
1749 pub fn can_focus(self, can_focus: bool) -> Self {
1750 Self {
1751 builder: self.builder.property("can-focus", can_focus),
1752 }
1753 }
1754
1755 /// Whether the widget can receive pointer events.
1756 pub fn can_target(self, can_target: bool) -> Self {
1757 Self {
1758 builder: self.builder.property("can-target", can_target),
1759 }
1760 }
1761
1762 /// A list of css classes applied to this widget.
1763 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1764 Self {
1765 builder: self.builder.property("css-classes", css_classes.into()),
1766 }
1767 }
1768
1769 /// The name of this widget in the CSS tree.
1770 ///
1771 /// This property is meant to be set by widget implementations,
1772 /// typically in their instance init function.
1773 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1774 Self {
1775 builder: self.builder.property("css-name", css_name.into()),
1776 }
1777 }
1778
1779 /// The cursor used by @widget.
1780 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1781 Self {
1782 builder: self.builder.property("cursor", cursor.clone()),
1783 }
1784 }
1785
1786 /// Whether the widget should grab focus when it is clicked with the mouse.
1787 ///
1788 /// This property is only relevant for widgets that can take focus.
1789 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1790 Self {
1791 builder: self.builder.property("focus-on-click", focus_on_click),
1792 }
1793 }
1794
1795 /// Whether this widget itself will accept the input focus.
1796 pub fn focusable(self, focusable: bool) -> Self {
1797 Self {
1798 builder: self.builder.property("focusable", focusable),
1799 }
1800 }
1801
1802 /// How to distribute horizontal space if widget gets extra space.
1803 pub fn halign(self, halign: gtk::Align) -> Self {
1804 Self {
1805 builder: self.builder.property("halign", halign),
1806 }
1807 }
1808
1809 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip]
1810 /// signal on @widget.
1811 ///
1812 /// A true value indicates that @widget can have a tooltip, in this case
1813 /// the widget will be queried using [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] to
1814 /// determine whether it will provide a tooltip or not.
1815 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1816 Self {
1817 builder: self.builder.property("has-tooltip", has_tooltip),
1818 }
1819 }
1820
1821 /// Overrides for height request of the widget.
1822 ///
1823 /// If this is -1, the natural request will be used.
1824 pub fn height_request(self, height_request: i32) -> Self {
1825 Self {
1826 builder: self.builder.property("height-request", height_request),
1827 }
1828 }
1829
1830 /// Whether to expand horizontally.
1831 pub fn hexpand(self, hexpand: bool) -> Self {
1832 Self {
1833 builder: self.builder.property("hexpand", hexpand),
1834 }
1835 }
1836
1837 /// Whether to use the `hexpand` property.
1838 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1839 Self {
1840 builder: self.builder.property("hexpand-set", hexpand_set),
1841 }
1842 }
1843
1844 /// The [`gtk::LayoutManager`][crate::gtk::LayoutManager] instance to use to compute
1845 /// the preferred size of the widget, and allocate its children.
1846 ///
1847 /// This property is meant to be set by widget implementations,
1848 /// typically in their instance init function.
1849 pub fn layout_manager(self, layout_manager: &impl IsA<gtk::LayoutManager>) -> Self {
1850 Self {
1851 builder: self
1852 .builder
1853 .property("layout-manager", layout_manager.clone().upcast()),
1854 }
1855 }
1856
1857 /// Makes this widget act like a modal dialog, with respect to
1858 /// event delivery.
1859 ///
1860 /// Global event controllers will not handle events with targets
1861 /// inside the widget, unless they are set up to ignore propagation
1862 /// limits. See `Gtk::EventController::set_propagation_limit()`.
1863 #[cfg(feature = "gtk_v4_18")]
1864 #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))]
1865 pub fn limit_events(self, limit_events: bool) -> Self {
1866 Self {
1867 builder: self.builder.property("limit-events", limit_events),
1868 }
1869 }
1870
1871 /// Margin on bottom side of widget.
1872 ///
1873 /// This property adds margin outside of the widget's normal size
1874 /// request, the margin will be added in addition to the size from
1875 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
1876 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1877 Self {
1878 builder: self.builder.property("margin-bottom", margin_bottom),
1879 }
1880 }
1881
1882 /// Margin on end of widget, horizontally.
1883 ///
1884 /// This property supports left-to-right and right-to-left text
1885 /// directions.
1886 ///
1887 /// This property adds margin outside of the widget's normal size
1888 /// request, the margin will be added in addition to the size from
1889 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
1890 pub fn margin_end(self, margin_end: i32) -> Self {
1891 Self {
1892 builder: self.builder.property("margin-end", margin_end),
1893 }
1894 }
1895
1896 /// Margin on start of widget, horizontally.
1897 ///
1898 /// This property supports left-to-right and right-to-left text
1899 /// directions.
1900 ///
1901 /// This property adds margin outside of the widget's normal size
1902 /// request, the margin will be added in addition to the size from
1903 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
1904 pub fn margin_start(self, margin_start: i32) -> Self {
1905 Self {
1906 builder: self.builder.property("margin-start", margin_start),
1907 }
1908 }
1909
1910 /// Margin on top side of widget.
1911 ///
1912 /// This property adds margin outside of the widget's normal size
1913 /// request, the margin will be added in addition to the size from
1914 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
1915 pub fn margin_top(self, margin_top: i32) -> Self {
1916 Self {
1917 builder: self.builder.property("margin-top", margin_top),
1918 }
1919 }
1920
1921 /// The name of the widget.
1922 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1923 Self {
1924 builder: self.builder.property("name", name.into()),
1925 }
1926 }
1927
1928 /// The requested opacity of the widget.
1929 pub fn opacity(self, opacity: f64) -> Self {
1930 Self {
1931 builder: self.builder.property("opacity", opacity),
1932 }
1933 }
1934
1935 /// How content outside the widget's content area is treated.
1936 ///
1937 /// This property is meant to be set by widget implementations,
1938 /// typically in their instance init function.
1939 pub fn overflow(self, overflow: gtk::Overflow) -> Self {
1940 Self {
1941 builder: self.builder.property("overflow", overflow),
1942 }
1943 }
1944
1945 /// Whether the widget will receive the default action when it is focused.
1946 pub fn receives_default(self, receives_default: bool) -> Self {
1947 Self {
1948 builder: self.builder.property("receives-default", receives_default),
1949 }
1950 }
1951
1952 /// Whether the widget responds to input.
1953 pub fn sensitive(self, sensitive: bool) -> Self {
1954 Self {
1955 builder: self.builder.property("sensitive", sensitive),
1956 }
1957 }
1958
1959 /// Sets the text of tooltip to be the given string, which is marked up
1960 /// with Pango markup.
1961 ///
1962 /// Also see `Gtk::Tooltip::set_markup()`.
1963 ///
1964 /// This is a convenience property which will take care of getting the
1965 /// tooltip shown if the given string is not `NULL`:
1966 /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
1967 /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
1968 /// the default signal handler.
1969 ///
1970 /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
1971 /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
1972 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1973 Self {
1974 builder: self
1975 .builder
1976 .property("tooltip-markup", tooltip_markup.into()),
1977 }
1978 }
1979
1980 /// Sets the text of tooltip to be the given string.
1981 ///
1982 /// Also see `Gtk::Tooltip::set_text()`.
1983 ///
1984 /// This is a convenience property which will take care of getting the
1985 /// tooltip shown if the given string is not `NULL`:
1986 /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
1987 /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
1988 /// the default signal handler.
1989 ///
1990 /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
1991 /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
1992 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1993 Self {
1994 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1995 }
1996 }
1997
1998 /// How to distribute vertical space if widget gets extra space.
1999 pub fn valign(self, valign: gtk::Align) -> Self {
2000 Self {
2001 builder: self.builder.property("valign", valign),
2002 }
2003 }
2004
2005 /// Whether to expand vertically.
2006 pub fn vexpand(self, vexpand: bool) -> Self {
2007 Self {
2008 builder: self.builder.property("vexpand", vexpand),
2009 }
2010 }
2011
2012 /// Whether to use the `vexpand` property.
2013 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
2014 Self {
2015 builder: self.builder.property("vexpand-set", vexpand_set),
2016 }
2017 }
2018
2019 /// Whether the widget is visible.
2020 pub fn visible(self, visible: bool) -> Self {
2021 Self {
2022 builder: self.builder.property("visible", visible),
2023 }
2024 }
2025
2026 /// Overrides for width request of the widget.
2027 ///
2028 /// If this is -1, the natural request will be used.
2029 pub fn width_request(self, width_request: i32) -> Self {
2030 Self {
2031 builder: self.builder.property("width-request", width_request),
2032 }
2033 }
2034
2035 /// The accessible role of the given [`gtk::Accessible`][crate::gtk::Accessible] implementation.
2036 ///
2037 /// The accessible role cannot be changed once set.
2038 pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self {
2039 Self {
2040 builder: self.builder.property("accessible-role", accessible_role),
2041 }
2042 }
2043
2044 /// The orientation of the orientable.
2045 pub fn orientation(self, orientation: gtk::Orientation) -> Self {
2046 Self {
2047 builder: self.builder.property("orientation", orientation),
2048 }
2049 }
2050
2051 // rustdoc-stripper-ignore-next
2052 /// Build the [`Flap`].
2053 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
2054 pub fn build(self) -> Flap {
2055 assert_initialized_main_thread!();
2056 self.builder.build()
2057 }
2058}