1use crate::{ffi, TabPage, TabView};
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 = "AdwTabOverview")]
17 pub struct TabOverview(Object<ffi::AdwTabOverview, ffi::AdwTabOverviewClass>) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget;
18
19 match fn {
20 type_ => || ffi::adw_tab_overview_get_type(),
21 }
22}
23
24impl TabOverview {
25 #[doc(alias = "adw_tab_overview_new")]
26 pub fn new() -> TabOverview {
27 assert_initialized_main_thread!();
28 unsafe { gtk::Widget::from_glib_none(ffi::adw_tab_overview_new()).unsafe_cast() }
29 }
30
31 pub fn builder() -> TabOverviewBuilder {
36 TabOverviewBuilder::new()
37 }
38
39 #[doc(alias = "adw_tab_overview_get_child")]
40 #[doc(alias = "get_child")]
41 pub fn child(&self) -> Option<gtk::Widget> {
42 unsafe { from_glib_none(ffi::adw_tab_overview_get_child(self.to_glib_none().0)) }
43 }
44
45 #[doc(alias = "adw_tab_overview_get_enable_new_tab")]
46 #[doc(alias = "get_enable_new_tab")]
47 #[doc(alias = "enable-new-tab")]
48 pub fn enables_new_tab(&self) -> bool {
49 unsafe {
50 from_glib(ffi::adw_tab_overview_get_enable_new_tab(
51 self.to_glib_none().0,
52 ))
53 }
54 }
55
56 #[doc(alias = "adw_tab_overview_get_enable_search")]
57 #[doc(alias = "get_enable_search")]
58 #[doc(alias = "enable-search")]
59 pub fn enables_search(&self) -> bool {
60 unsafe {
61 from_glib(ffi::adw_tab_overview_get_enable_search(
62 self.to_glib_none().0,
63 ))
64 }
65 }
66
67 #[cfg(feature = "v1_4")]
68 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
69 #[doc(alias = "adw_tab_overview_get_extra_drag_preferred_action")]
70 #[doc(alias = "get_extra_drag_preferred_action")]
71 #[doc(alias = "extra-drag-preferred-action")]
72 pub fn extra_drag_preferred_action(&self) -> gdk::DragAction {
73 unsafe {
74 from_glib(ffi::adw_tab_overview_get_extra_drag_preferred_action(
75 self.to_glib_none().0,
76 ))
77 }
78 }
79
80 #[doc(alias = "adw_tab_overview_get_extra_drag_preload")]
81 #[doc(alias = "get_extra_drag_preload")]
82 #[doc(alias = "extra-drag-preload")]
83 pub fn is_extra_drag_preload(&self) -> bool {
84 unsafe {
85 from_glib(ffi::adw_tab_overview_get_extra_drag_preload(
86 self.to_glib_none().0,
87 ))
88 }
89 }
90
91 #[doc(alias = "adw_tab_overview_get_inverted")]
92 #[doc(alias = "get_inverted")]
93 #[doc(alias = "inverted")]
94 pub fn is_inverted(&self) -> bool {
95 unsafe { from_glib(ffi::adw_tab_overview_get_inverted(self.to_glib_none().0)) }
96 }
97
98 #[doc(alias = "adw_tab_overview_get_open")]
99 #[doc(alias = "get_open")]
100 #[doc(alias = "open")]
101 pub fn is_open(&self) -> bool {
102 unsafe { from_glib(ffi::adw_tab_overview_get_open(self.to_glib_none().0)) }
103 }
104
105 #[doc(alias = "adw_tab_overview_get_search_active")]
106 #[doc(alias = "get_search_active")]
107 #[doc(alias = "search-active")]
108 pub fn is_search_active(&self) -> bool {
109 unsafe {
110 from_glib(ffi::adw_tab_overview_get_search_active(
111 self.to_glib_none().0,
112 ))
113 }
114 }
115
116 #[doc(alias = "adw_tab_overview_get_secondary_menu")]
117 #[doc(alias = "get_secondary_menu")]
118 #[doc(alias = "secondary-menu")]
119 pub fn secondary_menu(&self) -> Option<gio::MenuModel> {
120 unsafe {
121 from_glib_none(ffi::adw_tab_overview_get_secondary_menu(
122 self.to_glib_none().0,
123 ))
124 }
125 }
126
127 #[doc(alias = "adw_tab_overview_get_show_end_title_buttons")]
128 #[doc(alias = "get_show_end_title_buttons")]
129 #[doc(alias = "show-end-title-buttons")]
130 pub fn shows_end_title_buttons(&self) -> bool {
131 unsafe {
132 from_glib(ffi::adw_tab_overview_get_show_end_title_buttons(
133 self.to_glib_none().0,
134 ))
135 }
136 }
137
138 #[doc(alias = "adw_tab_overview_get_show_start_title_buttons")]
139 #[doc(alias = "get_show_start_title_buttons")]
140 #[doc(alias = "show-start-title-buttons")]
141 pub fn shows_start_title_buttons(&self) -> bool {
142 unsafe {
143 from_glib(ffi::adw_tab_overview_get_show_start_title_buttons(
144 self.to_glib_none().0,
145 ))
146 }
147 }
148
149 #[doc(alias = "adw_tab_overview_get_view")]
150 #[doc(alias = "get_view")]
151 pub fn view(&self) -> Option<TabView> {
152 unsafe { from_glib_none(ffi::adw_tab_overview_get_view(self.to_glib_none().0)) }
153 }
154
155 #[doc(alias = "adw_tab_overview_set_child")]
156 #[doc(alias = "child")]
157 pub fn set_child(&self, child: Option<&impl IsA<gtk::Widget>>) {
158 unsafe {
159 ffi::adw_tab_overview_set_child(
160 self.to_glib_none().0,
161 child.map(|p| p.as_ref()).to_glib_none().0,
162 );
163 }
164 }
165
166 #[doc(alias = "adw_tab_overview_set_enable_new_tab")]
167 #[doc(alias = "enable-new-tab")]
168 pub fn set_enable_new_tab(&self, enable_new_tab: bool) {
169 unsafe {
170 ffi::adw_tab_overview_set_enable_new_tab(
171 self.to_glib_none().0,
172 enable_new_tab.into_glib(),
173 );
174 }
175 }
176
177 #[doc(alias = "adw_tab_overview_set_enable_search")]
178 #[doc(alias = "enable-search")]
179 pub fn set_enable_search(&self, enable_search: bool) {
180 unsafe {
181 ffi::adw_tab_overview_set_enable_search(
182 self.to_glib_none().0,
183 enable_search.into_glib(),
184 );
185 }
186 }
187
188 #[doc(alias = "adw_tab_overview_set_extra_drag_preload")]
189 #[doc(alias = "extra-drag-preload")]
190 pub fn set_extra_drag_preload(&self, preload: bool) {
191 unsafe {
192 ffi::adw_tab_overview_set_extra_drag_preload(
193 self.to_glib_none().0,
194 preload.into_glib(),
195 );
196 }
197 }
198
199 #[doc(alias = "adw_tab_overview_set_inverted")]
200 #[doc(alias = "inverted")]
201 pub fn set_inverted(&self, inverted: bool) {
202 unsafe {
203 ffi::adw_tab_overview_set_inverted(self.to_glib_none().0, inverted.into_glib());
204 }
205 }
206
207 #[doc(alias = "adw_tab_overview_set_open")]
208 #[doc(alias = "open")]
209 pub fn set_open(&self, open: bool) {
210 unsafe {
211 ffi::adw_tab_overview_set_open(self.to_glib_none().0, open.into_glib());
212 }
213 }
214
215 #[doc(alias = "adw_tab_overview_set_secondary_menu")]
216 #[doc(alias = "secondary-menu")]
217 pub fn set_secondary_menu(&self, secondary_menu: Option<&impl IsA<gio::MenuModel>>) {
218 unsafe {
219 ffi::adw_tab_overview_set_secondary_menu(
220 self.to_glib_none().0,
221 secondary_menu.map(|p| p.as_ref()).to_glib_none().0,
222 );
223 }
224 }
225
226 #[doc(alias = "adw_tab_overview_set_show_end_title_buttons")]
227 #[doc(alias = "show-end-title-buttons")]
228 pub fn set_show_end_title_buttons(&self, show_end_title_buttons: bool) {
229 unsafe {
230 ffi::adw_tab_overview_set_show_end_title_buttons(
231 self.to_glib_none().0,
232 show_end_title_buttons.into_glib(),
233 );
234 }
235 }
236
237 #[doc(alias = "adw_tab_overview_set_show_start_title_buttons")]
238 #[doc(alias = "show-start-title-buttons")]
239 pub fn set_show_start_title_buttons(&self, show_start_title_buttons: bool) {
240 unsafe {
241 ffi::adw_tab_overview_set_show_start_title_buttons(
242 self.to_glib_none().0,
243 show_start_title_buttons.into_glib(),
244 );
245 }
246 }
247
248 #[doc(alias = "adw_tab_overview_set_view")]
249 #[doc(alias = "view")]
250 pub fn set_view(&self, view: Option<&TabView>) {
251 unsafe {
252 ffi::adw_tab_overview_set_view(self.to_glib_none().0, view.to_glib_none().0);
253 }
254 }
255
256 #[cfg(feature = "v1_3")]
257 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
258 #[doc(alias = "create-tab")]
259 pub fn connect_create_tab<F: Fn(&Self) -> TabPage + 'static>(&self, f: F) -> SignalHandlerId {
260 unsafe extern "C" fn create_tab_trampoline<F: Fn(&TabOverview) -> TabPage + 'static>(
261 this: *mut ffi::AdwTabOverview,
262 f: glib::ffi::gpointer,
263 ) -> *mut ffi::AdwTabPage {
264 let f: &F = &*(f as *const F);
265 f(&from_glib_borrow(this)) .to_glib_none()
267 .0
268 }
269 unsafe {
270 let f: Box_<F> = Box_::new(f);
271 connect_raw(
272 self.as_ptr() as *mut _,
273 c"create-tab".as_ptr() as *const _,
274 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
275 create_tab_trampoline::<F> as *const (),
276 )),
277 Box_::into_raw(f),
278 )
279 }
280 }
281
282 #[cfg(feature = "v1_3")]
283 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
284 #[doc(alias = "extra-drag-drop")]
285 pub fn connect_extra_drag_drop<F: Fn(&Self, &TabPage, &glib::Value) -> bool + 'static>(
286 &self,
287 f: F,
288 ) -> SignalHandlerId {
289 unsafe extern "C" fn extra_drag_drop_trampoline<
290 F: Fn(&TabOverview, &TabPage, &glib::Value) -> bool + 'static,
291 >(
292 this: *mut ffi::AdwTabOverview,
293 page: *mut ffi::AdwTabPage,
294 value: *mut glib::gobject_ffi::GValue,
295 f: glib::ffi::gpointer,
296 ) -> glib::ffi::gboolean {
297 let f: &F = &*(f as *const F);
298 f(
299 &from_glib_borrow(this),
300 &from_glib_borrow(page),
301 &from_glib_borrow(value),
302 )
303 .into_glib()
304 }
305 unsafe {
306 let f: Box_<F> = Box_::new(f);
307 connect_raw(
308 self.as_ptr() as *mut _,
309 c"extra-drag-drop".as_ptr() as *const _,
310 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
311 extra_drag_drop_trampoline::<F> as *const (),
312 )),
313 Box_::into_raw(f),
314 )
315 }
316 }
317
318 #[cfg(feature = "v1_3")]
319 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
320 #[doc(alias = "extra-drag-value")]
321 pub fn connect_extra_drag_value<
322 F: Fn(&Self, &TabPage, &glib::Value) -> gdk::DragAction + 'static,
323 >(
324 &self,
325 f: F,
326 ) -> SignalHandlerId {
327 unsafe extern "C" fn extra_drag_value_trampoline<
328 F: Fn(&TabOverview, &TabPage, &glib::Value) -> gdk::DragAction + 'static,
329 >(
330 this: *mut ffi::AdwTabOverview,
331 page: *mut ffi::AdwTabPage,
332 value: *mut glib::gobject_ffi::GValue,
333 f: glib::ffi::gpointer,
334 ) -> gdk::ffi::GdkDragAction {
335 let f: &F = &*(f as *const F);
336 f(
337 &from_glib_borrow(this),
338 &from_glib_borrow(page),
339 &from_glib_borrow(value),
340 )
341 .into_glib()
342 }
343 unsafe {
344 let f: Box_<F> = Box_::new(f);
345 connect_raw(
346 self.as_ptr() as *mut _,
347 c"extra-drag-value".as_ptr() as *const _,
348 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
349 extra_drag_value_trampoline::<F> as *const (),
350 )),
351 Box_::into_raw(f),
352 )
353 }
354 }
355
356 #[cfg(feature = "v1_3")]
357 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
358 #[doc(alias = "child")]
359 pub fn connect_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
360 unsafe extern "C" fn notify_child_trampoline<F: Fn(&TabOverview) + 'static>(
361 this: *mut ffi::AdwTabOverview,
362 _param_spec: glib::ffi::gpointer,
363 f: glib::ffi::gpointer,
364 ) {
365 let f: &F = &*(f as *const F);
366 f(&from_glib_borrow(this))
367 }
368 unsafe {
369 let f: Box_<F> = Box_::new(f);
370 connect_raw(
371 self.as_ptr() as *mut _,
372 c"notify::child".as_ptr() as *const _,
373 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
374 notify_child_trampoline::<F> as *const (),
375 )),
376 Box_::into_raw(f),
377 )
378 }
379 }
380
381 #[cfg(feature = "v1_3")]
382 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
383 #[doc(alias = "enable-new-tab")]
384 pub fn connect_enable_new_tab_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
385 unsafe extern "C" fn notify_enable_new_tab_trampoline<F: Fn(&TabOverview) + 'static>(
386 this: *mut ffi::AdwTabOverview,
387 _param_spec: glib::ffi::gpointer,
388 f: glib::ffi::gpointer,
389 ) {
390 let f: &F = &*(f as *const F);
391 f(&from_glib_borrow(this))
392 }
393 unsafe {
394 let f: Box_<F> = Box_::new(f);
395 connect_raw(
396 self.as_ptr() as *mut _,
397 c"notify::enable-new-tab".as_ptr() as *const _,
398 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
399 notify_enable_new_tab_trampoline::<F> as *const (),
400 )),
401 Box_::into_raw(f),
402 )
403 }
404 }
405
406 #[cfg(feature = "v1_3")]
407 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
408 #[doc(alias = "enable-search")]
409 pub fn connect_enable_search_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
410 unsafe extern "C" fn notify_enable_search_trampoline<F: Fn(&TabOverview) + 'static>(
411 this: *mut ffi::AdwTabOverview,
412 _param_spec: glib::ffi::gpointer,
413 f: glib::ffi::gpointer,
414 ) {
415 let f: &F = &*(f as *const F);
416 f(&from_glib_borrow(this))
417 }
418 unsafe {
419 let f: Box_<F> = Box_::new(f);
420 connect_raw(
421 self.as_ptr() as *mut _,
422 c"notify::enable-search".as_ptr() as *const _,
423 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
424 notify_enable_search_trampoline::<F> as *const (),
425 )),
426 Box_::into_raw(f),
427 )
428 }
429 }
430
431 #[cfg(feature = "v1_4")]
432 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
433 #[doc(alias = "extra-drag-preferred-action")]
434 pub fn connect_extra_drag_preferred_action_notify<F: Fn(&Self) + 'static>(
435 &self,
436 f: F,
437 ) -> SignalHandlerId {
438 unsafe extern "C" fn notify_extra_drag_preferred_action_trampoline<
439 F: Fn(&TabOverview) + 'static,
440 >(
441 this: *mut ffi::AdwTabOverview,
442 _param_spec: glib::ffi::gpointer,
443 f: glib::ffi::gpointer,
444 ) {
445 let f: &F = &*(f as *const F);
446 f(&from_glib_borrow(this))
447 }
448 unsafe {
449 let f: Box_<F> = Box_::new(f);
450 connect_raw(
451 self.as_ptr() as *mut _,
452 c"notify::extra-drag-preferred-action".as_ptr() as *const _,
453 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
454 notify_extra_drag_preferred_action_trampoline::<F> as *const (),
455 )),
456 Box_::into_raw(f),
457 )
458 }
459 }
460
461 #[cfg(feature = "v1_3")]
462 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
463 #[doc(alias = "extra-drag-preload")]
464 pub fn connect_extra_drag_preload_notify<F: Fn(&Self) + 'static>(
465 &self,
466 f: F,
467 ) -> SignalHandlerId {
468 unsafe extern "C" fn notify_extra_drag_preload_trampoline<F: Fn(&TabOverview) + 'static>(
469 this: *mut ffi::AdwTabOverview,
470 _param_spec: glib::ffi::gpointer,
471 f: glib::ffi::gpointer,
472 ) {
473 let f: &F = &*(f as *const F);
474 f(&from_glib_borrow(this))
475 }
476 unsafe {
477 let f: Box_<F> = Box_::new(f);
478 connect_raw(
479 self.as_ptr() as *mut _,
480 c"notify::extra-drag-preload".as_ptr() as *const _,
481 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
482 notify_extra_drag_preload_trampoline::<F> as *const (),
483 )),
484 Box_::into_raw(f),
485 )
486 }
487 }
488
489 #[cfg(feature = "v1_3")]
490 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
491 #[doc(alias = "inverted")]
492 pub fn connect_inverted_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
493 unsafe extern "C" fn notify_inverted_trampoline<F: Fn(&TabOverview) + 'static>(
494 this: *mut ffi::AdwTabOverview,
495 _param_spec: glib::ffi::gpointer,
496 f: glib::ffi::gpointer,
497 ) {
498 let f: &F = &*(f as *const F);
499 f(&from_glib_borrow(this))
500 }
501 unsafe {
502 let f: Box_<F> = Box_::new(f);
503 connect_raw(
504 self.as_ptr() as *mut _,
505 c"notify::inverted".as_ptr() as *const _,
506 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
507 notify_inverted_trampoline::<F> as *const (),
508 )),
509 Box_::into_raw(f),
510 )
511 }
512 }
513
514 #[cfg(feature = "v1_3")]
515 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
516 #[doc(alias = "open")]
517 pub fn connect_open_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
518 unsafe extern "C" fn notify_open_trampoline<F: Fn(&TabOverview) + 'static>(
519 this: *mut ffi::AdwTabOverview,
520 _param_spec: glib::ffi::gpointer,
521 f: glib::ffi::gpointer,
522 ) {
523 let f: &F = &*(f as *const F);
524 f(&from_glib_borrow(this))
525 }
526 unsafe {
527 let f: Box_<F> = Box_::new(f);
528 connect_raw(
529 self.as_ptr() as *mut _,
530 c"notify::open".as_ptr() as *const _,
531 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
532 notify_open_trampoline::<F> as *const (),
533 )),
534 Box_::into_raw(f),
535 )
536 }
537 }
538
539 #[cfg(feature = "v1_3")]
540 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
541 #[doc(alias = "search-active")]
542 pub fn connect_search_active_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
543 unsafe extern "C" fn notify_search_active_trampoline<F: Fn(&TabOverview) + 'static>(
544 this: *mut ffi::AdwTabOverview,
545 _param_spec: glib::ffi::gpointer,
546 f: glib::ffi::gpointer,
547 ) {
548 let f: &F = &*(f as *const F);
549 f(&from_glib_borrow(this))
550 }
551 unsafe {
552 let f: Box_<F> = Box_::new(f);
553 connect_raw(
554 self.as_ptr() as *mut _,
555 c"notify::search-active".as_ptr() as *const _,
556 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
557 notify_search_active_trampoline::<F> as *const (),
558 )),
559 Box_::into_raw(f),
560 )
561 }
562 }
563
564 #[cfg(feature = "v1_3")]
565 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
566 #[doc(alias = "secondary-menu")]
567 pub fn connect_secondary_menu_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
568 unsafe extern "C" fn notify_secondary_menu_trampoline<F: Fn(&TabOverview) + 'static>(
569 this: *mut ffi::AdwTabOverview,
570 _param_spec: glib::ffi::gpointer,
571 f: glib::ffi::gpointer,
572 ) {
573 let f: &F = &*(f as *const F);
574 f(&from_glib_borrow(this))
575 }
576 unsafe {
577 let f: Box_<F> = Box_::new(f);
578 connect_raw(
579 self.as_ptr() as *mut _,
580 c"notify::secondary-menu".as_ptr() as *const _,
581 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
582 notify_secondary_menu_trampoline::<F> as *const (),
583 )),
584 Box_::into_raw(f),
585 )
586 }
587 }
588
589 #[cfg(feature = "v1_3")]
590 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
591 #[doc(alias = "show-end-title-buttons")]
592 pub fn connect_show_end_title_buttons_notify<F: Fn(&Self) + 'static>(
593 &self,
594 f: F,
595 ) -> SignalHandlerId {
596 unsafe extern "C" fn notify_show_end_title_buttons_trampoline<
597 F: Fn(&TabOverview) + 'static,
598 >(
599 this: *mut ffi::AdwTabOverview,
600 _param_spec: glib::ffi::gpointer,
601 f: glib::ffi::gpointer,
602 ) {
603 let f: &F = &*(f as *const F);
604 f(&from_glib_borrow(this))
605 }
606 unsafe {
607 let f: Box_<F> = Box_::new(f);
608 connect_raw(
609 self.as_ptr() as *mut _,
610 c"notify::show-end-title-buttons".as_ptr() as *const _,
611 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
612 notify_show_end_title_buttons_trampoline::<F> as *const (),
613 )),
614 Box_::into_raw(f),
615 )
616 }
617 }
618
619 #[cfg(feature = "v1_3")]
620 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
621 #[doc(alias = "show-start-title-buttons")]
622 pub fn connect_show_start_title_buttons_notify<F: Fn(&Self) + 'static>(
623 &self,
624 f: F,
625 ) -> SignalHandlerId {
626 unsafe extern "C" fn notify_show_start_title_buttons_trampoline<
627 F: Fn(&TabOverview) + 'static,
628 >(
629 this: *mut ffi::AdwTabOverview,
630 _param_spec: glib::ffi::gpointer,
631 f: glib::ffi::gpointer,
632 ) {
633 let f: &F = &*(f as *const F);
634 f(&from_glib_borrow(this))
635 }
636 unsafe {
637 let f: Box_<F> = Box_::new(f);
638 connect_raw(
639 self.as_ptr() as *mut _,
640 c"notify::show-start-title-buttons".as_ptr() as *const _,
641 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
642 notify_show_start_title_buttons_trampoline::<F> as *const (),
643 )),
644 Box_::into_raw(f),
645 )
646 }
647 }
648
649 #[cfg(feature = "v1_3")]
650 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
651 #[doc(alias = "view")]
652 pub fn connect_view_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
653 unsafe extern "C" fn notify_view_trampoline<F: Fn(&TabOverview) + 'static>(
654 this: *mut ffi::AdwTabOverview,
655 _param_spec: glib::ffi::gpointer,
656 f: glib::ffi::gpointer,
657 ) {
658 let f: &F = &*(f as *const F);
659 f(&from_glib_borrow(this))
660 }
661 unsafe {
662 let f: Box_<F> = Box_::new(f);
663 connect_raw(
664 self.as_ptr() as *mut _,
665 c"notify::view".as_ptr() as *const _,
666 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
667 notify_view_trampoline::<F> as *const (),
668 )),
669 Box_::into_raw(f),
670 )
671 }
672 }
673}
674
675#[cfg(feature = "v1_3")]
676#[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
677impl Default for TabOverview {
678 fn default() -> Self {
679 Self::new()
680 }
681}
682
683#[must_use = "The builder must be built to be used"]
688pub struct TabOverviewBuilder {
689 builder: glib::object::ObjectBuilder<'static, TabOverview>,
690}
691
692impl TabOverviewBuilder {
693 fn new() -> Self {
694 Self {
695 builder: glib::object::Object::builder(),
696 }
697 }
698
699 #[cfg(feature = "v1_3")]
700 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
701 pub fn child(self, child: &impl IsA<gtk::Widget>) -> Self {
702 Self {
703 builder: self.builder.property("child", child.clone().upcast()),
704 }
705 }
706
707 #[cfg(feature = "v1_3")]
708 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
709 pub fn enable_new_tab(self, enable_new_tab: bool) -> Self {
710 Self {
711 builder: self.builder.property("enable-new-tab", enable_new_tab),
712 }
713 }
714
715 #[cfg(feature = "v1_3")]
716 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
717 pub fn enable_search(self, enable_search: bool) -> Self {
718 Self {
719 builder: self.builder.property("enable-search", enable_search),
720 }
721 }
722
723 #[cfg(feature = "v1_3")]
724 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
725 pub fn extra_drag_preload(self, extra_drag_preload: bool) -> Self {
726 Self {
727 builder: self
728 .builder
729 .property("extra-drag-preload", extra_drag_preload),
730 }
731 }
732
733 #[cfg(feature = "v1_3")]
734 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
735 pub fn inverted(self, inverted: bool) -> Self {
736 Self {
737 builder: self.builder.property("inverted", inverted),
738 }
739 }
740
741 #[cfg(feature = "v1_3")]
742 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
743 pub fn open(self, open: bool) -> Self {
744 Self {
745 builder: self.builder.property("open", open),
746 }
747 }
748
749 #[cfg(feature = "v1_3")]
750 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
751 pub fn secondary_menu(self, secondary_menu: &impl IsA<gio::MenuModel>) -> Self {
752 Self {
753 builder: self
754 .builder
755 .property("secondary-menu", secondary_menu.clone().upcast()),
756 }
757 }
758
759 #[cfg(feature = "v1_3")]
760 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
761 pub fn show_end_title_buttons(self, show_end_title_buttons: bool) -> Self {
762 Self {
763 builder: self
764 .builder
765 .property("show-end-title-buttons", show_end_title_buttons),
766 }
767 }
768
769 #[cfg(feature = "v1_3")]
770 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
771 pub fn show_start_title_buttons(self, show_start_title_buttons: bool) -> Self {
772 Self {
773 builder: self
774 .builder
775 .property("show-start-title-buttons", show_start_title_buttons),
776 }
777 }
778
779 #[cfg(feature = "v1_3")]
780 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
781 pub fn view(self, view: &TabView) -> Self {
782 Self {
783 builder: self.builder.property("view", view.clone()),
784 }
785 }
786
787 pub fn can_focus(self, can_focus: bool) -> Self {
788 Self {
789 builder: self.builder.property("can-focus", can_focus),
790 }
791 }
792
793 pub fn can_target(self, can_target: bool) -> Self {
794 Self {
795 builder: self.builder.property("can-target", can_target),
796 }
797 }
798
799 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
800 Self {
801 builder: self.builder.property("css-classes", css_classes.into()),
802 }
803 }
804
805 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
806 Self {
807 builder: self.builder.property("css-name", css_name.into()),
808 }
809 }
810
811 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
812 Self {
813 builder: self.builder.property("cursor", cursor.clone()),
814 }
815 }
816
817 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
818 Self {
819 builder: self.builder.property("focus-on-click", focus_on_click),
820 }
821 }
822
823 pub fn focusable(self, focusable: bool) -> Self {
824 Self {
825 builder: self.builder.property("focusable", focusable),
826 }
827 }
828
829 pub fn halign(self, halign: gtk::Align) -> Self {
830 Self {
831 builder: self.builder.property("halign", halign),
832 }
833 }
834
835 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
836 Self {
837 builder: self.builder.property("has-tooltip", has_tooltip),
838 }
839 }
840
841 pub fn height_request(self, height_request: i32) -> Self {
842 Self {
843 builder: self.builder.property("height-request", height_request),
844 }
845 }
846
847 pub fn hexpand(self, hexpand: bool) -> Self {
848 Self {
849 builder: self.builder.property("hexpand", hexpand),
850 }
851 }
852
853 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
854 Self {
855 builder: self.builder.property("hexpand-set", hexpand_set),
856 }
857 }
858
859 pub fn layout_manager(self, layout_manager: &impl IsA<gtk::LayoutManager>) -> Self {
860 Self {
861 builder: self
862 .builder
863 .property("layout-manager", layout_manager.clone().upcast()),
864 }
865 }
866
867 #[cfg(feature = "gtk_v4_18")]
868 #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))]
869 pub fn limit_events(self, limit_events: bool) -> Self {
870 Self {
871 builder: self.builder.property("limit-events", limit_events),
872 }
873 }
874
875 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
876 Self {
877 builder: self.builder.property("margin-bottom", margin_bottom),
878 }
879 }
880
881 pub fn margin_end(self, margin_end: i32) -> Self {
882 Self {
883 builder: self.builder.property("margin-end", margin_end),
884 }
885 }
886
887 pub fn margin_start(self, margin_start: i32) -> Self {
888 Self {
889 builder: self.builder.property("margin-start", margin_start),
890 }
891 }
892
893 pub fn margin_top(self, margin_top: i32) -> Self {
894 Self {
895 builder: self.builder.property("margin-top", margin_top),
896 }
897 }
898
899 pub fn name(self, name: impl Into<glib::GString>) -> Self {
900 Self {
901 builder: self.builder.property("name", name.into()),
902 }
903 }
904
905 pub fn opacity(self, opacity: f64) -> Self {
906 Self {
907 builder: self.builder.property("opacity", opacity),
908 }
909 }
910
911 pub fn overflow(self, overflow: gtk::Overflow) -> Self {
912 Self {
913 builder: self.builder.property("overflow", overflow),
914 }
915 }
916
917 pub fn receives_default(self, receives_default: bool) -> Self {
918 Self {
919 builder: self.builder.property("receives-default", receives_default),
920 }
921 }
922
923 pub fn sensitive(self, sensitive: bool) -> Self {
924 Self {
925 builder: self.builder.property("sensitive", sensitive),
926 }
927 }
928
929 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
930 Self {
931 builder: self
932 .builder
933 .property("tooltip-markup", tooltip_markup.into()),
934 }
935 }
936
937 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
938 Self {
939 builder: self.builder.property("tooltip-text", tooltip_text.into()),
940 }
941 }
942
943 pub fn valign(self, valign: gtk::Align) -> Self {
944 Self {
945 builder: self.builder.property("valign", valign),
946 }
947 }
948
949 pub fn vexpand(self, vexpand: bool) -> Self {
950 Self {
951 builder: self.builder.property("vexpand", vexpand),
952 }
953 }
954
955 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
956 Self {
957 builder: self.builder.property("vexpand-set", vexpand_set),
958 }
959 }
960
961 pub fn visible(self, visible: bool) -> Self {
962 Self {
963 builder: self.builder.property("visible", visible),
964 }
965 }
966
967 pub fn width_request(self, width_request: i32) -> Self {
968 Self {
969 builder: self.builder.property("width-request", width_request),
970 }
971 }
972
973 pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self {
974 Self {
975 builder: self.builder.property("accessible-role", accessible_role),
976 }
977 }
978
979 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
982 pub fn build(self) -> TabOverview {
983 assert_initialized_main_thread!();
984 self.builder.build()
985 }
986}