libadwaita/auto/navigation_page.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
6use crate::ffi;
7use glib::{
8 object::ObjectType as _,
9 prelude::*,
10 signal::{SignalHandlerId, connect_raw},
11 translate::*,
12};
13use std::boxed::Box as Box_;
14
15glib::wrapper! {
16 /// A page within [`NavigationView`][crate::NavigationView] or [`NavigationSplitView`][crate::NavigationSplitView].
17 ///
18 /// Each page has a child widget, a title and optionally a tag.
19 ///
20 /// The [`showing`][struct@crate::NavigationPage#showing], [`shown`][struct@crate::NavigationPage#shown],
21 /// [`hiding`][struct@crate::NavigationPage#hiding] and [`hidden`][struct@crate::NavigationPage#hidden] signals
22 /// can be used to track the page's visibility within its [`NavigationView`][crate::NavigationView].
23 ///
24 /// ## Header Bar Integration
25 ///
26 /// When placed inside [`NavigationPage`][crate::NavigationPage], [`HeaderBar`][crate::HeaderBar] will display the
27 /// page title instead of window title.
28 ///
29 /// When used together with [`NavigationView`][crate::NavigationView], it will also display a back
30 /// button that can be used to go back to the previous page. Set
31 /// [`show-back-button`][struct@crate::HeaderBar#show-back-button] to `FALSE` to disable that behavior if
32 /// it's unwanted.
33 ///
34 /// ## CSS Nodes
35 ///
36 /// [`NavigationPage`][crate::NavigationPage] has a single CSS node with name
37 /// `navigation-view-page`.
38 ///
39 /// ## Accessibility
40 ///
41 /// [`NavigationPage`][crate::NavigationPage] uses the [enum@Gtk.AccessibleRole.group] role.
42 ///
43 /// ## Properties
44 ///
45 ///
46 /// #### `can-pop`
47 /// Whether the page can be popped from navigation stack.
48 ///
49 /// Set it to `FALSE` to disable shortcuts and gestures, as well as remove the
50 /// back button from [`HeaderBar`][crate::HeaderBar].
51 ///
52 /// Manually calling [`NavigationView::pop()`][crate::NavigationView::pop()] or using the `navigation.pop`
53 /// action will still work.
54 ///
55 /// See [`show-back-button`][struct@crate::HeaderBar#show-back-button] for removing only the back
56 /// button, but not shortcuts.
57 ///
58 /// Readable | Writeable
59 ///
60 ///
61 /// #### `child`
62 /// The child widget.
63 ///
64 /// Readable | Writeable
65 ///
66 ///
67 /// #### `tag`
68 /// The page tag.
69 ///
70 /// The tag can be used to retrieve the page with
71 /// [`NavigationView::find_page()`][crate::NavigationView::find_page()], as well as with
72 /// [`NavigationView::push_by_tag()`][crate::NavigationView::push_by_tag()], [`NavigationView::pop_to_tag()`][crate::NavigationView::pop_to_tag()] or
73 /// [`NavigationView::replace_with_tags()`][crate::NavigationView::replace_with_tags()].
74 ///
75 /// Tags must be unique within each [`NavigationView`][crate::NavigationView].
76 ///
77 /// The tag also must be set to use the `navigation.push` action.
78 ///
79 /// Readable | Writeable
80 ///
81 ///
82 /// #### `title`
83 /// The page title.
84 ///
85 /// It's displayed in [`HeaderBar`][crate::HeaderBar] instead of the window title, and used
86 /// as the tooltip on the next page's back button, as well as by screen reader.
87 ///
88 /// Readable | Writeable
89 /// <details><summary><h4>Widget</h4></summary>
90 ///
91 ///
92 /// #### `can-focus`
93 /// Whether the widget or any of its descendents can accept
94 /// the input focus.
95 ///
96 /// This property is meant to be set by widget implementations,
97 /// typically in their instance init function.
98 ///
99 /// Readable | Writeable
100 ///
101 ///
102 /// #### `can-target`
103 /// Whether the widget can receive pointer events.
104 ///
105 /// Readable | Writeable
106 ///
107 ///
108 /// #### `css-classes`
109 /// A list of css classes applied to this widget.
110 ///
111 /// Readable | Writeable
112 ///
113 ///
114 /// #### `css-name`
115 /// The name of this widget in the CSS tree.
116 ///
117 /// This property is meant to be set by widget implementations,
118 /// typically in their instance init function.
119 ///
120 /// Readable | Writeable | Construct Only
121 ///
122 ///
123 /// #### `cursor`
124 /// The cursor used by @widget.
125 ///
126 /// Readable | Writeable
127 ///
128 ///
129 /// #### `focus-on-click`
130 /// Whether the widget should grab focus when it is clicked with the mouse.
131 ///
132 /// This property is only relevant for widgets that can take focus.
133 ///
134 /// Readable | Writeable
135 ///
136 ///
137 /// #### `focusable`
138 /// Whether this widget itself will accept the input focus.
139 ///
140 /// Readable | Writeable
141 ///
142 ///
143 /// #### `halign`
144 /// How to distribute horizontal space if widget gets extra space.
145 ///
146 /// Readable | Writeable
147 ///
148 ///
149 /// #### `has-default`
150 /// Whether the widget is the default widget.
151 ///
152 /// Readable
153 ///
154 ///
155 /// #### `has-focus`
156 /// Whether the widget has the input focus.
157 ///
158 /// Readable
159 ///
160 ///
161 /// #### `has-tooltip`
162 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip]
163 /// signal on @widget.
164 ///
165 /// A true value indicates that @widget can have a tooltip, in this case
166 /// the widget will be queried using [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] to
167 /// determine whether it will provide a tooltip or not.
168 ///
169 /// Readable | Writeable
170 ///
171 ///
172 /// #### `height-request`
173 /// Overrides for height request of the widget.
174 ///
175 /// If this is -1, the natural request will be used.
176 ///
177 /// Readable | Writeable
178 ///
179 ///
180 /// #### `hexpand`
181 /// Whether to expand horizontally.
182 ///
183 /// Readable | Writeable
184 ///
185 ///
186 /// #### `hexpand-set`
187 /// Whether to use the `hexpand` property.
188 ///
189 /// Readable | Writeable
190 ///
191 ///
192 /// #### `layout-manager`
193 /// The [`gtk::LayoutManager`][crate::gtk::LayoutManager] instance to use to compute
194 /// the preferred size of the widget, and allocate its children.
195 ///
196 /// This property is meant to be set by widget implementations,
197 /// typically in their instance init function.
198 ///
199 /// Readable | Writeable
200 ///
201 ///
202 /// #### `limit-events`
203 /// Makes this widget act like a modal dialog, with respect to
204 /// event delivery.
205 ///
206 /// Global event controllers will not handle events with targets
207 /// inside the widget, unless they are set up to ignore propagation
208 /// limits. See `Gtk::EventController::set_propagation_limit()`.
209 ///
210 /// Readable | Writeable
211 ///
212 ///
213 /// #### `margin-bottom`
214 /// Margin on bottom side of widget.
215 ///
216 /// This property adds margin outside of the widget's normal size
217 /// request, the margin will be added in addition to the size from
218 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
219 ///
220 /// Readable | Writeable
221 ///
222 ///
223 /// #### `margin-end`
224 /// Margin on end of widget, horizontally.
225 ///
226 /// This property supports left-to-right and right-to-left text
227 /// directions.
228 ///
229 /// This property adds margin outside of the widget's normal size
230 /// request, the margin will be added in addition to the size from
231 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
232 ///
233 /// Readable | Writeable
234 ///
235 ///
236 /// #### `margin-start`
237 /// Margin on start of widget, horizontally.
238 ///
239 /// This property supports left-to-right and right-to-left text
240 /// directions.
241 ///
242 /// This property adds margin outside of the widget's normal size
243 /// request, the margin will be added in addition to the size from
244 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
245 ///
246 /// Readable | Writeable
247 ///
248 ///
249 /// #### `margin-top`
250 /// Margin on top side of widget.
251 ///
252 /// This property adds margin outside of the widget's normal size
253 /// request, the margin will be added in addition to the size from
254 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
255 ///
256 /// Readable | Writeable
257 ///
258 ///
259 /// #### `name`
260 /// The name of the widget.
261 ///
262 /// Readable | Writeable
263 ///
264 ///
265 /// #### `opacity`
266 /// The requested opacity of the widget.
267 ///
268 /// Readable | Writeable
269 ///
270 ///
271 /// #### `overflow`
272 /// How content outside the widget's content area is treated.
273 ///
274 /// This property is meant to be set by widget implementations,
275 /// typically in their instance init function.
276 ///
277 /// Readable | Writeable
278 ///
279 ///
280 /// #### `parent`
281 /// The parent widget of this widget.
282 ///
283 /// Readable
284 ///
285 ///
286 /// #### `receives-default`
287 /// Whether the widget will receive the default action when it is focused.
288 ///
289 /// Readable | Writeable
290 ///
291 ///
292 /// #### `root`
293 /// The [`gtk::Root`][crate::gtk::Root] widget of the widget tree containing this widget.
294 ///
295 /// This will be `NULL` if the widget is not contained in a root widget.
296 ///
297 /// Readable
298 ///
299 ///
300 /// #### `scale-factor`
301 /// The scale factor of the widget.
302 ///
303 /// Readable
304 ///
305 ///
306 /// #### `sensitive`
307 /// Whether the widget responds to input.
308 ///
309 /// Readable | Writeable
310 ///
311 ///
312 /// #### `tooltip-markup`
313 /// Sets the text of tooltip to be the given string, which is marked up
314 /// with Pango markup.
315 ///
316 /// Also see `Gtk::Tooltip::set_markup()`.
317 ///
318 /// This is a convenience property which will take care of getting the
319 /// tooltip shown if the given string is not `NULL`:
320 /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
321 /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
322 /// the default signal handler.
323 ///
324 /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
325 /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
326 ///
327 /// Readable | Writeable
328 ///
329 ///
330 /// #### `tooltip-text`
331 /// Sets the text of tooltip to be the given string.
332 ///
333 /// Also see `Gtk::Tooltip::set_text()`.
334 ///
335 /// This is a convenience property which will take care of getting the
336 /// tooltip shown if the given string is not `NULL`:
337 /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
338 /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
339 /// the default signal handler.
340 ///
341 /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
342 /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
343 ///
344 /// Readable | Writeable
345 ///
346 ///
347 /// #### `valign`
348 /// How to distribute vertical space if widget gets extra space.
349 ///
350 /// Readable | Writeable
351 ///
352 ///
353 /// #### `vexpand`
354 /// Whether to expand vertically.
355 ///
356 /// Readable | Writeable
357 ///
358 ///
359 /// #### `vexpand-set`
360 /// Whether to use the `vexpand` property.
361 ///
362 /// Readable | Writeable
363 ///
364 ///
365 /// #### `visible`
366 /// Whether the widget is visible.
367 ///
368 /// Readable | Writeable
369 ///
370 ///
371 /// #### `width-request`
372 /// Overrides for width request of the widget.
373 ///
374 /// If this is -1, the natural request will be used.
375 ///
376 /// Readable | Writeable
377 /// </details>
378 /// <details><summary><h4>Accessible</h4></summary>
379 ///
380 ///
381 /// #### `accessible-role`
382 /// The accessible role of the given [`gtk::Accessible`][crate::gtk::Accessible] implementation.
383 ///
384 /// The accessible role cannot be changed once set.
385 ///
386 /// Readable | Writeable
387 /// </details>
388 ///
389 /// ## Signals
390 ///
391 ///
392 /// #### `hidden`
393 /// Emitted when the navigation view transition has been completed and the page
394 /// is fully hidden.
395 ///
396 /// It will always be preceded by [`hiding`][struct@crate::NavigationPage#hiding] or
397 /// [`showing`][struct@crate::NavigationPage#showing].
398 ///
399 ///
400 ///
401 ///
402 /// #### `hiding`
403 /// Emitted when the page starts hiding at the beginning of the navigation view
404 /// transition.
405 ///
406 /// It will always be followed by [`hidden`][struct@crate::NavigationPage#hidden] or
407 /// [`shown`][struct@crate::NavigationPage#shown].
408 ///
409 ///
410 ///
411 ///
412 /// #### `showing`
413 /// Emitted when the page shows at the beginning of the navigation view
414 /// transition.
415 ///
416 /// It will always be followed by [`shown`][struct@crate::NavigationPage#shown] or
417 /// [`hidden`][struct@crate::NavigationPage#hidden].
418 ///
419 ///
420 ///
421 ///
422 /// #### `shown`
423 /// Emitted when the navigation view transition has been completed and the page
424 /// is fully shown.
425 ///
426 /// It will always be preceded by [`showing`][struct@crate::NavigationPage#showing] or
427 /// [`hiding`][struct@crate::NavigationPage#hiding].
428 ///
429 ///
430 /// <details><summary><h4>Widget</h4></summary>
431 ///
432 ///
433 /// #### `destroy`
434 /// Signals that all holders of a reference to the widget should release
435 /// the reference that they hold.
436 ///
437 /// May result in finalization of the widget if all references are released.
438 ///
439 /// This signal is not suitable for saving widget state.
440 ///
441 ///
442 ///
443 ///
444 /// #### `direction-changed`
445 /// Emitted when the text direction of a widget changes.
446 ///
447 ///
448 ///
449 ///
450 /// #### `hide`
451 /// Emitted when @widget is hidden.
452 ///
453 ///
454 ///
455 ///
456 /// #### `keynav-failed`
457 /// Emitted if keyboard navigation fails.
458 ///
459 /// See [`WidgetExtManual::keynav_failed()`][crate::gtk::prelude::WidgetExtManual::keynav_failed()] for details.
460 ///
461 ///
462 ///
463 ///
464 /// #### `map`
465 /// Emitted when @widget is going to be mapped.
466 ///
467 /// A widget is mapped when the widget is visible (which is controlled with
468 /// [`visible`][struct@crate::gtk::Widget#visible]) and all its parents up to the toplevel widget
469 /// are also visible.
470 ///
471 /// The `::map` signal can be used to determine whether a widget will be drawn,
472 /// for instance it can resume an animation that was stopped during the
473 /// emission of [`unmap`][struct@crate::gtk::Widget#unmap].
474 ///
475 ///
476 ///
477 ///
478 /// #### `mnemonic-activate`
479 /// Emitted when a widget is activated via a mnemonic.
480 ///
481 /// The default handler for this signal activates @widget if @group_cycling
482 /// is false, or just makes @widget grab focus if @group_cycling is true.
483 ///
484 ///
485 ///
486 ///
487 /// #### `move-focus`
488 /// Emitted when the focus is moved.
489 ///
490 /// The `::move-focus` signal is a [keybinding signal](class.SignalAction.html).
491 ///
492 /// The default bindings for this signal are <kbd>Tab</kbd> to move forward,
493 /// and <kbd>Shift</kbd>+<kbd>Tab</kbd> to move backward.
494 ///
495 /// Action
496 ///
497 ///
498 /// #### `query-tooltip`
499 /// Emitted when the widget’s tooltip is about to be shown.
500 ///
501 /// This happens when the [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] property
502 /// is true and the hover timeout has expired with the cursor hovering
503 /// above @widget; or emitted when @widget got focus in keyboard mode.
504 ///
505 /// Using the given coordinates, the signal handler should determine
506 /// whether a tooltip should be shown for @widget. If this is the case
507 /// true should be returned, false otherwise. Note that if @keyboard_mode
508 /// is true, the values of @x and @y are undefined and should not be used.
509 ///
510 /// The signal handler is free to manipulate @tooltip with the therefore
511 /// destined function calls.
512 ///
513 ///
514 ///
515 ///
516 /// #### `realize`
517 /// Emitted when @widget is associated with a `GdkSurface`.
518 ///
519 /// This means that [`WidgetExtManual::realize()`][crate::gtk::prelude::WidgetExtManual::realize()] has been called
520 /// or the widget has been mapped (that is, it is going to be drawn).
521 ///
522 ///
523 ///
524 ///
525 /// #### `show`
526 /// Emitted when @widget is shown.
527 ///
528 ///
529 ///
530 ///
531 /// #### `state-flags-changed`
532 /// Emitted when the widget state changes.
533 ///
534 /// See [`WidgetExtManual::state_flags()`][crate::gtk::prelude::WidgetExtManual::state_flags()].
535 ///
536 ///
537 ///
538 ///
539 /// #### `unmap`
540 /// Emitted when @widget is going to be unmapped.
541 ///
542 /// A widget is unmapped when either it or any of its parents up to the
543 /// toplevel widget have been set as hidden.
544 ///
545 /// As `::unmap` indicates that a widget will not be shown any longer,
546 /// it can be used to, for example, stop an animation on the widget.
547 ///
548 ///
549 ///
550 ///
551 /// #### `unrealize`
552 /// Emitted when the `GdkSurface` associated with @widget is destroyed.
553 ///
554 /// This means that [`WidgetExtManual::unrealize()`][crate::gtk::prelude::WidgetExtManual::unrealize()] has been called
555 /// or the widget has been unmapped (that is, it is going to be hidden).
556 ///
557 ///
558 /// </details>
559 ///
560 /// # Implements
561 ///
562 /// [`NavigationPageExt`][trait@crate::prelude::NavigationPageExt], [`trait@gtk::prelude::WidgetExt`], [`trait@glib::ObjectExt`], [`trait@gtk::prelude::AccessibleExt`], [`trait@gtk::prelude::BuildableExt`], [`trait@gtk::prelude::ConstraintTargetExt`]
563 #[doc(alias = "AdwNavigationPage")]
564 pub struct NavigationPage(Object<ffi::AdwNavigationPage, ffi::AdwNavigationPageClass>) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget;
565
566 match fn {
567 type_ => || ffi::adw_navigation_page_get_type(),
568 }
569}
570
571impl NavigationPage {
572 pub const NONE: Option<&'static NavigationPage> = None;
573
574 /// Creates a new [`NavigationPage`][crate::NavigationPage].
575 /// ## `child`
576 /// the child widget
577 /// ## `title`
578 /// the page title
579 ///
580 /// # Returns
581 ///
582 /// the new created [`NavigationPage`][crate::NavigationPage]
583 #[doc(alias = "adw_navigation_page_new")]
584 pub fn new(child: &impl IsA<gtk::Widget>, title: &str) -> NavigationPage {
585 assert_initialized_main_thread!();
586 unsafe {
587 from_glib_none(ffi::adw_navigation_page_new(
588 child.as_ref().to_glib_none().0,
589 title.to_glib_none().0,
590 ))
591 }
592 }
593
594 /// Creates a new [`NavigationPage`][crate::NavigationPage] with provided tag.
595 /// ## `child`
596 /// the child widget
597 /// ## `title`
598 /// the page title
599 /// ## `tag`
600 /// the page tag
601 ///
602 /// # Returns
603 ///
604 /// the new created [`NavigationPage`][crate::NavigationPage]
605 #[doc(alias = "adw_navigation_page_new_with_tag")]
606 #[doc(alias = "new_with_tag")]
607 pub fn with_tag(child: &impl IsA<gtk::Widget>, title: &str, tag: &str) -> NavigationPage {
608 assert_initialized_main_thread!();
609 unsafe {
610 from_glib_none(ffi::adw_navigation_page_new_with_tag(
611 child.as_ref().to_glib_none().0,
612 title.to_glib_none().0,
613 tag.to_glib_none().0,
614 ))
615 }
616 }
617
618 // rustdoc-stripper-ignore-next
619 /// Creates a new builder-pattern struct instance to construct [`NavigationPage`] objects.
620 ///
621 /// This method returns an instance of [`NavigationPageBuilder`](crate::builders::NavigationPageBuilder) which can be used to create [`NavigationPage`] objects.
622 pub fn builder() -> NavigationPageBuilder {
623 NavigationPageBuilder::new()
624 }
625}
626
627#[cfg(feature = "v1_4")]
628#[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
629impl Default for NavigationPage {
630 fn default() -> Self {
631 glib::object::Object::new::<Self>()
632 }
633}
634
635// rustdoc-stripper-ignore-next
636/// A [builder-pattern] type to construct [`NavigationPage`] objects.
637///
638/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
639#[must_use = "The builder must be built to be used"]
640pub struct NavigationPageBuilder {
641 builder: glib::object::ObjectBuilder<'static, NavigationPage>,
642}
643
644impl NavigationPageBuilder {
645 fn new() -> Self {
646 Self {
647 builder: glib::object::Object::builder(),
648 }
649 }
650
651 /// Whether the page can be popped from navigation stack.
652 ///
653 /// Set it to `FALSE` to disable shortcuts and gestures, as well as remove the
654 /// back button from [`HeaderBar`][crate::HeaderBar].
655 ///
656 /// Manually calling [`NavigationView::pop()`][crate::NavigationView::pop()] or using the `navigation.pop`
657 /// action will still work.
658 ///
659 /// See [`show-back-button`][struct@crate::HeaderBar#show-back-button] for removing only the back
660 /// button, but not shortcuts.
661 #[cfg(feature = "v1_4")]
662 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
663 pub fn can_pop(self, can_pop: bool) -> Self {
664 Self {
665 builder: self.builder.property("can-pop", can_pop),
666 }
667 }
668
669 /// The child widget.
670 #[cfg(feature = "v1_4")]
671 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
672 pub fn child(self, child: &impl IsA<gtk::Widget>) -> Self {
673 Self {
674 builder: self.builder.property("child", child.clone().upcast()),
675 }
676 }
677
678 /// The page tag.
679 ///
680 /// The tag can be used to retrieve the page with
681 /// [`NavigationView::find_page()`][crate::NavigationView::find_page()], as well as with
682 /// [`NavigationView::push_by_tag()`][crate::NavigationView::push_by_tag()], [`NavigationView::pop_to_tag()`][crate::NavigationView::pop_to_tag()] or
683 /// [`NavigationView::replace_with_tags()`][crate::NavigationView::replace_with_tags()].
684 ///
685 /// Tags must be unique within each [`NavigationView`][crate::NavigationView].
686 ///
687 /// The tag also must be set to use the `navigation.push` action.
688 #[cfg(feature = "v1_4")]
689 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
690 pub fn tag(self, tag: impl Into<glib::GString>) -> Self {
691 Self {
692 builder: self.builder.property("tag", tag.into()),
693 }
694 }
695
696 /// The page title.
697 ///
698 /// It's displayed in [`HeaderBar`][crate::HeaderBar] instead of the window title, and used
699 /// as the tooltip on the next page's back button, as well as by screen reader.
700 #[cfg(feature = "v1_4")]
701 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
702 pub fn title(self, title: impl Into<glib::GString>) -> Self {
703 Self {
704 builder: self.builder.property("title", title.into()),
705 }
706 }
707
708 /// Whether the widget or any of its descendents can accept
709 /// the input focus.
710 ///
711 /// This property is meant to be set by widget implementations,
712 /// typically in their instance init function.
713 pub fn can_focus(self, can_focus: bool) -> Self {
714 Self {
715 builder: self.builder.property("can-focus", can_focus),
716 }
717 }
718
719 /// Whether the widget can receive pointer events.
720 pub fn can_target(self, can_target: bool) -> Self {
721 Self {
722 builder: self.builder.property("can-target", can_target),
723 }
724 }
725
726 /// A list of css classes applied to this widget.
727 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
728 Self {
729 builder: self.builder.property("css-classes", css_classes.into()),
730 }
731 }
732
733 /// The name of this widget in the CSS tree.
734 ///
735 /// This property is meant to be set by widget implementations,
736 /// typically in their instance init function.
737 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
738 Self {
739 builder: self.builder.property("css-name", css_name.into()),
740 }
741 }
742
743 /// The cursor used by @widget.
744 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
745 Self {
746 builder: self.builder.property("cursor", cursor.clone()),
747 }
748 }
749
750 /// Whether the widget should grab focus when it is clicked with the mouse.
751 ///
752 /// This property is only relevant for widgets that can take focus.
753 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
754 Self {
755 builder: self.builder.property("focus-on-click", focus_on_click),
756 }
757 }
758
759 /// Whether this widget itself will accept the input focus.
760 pub fn focusable(self, focusable: bool) -> Self {
761 Self {
762 builder: self.builder.property("focusable", focusable),
763 }
764 }
765
766 /// How to distribute horizontal space if widget gets extra space.
767 pub fn halign(self, halign: gtk::Align) -> Self {
768 Self {
769 builder: self.builder.property("halign", halign),
770 }
771 }
772
773 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip]
774 /// signal on @widget.
775 ///
776 /// A true value indicates that @widget can have a tooltip, in this case
777 /// the widget will be queried using [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] to
778 /// determine whether it will provide a tooltip or not.
779 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
780 Self {
781 builder: self.builder.property("has-tooltip", has_tooltip),
782 }
783 }
784
785 /// Overrides for height request of the widget.
786 ///
787 /// If this is -1, the natural request will be used.
788 pub fn height_request(self, height_request: i32) -> Self {
789 Self {
790 builder: self.builder.property("height-request", height_request),
791 }
792 }
793
794 /// Whether to expand horizontally.
795 pub fn hexpand(self, hexpand: bool) -> Self {
796 Self {
797 builder: self.builder.property("hexpand", hexpand),
798 }
799 }
800
801 /// Whether to use the `hexpand` property.
802 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
803 Self {
804 builder: self.builder.property("hexpand-set", hexpand_set),
805 }
806 }
807
808 /// The [`gtk::LayoutManager`][crate::gtk::LayoutManager] instance to use to compute
809 /// the preferred size of the widget, and allocate its children.
810 ///
811 /// This property is meant to be set by widget implementations,
812 /// typically in their instance init function.
813 pub fn layout_manager(self, layout_manager: &impl IsA<gtk::LayoutManager>) -> Self {
814 Self {
815 builder: self
816 .builder
817 .property("layout-manager", layout_manager.clone().upcast()),
818 }
819 }
820
821 /// Makes this widget act like a modal dialog, with respect to
822 /// event delivery.
823 ///
824 /// Global event controllers will not handle events with targets
825 /// inside the widget, unless they are set up to ignore propagation
826 /// limits. See `Gtk::EventController::set_propagation_limit()`.
827 #[cfg(feature = "gtk_v4_18")]
828 #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))]
829 pub fn limit_events(self, limit_events: bool) -> Self {
830 Self {
831 builder: self.builder.property("limit-events", limit_events),
832 }
833 }
834
835 /// Margin on bottom side of widget.
836 ///
837 /// This property adds margin outside of the widget's normal size
838 /// request, the margin will be added in addition to the size from
839 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
840 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
841 Self {
842 builder: self.builder.property("margin-bottom", margin_bottom),
843 }
844 }
845
846 /// Margin on end of widget, horizontally.
847 ///
848 /// This property supports left-to-right and right-to-left text
849 /// directions.
850 ///
851 /// This property adds margin outside of the widget's normal size
852 /// request, the margin will be added in addition to the size from
853 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
854 pub fn margin_end(self, margin_end: i32) -> Self {
855 Self {
856 builder: self.builder.property("margin-end", margin_end),
857 }
858 }
859
860 /// Margin on start of widget, horizontally.
861 ///
862 /// This property supports left-to-right and right-to-left text
863 /// directions.
864 ///
865 /// This property adds margin outside of the widget's normal size
866 /// request, the margin will be added in addition to the size from
867 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
868 pub fn margin_start(self, margin_start: i32) -> Self {
869 Self {
870 builder: self.builder.property("margin-start", margin_start),
871 }
872 }
873
874 /// Margin on top side of widget.
875 ///
876 /// This property adds margin outside of the widget's normal size
877 /// request, the margin will be added in addition to the size from
878 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
879 pub fn margin_top(self, margin_top: i32) -> Self {
880 Self {
881 builder: self.builder.property("margin-top", margin_top),
882 }
883 }
884
885 /// The name of the widget.
886 pub fn name(self, name: impl Into<glib::GString>) -> Self {
887 Self {
888 builder: self.builder.property("name", name.into()),
889 }
890 }
891
892 /// The requested opacity of the widget.
893 pub fn opacity(self, opacity: f64) -> Self {
894 Self {
895 builder: self.builder.property("opacity", opacity),
896 }
897 }
898
899 /// How content outside the widget's content area is treated.
900 ///
901 /// This property is meant to be set by widget implementations,
902 /// typically in their instance init function.
903 pub fn overflow(self, overflow: gtk::Overflow) -> Self {
904 Self {
905 builder: self.builder.property("overflow", overflow),
906 }
907 }
908
909 /// Whether the widget will receive the default action when it is focused.
910 pub fn receives_default(self, receives_default: bool) -> Self {
911 Self {
912 builder: self.builder.property("receives-default", receives_default),
913 }
914 }
915
916 /// Whether the widget responds to input.
917 pub fn sensitive(self, sensitive: bool) -> Self {
918 Self {
919 builder: self.builder.property("sensitive", sensitive),
920 }
921 }
922
923 /// Sets the text of tooltip to be the given string, which is marked up
924 /// with Pango markup.
925 ///
926 /// Also see `Gtk::Tooltip::set_markup()`.
927 ///
928 /// This is a convenience property which will take care of getting the
929 /// tooltip shown if the given string is not `NULL`:
930 /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
931 /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
932 /// the default signal handler.
933 ///
934 /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
935 /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
936 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
937 Self {
938 builder: self
939 .builder
940 .property("tooltip-markup", tooltip_markup.into()),
941 }
942 }
943
944 /// Sets the text of tooltip to be the given string.
945 ///
946 /// Also see `Gtk::Tooltip::set_text()`.
947 ///
948 /// This is a convenience property which will take care of getting the
949 /// tooltip shown if the given string is not `NULL`:
950 /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
951 /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
952 /// the default signal handler.
953 ///
954 /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
955 /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
956 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
957 Self {
958 builder: self.builder.property("tooltip-text", tooltip_text.into()),
959 }
960 }
961
962 /// How to distribute vertical space if widget gets extra space.
963 pub fn valign(self, valign: gtk::Align) -> Self {
964 Self {
965 builder: self.builder.property("valign", valign),
966 }
967 }
968
969 /// Whether to expand vertically.
970 pub fn vexpand(self, vexpand: bool) -> Self {
971 Self {
972 builder: self.builder.property("vexpand", vexpand),
973 }
974 }
975
976 /// Whether to use the `vexpand` property.
977 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
978 Self {
979 builder: self.builder.property("vexpand-set", vexpand_set),
980 }
981 }
982
983 /// Whether the widget is visible.
984 pub fn visible(self, visible: bool) -> Self {
985 Self {
986 builder: self.builder.property("visible", visible),
987 }
988 }
989
990 /// Overrides for width request of the widget.
991 ///
992 /// If this is -1, the natural request will be used.
993 pub fn width_request(self, width_request: i32) -> Self {
994 Self {
995 builder: self.builder.property("width-request", width_request),
996 }
997 }
998
999 /// The accessible role of the given [`gtk::Accessible`][crate::gtk::Accessible] implementation.
1000 ///
1001 /// The accessible role cannot be changed once set.
1002 pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self {
1003 Self {
1004 builder: self.builder.property("accessible-role", accessible_role),
1005 }
1006 }
1007
1008 // rustdoc-stripper-ignore-next
1009 /// Build the [`NavigationPage`].
1010 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1011 pub fn build(self) -> NavigationPage {
1012 assert_initialized_main_thread!();
1013 self.builder.build()
1014 }
1015}
1016
1017/// Trait containing all [`struct@NavigationPage`] methods.
1018///
1019/// # Implementors
1020///
1021/// [`NavigationPage`][struct@crate::NavigationPage]
1022pub trait NavigationPageExt: IsA<NavigationPage> + 'static {
1023 /// Gets whether @self can be popped from navigation stack.
1024 ///
1025 /// # Returns
1026 ///
1027 /// whether the page can be popped from navigation stack
1028 #[doc(alias = "adw_navigation_page_get_can_pop")]
1029 #[doc(alias = "get_can_pop")]
1030 #[doc(alias = "can-pop")]
1031 fn can_pop(&self) -> bool {
1032 unsafe {
1033 from_glib(ffi::adw_navigation_page_get_can_pop(
1034 self.as_ref().to_glib_none().0,
1035 ))
1036 }
1037 }
1038
1039 /// Gets the child widget of @self.
1040 ///
1041 /// # Returns
1042 ///
1043 /// the child widget of @self
1044 #[doc(alias = "adw_navigation_page_get_child")]
1045 #[doc(alias = "get_child")]
1046 fn child(&self) -> Option<gtk::Widget> {
1047 unsafe {
1048 from_glib_none(ffi::adw_navigation_page_get_child(
1049 self.as_ref().to_glib_none().0,
1050 ))
1051 }
1052 }
1053
1054 /// Gets the tag of @self.
1055 ///
1056 /// # Returns
1057 ///
1058 /// the page tag
1059 #[doc(alias = "adw_navigation_page_get_tag")]
1060 #[doc(alias = "get_tag")]
1061 fn tag(&self) -> Option<glib::GString> {
1062 unsafe {
1063 from_glib_none(ffi::adw_navigation_page_get_tag(
1064 self.as_ref().to_glib_none().0,
1065 ))
1066 }
1067 }
1068
1069 /// Gets the title of @self.
1070 ///
1071 /// # Returns
1072 ///
1073 /// the title of @self
1074 #[doc(alias = "adw_navigation_page_get_title")]
1075 #[doc(alias = "get_title")]
1076 fn title(&self) -> glib::GString {
1077 unsafe {
1078 from_glib_none(ffi::adw_navigation_page_get_title(
1079 self.as_ref().to_glib_none().0,
1080 ))
1081 }
1082 }
1083
1084 /// Sets whether @self can be popped from navigation stack.
1085 ///
1086 /// Set it to `FALSE` to disable shortcuts and gestures, as well as remove the
1087 /// back button from [`HeaderBar`][crate::HeaderBar].
1088 ///
1089 /// Manually calling [`NavigationView::pop()`][crate::NavigationView::pop()] or using the `navigation.pop`
1090 /// action will still work.
1091 ///
1092 /// See [`show-back-button`][struct@crate::HeaderBar#show-back-button] for removing only the back button,
1093 /// but not shortcuts.
1094 /// ## `can_pop`
1095 /// whether the page can be popped from navigation stack
1096 #[doc(alias = "adw_navigation_page_set_can_pop")]
1097 #[doc(alias = "can-pop")]
1098 fn set_can_pop(&self, can_pop: bool) {
1099 unsafe {
1100 ffi::adw_navigation_page_set_can_pop(
1101 self.as_ref().to_glib_none().0,
1102 can_pop.into_glib(),
1103 );
1104 }
1105 }
1106
1107 /// Sets the child widget of @self.
1108 /// ## `child`
1109 /// the child widget
1110 #[doc(alias = "adw_navigation_page_set_child")]
1111 #[doc(alias = "child")]
1112 fn set_child(&self, child: Option<&impl IsA<gtk::Widget>>) {
1113 unsafe {
1114 ffi::adw_navigation_page_set_child(
1115 self.as_ref().to_glib_none().0,
1116 child.map(|p| p.as_ref()).to_glib_none().0,
1117 );
1118 }
1119 }
1120
1121 /// Sets the tag for @self.
1122 ///
1123 /// The tag can be used to retrieve the page with
1124 /// [`NavigationView::find_page()`][crate::NavigationView::find_page()], as well as with
1125 /// [`NavigationView::push_by_tag()`][crate::NavigationView::push_by_tag()], [`NavigationView::pop_to_tag()`][crate::NavigationView::pop_to_tag()] or
1126 /// [`NavigationView::replace_with_tags()`][crate::NavigationView::replace_with_tags()].
1127 ///
1128 /// Tags must be unique within each [`NavigationView`][crate::NavigationView].
1129 ///
1130 /// The tag also must be set to use the `navigation.push` action.
1131 /// ## `tag`
1132 /// the page tag
1133 #[doc(alias = "adw_navigation_page_set_tag")]
1134 #[doc(alias = "tag")]
1135 fn set_tag(&self, tag: Option<&str>) {
1136 unsafe {
1137 ffi::adw_navigation_page_set_tag(self.as_ref().to_glib_none().0, tag.to_glib_none().0);
1138 }
1139 }
1140
1141 /// Sets the title of @self.
1142 ///
1143 /// It's displayed in [`HeaderBar`][crate::HeaderBar] instead of the window title, and used as
1144 /// the tooltip on the next page's back button, as well as by screen reader.
1145 /// ## `title`
1146 /// the title
1147 #[doc(alias = "adw_navigation_page_set_title")]
1148 #[doc(alias = "title")]
1149 fn set_title(&self, title: &str) {
1150 unsafe {
1151 ffi::adw_navigation_page_set_title(
1152 self.as_ref().to_glib_none().0,
1153 title.to_glib_none().0,
1154 );
1155 }
1156 }
1157
1158 /// Emitted when the navigation view transition has been completed and the page
1159 /// is fully hidden.
1160 ///
1161 /// It will always be preceded by [`hiding`][struct@crate::NavigationPage#hiding] or
1162 /// [`showing`][struct@crate::NavigationPage#showing].
1163 #[cfg(feature = "v1_4")]
1164 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1165 #[doc(alias = "hidden")]
1166 fn connect_hidden<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1167 unsafe extern "C" fn hidden_trampoline<P: IsA<NavigationPage>, F: Fn(&P) + 'static>(
1168 this: *mut ffi::AdwNavigationPage,
1169 f: glib::ffi::gpointer,
1170 ) {
1171 unsafe {
1172 let f: &F = &*(f as *const F);
1173 f(NavigationPage::from_glib_borrow(this).unsafe_cast_ref())
1174 }
1175 }
1176 unsafe {
1177 let f: Box_<F> = Box_::new(f);
1178 connect_raw(
1179 self.as_ptr() as *mut _,
1180 c"hidden".as_ptr() as *const _,
1181 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1182 hidden_trampoline::<Self, F> as *const (),
1183 )),
1184 Box_::into_raw(f),
1185 )
1186 }
1187 }
1188
1189 /// Emitted when the page starts hiding at the beginning of the navigation view
1190 /// transition.
1191 ///
1192 /// It will always be followed by [`hidden`][struct@crate::NavigationPage#hidden] or
1193 /// [`shown`][struct@crate::NavigationPage#shown].
1194 #[cfg(feature = "v1_4")]
1195 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1196 #[doc(alias = "hiding")]
1197 fn connect_hiding<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1198 unsafe extern "C" fn hiding_trampoline<P: IsA<NavigationPage>, F: Fn(&P) + 'static>(
1199 this: *mut ffi::AdwNavigationPage,
1200 f: glib::ffi::gpointer,
1201 ) {
1202 unsafe {
1203 let f: &F = &*(f as *const F);
1204 f(NavigationPage::from_glib_borrow(this).unsafe_cast_ref())
1205 }
1206 }
1207 unsafe {
1208 let f: Box_<F> = Box_::new(f);
1209 connect_raw(
1210 self.as_ptr() as *mut _,
1211 c"hiding".as_ptr() as *const _,
1212 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1213 hiding_trampoline::<Self, F> as *const (),
1214 )),
1215 Box_::into_raw(f),
1216 )
1217 }
1218 }
1219
1220 /// Emitted when the page shows at the beginning of the navigation view
1221 /// transition.
1222 ///
1223 /// It will always be followed by [`shown`][struct@crate::NavigationPage#shown] or
1224 /// [`hidden`][struct@crate::NavigationPage#hidden].
1225 #[cfg(feature = "v1_4")]
1226 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1227 #[doc(alias = "showing")]
1228 fn connect_showing<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1229 unsafe extern "C" fn showing_trampoline<P: IsA<NavigationPage>, F: Fn(&P) + 'static>(
1230 this: *mut ffi::AdwNavigationPage,
1231 f: glib::ffi::gpointer,
1232 ) {
1233 unsafe {
1234 let f: &F = &*(f as *const F);
1235 f(NavigationPage::from_glib_borrow(this).unsafe_cast_ref())
1236 }
1237 }
1238 unsafe {
1239 let f: Box_<F> = Box_::new(f);
1240 connect_raw(
1241 self.as_ptr() as *mut _,
1242 c"showing".as_ptr() as *const _,
1243 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1244 showing_trampoline::<Self, F> as *const (),
1245 )),
1246 Box_::into_raw(f),
1247 )
1248 }
1249 }
1250
1251 /// Emitted when the navigation view transition has been completed and the page
1252 /// is fully shown.
1253 ///
1254 /// It will always be preceded by [`showing`][struct@crate::NavigationPage#showing] or
1255 /// [`hiding`][struct@crate::NavigationPage#hiding].
1256 #[cfg(feature = "v1_4")]
1257 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1258 #[doc(alias = "shown")]
1259 fn connect_shown<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1260 unsafe extern "C" fn shown_trampoline<P: IsA<NavigationPage>, F: Fn(&P) + 'static>(
1261 this: *mut ffi::AdwNavigationPage,
1262 f: glib::ffi::gpointer,
1263 ) {
1264 unsafe {
1265 let f: &F = &*(f as *const F);
1266 f(NavigationPage::from_glib_borrow(this).unsafe_cast_ref())
1267 }
1268 }
1269 unsafe {
1270 let f: Box_<F> = Box_::new(f);
1271 connect_raw(
1272 self.as_ptr() as *mut _,
1273 c"shown".as_ptr() as *const _,
1274 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1275 shown_trampoline::<Self, F> as *const (),
1276 )),
1277 Box_::into_raw(f),
1278 )
1279 }
1280 }
1281
1282 #[cfg(feature = "v1_4")]
1283 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1284 #[doc(alias = "can-pop")]
1285 fn connect_can_pop_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1286 unsafe extern "C" fn notify_can_pop_trampoline<
1287 P: IsA<NavigationPage>,
1288 F: Fn(&P) + 'static,
1289 >(
1290 this: *mut ffi::AdwNavigationPage,
1291 _param_spec: glib::ffi::gpointer,
1292 f: glib::ffi::gpointer,
1293 ) {
1294 unsafe {
1295 let f: &F = &*(f as *const F);
1296 f(NavigationPage::from_glib_borrow(this).unsafe_cast_ref())
1297 }
1298 }
1299 unsafe {
1300 let f: Box_<F> = Box_::new(f);
1301 connect_raw(
1302 self.as_ptr() as *mut _,
1303 c"notify::can-pop".as_ptr() as *const _,
1304 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1305 notify_can_pop_trampoline::<Self, F> as *const (),
1306 )),
1307 Box_::into_raw(f),
1308 )
1309 }
1310 }
1311
1312 #[cfg(feature = "v1_4")]
1313 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1314 #[doc(alias = "child")]
1315 fn connect_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1316 unsafe extern "C" fn notify_child_trampoline<
1317 P: IsA<NavigationPage>,
1318 F: Fn(&P) + 'static,
1319 >(
1320 this: *mut ffi::AdwNavigationPage,
1321 _param_spec: glib::ffi::gpointer,
1322 f: glib::ffi::gpointer,
1323 ) {
1324 unsafe {
1325 let f: &F = &*(f as *const F);
1326 f(NavigationPage::from_glib_borrow(this).unsafe_cast_ref())
1327 }
1328 }
1329 unsafe {
1330 let f: Box_<F> = Box_::new(f);
1331 connect_raw(
1332 self.as_ptr() as *mut _,
1333 c"notify::child".as_ptr() as *const _,
1334 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1335 notify_child_trampoline::<Self, F> as *const (),
1336 )),
1337 Box_::into_raw(f),
1338 )
1339 }
1340 }
1341
1342 #[cfg(feature = "v1_4")]
1343 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1344 #[doc(alias = "tag")]
1345 fn connect_tag_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1346 unsafe extern "C" fn notify_tag_trampoline<P: IsA<NavigationPage>, F: Fn(&P) + 'static>(
1347 this: *mut ffi::AdwNavigationPage,
1348 _param_spec: glib::ffi::gpointer,
1349 f: glib::ffi::gpointer,
1350 ) {
1351 unsafe {
1352 let f: &F = &*(f as *const F);
1353 f(NavigationPage::from_glib_borrow(this).unsafe_cast_ref())
1354 }
1355 }
1356 unsafe {
1357 let f: Box_<F> = Box_::new(f);
1358 connect_raw(
1359 self.as_ptr() as *mut _,
1360 c"notify::tag".as_ptr() as *const _,
1361 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1362 notify_tag_trampoline::<Self, F> as *const (),
1363 )),
1364 Box_::into_raw(f),
1365 )
1366 }
1367 }
1368
1369 #[cfg(feature = "v1_4")]
1370 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1371 #[doc(alias = "title")]
1372 fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1373 unsafe extern "C" fn notify_title_trampoline<
1374 P: IsA<NavigationPage>,
1375 F: Fn(&P) + 'static,
1376 >(
1377 this: *mut ffi::AdwNavigationPage,
1378 _param_spec: glib::ffi::gpointer,
1379 f: glib::ffi::gpointer,
1380 ) {
1381 unsafe {
1382 let f: &F = &*(f as *const F);
1383 f(NavigationPage::from_glib_borrow(this).unsafe_cast_ref())
1384 }
1385 }
1386 unsafe {
1387 let f: Box_<F> = Box_::new(f);
1388 connect_raw(
1389 self.as_ptr() as *mut _,
1390 c"notify::title".as_ptr() as *const _,
1391 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1392 notify_title_trampoline::<Self, F> as *const (),
1393 )),
1394 Box_::into_raw(f),
1395 )
1396 }
1397 }
1398}
1399
1400impl<O: IsA<NavigationPage>> NavigationPageExt for O {}