1use crate::{ffi, NavigationPage, Swipeable};
7use glib::{
8 object::ObjectType as _,
9 prelude::*,
10 signal::{connect_raw, SignalHandlerId},
11 translate::*,
12};
13use std::boxed::Box as Box_;
14
15glib::wrapper! {
16 #[doc(alias = "AdwNavigationView")]
17 pub struct NavigationView(Object<ffi::AdwNavigationView, ffi::AdwNavigationViewClass>) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, Swipeable;
18
19 match fn {
20 type_ => || ffi::adw_navigation_view_get_type(),
21 }
22}
23
24impl NavigationView {
25 #[doc(alias = "adw_navigation_view_new")]
26 pub fn new() -> NavigationView {
27 assert_initialized_main_thread!();
28 unsafe { gtk::Widget::from_glib_none(ffi::adw_navigation_view_new()).unsafe_cast() }
29 }
30
31 pub fn builder() -> NavigationViewBuilder {
36 NavigationViewBuilder::new()
37 }
38
39 #[doc(alias = "adw_navigation_view_add")]
40 pub fn add(&self, page: &impl IsA<NavigationPage>) {
41 unsafe {
42 ffi::adw_navigation_view_add(self.to_glib_none().0, page.as_ref().to_glib_none().0);
43 }
44 }
45
46 #[doc(alias = "adw_navigation_view_find_page")]
47 pub fn find_page(&self, tag: &str) -> Option<NavigationPage> {
48 unsafe {
49 from_glib_none(ffi::adw_navigation_view_find_page(
50 self.to_glib_none().0,
51 tag.to_glib_none().0,
52 ))
53 }
54 }
55
56 #[doc(alias = "adw_navigation_view_get_animate_transitions")]
57 #[doc(alias = "get_animate_transitions")]
58 #[doc(alias = "animate-transitions")]
59 pub fn is_animate_transitions(&self) -> bool {
60 unsafe {
61 from_glib(ffi::adw_navigation_view_get_animate_transitions(
62 self.to_glib_none().0,
63 ))
64 }
65 }
66
67 #[cfg(feature = "v1_7")]
68 #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
69 #[doc(alias = "adw_navigation_view_get_hhomogeneous")]
70 #[doc(alias = "get_hhomogeneous")]
71 #[doc(alias = "hhomogeneous")]
72 pub fn is_hhomogeneous(&self) -> bool {
73 unsafe {
74 from_glib(ffi::adw_navigation_view_get_hhomogeneous(
75 self.to_glib_none().0,
76 ))
77 }
78 }
79
80 #[doc(alias = "adw_navigation_view_get_navigation_stack")]
81 #[doc(alias = "get_navigation_stack")]
82 #[doc(alias = "navigation-stack")]
83 pub fn navigation_stack(&self) -> gio::ListModel {
84 unsafe {
85 from_glib_full(ffi::adw_navigation_view_get_navigation_stack(
86 self.to_glib_none().0,
87 ))
88 }
89 }
90
91 #[doc(alias = "adw_navigation_view_get_pop_on_escape")]
92 #[doc(alias = "get_pop_on_escape")]
93 #[doc(alias = "pop-on-escape")]
94 pub fn is_pop_on_escape(&self) -> bool {
95 unsafe {
96 from_glib(ffi::adw_navigation_view_get_pop_on_escape(
97 self.to_glib_none().0,
98 ))
99 }
100 }
101
102 #[doc(alias = "adw_navigation_view_get_previous_page")]
103 #[doc(alias = "get_previous_page")]
104 pub fn previous_page(&self, page: &impl IsA<NavigationPage>) -> Option<NavigationPage> {
105 unsafe {
106 from_glib_none(ffi::adw_navigation_view_get_previous_page(
107 self.to_glib_none().0,
108 page.as_ref().to_glib_none().0,
109 ))
110 }
111 }
112
113 #[cfg(feature = "v1_7")]
114 #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
115 #[doc(alias = "adw_navigation_view_get_vhomogeneous")]
116 #[doc(alias = "get_vhomogeneous")]
117 #[doc(alias = "vhomogeneous")]
118 pub fn is_vhomogeneous(&self) -> bool {
119 unsafe {
120 from_glib(ffi::adw_navigation_view_get_vhomogeneous(
121 self.to_glib_none().0,
122 ))
123 }
124 }
125
126 #[doc(alias = "adw_navigation_view_get_visible_page")]
127 #[doc(alias = "get_visible_page")]
128 #[doc(alias = "visible-page")]
129 pub fn visible_page(&self) -> Option<NavigationPage> {
130 unsafe {
131 from_glib_none(ffi::adw_navigation_view_get_visible_page(
132 self.to_glib_none().0,
133 ))
134 }
135 }
136
137 #[cfg(feature = "v1_7")]
138 #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
139 #[doc(alias = "adw_navigation_view_get_visible_page_tag")]
140 #[doc(alias = "get_visible_page_tag")]
141 #[doc(alias = "visible-page-tag")]
142 pub fn visible_page_tag(&self) -> Option<glib::GString> {
143 unsafe {
144 from_glib_none(ffi::adw_navigation_view_get_visible_page_tag(
145 self.to_glib_none().0,
146 ))
147 }
148 }
149
150 #[doc(alias = "adw_navigation_view_pop")]
151 pub fn pop(&self) -> bool {
152 unsafe { from_glib(ffi::adw_navigation_view_pop(self.to_glib_none().0)) }
153 }
154
155 #[doc(alias = "adw_navigation_view_pop_to_page")]
156 pub fn pop_to_page(&self, page: &impl IsA<NavigationPage>) -> bool {
157 unsafe {
158 from_glib(ffi::adw_navigation_view_pop_to_page(
159 self.to_glib_none().0,
160 page.as_ref().to_glib_none().0,
161 ))
162 }
163 }
164
165 #[doc(alias = "adw_navigation_view_pop_to_tag")]
166 pub fn pop_to_tag(&self, tag: &str) -> bool {
167 unsafe {
168 from_glib(ffi::adw_navigation_view_pop_to_tag(
169 self.to_glib_none().0,
170 tag.to_glib_none().0,
171 ))
172 }
173 }
174
175 #[doc(alias = "adw_navigation_view_push")]
176 pub fn push(&self, page: &impl IsA<NavigationPage>) {
177 unsafe {
178 ffi::adw_navigation_view_push(self.to_glib_none().0, page.as_ref().to_glib_none().0);
179 }
180 }
181
182 #[doc(alias = "adw_navigation_view_push_by_tag")]
183 pub fn push_by_tag(&self, tag: &str) {
184 unsafe {
185 ffi::adw_navigation_view_push_by_tag(self.to_glib_none().0, tag.to_glib_none().0);
186 }
187 }
188
189 #[doc(alias = "adw_navigation_view_remove")]
190 pub fn remove(&self, page: &impl IsA<NavigationPage>) {
191 unsafe {
192 ffi::adw_navigation_view_remove(self.to_glib_none().0, page.as_ref().to_glib_none().0);
193 }
194 }
195
196 #[doc(alias = "adw_navigation_view_replace")]
197 pub fn replace(&self, pages: &[NavigationPage]) {
198 let n_pages = pages.len() as _;
199 unsafe {
200 ffi::adw_navigation_view_replace(
201 self.to_glib_none().0,
202 pages.to_glib_none().0,
203 n_pages,
204 );
205 }
206 }
207
208 #[doc(alias = "adw_navigation_view_replace_with_tags")]
209 pub fn replace_with_tags(&self, tags: &[&str]) {
210 let n_tags = tags.len() as _;
211 unsafe {
212 ffi::adw_navigation_view_replace_with_tags(
213 self.to_glib_none().0,
214 tags.to_glib_none().0,
215 n_tags,
216 );
217 }
218 }
219
220 #[doc(alias = "adw_navigation_view_set_animate_transitions")]
221 #[doc(alias = "animate-transitions")]
222 pub fn set_animate_transitions(&self, animate_transitions: bool) {
223 unsafe {
224 ffi::adw_navigation_view_set_animate_transitions(
225 self.to_glib_none().0,
226 animate_transitions.into_glib(),
227 );
228 }
229 }
230
231 #[cfg(feature = "v1_7")]
232 #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
233 #[doc(alias = "adw_navigation_view_set_hhomogeneous")]
234 #[doc(alias = "hhomogeneous")]
235 pub fn set_hhomogeneous(&self, hhomogeneous: bool) {
236 unsafe {
237 ffi::adw_navigation_view_set_hhomogeneous(
238 self.to_glib_none().0,
239 hhomogeneous.into_glib(),
240 );
241 }
242 }
243
244 #[doc(alias = "adw_navigation_view_set_pop_on_escape")]
245 #[doc(alias = "pop-on-escape")]
246 pub fn set_pop_on_escape(&self, pop_on_escape: bool) {
247 unsafe {
248 ffi::adw_navigation_view_set_pop_on_escape(
249 self.to_glib_none().0,
250 pop_on_escape.into_glib(),
251 );
252 }
253 }
254
255 #[cfg(feature = "v1_7")]
256 #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
257 #[doc(alias = "adw_navigation_view_set_vhomogeneous")]
258 #[doc(alias = "vhomogeneous")]
259 pub fn set_vhomogeneous(&self, vhomogeneous: bool) {
260 unsafe {
261 ffi::adw_navigation_view_set_vhomogeneous(
262 self.to_glib_none().0,
263 vhomogeneous.into_glib(),
264 );
265 }
266 }
267
268 #[cfg(feature = "v1_4")]
269 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
270 #[doc(alias = "get-next-page")]
271 pub fn connect_get_next_page<F: Fn(&Self) -> Option<NavigationPage> + 'static>(
272 &self,
273 f: F,
274 ) -> SignalHandlerId {
275 unsafe extern "C" fn get_next_page_trampoline<
276 F: Fn(&NavigationView) -> Option<NavigationPage> + 'static,
277 >(
278 this: *mut ffi::AdwNavigationView,
279 f: glib::ffi::gpointer,
280 ) -> *mut ffi::AdwNavigationPage {
281 let f: &F = &*(f as *const F);
282 f(&from_glib_borrow(this)).to_glib_full()
283 }
284 unsafe {
285 let f: Box_<F> = Box_::new(f);
286 connect_raw(
287 self.as_ptr() as *mut _,
288 c"get-next-page".as_ptr() as *const _,
289 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
290 get_next_page_trampoline::<F> as *const (),
291 )),
292 Box_::into_raw(f),
293 )
294 }
295 }
296
297 #[cfg(feature = "v1_4")]
298 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
299 #[doc(alias = "popped")]
300 pub fn connect_popped<F: Fn(&Self, &NavigationPage) + 'static>(&self, f: F) -> SignalHandlerId {
301 unsafe extern "C" fn popped_trampoline<
302 F: Fn(&NavigationView, &NavigationPage) + 'static,
303 >(
304 this: *mut ffi::AdwNavigationView,
305 page: *mut ffi::AdwNavigationPage,
306 f: glib::ffi::gpointer,
307 ) {
308 let f: &F = &*(f as *const F);
309 f(&from_glib_borrow(this), &from_glib_borrow(page))
310 }
311 unsafe {
312 let f: Box_<F> = Box_::new(f);
313 connect_raw(
314 self.as_ptr() as *mut _,
315 c"popped".as_ptr() as *const _,
316 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
317 popped_trampoline::<F> as *const (),
318 )),
319 Box_::into_raw(f),
320 )
321 }
322 }
323
324 #[cfg(feature = "v1_4")]
325 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
326 #[doc(alias = "pushed")]
327 pub fn connect_pushed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
328 unsafe extern "C" fn pushed_trampoline<F: Fn(&NavigationView) + 'static>(
329 this: *mut ffi::AdwNavigationView,
330 f: glib::ffi::gpointer,
331 ) {
332 let f: &F = &*(f as *const F);
333 f(&from_glib_borrow(this))
334 }
335 unsafe {
336 let f: Box_<F> = Box_::new(f);
337 connect_raw(
338 self.as_ptr() as *mut _,
339 c"pushed".as_ptr() as *const _,
340 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
341 pushed_trampoline::<F> as *const (),
342 )),
343 Box_::into_raw(f),
344 )
345 }
346 }
347
348 #[cfg(feature = "v1_4")]
349 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
350 #[doc(alias = "replaced")]
351 pub fn connect_replaced<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
352 unsafe extern "C" fn replaced_trampoline<F: Fn(&NavigationView) + 'static>(
353 this: *mut ffi::AdwNavigationView,
354 f: glib::ffi::gpointer,
355 ) {
356 let f: &F = &*(f as *const F);
357 f(&from_glib_borrow(this))
358 }
359 unsafe {
360 let f: Box_<F> = Box_::new(f);
361 connect_raw(
362 self.as_ptr() as *mut _,
363 c"replaced".as_ptr() as *const _,
364 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
365 replaced_trampoline::<F> as *const (),
366 )),
367 Box_::into_raw(f),
368 )
369 }
370 }
371
372 #[cfg(feature = "v1_4")]
373 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
374 #[doc(alias = "animate-transitions")]
375 pub fn connect_animate_transitions_notify<F: Fn(&Self) + 'static>(
376 &self,
377 f: F,
378 ) -> SignalHandlerId {
379 unsafe extern "C" fn notify_animate_transitions_trampoline<
380 F: Fn(&NavigationView) + 'static,
381 >(
382 this: *mut ffi::AdwNavigationView,
383 _param_spec: glib::ffi::gpointer,
384 f: glib::ffi::gpointer,
385 ) {
386 let f: &F = &*(f as *const F);
387 f(&from_glib_borrow(this))
388 }
389 unsafe {
390 let f: Box_<F> = Box_::new(f);
391 connect_raw(
392 self.as_ptr() as *mut _,
393 c"notify::animate-transitions".as_ptr() as *const _,
394 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
395 notify_animate_transitions_trampoline::<F> as *const (),
396 )),
397 Box_::into_raw(f),
398 )
399 }
400 }
401
402 #[cfg(feature = "v1_7")]
403 #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
404 #[doc(alias = "hhomogeneous")]
405 pub fn connect_hhomogeneous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
406 unsafe extern "C" fn notify_hhomogeneous_trampoline<F: Fn(&NavigationView) + 'static>(
407 this: *mut ffi::AdwNavigationView,
408 _param_spec: glib::ffi::gpointer,
409 f: glib::ffi::gpointer,
410 ) {
411 let f: &F = &*(f as *const F);
412 f(&from_glib_borrow(this))
413 }
414 unsafe {
415 let f: Box_<F> = Box_::new(f);
416 connect_raw(
417 self.as_ptr() as *mut _,
418 c"notify::hhomogeneous".as_ptr() as *const _,
419 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
420 notify_hhomogeneous_trampoline::<F> as *const (),
421 )),
422 Box_::into_raw(f),
423 )
424 }
425 }
426
427 #[cfg(feature = "v1_4")]
428 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
429 #[doc(alias = "navigation-stack")]
430 pub fn connect_navigation_stack_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
431 unsafe extern "C" fn notify_navigation_stack_trampoline<
432 F: Fn(&NavigationView) + 'static,
433 >(
434 this: *mut ffi::AdwNavigationView,
435 _param_spec: glib::ffi::gpointer,
436 f: glib::ffi::gpointer,
437 ) {
438 let f: &F = &*(f as *const F);
439 f(&from_glib_borrow(this))
440 }
441 unsafe {
442 let f: Box_<F> = Box_::new(f);
443 connect_raw(
444 self.as_ptr() as *mut _,
445 c"notify::navigation-stack".as_ptr() as *const _,
446 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
447 notify_navigation_stack_trampoline::<F> as *const (),
448 )),
449 Box_::into_raw(f),
450 )
451 }
452 }
453
454 #[cfg(feature = "v1_4")]
455 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
456 #[doc(alias = "pop-on-escape")]
457 pub fn connect_pop_on_escape_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
458 unsafe extern "C" fn notify_pop_on_escape_trampoline<F: Fn(&NavigationView) + 'static>(
459 this: *mut ffi::AdwNavigationView,
460 _param_spec: glib::ffi::gpointer,
461 f: glib::ffi::gpointer,
462 ) {
463 let f: &F = &*(f as *const F);
464 f(&from_glib_borrow(this))
465 }
466 unsafe {
467 let f: Box_<F> = Box_::new(f);
468 connect_raw(
469 self.as_ptr() as *mut _,
470 c"notify::pop-on-escape".as_ptr() as *const _,
471 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
472 notify_pop_on_escape_trampoline::<F> as *const (),
473 )),
474 Box_::into_raw(f),
475 )
476 }
477 }
478
479 #[cfg(feature = "v1_7")]
480 #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
481 #[doc(alias = "vhomogeneous")]
482 pub fn connect_vhomogeneous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
483 unsafe extern "C" fn notify_vhomogeneous_trampoline<F: Fn(&NavigationView) + 'static>(
484 this: *mut ffi::AdwNavigationView,
485 _param_spec: glib::ffi::gpointer,
486 f: glib::ffi::gpointer,
487 ) {
488 let f: &F = &*(f as *const F);
489 f(&from_glib_borrow(this))
490 }
491 unsafe {
492 let f: Box_<F> = Box_::new(f);
493 connect_raw(
494 self.as_ptr() as *mut _,
495 c"notify::vhomogeneous".as_ptr() as *const _,
496 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
497 notify_vhomogeneous_trampoline::<F> as *const (),
498 )),
499 Box_::into_raw(f),
500 )
501 }
502 }
503
504 #[cfg(feature = "v1_4")]
505 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
506 #[doc(alias = "visible-page")]
507 pub fn connect_visible_page_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
508 unsafe extern "C" fn notify_visible_page_trampoline<F: Fn(&NavigationView) + 'static>(
509 this: *mut ffi::AdwNavigationView,
510 _param_spec: glib::ffi::gpointer,
511 f: glib::ffi::gpointer,
512 ) {
513 let f: &F = &*(f as *const F);
514 f(&from_glib_borrow(this))
515 }
516 unsafe {
517 let f: Box_<F> = Box_::new(f);
518 connect_raw(
519 self.as_ptr() as *mut _,
520 c"notify::visible-page".as_ptr() as *const _,
521 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
522 notify_visible_page_trampoline::<F> as *const (),
523 )),
524 Box_::into_raw(f),
525 )
526 }
527 }
528
529 #[cfg(feature = "v1_7")]
530 #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
531 #[doc(alias = "visible-page-tag")]
532 pub fn connect_visible_page_tag_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
533 unsafe extern "C" fn notify_visible_page_tag_trampoline<
534 F: Fn(&NavigationView) + 'static,
535 >(
536 this: *mut ffi::AdwNavigationView,
537 _param_spec: glib::ffi::gpointer,
538 f: glib::ffi::gpointer,
539 ) {
540 let f: &F = &*(f as *const F);
541 f(&from_glib_borrow(this))
542 }
543 unsafe {
544 let f: Box_<F> = Box_::new(f);
545 connect_raw(
546 self.as_ptr() as *mut _,
547 c"notify::visible-page-tag".as_ptr() as *const _,
548 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
549 notify_visible_page_tag_trampoline::<F> as *const (),
550 )),
551 Box_::into_raw(f),
552 )
553 }
554 }
555}
556
557#[cfg(feature = "v1_4")]
558#[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
559impl Default for NavigationView {
560 fn default() -> Self {
561 Self::new()
562 }
563}
564
565#[must_use = "The builder must be built to be used"]
570pub struct NavigationViewBuilder {
571 builder: glib::object::ObjectBuilder<'static, NavigationView>,
572}
573
574impl NavigationViewBuilder {
575 fn new() -> Self {
576 Self {
577 builder: glib::object::Object::builder(),
578 }
579 }
580
581 #[cfg(feature = "v1_4")]
582 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
583 pub fn animate_transitions(self, animate_transitions: bool) -> Self {
584 Self {
585 builder: self
586 .builder
587 .property("animate-transitions", animate_transitions),
588 }
589 }
590
591 #[cfg(feature = "v1_7")]
592 #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
593 pub fn hhomogeneous(self, hhomogeneous: bool) -> Self {
594 Self {
595 builder: self.builder.property("hhomogeneous", hhomogeneous),
596 }
597 }
598
599 #[cfg(feature = "v1_4")]
600 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
601 pub fn pop_on_escape(self, pop_on_escape: bool) -> Self {
602 Self {
603 builder: self.builder.property("pop-on-escape", pop_on_escape),
604 }
605 }
606
607 #[cfg(feature = "v1_7")]
608 #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
609 pub fn vhomogeneous(self, vhomogeneous: bool) -> Self {
610 Self {
611 builder: self.builder.property("vhomogeneous", vhomogeneous),
612 }
613 }
614
615 pub fn can_focus(self, can_focus: bool) -> Self {
616 Self {
617 builder: self.builder.property("can-focus", can_focus),
618 }
619 }
620
621 pub fn can_target(self, can_target: bool) -> Self {
622 Self {
623 builder: self.builder.property("can-target", can_target),
624 }
625 }
626
627 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
628 Self {
629 builder: self.builder.property("css-classes", css_classes.into()),
630 }
631 }
632
633 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
634 Self {
635 builder: self.builder.property("css-name", css_name.into()),
636 }
637 }
638
639 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
640 Self {
641 builder: self.builder.property("cursor", cursor.clone()),
642 }
643 }
644
645 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
646 Self {
647 builder: self.builder.property("focus-on-click", focus_on_click),
648 }
649 }
650
651 pub fn focusable(self, focusable: bool) -> Self {
652 Self {
653 builder: self.builder.property("focusable", focusable),
654 }
655 }
656
657 pub fn halign(self, halign: gtk::Align) -> Self {
658 Self {
659 builder: self.builder.property("halign", halign),
660 }
661 }
662
663 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
664 Self {
665 builder: self.builder.property("has-tooltip", has_tooltip),
666 }
667 }
668
669 pub fn height_request(self, height_request: i32) -> Self {
670 Self {
671 builder: self.builder.property("height-request", height_request),
672 }
673 }
674
675 pub fn hexpand(self, hexpand: bool) -> Self {
676 Self {
677 builder: self.builder.property("hexpand", hexpand),
678 }
679 }
680
681 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
682 Self {
683 builder: self.builder.property("hexpand-set", hexpand_set),
684 }
685 }
686
687 pub fn layout_manager(self, layout_manager: &impl IsA<gtk::LayoutManager>) -> Self {
688 Self {
689 builder: self
690 .builder
691 .property("layout-manager", layout_manager.clone().upcast()),
692 }
693 }
694
695 #[cfg(feature = "gtk_v4_18")]
696 #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))]
697 pub fn limit_events(self, limit_events: bool) -> Self {
698 Self {
699 builder: self.builder.property("limit-events", limit_events),
700 }
701 }
702
703 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
704 Self {
705 builder: self.builder.property("margin-bottom", margin_bottom),
706 }
707 }
708
709 pub fn margin_end(self, margin_end: i32) -> Self {
710 Self {
711 builder: self.builder.property("margin-end", margin_end),
712 }
713 }
714
715 pub fn margin_start(self, margin_start: i32) -> Self {
716 Self {
717 builder: self.builder.property("margin-start", margin_start),
718 }
719 }
720
721 pub fn margin_top(self, margin_top: i32) -> Self {
722 Self {
723 builder: self.builder.property("margin-top", margin_top),
724 }
725 }
726
727 pub fn name(self, name: impl Into<glib::GString>) -> Self {
728 Self {
729 builder: self.builder.property("name", name.into()),
730 }
731 }
732
733 pub fn opacity(self, opacity: f64) -> Self {
734 Self {
735 builder: self.builder.property("opacity", opacity),
736 }
737 }
738
739 pub fn overflow(self, overflow: gtk::Overflow) -> Self {
740 Self {
741 builder: self.builder.property("overflow", overflow),
742 }
743 }
744
745 pub fn receives_default(self, receives_default: bool) -> Self {
746 Self {
747 builder: self.builder.property("receives-default", receives_default),
748 }
749 }
750
751 pub fn sensitive(self, sensitive: bool) -> Self {
752 Self {
753 builder: self.builder.property("sensitive", sensitive),
754 }
755 }
756
757 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
758 Self {
759 builder: self
760 .builder
761 .property("tooltip-markup", tooltip_markup.into()),
762 }
763 }
764
765 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
766 Self {
767 builder: self.builder.property("tooltip-text", tooltip_text.into()),
768 }
769 }
770
771 pub fn valign(self, valign: gtk::Align) -> Self {
772 Self {
773 builder: self.builder.property("valign", valign),
774 }
775 }
776
777 pub fn vexpand(self, vexpand: bool) -> Self {
778 Self {
779 builder: self.builder.property("vexpand", vexpand),
780 }
781 }
782
783 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
784 Self {
785 builder: self.builder.property("vexpand-set", vexpand_set),
786 }
787 }
788
789 pub fn visible(self, visible: bool) -> Self {
790 Self {
791 builder: self.builder.property("visible", visible),
792 }
793 }
794
795 pub fn width_request(self, width_request: i32) -> Self {
796 Self {
797 builder: self.builder.property("width-request", width_request),
798 }
799 }
800
801 pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self {
802 Self {
803 builder: self.builder.property("accessible-role", accessible_role),
804 }
805 }
806
807 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
810 pub fn build(self) -> NavigationView {
811 assert_initialized_main_thread!();
812 self.builder.build()
813 }
814}