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, Option<&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, Option<&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 Option::<glib::Value>::from_glib_borrow(value)
340 .as_ref()
341 .as_ref(),
342 )
343 .into_glib()
344 }
345 unsafe {
346 let f: Box_<F> = Box_::new(f);
347 connect_raw(
348 self.as_ptr() as *mut _,
349 c"extra-drag-value".as_ptr() as *const _,
350 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
351 extra_drag_value_trampoline::<F> as *const (),
352 )),
353 Box_::into_raw(f),
354 )
355 }
356 }
357
358 #[cfg(feature = "v1_3")]
359 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
360 #[doc(alias = "child")]
361 pub fn connect_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
362 unsafe extern "C" fn notify_child_trampoline<F: Fn(&TabOverview) + 'static>(
363 this: *mut ffi::AdwTabOverview,
364 _param_spec: glib::ffi::gpointer,
365 f: glib::ffi::gpointer,
366 ) {
367 let f: &F = &*(f as *const F);
368 f(&from_glib_borrow(this))
369 }
370 unsafe {
371 let f: Box_<F> = Box_::new(f);
372 connect_raw(
373 self.as_ptr() as *mut _,
374 c"notify::child".as_ptr() as *const _,
375 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
376 notify_child_trampoline::<F> as *const (),
377 )),
378 Box_::into_raw(f),
379 )
380 }
381 }
382
383 #[cfg(feature = "v1_3")]
384 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
385 #[doc(alias = "enable-new-tab")]
386 pub fn connect_enable_new_tab_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
387 unsafe extern "C" fn notify_enable_new_tab_trampoline<F: Fn(&TabOverview) + 'static>(
388 this: *mut ffi::AdwTabOverview,
389 _param_spec: glib::ffi::gpointer,
390 f: glib::ffi::gpointer,
391 ) {
392 let f: &F = &*(f as *const F);
393 f(&from_glib_borrow(this))
394 }
395 unsafe {
396 let f: Box_<F> = Box_::new(f);
397 connect_raw(
398 self.as_ptr() as *mut _,
399 c"notify::enable-new-tab".as_ptr() as *const _,
400 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
401 notify_enable_new_tab_trampoline::<F> as *const (),
402 )),
403 Box_::into_raw(f),
404 )
405 }
406 }
407
408 #[cfg(feature = "v1_3")]
409 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
410 #[doc(alias = "enable-search")]
411 pub fn connect_enable_search_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
412 unsafe extern "C" fn notify_enable_search_trampoline<F: Fn(&TabOverview) + 'static>(
413 this: *mut ffi::AdwTabOverview,
414 _param_spec: glib::ffi::gpointer,
415 f: glib::ffi::gpointer,
416 ) {
417 let f: &F = &*(f as *const F);
418 f(&from_glib_borrow(this))
419 }
420 unsafe {
421 let f: Box_<F> = Box_::new(f);
422 connect_raw(
423 self.as_ptr() as *mut _,
424 c"notify::enable-search".as_ptr() as *const _,
425 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
426 notify_enable_search_trampoline::<F> as *const (),
427 )),
428 Box_::into_raw(f),
429 )
430 }
431 }
432
433 #[cfg(feature = "v1_4")]
434 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
435 #[doc(alias = "extra-drag-preferred-action")]
436 pub fn connect_extra_drag_preferred_action_notify<F: Fn(&Self) + 'static>(
437 &self,
438 f: F,
439 ) -> SignalHandlerId {
440 unsafe extern "C" fn notify_extra_drag_preferred_action_trampoline<
441 F: Fn(&TabOverview) + 'static,
442 >(
443 this: *mut ffi::AdwTabOverview,
444 _param_spec: glib::ffi::gpointer,
445 f: glib::ffi::gpointer,
446 ) {
447 let f: &F = &*(f as *const F);
448 f(&from_glib_borrow(this))
449 }
450 unsafe {
451 let f: Box_<F> = Box_::new(f);
452 connect_raw(
453 self.as_ptr() as *mut _,
454 c"notify::extra-drag-preferred-action".as_ptr() as *const _,
455 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
456 notify_extra_drag_preferred_action_trampoline::<F> as *const (),
457 )),
458 Box_::into_raw(f),
459 )
460 }
461 }
462
463 #[cfg(feature = "v1_3")]
464 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
465 #[doc(alias = "extra-drag-preload")]
466 pub fn connect_extra_drag_preload_notify<F: Fn(&Self) + 'static>(
467 &self,
468 f: F,
469 ) -> SignalHandlerId {
470 unsafe extern "C" fn notify_extra_drag_preload_trampoline<F: Fn(&TabOverview) + 'static>(
471 this: *mut ffi::AdwTabOverview,
472 _param_spec: glib::ffi::gpointer,
473 f: glib::ffi::gpointer,
474 ) {
475 let f: &F = &*(f as *const F);
476 f(&from_glib_borrow(this))
477 }
478 unsafe {
479 let f: Box_<F> = Box_::new(f);
480 connect_raw(
481 self.as_ptr() as *mut _,
482 c"notify::extra-drag-preload".as_ptr() as *const _,
483 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
484 notify_extra_drag_preload_trampoline::<F> as *const (),
485 )),
486 Box_::into_raw(f),
487 )
488 }
489 }
490
491 #[cfg(feature = "v1_3")]
492 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
493 #[doc(alias = "inverted")]
494 pub fn connect_inverted_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
495 unsafe extern "C" fn notify_inverted_trampoline<F: Fn(&TabOverview) + 'static>(
496 this: *mut ffi::AdwTabOverview,
497 _param_spec: glib::ffi::gpointer,
498 f: glib::ffi::gpointer,
499 ) {
500 let f: &F = &*(f as *const F);
501 f(&from_glib_borrow(this))
502 }
503 unsafe {
504 let f: Box_<F> = Box_::new(f);
505 connect_raw(
506 self.as_ptr() as *mut _,
507 c"notify::inverted".as_ptr() as *const _,
508 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
509 notify_inverted_trampoline::<F> as *const (),
510 )),
511 Box_::into_raw(f),
512 )
513 }
514 }
515
516 #[cfg(feature = "v1_3")]
517 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
518 #[doc(alias = "open")]
519 pub fn connect_open_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
520 unsafe extern "C" fn notify_open_trampoline<F: Fn(&TabOverview) + 'static>(
521 this: *mut ffi::AdwTabOverview,
522 _param_spec: glib::ffi::gpointer,
523 f: glib::ffi::gpointer,
524 ) {
525 let f: &F = &*(f as *const F);
526 f(&from_glib_borrow(this))
527 }
528 unsafe {
529 let f: Box_<F> = Box_::new(f);
530 connect_raw(
531 self.as_ptr() as *mut _,
532 c"notify::open".as_ptr() as *const _,
533 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
534 notify_open_trampoline::<F> as *const (),
535 )),
536 Box_::into_raw(f),
537 )
538 }
539 }
540
541 #[cfg(feature = "v1_3")]
542 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
543 #[doc(alias = "search-active")]
544 pub fn connect_search_active_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
545 unsafe extern "C" fn notify_search_active_trampoline<F: Fn(&TabOverview) + 'static>(
546 this: *mut ffi::AdwTabOverview,
547 _param_spec: glib::ffi::gpointer,
548 f: glib::ffi::gpointer,
549 ) {
550 let f: &F = &*(f as *const F);
551 f(&from_glib_borrow(this))
552 }
553 unsafe {
554 let f: Box_<F> = Box_::new(f);
555 connect_raw(
556 self.as_ptr() as *mut _,
557 c"notify::search-active".as_ptr() as *const _,
558 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
559 notify_search_active_trampoline::<F> as *const (),
560 )),
561 Box_::into_raw(f),
562 )
563 }
564 }
565
566 #[cfg(feature = "v1_3")]
567 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
568 #[doc(alias = "secondary-menu")]
569 pub fn connect_secondary_menu_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
570 unsafe extern "C" fn notify_secondary_menu_trampoline<F: Fn(&TabOverview) + 'static>(
571 this: *mut ffi::AdwTabOverview,
572 _param_spec: glib::ffi::gpointer,
573 f: glib::ffi::gpointer,
574 ) {
575 let f: &F = &*(f as *const F);
576 f(&from_glib_borrow(this))
577 }
578 unsafe {
579 let f: Box_<F> = Box_::new(f);
580 connect_raw(
581 self.as_ptr() as *mut _,
582 c"notify::secondary-menu".as_ptr() as *const _,
583 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
584 notify_secondary_menu_trampoline::<F> as *const (),
585 )),
586 Box_::into_raw(f),
587 )
588 }
589 }
590
591 #[cfg(feature = "v1_3")]
592 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
593 #[doc(alias = "show-end-title-buttons")]
594 pub fn connect_show_end_title_buttons_notify<F: Fn(&Self) + 'static>(
595 &self,
596 f: F,
597 ) -> SignalHandlerId {
598 unsafe extern "C" fn notify_show_end_title_buttons_trampoline<
599 F: Fn(&TabOverview) + 'static,
600 >(
601 this: *mut ffi::AdwTabOverview,
602 _param_spec: glib::ffi::gpointer,
603 f: glib::ffi::gpointer,
604 ) {
605 let f: &F = &*(f as *const F);
606 f(&from_glib_borrow(this))
607 }
608 unsafe {
609 let f: Box_<F> = Box_::new(f);
610 connect_raw(
611 self.as_ptr() as *mut _,
612 c"notify::show-end-title-buttons".as_ptr() as *const _,
613 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
614 notify_show_end_title_buttons_trampoline::<F> as *const (),
615 )),
616 Box_::into_raw(f),
617 )
618 }
619 }
620
621 #[cfg(feature = "v1_3")]
622 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
623 #[doc(alias = "show-start-title-buttons")]
624 pub fn connect_show_start_title_buttons_notify<F: Fn(&Self) + 'static>(
625 &self,
626 f: F,
627 ) -> SignalHandlerId {
628 unsafe extern "C" fn notify_show_start_title_buttons_trampoline<
629 F: Fn(&TabOverview) + 'static,
630 >(
631 this: *mut ffi::AdwTabOverview,
632 _param_spec: glib::ffi::gpointer,
633 f: glib::ffi::gpointer,
634 ) {
635 let f: &F = &*(f as *const F);
636 f(&from_glib_borrow(this))
637 }
638 unsafe {
639 let f: Box_<F> = Box_::new(f);
640 connect_raw(
641 self.as_ptr() as *mut _,
642 c"notify::show-start-title-buttons".as_ptr() as *const _,
643 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
644 notify_show_start_title_buttons_trampoline::<F> as *const (),
645 )),
646 Box_::into_raw(f),
647 )
648 }
649 }
650
651 #[cfg(feature = "v1_3")]
652 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
653 #[doc(alias = "view")]
654 pub fn connect_view_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
655 unsafe extern "C" fn notify_view_trampoline<F: Fn(&TabOverview) + 'static>(
656 this: *mut ffi::AdwTabOverview,
657 _param_spec: glib::ffi::gpointer,
658 f: glib::ffi::gpointer,
659 ) {
660 let f: &F = &*(f as *const F);
661 f(&from_glib_borrow(this))
662 }
663 unsafe {
664 let f: Box_<F> = Box_::new(f);
665 connect_raw(
666 self.as_ptr() as *mut _,
667 c"notify::view".as_ptr() as *const _,
668 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
669 notify_view_trampoline::<F> as *const (),
670 )),
671 Box_::into_raw(f),
672 )
673 }
674 }
675}
676
677#[cfg(feature = "v1_3")]
678#[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
679impl Default for TabOverview {
680 fn default() -> Self {
681 Self::new()
682 }
683}
684
685#[must_use = "The builder must be built to be used"]
690pub struct TabOverviewBuilder {
691 builder: glib::object::ObjectBuilder<'static, TabOverview>,
692}
693
694impl TabOverviewBuilder {
695 fn new() -> Self {
696 Self {
697 builder: glib::object::Object::builder(),
698 }
699 }
700
701 #[cfg(feature = "v1_3")]
702 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
703 pub fn child(self, child: &impl IsA<gtk::Widget>) -> Self {
704 Self {
705 builder: self.builder.property("child", child.clone().upcast()),
706 }
707 }
708
709 #[cfg(feature = "v1_3")]
710 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
711 pub fn enable_new_tab(self, enable_new_tab: bool) -> Self {
712 Self {
713 builder: self.builder.property("enable-new-tab", enable_new_tab),
714 }
715 }
716
717 #[cfg(feature = "v1_3")]
718 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
719 pub fn enable_search(self, enable_search: bool) -> Self {
720 Self {
721 builder: self.builder.property("enable-search", enable_search),
722 }
723 }
724
725 #[cfg(feature = "v1_3")]
726 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
727 pub fn extra_drag_preload(self, extra_drag_preload: bool) -> Self {
728 Self {
729 builder: self
730 .builder
731 .property("extra-drag-preload", extra_drag_preload),
732 }
733 }
734
735 #[cfg(feature = "v1_3")]
736 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
737 pub fn inverted(self, inverted: bool) -> Self {
738 Self {
739 builder: self.builder.property("inverted", inverted),
740 }
741 }
742
743 #[cfg(feature = "v1_3")]
744 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
745 pub fn open(self, open: bool) -> Self {
746 Self {
747 builder: self.builder.property("open", open),
748 }
749 }
750
751 #[cfg(feature = "v1_3")]
752 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
753 pub fn secondary_menu(self, secondary_menu: &impl IsA<gio::MenuModel>) -> Self {
754 Self {
755 builder: self
756 .builder
757 .property("secondary-menu", secondary_menu.clone().upcast()),
758 }
759 }
760
761 #[cfg(feature = "v1_3")]
762 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
763 pub fn show_end_title_buttons(self, show_end_title_buttons: bool) -> Self {
764 Self {
765 builder: self
766 .builder
767 .property("show-end-title-buttons", show_end_title_buttons),
768 }
769 }
770
771 #[cfg(feature = "v1_3")]
772 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
773 pub fn show_start_title_buttons(self, show_start_title_buttons: bool) -> Self {
774 Self {
775 builder: self
776 .builder
777 .property("show-start-title-buttons", show_start_title_buttons),
778 }
779 }
780
781 #[cfg(feature = "v1_3")]
782 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
783 pub fn view(self, view: &TabView) -> Self {
784 Self {
785 builder: self.builder.property("view", view.clone()),
786 }
787 }
788
789 pub fn can_focus(self, can_focus: bool) -> Self {
790 Self {
791 builder: self.builder.property("can-focus", can_focus),
792 }
793 }
794
795 pub fn can_target(self, can_target: bool) -> Self {
796 Self {
797 builder: self.builder.property("can-target", can_target),
798 }
799 }
800
801 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
802 Self {
803 builder: self.builder.property("css-classes", css_classes.into()),
804 }
805 }
806
807 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
808 Self {
809 builder: self.builder.property("css-name", css_name.into()),
810 }
811 }
812
813 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
814 Self {
815 builder: self.builder.property("cursor", cursor.clone()),
816 }
817 }
818
819 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
820 Self {
821 builder: self.builder.property("focus-on-click", focus_on_click),
822 }
823 }
824
825 pub fn focusable(self, focusable: bool) -> Self {
826 Self {
827 builder: self.builder.property("focusable", focusable),
828 }
829 }
830
831 pub fn halign(self, halign: gtk::Align) -> Self {
832 Self {
833 builder: self.builder.property("halign", halign),
834 }
835 }
836
837 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
838 Self {
839 builder: self.builder.property("has-tooltip", has_tooltip),
840 }
841 }
842
843 pub fn height_request(self, height_request: i32) -> Self {
844 Self {
845 builder: self.builder.property("height-request", height_request),
846 }
847 }
848
849 pub fn hexpand(self, hexpand: bool) -> Self {
850 Self {
851 builder: self.builder.property("hexpand", hexpand),
852 }
853 }
854
855 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
856 Self {
857 builder: self.builder.property("hexpand-set", hexpand_set),
858 }
859 }
860
861 pub fn layout_manager(self, layout_manager: &impl IsA<gtk::LayoutManager>) -> Self {
862 Self {
863 builder: self
864 .builder
865 .property("layout-manager", layout_manager.clone().upcast()),
866 }
867 }
868
869 #[cfg(feature = "gtk_v4_18")]
870 #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))]
871 pub fn limit_events(self, limit_events: bool) -> Self {
872 Self {
873 builder: self.builder.property("limit-events", limit_events),
874 }
875 }
876
877 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
878 Self {
879 builder: self.builder.property("margin-bottom", margin_bottom),
880 }
881 }
882
883 pub fn margin_end(self, margin_end: i32) -> Self {
884 Self {
885 builder: self.builder.property("margin-end", margin_end),
886 }
887 }
888
889 pub fn margin_start(self, margin_start: i32) -> Self {
890 Self {
891 builder: self.builder.property("margin-start", margin_start),
892 }
893 }
894
895 pub fn margin_top(self, margin_top: i32) -> Self {
896 Self {
897 builder: self.builder.property("margin-top", margin_top),
898 }
899 }
900
901 pub fn name(self, name: impl Into<glib::GString>) -> Self {
902 Self {
903 builder: self.builder.property("name", name.into()),
904 }
905 }
906
907 pub fn opacity(self, opacity: f64) -> Self {
908 Self {
909 builder: self.builder.property("opacity", opacity),
910 }
911 }
912
913 pub fn overflow(self, overflow: gtk::Overflow) -> Self {
914 Self {
915 builder: self.builder.property("overflow", overflow),
916 }
917 }
918
919 pub fn receives_default(self, receives_default: bool) -> Self {
920 Self {
921 builder: self.builder.property("receives-default", receives_default),
922 }
923 }
924
925 pub fn sensitive(self, sensitive: bool) -> Self {
926 Self {
927 builder: self.builder.property("sensitive", sensitive),
928 }
929 }
930
931 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
932 Self {
933 builder: self
934 .builder
935 .property("tooltip-markup", tooltip_markup.into()),
936 }
937 }
938
939 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
940 Self {
941 builder: self.builder.property("tooltip-text", tooltip_text.into()),
942 }
943 }
944
945 pub fn valign(self, valign: gtk::Align) -> Self {
946 Self {
947 builder: self.builder.property("valign", valign),
948 }
949 }
950
951 pub fn vexpand(self, vexpand: bool) -> Self {
952 Self {
953 builder: self.builder.property("vexpand", vexpand),
954 }
955 }
956
957 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
958 Self {
959 builder: self.builder.property("vexpand-set", vexpand_set),
960 }
961 }
962
963 pub fn visible(self, visible: bool) -> Self {
964 Self {
965 builder: self.builder.property("visible", visible),
966 }
967 }
968
969 pub fn width_request(self, width_request: i32) -> Self {
970 Self {
971 builder: self.builder.property("width-request", width_request),
972 }
973 }
974
975 pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self {
976 Self {
977 builder: self.builder.property("accessible-role", accessible_role),
978 }
979 }
980
981 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
984 pub fn build(self) -> TabOverview {
985 assert_initialized_main_thread!();
986 self.builder.build()
987 }
988}