gtk/auto/
notebook.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::{
6    Align, Buildable, Container, DirectionType, NotebookTab, PackType, PositionType, ResizeMode,
7    Widget,
8};
9use glib::{
10    prelude::*,
11    signal::{connect_raw, SignalHandlerId},
12    translate::*,
13};
14use std::{boxed::Box as Box_, fmt, mem::transmute};
15
16glib::wrapper! {
17    #[doc(alias = "GtkNotebook")]
18    pub struct Notebook(Object<ffi::GtkNotebook, ffi::GtkNotebookClass>) @extends Container, Widget, @implements Buildable;
19
20    match fn {
21        type_ => || ffi::gtk_notebook_get_type(),
22    }
23}
24
25impl Notebook {
26    pub const NONE: Option<&'static Notebook> = None;
27
28    #[doc(alias = "gtk_notebook_new")]
29    pub fn new() -> Notebook {
30        assert_initialized_main_thread!();
31        unsafe { Widget::from_glib_none(ffi::gtk_notebook_new()).unsafe_cast() }
32    }
33
34    // rustdoc-stripper-ignore-next
35    /// Creates a new builder-pattern struct instance to construct [`Notebook`] objects.
36    ///
37    /// This method returns an instance of [`NotebookBuilder`](crate::builders::NotebookBuilder) which can be used to create [`Notebook`] objects.
38    pub fn builder() -> NotebookBuilder {
39        NotebookBuilder::new()
40    }
41}
42
43impl Default for Notebook {
44    fn default() -> Self {
45        Self::new()
46    }
47}
48
49// rustdoc-stripper-ignore-next
50/// A [builder-pattern] type to construct [`Notebook`] objects.
51///
52/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
53#[must_use = "The builder must be built to be used"]
54pub struct NotebookBuilder {
55    builder: glib::object::ObjectBuilder<'static, Notebook>,
56}
57
58impl NotebookBuilder {
59    fn new() -> Self {
60        Self {
61            builder: glib::object::Object::builder(),
62        }
63    }
64
65    pub fn enable_popup(self, enable_popup: bool) -> Self {
66        Self {
67            builder: self.builder.property("enable-popup", enable_popup),
68        }
69    }
70
71    pub fn group_name(self, group_name: impl Into<glib::GString>) -> Self {
72        Self {
73            builder: self.builder.property("group-name", group_name.into()),
74        }
75    }
76
77    pub fn page(self, page: i32) -> Self {
78        Self {
79            builder: self.builder.property("page", page),
80        }
81    }
82
83    pub fn scrollable(self, scrollable: bool) -> Self {
84        Self {
85            builder: self.builder.property("scrollable", scrollable),
86        }
87    }
88
89    pub fn show_border(self, show_border: bool) -> Self {
90        Self {
91            builder: self.builder.property("show-border", show_border),
92        }
93    }
94
95    pub fn show_tabs(self, show_tabs: bool) -> Self {
96        Self {
97            builder: self.builder.property("show-tabs", show_tabs),
98        }
99    }
100
101    pub fn tab_pos(self, tab_pos: PositionType) -> Self {
102        Self {
103            builder: self.builder.property("tab-pos", tab_pos),
104        }
105    }
106
107    pub fn border_width(self, border_width: u32) -> Self {
108        Self {
109            builder: self.builder.property("border-width", border_width),
110        }
111    }
112
113    pub fn child(self, child: &impl IsA<Widget>) -> Self {
114        Self {
115            builder: self.builder.property("child", child.clone().upcast()),
116        }
117    }
118
119    pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
120        Self {
121            builder: self.builder.property("resize-mode", resize_mode),
122        }
123    }
124
125    pub fn app_paintable(self, app_paintable: bool) -> Self {
126        Self {
127            builder: self.builder.property("app-paintable", app_paintable),
128        }
129    }
130
131    pub fn can_default(self, can_default: bool) -> Self {
132        Self {
133            builder: self.builder.property("can-default", can_default),
134        }
135    }
136
137    pub fn can_focus(self, can_focus: bool) -> Self {
138        Self {
139            builder: self.builder.property("can-focus", can_focus),
140        }
141    }
142
143    pub fn events(self, events: gdk::EventMask) -> Self {
144        Self {
145            builder: self.builder.property("events", events),
146        }
147    }
148
149    pub fn expand(self, expand: bool) -> Self {
150        Self {
151            builder: self.builder.property("expand", expand),
152        }
153    }
154
155    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
156        Self {
157            builder: self.builder.property("focus-on-click", focus_on_click),
158        }
159    }
160
161    pub fn halign(self, halign: Align) -> Self {
162        Self {
163            builder: self.builder.property("halign", halign),
164        }
165    }
166
167    pub fn has_default(self, has_default: bool) -> Self {
168        Self {
169            builder: self.builder.property("has-default", has_default),
170        }
171    }
172
173    pub fn has_focus(self, has_focus: bool) -> Self {
174        Self {
175            builder: self.builder.property("has-focus", has_focus),
176        }
177    }
178
179    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
180        Self {
181            builder: self.builder.property("has-tooltip", has_tooltip),
182        }
183    }
184
185    pub fn height_request(self, height_request: i32) -> Self {
186        Self {
187            builder: self.builder.property("height-request", height_request),
188        }
189    }
190
191    pub fn hexpand(self, hexpand: bool) -> Self {
192        Self {
193            builder: self.builder.property("hexpand", hexpand),
194        }
195    }
196
197    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
198        Self {
199            builder: self.builder.property("hexpand-set", hexpand_set),
200        }
201    }
202
203    pub fn is_focus(self, is_focus: bool) -> Self {
204        Self {
205            builder: self.builder.property("is-focus", is_focus),
206        }
207    }
208
209    pub fn margin(self, margin: i32) -> Self {
210        Self {
211            builder: self.builder.property("margin", margin),
212        }
213    }
214
215    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
216        Self {
217            builder: self.builder.property("margin-bottom", margin_bottom),
218        }
219    }
220
221    pub fn margin_end(self, margin_end: i32) -> Self {
222        Self {
223            builder: self.builder.property("margin-end", margin_end),
224        }
225    }
226
227    pub fn margin_start(self, margin_start: i32) -> Self {
228        Self {
229            builder: self.builder.property("margin-start", margin_start),
230        }
231    }
232
233    pub fn margin_top(self, margin_top: i32) -> Self {
234        Self {
235            builder: self.builder.property("margin-top", margin_top),
236        }
237    }
238
239    pub fn name(self, name: impl Into<glib::GString>) -> Self {
240        Self {
241            builder: self.builder.property("name", name.into()),
242        }
243    }
244
245    pub fn no_show_all(self, no_show_all: bool) -> Self {
246        Self {
247            builder: self.builder.property("no-show-all", no_show_all),
248        }
249    }
250
251    pub fn opacity(self, opacity: f64) -> Self {
252        Self {
253            builder: self.builder.property("opacity", opacity),
254        }
255    }
256
257    pub fn parent(self, parent: &impl IsA<Container>) -> Self {
258        Self {
259            builder: self.builder.property("parent", parent.clone().upcast()),
260        }
261    }
262
263    pub fn receives_default(self, receives_default: bool) -> Self {
264        Self {
265            builder: self.builder.property("receives-default", receives_default),
266        }
267    }
268
269    pub fn sensitive(self, sensitive: bool) -> Self {
270        Self {
271            builder: self.builder.property("sensitive", sensitive),
272        }
273    }
274
275    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
276        Self {
277            builder: self
278                .builder
279                .property("tooltip-markup", tooltip_markup.into()),
280        }
281    }
282
283    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
284        Self {
285            builder: self.builder.property("tooltip-text", tooltip_text.into()),
286        }
287    }
288
289    pub fn valign(self, valign: Align) -> Self {
290        Self {
291            builder: self.builder.property("valign", valign),
292        }
293    }
294
295    pub fn vexpand(self, vexpand: bool) -> Self {
296        Self {
297            builder: self.builder.property("vexpand", vexpand),
298        }
299    }
300
301    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
302        Self {
303            builder: self.builder.property("vexpand-set", vexpand_set),
304        }
305    }
306
307    pub fn visible(self, visible: bool) -> Self {
308        Self {
309            builder: self.builder.property("visible", visible),
310        }
311    }
312
313    pub fn width_request(self, width_request: i32) -> Self {
314        Self {
315            builder: self.builder.property("width-request", width_request),
316        }
317    }
318
319    // rustdoc-stripper-ignore-next
320    /// Build the [`Notebook`].
321    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
322    pub fn build(self) -> Notebook {
323        self.builder.build()
324    }
325}
326
327mod sealed {
328    pub trait Sealed {}
329    impl<T: super::IsA<super::Notebook>> Sealed for T {}
330}
331
332pub trait NotebookExt: IsA<Notebook> + sealed::Sealed + 'static {
333    #[doc(alias = "gtk_notebook_detach_tab")]
334    fn detach_tab(&self, child: &impl IsA<Widget>) {
335        unsafe {
336            ffi::gtk_notebook_detach_tab(
337                self.as_ref().to_glib_none().0,
338                child.as_ref().to_glib_none().0,
339            );
340        }
341    }
342
343    #[doc(alias = "gtk_notebook_get_action_widget")]
344    #[doc(alias = "get_action_widget")]
345    fn action_widget(&self, pack_type: PackType) -> Option<Widget> {
346        unsafe {
347            from_glib_none(ffi::gtk_notebook_get_action_widget(
348                self.as_ref().to_glib_none().0,
349                pack_type.into_glib(),
350            ))
351        }
352    }
353
354    #[doc(alias = "gtk_notebook_get_group_name")]
355    #[doc(alias = "get_group_name")]
356    fn group_name(&self) -> Option<glib::GString> {
357        unsafe {
358            from_glib_none(ffi::gtk_notebook_get_group_name(
359                self.as_ref().to_glib_none().0,
360            ))
361        }
362    }
363
364    #[doc(alias = "gtk_notebook_get_menu_label")]
365    #[doc(alias = "get_menu_label")]
366    fn menu_label(&self, child: &impl IsA<Widget>) -> Option<Widget> {
367        unsafe {
368            from_glib_none(ffi::gtk_notebook_get_menu_label(
369                self.as_ref().to_glib_none().0,
370                child.as_ref().to_glib_none().0,
371            ))
372        }
373    }
374
375    #[doc(alias = "gtk_notebook_get_menu_label_text")]
376    #[doc(alias = "get_menu_label_text")]
377    fn menu_label_text(&self, child: &impl IsA<Widget>) -> Option<glib::GString> {
378        unsafe {
379            from_glib_none(ffi::gtk_notebook_get_menu_label_text(
380                self.as_ref().to_glib_none().0,
381                child.as_ref().to_glib_none().0,
382            ))
383        }
384    }
385
386    #[doc(alias = "gtk_notebook_get_scrollable")]
387    #[doc(alias = "get_scrollable")]
388    fn is_scrollable(&self) -> bool {
389        unsafe {
390            from_glib(ffi::gtk_notebook_get_scrollable(
391                self.as_ref().to_glib_none().0,
392            ))
393        }
394    }
395
396    #[doc(alias = "gtk_notebook_get_show_border")]
397    #[doc(alias = "get_show_border")]
398    fn shows_border(&self) -> bool {
399        unsafe {
400            from_glib(ffi::gtk_notebook_get_show_border(
401                self.as_ref().to_glib_none().0,
402            ))
403        }
404    }
405
406    #[doc(alias = "gtk_notebook_get_show_tabs")]
407    #[doc(alias = "get_show_tabs")]
408    fn shows_tabs(&self) -> bool {
409        unsafe {
410            from_glib(ffi::gtk_notebook_get_show_tabs(
411                self.as_ref().to_glib_none().0,
412            ))
413        }
414    }
415
416    #[doc(alias = "gtk_notebook_get_tab_detachable")]
417    #[doc(alias = "get_tab_detachable")]
418    fn tab_is_detachable(&self, child: &impl IsA<Widget>) -> bool {
419        unsafe {
420            from_glib(ffi::gtk_notebook_get_tab_detachable(
421                self.as_ref().to_glib_none().0,
422                child.as_ref().to_glib_none().0,
423            ))
424        }
425    }
426
427    #[doc(alias = "gtk_notebook_get_tab_label")]
428    #[doc(alias = "get_tab_label")]
429    fn tab_label(&self, child: &impl IsA<Widget>) -> Option<Widget> {
430        unsafe {
431            from_glib_none(ffi::gtk_notebook_get_tab_label(
432                self.as_ref().to_glib_none().0,
433                child.as_ref().to_glib_none().0,
434            ))
435        }
436    }
437
438    #[doc(alias = "gtk_notebook_get_tab_label_text")]
439    #[doc(alias = "get_tab_label_text")]
440    fn tab_label_text(&self, child: &impl IsA<Widget>) -> Option<glib::GString> {
441        unsafe {
442            from_glib_none(ffi::gtk_notebook_get_tab_label_text(
443                self.as_ref().to_glib_none().0,
444                child.as_ref().to_glib_none().0,
445            ))
446        }
447    }
448
449    #[doc(alias = "gtk_notebook_get_tab_pos")]
450    #[doc(alias = "get_tab_pos")]
451    fn tab_pos(&self) -> PositionType {
452        unsafe {
453            from_glib(ffi::gtk_notebook_get_tab_pos(
454                self.as_ref().to_glib_none().0,
455            ))
456        }
457    }
458
459    #[doc(alias = "gtk_notebook_get_tab_reorderable")]
460    #[doc(alias = "get_tab_reorderable")]
461    fn tab_is_reorderable(&self, child: &impl IsA<Widget>) -> bool {
462        unsafe {
463            from_glib(ffi::gtk_notebook_get_tab_reorderable(
464                self.as_ref().to_glib_none().0,
465                child.as_ref().to_glib_none().0,
466            ))
467        }
468    }
469
470    #[doc(alias = "gtk_notebook_next_page")]
471    fn next_page(&self) {
472        unsafe {
473            ffi::gtk_notebook_next_page(self.as_ref().to_glib_none().0);
474        }
475    }
476
477    #[doc(alias = "gtk_notebook_popup_disable")]
478    fn popup_disable(&self) {
479        unsafe {
480            ffi::gtk_notebook_popup_disable(self.as_ref().to_glib_none().0);
481        }
482    }
483
484    #[doc(alias = "gtk_notebook_popup_enable")]
485    fn popup_enable(&self) {
486        unsafe {
487            ffi::gtk_notebook_popup_enable(self.as_ref().to_glib_none().0);
488        }
489    }
490
491    #[doc(alias = "gtk_notebook_prev_page")]
492    fn prev_page(&self) {
493        unsafe {
494            ffi::gtk_notebook_prev_page(self.as_ref().to_glib_none().0);
495        }
496    }
497
498    #[doc(alias = "gtk_notebook_set_action_widget")]
499    fn set_action_widget(&self, widget: &impl IsA<Widget>, pack_type: PackType) {
500        unsafe {
501            ffi::gtk_notebook_set_action_widget(
502                self.as_ref().to_glib_none().0,
503                widget.as_ref().to_glib_none().0,
504                pack_type.into_glib(),
505            );
506        }
507    }
508
509    #[doc(alias = "gtk_notebook_set_group_name")]
510    fn set_group_name(&self, group_name: Option<&str>) {
511        unsafe {
512            ffi::gtk_notebook_set_group_name(
513                self.as_ref().to_glib_none().0,
514                group_name.to_glib_none().0,
515            );
516        }
517    }
518
519    #[doc(alias = "gtk_notebook_set_menu_label")]
520    fn set_menu_label(&self, child: &impl IsA<Widget>, menu_label: Option<&impl IsA<Widget>>) {
521        unsafe {
522            ffi::gtk_notebook_set_menu_label(
523                self.as_ref().to_glib_none().0,
524                child.as_ref().to_glib_none().0,
525                menu_label.map(|p| p.as_ref()).to_glib_none().0,
526            );
527        }
528    }
529
530    #[doc(alias = "gtk_notebook_set_menu_label_text")]
531    fn set_menu_label_text(&self, child: &impl IsA<Widget>, menu_text: &str) {
532        unsafe {
533            ffi::gtk_notebook_set_menu_label_text(
534                self.as_ref().to_glib_none().0,
535                child.as_ref().to_glib_none().0,
536                menu_text.to_glib_none().0,
537            );
538        }
539    }
540
541    #[doc(alias = "gtk_notebook_set_scrollable")]
542    fn set_scrollable(&self, scrollable: bool) {
543        unsafe {
544            ffi::gtk_notebook_set_scrollable(
545                self.as_ref().to_glib_none().0,
546                scrollable.into_glib(),
547            );
548        }
549    }
550
551    #[doc(alias = "gtk_notebook_set_show_border")]
552    fn set_show_border(&self, show_border: bool) {
553        unsafe {
554            ffi::gtk_notebook_set_show_border(
555                self.as_ref().to_glib_none().0,
556                show_border.into_glib(),
557            );
558        }
559    }
560
561    #[doc(alias = "gtk_notebook_set_show_tabs")]
562    fn set_show_tabs(&self, show_tabs: bool) {
563        unsafe {
564            ffi::gtk_notebook_set_show_tabs(self.as_ref().to_glib_none().0, show_tabs.into_glib());
565        }
566    }
567
568    #[doc(alias = "gtk_notebook_set_tab_detachable")]
569    fn set_tab_detachable(&self, child: &impl IsA<Widget>, detachable: bool) {
570        unsafe {
571            ffi::gtk_notebook_set_tab_detachable(
572                self.as_ref().to_glib_none().0,
573                child.as_ref().to_glib_none().0,
574                detachable.into_glib(),
575            );
576        }
577    }
578
579    #[doc(alias = "gtk_notebook_set_tab_label")]
580    fn set_tab_label(&self, child: &impl IsA<Widget>, tab_label: Option<&impl IsA<Widget>>) {
581        unsafe {
582            ffi::gtk_notebook_set_tab_label(
583                self.as_ref().to_glib_none().0,
584                child.as_ref().to_glib_none().0,
585                tab_label.map(|p| p.as_ref()).to_glib_none().0,
586            );
587        }
588    }
589
590    #[doc(alias = "gtk_notebook_set_tab_label_text")]
591    fn set_tab_label_text(&self, child: &impl IsA<Widget>, tab_text: &str) {
592        unsafe {
593            ffi::gtk_notebook_set_tab_label_text(
594                self.as_ref().to_glib_none().0,
595                child.as_ref().to_glib_none().0,
596                tab_text.to_glib_none().0,
597            );
598        }
599    }
600
601    #[doc(alias = "gtk_notebook_set_tab_pos")]
602    fn set_tab_pos(&self, pos: PositionType) {
603        unsafe {
604            ffi::gtk_notebook_set_tab_pos(self.as_ref().to_glib_none().0, pos.into_glib());
605        }
606    }
607
608    #[doc(alias = "gtk_notebook_set_tab_reorderable")]
609    fn set_tab_reorderable(&self, child: &impl IsA<Widget>, reorderable: bool) {
610        unsafe {
611            ffi::gtk_notebook_set_tab_reorderable(
612                self.as_ref().to_glib_none().0,
613                child.as_ref().to_glib_none().0,
614                reorderable.into_glib(),
615            );
616        }
617    }
618
619    #[doc(alias = "enable-popup")]
620    fn enables_popup(&self) -> bool {
621        ObjectExt::property(self.as_ref(), "enable-popup")
622    }
623
624    #[doc(alias = "enable-popup")]
625    fn set_enable_popup(&self, enable_popup: bool) {
626        ObjectExt::set_property(self.as_ref(), "enable-popup", enable_popup)
627    }
628
629    fn page(&self) -> i32 {
630        ObjectExt::property(self.as_ref(), "page")
631    }
632
633    fn set_page(&self, page: i32) {
634        ObjectExt::set_property(self.as_ref(), "page", page)
635    }
636
637    fn child_is_detachable<T: IsA<crate::Widget>>(&self, item: &T) -> bool {
638        crate::prelude::ContainerExtManual::child_property(
639            self.as_ref(),
640            &item.clone().upcast(),
641            "detachable",
642        )
643    }
644
645    fn set_child_detachable<T: IsA<crate::Widget>>(&self, item: &T, detachable: bool) {
646        crate::prelude::ContainerExtManual::child_set_property(
647            self.as_ref(),
648            &item.clone().upcast(),
649            "detachable",
650            &detachable,
651        )
652    }
653
654    #[doc(alias = "child.menu-label")]
655    fn child_menu_label<T: IsA<crate::Widget>>(&self, item: &T) -> Option<glib::GString> {
656        crate::prelude::ContainerExtManual::child_property(
657            self.as_ref(),
658            &item.clone().upcast(),
659            "menu-label",
660        )
661    }
662
663    #[doc(alias = "child.menu-label")]
664    fn set_child_menu_label<T: IsA<crate::Widget>>(&self, item: &T, menu_label: Option<&str>) {
665        crate::prelude::ContainerExtManual::child_set_property(
666            self.as_ref(),
667            &item.clone().upcast(),
668            "menu-label",
669            &menu_label,
670        )
671    }
672
673    fn child_position<T: IsA<crate::Widget>>(&self, item: &T) -> i32 {
674        crate::prelude::ContainerExtManual::child_property(
675            self.as_ref(),
676            &item.clone().upcast(),
677            "position",
678        )
679    }
680
681    fn set_child_position<T: IsA<crate::Widget>>(&self, item: &T, position: i32) {
682        crate::prelude::ContainerExtManual::child_set_property(
683            self.as_ref(),
684            &item.clone().upcast(),
685            "position",
686            &position,
687        )
688    }
689
690    fn child_is_reorderable<T: IsA<crate::Widget>>(&self, item: &T) -> bool {
691        crate::prelude::ContainerExtManual::child_property(
692            self.as_ref(),
693            &item.clone().upcast(),
694            "reorderable",
695        )
696    }
697
698    fn set_child_reorderable<T: IsA<crate::Widget>>(&self, item: &T, reorderable: bool) {
699        crate::prelude::ContainerExtManual::child_set_property(
700            self.as_ref(),
701            &item.clone().upcast(),
702            "reorderable",
703            &reorderable,
704        )
705    }
706
707    #[doc(alias = "child.tab-expand")]
708    fn child_tab_expands<T: IsA<crate::Widget>>(&self, item: &T) -> bool {
709        crate::prelude::ContainerExtManual::child_property(
710            self.as_ref(),
711            &item.clone().upcast(),
712            "tab-expand",
713        )
714    }
715
716    #[doc(alias = "child.tab-expand")]
717    fn set_child_tab_expand<T: IsA<crate::Widget>>(&self, item: &T, tab_expand: bool) {
718        crate::prelude::ContainerExtManual::child_set_property(
719            self.as_ref(),
720            &item.clone().upcast(),
721            "tab-expand",
722            &tab_expand,
723        )
724    }
725
726    #[doc(alias = "child.tab-fill")]
727    fn child_tab_fills<T: IsA<crate::Widget>>(&self, item: &T) -> bool {
728        crate::prelude::ContainerExtManual::child_property(
729            self.as_ref(),
730            &item.clone().upcast(),
731            "tab-fill",
732        )
733    }
734
735    #[doc(alias = "child.tab-fill")]
736    fn set_child_tab_fill<T: IsA<crate::Widget>>(&self, item: &T, tab_fill: bool) {
737        crate::prelude::ContainerExtManual::child_set_property(
738            self.as_ref(),
739            &item.clone().upcast(),
740            "tab-fill",
741            &tab_fill,
742        )
743    }
744
745    #[doc(alias = "child.tab-label")]
746    fn child_tab_label<T: IsA<crate::Widget>>(&self, item: &T) -> Option<glib::GString> {
747        crate::prelude::ContainerExtManual::child_property(
748            self.as_ref(),
749            &item.clone().upcast(),
750            "tab-label",
751        )
752    }
753
754    #[doc(alias = "child.tab-label")]
755    fn set_child_tab_label<T: IsA<crate::Widget>>(&self, item: &T, tab_label: Option<&str>) {
756        crate::prelude::ContainerExtManual::child_set_property(
757            self.as_ref(),
758            &item.clone().upcast(),
759            "tab-label",
760            &tab_label,
761        )
762    }
763
764    #[doc(alias = "change-current-page")]
765    fn connect_change_current_page<F: Fn(&Self, i32) -> bool + 'static>(
766        &self,
767        f: F,
768    ) -> SignalHandlerId {
769        unsafe extern "C" fn change_current_page_trampoline<
770            P: IsA<Notebook>,
771            F: Fn(&P, i32) -> bool + 'static,
772        >(
773            this: *mut ffi::GtkNotebook,
774            object: libc::c_int,
775            f: glib::ffi::gpointer,
776        ) -> glib::ffi::gboolean {
777            let f: &F = &*(f as *const F);
778            f(Notebook::from_glib_borrow(this).unsafe_cast_ref(), object).into_glib()
779        }
780        unsafe {
781            let f: Box_<F> = Box_::new(f);
782            connect_raw(
783                self.as_ptr() as *mut _,
784                b"change-current-page\0".as_ptr() as *const _,
785                Some(transmute::<_, unsafe extern "C" fn()>(
786                    change_current_page_trampoline::<Self, F> as *const (),
787                )),
788                Box_::into_raw(f),
789            )
790        }
791    }
792
793    fn emit_change_current_page(&self, object: i32) -> bool {
794        self.emit_by_name("change-current-page", &[&object])
795    }
796
797    #[doc(alias = "create-window")]
798    fn connect_create_window<F: Fn(&Self, &Widget, i32, i32) -> Notebook + 'static>(
799        &self,
800        f: F,
801    ) -> SignalHandlerId {
802        unsafe extern "C" fn create_window_trampoline<
803            P: IsA<Notebook>,
804            F: Fn(&P, &Widget, i32, i32) -> Notebook + 'static,
805        >(
806            this: *mut ffi::GtkNotebook,
807            page: *mut ffi::GtkWidget,
808            x: libc::c_int,
809            y: libc::c_int,
810            f: glib::ffi::gpointer,
811        ) -> *mut ffi::GtkNotebook {
812            let f: &F = &*(f as *const F);
813            f(
814                Notebook::from_glib_borrow(this).unsafe_cast_ref(),
815                &from_glib_borrow(page),
816                x,
817                y,
818            ) /*Not checked*/
819            .to_glib_none()
820            .0
821        }
822        unsafe {
823            let f: Box_<F> = Box_::new(f);
824            connect_raw(
825                self.as_ptr() as *mut _,
826                b"create-window\0".as_ptr() as *const _,
827                Some(transmute::<_, unsafe extern "C" fn()>(
828                    create_window_trampoline::<Self, F> as *const (),
829                )),
830                Box_::into_raw(f),
831            )
832        }
833    }
834
835    #[doc(alias = "focus-tab")]
836    fn connect_focus_tab<F: Fn(&Self, NotebookTab) -> bool + 'static>(
837        &self,
838        f: F,
839    ) -> SignalHandlerId {
840        unsafe extern "C" fn focus_tab_trampoline<
841            P: IsA<Notebook>,
842            F: Fn(&P, NotebookTab) -> bool + 'static,
843        >(
844            this: *mut ffi::GtkNotebook,
845            object: ffi::GtkNotebookTab,
846            f: glib::ffi::gpointer,
847        ) -> glib::ffi::gboolean {
848            let f: &F = &*(f as *const F);
849            f(
850                Notebook::from_glib_borrow(this).unsafe_cast_ref(),
851                from_glib(object),
852            )
853            .into_glib()
854        }
855        unsafe {
856            let f: Box_<F> = Box_::new(f);
857            connect_raw(
858                self.as_ptr() as *mut _,
859                b"focus-tab\0".as_ptr() as *const _,
860                Some(transmute::<_, unsafe extern "C" fn()>(
861                    focus_tab_trampoline::<Self, F> as *const (),
862                )),
863                Box_::into_raw(f),
864            )
865        }
866    }
867
868    fn emit_focus_tab(&self, object: NotebookTab) -> bool {
869        self.emit_by_name("focus-tab", &[&object])
870    }
871
872    #[doc(alias = "move-focus-out")]
873    fn connect_move_focus_out<F: Fn(&Self, DirectionType) + 'static>(
874        &self,
875        f: F,
876    ) -> SignalHandlerId {
877        unsafe extern "C" fn move_focus_out_trampoline<
878            P: IsA<Notebook>,
879            F: Fn(&P, DirectionType) + 'static,
880        >(
881            this: *mut ffi::GtkNotebook,
882            object: ffi::GtkDirectionType,
883            f: glib::ffi::gpointer,
884        ) {
885            let f: &F = &*(f as *const F);
886            f(
887                Notebook::from_glib_borrow(this).unsafe_cast_ref(),
888                from_glib(object),
889            )
890        }
891        unsafe {
892            let f: Box_<F> = Box_::new(f);
893            connect_raw(
894                self.as_ptr() as *mut _,
895                b"move-focus-out\0".as_ptr() as *const _,
896                Some(transmute::<_, unsafe extern "C" fn()>(
897                    move_focus_out_trampoline::<Self, F> as *const (),
898                )),
899                Box_::into_raw(f),
900            )
901        }
902    }
903
904    fn emit_move_focus_out(&self, object: DirectionType) {
905        self.emit_by_name::<()>("move-focus-out", &[&object]);
906    }
907
908    #[doc(alias = "page-added")]
909    fn connect_page_added<F: Fn(&Self, &Widget, u32) + 'static>(&self, f: F) -> SignalHandlerId {
910        unsafe extern "C" fn page_added_trampoline<
911            P: IsA<Notebook>,
912            F: Fn(&P, &Widget, u32) + 'static,
913        >(
914            this: *mut ffi::GtkNotebook,
915            child: *mut ffi::GtkWidget,
916            page_num: libc::c_uint,
917            f: glib::ffi::gpointer,
918        ) {
919            let f: &F = &*(f as *const F);
920            f(
921                Notebook::from_glib_borrow(this).unsafe_cast_ref(),
922                &from_glib_borrow(child),
923                page_num,
924            )
925        }
926        unsafe {
927            let f: Box_<F> = Box_::new(f);
928            connect_raw(
929                self.as_ptr() as *mut _,
930                b"page-added\0".as_ptr() as *const _,
931                Some(transmute::<_, unsafe extern "C" fn()>(
932                    page_added_trampoline::<Self, F> as *const (),
933                )),
934                Box_::into_raw(f),
935            )
936        }
937    }
938
939    #[doc(alias = "page-removed")]
940    fn connect_page_removed<F: Fn(&Self, &Widget, u32) + 'static>(&self, f: F) -> SignalHandlerId {
941        unsafe extern "C" fn page_removed_trampoline<
942            P: IsA<Notebook>,
943            F: Fn(&P, &Widget, u32) + 'static,
944        >(
945            this: *mut ffi::GtkNotebook,
946            child: *mut ffi::GtkWidget,
947            page_num: libc::c_uint,
948            f: glib::ffi::gpointer,
949        ) {
950            let f: &F = &*(f as *const F);
951            f(
952                Notebook::from_glib_borrow(this).unsafe_cast_ref(),
953                &from_glib_borrow(child),
954                page_num,
955            )
956        }
957        unsafe {
958            let f: Box_<F> = Box_::new(f);
959            connect_raw(
960                self.as_ptr() as *mut _,
961                b"page-removed\0".as_ptr() as *const _,
962                Some(transmute::<_, unsafe extern "C" fn()>(
963                    page_removed_trampoline::<Self, F> as *const (),
964                )),
965                Box_::into_raw(f),
966            )
967        }
968    }
969
970    #[doc(alias = "page-reordered")]
971    fn connect_page_reordered<F: Fn(&Self, &Widget, u32) + 'static>(
972        &self,
973        f: F,
974    ) -> SignalHandlerId {
975        unsafe extern "C" fn page_reordered_trampoline<
976            P: IsA<Notebook>,
977            F: Fn(&P, &Widget, u32) + 'static,
978        >(
979            this: *mut ffi::GtkNotebook,
980            child: *mut ffi::GtkWidget,
981            page_num: libc::c_uint,
982            f: glib::ffi::gpointer,
983        ) {
984            let f: &F = &*(f as *const F);
985            f(
986                Notebook::from_glib_borrow(this).unsafe_cast_ref(),
987                &from_glib_borrow(child),
988                page_num,
989            )
990        }
991        unsafe {
992            let f: Box_<F> = Box_::new(f);
993            connect_raw(
994                self.as_ptr() as *mut _,
995                b"page-reordered\0".as_ptr() as *const _,
996                Some(transmute::<_, unsafe extern "C" fn()>(
997                    page_reordered_trampoline::<Self, F> as *const (),
998                )),
999                Box_::into_raw(f),
1000            )
1001        }
1002    }
1003
1004    #[doc(alias = "reorder-tab")]
1005    fn connect_reorder_tab<F: Fn(&Self, DirectionType, bool) -> bool + 'static>(
1006        &self,
1007        f: F,
1008    ) -> SignalHandlerId {
1009        unsafe extern "C" fn reorder_tab_trampoline<
1010            P: IsA<Notebook>,
1011            F: Fn(&P, DirectionType, bool) -> bool + 'static,
1012        >(
1013            this: *mut ffi::GtkNotebook,
1014            object: ffi::GtkDirectionType,
1015            p0: glib::ffi::gboolean,
1016            f: glib::ffi::gpointer,
1017        ) -> glib::ffi::gboolean {
1018            let f: &F = &*(f as *const F);
1019            f(
1020                Notebook::from_glib_borrow(this).unsafe_cast_ref(),
1021                from_glib(object),
1022                from_glib(p0),
1023            )
1024            .into_glib()
1025        }
1026        unsafe {
1027            let f: Box_<F> = Box_::new(f);
1028            connect_raw(
1029                self.as_ptr() as *mut _,
1030                b"reorder-tab\0".as_ptr() as *const _,
1031                Some(transmute::<_, unsafe extern "C" fn()>(
1032                    reorder_tab_trampoline::<Self, F> as *const (),
1033                )),
1034                Box_::into_raw(f),
1035            )
1036        }
1037    }
1038
1039    fn emit_reorder_tab(&self, object: DirectionType, p0: bool) -> bool {
1040        self.emit_by_name("reorder-tab", &[&object, &p0])
1041    }
1042
1043    #[doc(alias = "select-page")]
1044    fn connect_select_page<F: Fn(&Self, bool) -> bool + 'static>(&self, f: F) -> SignalHandlerId {
1045        unsafe extern "C" fn select_page_trampoline<
1046            P: IsA<Notebook>,
1047            F: Fn(&P, bool) -> bool + 'static,
1048        >(
1049            this: *mut ffi::GtkNotebook,
1050            object: glib::ffi::gboolean,
1051            f: glib::ffi::gpointer,
1052        ) -> glib::ffi::gboolean {
1053            let f: &F = &*(f as *const F);
1054            f(
1055                Notebook::from_glib_borrow(this).unsafe_cast_ref(),
1056                from_glib(object),
1057            )
1058            .into_glib()
1059        }
1060        unsafe {
1061            let f: Box_<F> = Box_::new(f);
1062            connect_raw(
1063                self.as_ptr() as *mut _,
1064                b"select-page\0".as_ptr() as *const _,
1065                Some(transmute::<_, unsafe extern "C" fn()>(
1066                    select_page_trampoline::<Self, F> as *const (),
1067                )),
1068                Box_::into_raw(f),
1069            )
1070        }
1071    }
1072
1073    fn emit_select_page(&self, object: bool) -> bool {
1074        self.emit_by_name("select-page", &[&object])
1075    }
1076
1077    #[doc(alias = "switch-page")]
1078    fn connect_switch_page<F: Fn(&Self, &Widget, u32) + 'static>(&self, f: F) -> SignalHandlerId {
1079        unsafe extern "C" fn switch_page_trampoline<
1080            P: IsA<Notebook>,
1081            F: Fn(&P, &Widget, u32) + 'static,
1082        >(
1083            this: *mut ffi::GtkNotebook,
1084            page: *mut ffi::GtkWidget,
1085            page_num: libc::c_uint,
1086            f: glib::ffi::gpointer,
1087        ) {
1088            let f: &F = &*(f as *const F);
1089            f(
1090                Notebook::from_glib_borrow(this).unsafe_cast_ref(),
1091                &from_glib_borrow(page),
1092                page_num,
1093            )
1094        }
1095        unsafe {
1096            let f: Box_<F> = Box_::new(f);
1097            connect_raw(
1098                self.as_ptr() as *mut _,
1099                b"switch-page\0".as_ptr() as *const _,
1100                Some(transmute::<_, unsafe extern "C" fn()>(
1101                    switch_page_trampoline::<Self, F> as *const (),
1102                )),
1103                Box_::into_raw(f),
1104            )
1105        }
1106    }
1107
1108    #[doc(alias = "enable-popup")]
1109    fn connect_enable_popup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1110        unsafe extern "C" fn notify_enable_popup_trampoline<
1111            P: IsA<Notebook>,
1112            F: Fn(&P) + 'static,
1113        >(
1114            this: *mut ffi::GtkNotebook,
1115            _param_spec: glib::ffi::gpointer,
1116            f: glib::ffi::gpointer,
1117        ) {
1118            let f: &F = &*(f as *const F);
1119            f(Notebook::from_glib_borrow(this).unsafe_cast_ref())
1120        }
1121        unsafe {
1122            let f: Box_<F> = Box_::new(f);
1123            connect_raw(
1124                self.as_ptr() as *mut _,
1125                b"notify::enable-popup\0".as_ptr() as *const _,
1126                Some(transmute::<_, unsafe extern "C" fn()>(
1127                    notify_enable_popup_trampoline::<Self, F> as *const (),
1128                )),
1129                Box_::into_raw(f),
1130            )
1131        }
1132    }
1133
1134    #[doc(alias = "group-name")]
1135    fn connect_group_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1136        unsafe extern "C" fn notify_group_name_trampoline<P: IsA<Notebook>, F: Fn(&P) + 'static>(
1137            this: *mut ffi::GtkNotebook,
1138            _param_spec: glib::ffi::gpointer,
1139            f: glib::ffi::gpointer,
1140        ) {
1141            let f: &F = &*(f as *const F);
1142            f(Notebook::from_glib_borrow(this).unsafe_cast_ref())
1143        }
1144        unsafe {
1145            let f: Box_<F> = Box_::new(f);
1146            connect_raw(
1147                self.as_ptr() as *mut _,
1148                b"notify::group-name\0".as_ptr() as *const _,
1149                Some(transmute::<_, unsafe extern "C" fn()>(
1150                    notify_group_name_trampoline::<Self, F> as *const (),
1151                )),
1152                Box_::into_raw(f),
1153            )
1154        }
1155    }
1156
1157    #[doc(alias = "page")]
1158    fn connect_page_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1159        unsafe extern "C" fn notify_page_trampoline<P: IsA<Notebook>, F: Fn(&P) + 'static>(
1160            this: *mut ffi::GtkNotebook,
1161            _param_spec: glib::ffi::gpointer,
1162            f: glib::ffi::gpointer,
1163        ) {
1164            let f: &F = &*(f as *const F);
1165            f(Notebook::from_glib_borrow(this).unsafe_cast_ref())
1166        }
1167        unsafe {
1168            let f: Box_<F> = Box_::new(f);
1169            connect_raw(
1170                self.as_ptr() as *mut _,
1171                b"notify::page\0".as_ptr() as *const _,
1172                Some(transmute::<_, unsafe extern "C" fn()>(
1173                    notify_page_trampoline::<Self, F> as *const (),
1174                )),
1175                Box_::into_raw(f),
1176            )
1177        }
1178    }
1179
1180    #[doc(alias = "scrollable")]
1181    fn connect_scrollable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1182        unsafe extern "C" fn notify_scrollable_trampoline<P: IsA<Notebook>, F: Fn(&P) + 'static>(
1183            this: *mut ffi::GtkNotebook,
1184            _param_spec: glib::ffi::gpointer,
1185            f: glib::ffi::gpointer,
1186        ) {
1187            let f: &F = &*(f as *const F);
1188            f(Notebook::from_glib_borrow(this).unsafe_cast_ref())
1189        }
1190        unsafe {
1191            let f: Box_<F> = Box_::new(f);
1192            connect_raw(
1193                self.as_ptr() as *mut _,
1194                b"notify::scrollable\0".as_ptr() as *const _,
1195                Some(transmute::<_, unsafe extern "C" fn()>(
1196                    notify_scrollable_trampoline::<Self, F> as *const (),
1197                )),
1198                Box_::into_raw(f),
1199            )
1200        }
1201    }
1202
1203    #[doc(alias = "show-border")]
1204    fn connect_show_border_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1205        unsafe extern "C" fn notify_show_border_trampoline<
1206            P: IsA<Notebook>,
1207            F: Fn(&P) + 'static,
1208        >(
1209            this: *mut ffi::GtkNotebook,
1210            _param_spec: glib::ffi::gpointer,
1211            f: glib::ffi::gpointer,
1212        ) {
1213            let f: &F = &*(f as *const F);
1214            f(Notebook::from_glib_borrow(this).unsafe_cast_ref())
1215        }
1216        unsafe {
1217            let f: Box_<F> = Box_::new(f);
1218            connect_raw(
1219                self.as_ptr() as *mut _,
1220                b"notify::show-border\0".as_ptr() as *const _,
1221                Some(transmute::<_, unsafe extern "C" fn()>(
1222                    notify_show_border_trampoline::<Self, F> as *const (),
1223                )),
1224                Box_::into_raw(f),
1225            )
1226        }
1227    }
1228
1229    #[doc(alias = "show-tabs")]
1230    fn connect_show_tabs_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1231        unsafe extern "C" fn notify_show_tabs_trampoline<P: IsA<Notebook>, F: Fn(&P) + 'static>(
1232            this: *mut ffi::GtkNotebook,
1233            _param_spec: glib::ffi::gpointer,
1234            f: glib::ffi::gpointer,
1235        ) {
1236            let f: &F = &*(f as *const F);
1237            f(Notebook::from_glib_borrow(this).unsafe_cast_ref())
1238        }
1239        unsafe {
1240            let f: Box_<F> = Box_::new(f);
1241            connect_raw(
1242                self.as_ptr() as *mut _,
1243                b"notify::show-tabs\0".as_ptr() as *const _,
1244                Some(transmute::<_, unsafe extern "C" fn()>(
1245                    notify_show_tabs_trampoline::<Self, F> as *const (),
1246                )),
1247                Box_::into_raw(f),
1248            )
1249        }
1250    }
1251
1252    #[doc(alias = "tab-pos")]
1253    fn connect_tab_pos_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1254        unsafe extern "C" fn notify_tab_pos_trampoline<P: IsA<Notebook>, F: Fn(&P) + 'static>(
1255            this: *mut ffi::GtkNotebook,
1256            _param_spec: glib::ffi::gpointer,
1257            f: glib::ffi::gpointer,
1258        ) {
1259            let f: &F = &*(f as *const F);
1260            f(Notebook::from_glib_borrow(this).unsafe_cast_ref())
1261        }
1262        unsafe {
1263            let f: Box_<F> = Box_::new(f);
1264            connect_raw(
1265                self.as_ptr() as *mut _,
1266                b"notify::tab-pos\0".as_ptr() as *const _,
1267                Some(transmute::<_, unsafe extern "C" fn()>(
1268                    notify_tab_pos_trampoline::<Self, F> as *const (),
1269                )),
1270                Box_::into_raw(f),
1271            )
1272        }
1273    }
1274}
1275
1276impl<O: IsA<Notebook>> NotebookExt for O {}
1277
1278impl fmt::Display for Notebook {
1279    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1280        f.write_str("Notebook")
1281    }
1282}