1use gdk;
6use glib;
7use glib::object::Cast;
8use glib::object::IsA;
9use glib::object::ObjectExt;
10use glib::signal::connect_raw;
11use glib::signal::SignalHandlerId;
12use glib::translate::*;
13use glib::GString;
14use glib::StaticType;
15use glib::ToValue;
16use glib::Value;
17use glib_sys;
18use gobject_sys;
19use gtk_sys;
20use libc;
21use std::boxed::Box as Box_;
22use std::fmt;
23use std::mem::transmute;
24use Align;
25use Buildable;
26use Container;
27use DirectionType;
28use NotebookTab;
29use PackType;
30use PositionType;
31use ResizeMode;
32use Widget;
33
34glib_wrapper! {
35 pub struct Notebook(Object<gtk_sys::GtkNotebook, gtk_sys::GtkNotebookClass, NotebookClass>) @extends Container, Widget, @implements Buildable;
36
37 match fn {
38 get_type => || gtk_sys::gtk_notebook_get_type(),
39 }
40}
41
42impl Notebook {
43 pub fn new() -> Notebook {
44 assert_initialized_main_thread!();
45 unsafe { Widget::from_glib_none(gtk_sys::gtk_notebook_new()).unsafe_cast() }
46 }
47}
48
49impl Default for Notebook {
50 fn default() -> Self {
51 Self::new()
52 }
53}
54
55pub struct NotebookBuilder {
56 enable_popup: Option<bool>,
57 group_name: Option<String>,
58 page: Option<i32>,
59 scrollable: Option<bool>,
60 show_border: Option<bool>,
61 show_tabs: Option<bool>,
62 tab_pos: Option<PositionType>,
63 border_width: Option<u32>,
64 child: Option<Widget>,
65 resize_mode: Option<ResizeMode>,
66 app_paintable: Option<bool>,
67 can_default: Option<bool>,
68 can_focus: Option<bool>,
69 events: Option<gdk::EventMask>,
70 expand: Option<bool>,
71 #[cfg(any(feature = "v3_20", feature = "dox"))]
72 focus_on_click: Option<bool>,
73 halign: Option<Align>,
74 has_default: Option<bool>,
75 has_focus: Option<bool>,
76 has_tooltip: Option<bool>,
77 height_request: Option<i32>,
78 hexpand: Option<bool>,
79 hexpand_set: Option<bool>,
80 is_focus: Option<bool>,
81 margin: Option<i32>,
82 margin_bottom: Option<i32>,
83 margin_end: Option<i32>,
84 margin_start: Option<i32>,
85 margin_top: Option<i32>,
86 name: Option<String>,
87 no_show_all: Option<bool>,
88 opacity: Option<f64>,
89 parent: Option<Container>,
90 receives_default: Option<bool>,
91 sensitive: Option<bool>,
92 tooltip_markup: Option<String>,
94 tooltip_text: Option<String>,
95 valign: Option<Align>,
96 vexpand: Option<bool>,
97 vexpand_set: Option<bool>,
98 visible: Option<bool>,
99 width_request: Option<i32>,
100}
101
102impl NotebookBuilder {
103 pub fn new() -> Self {
104 Self {
105 enable_popup: None,
106 group_name: None,
107 page: None,
108 scrollable: None,
109 show_border: None,
110 show_tabs: None,
111 tab_pos: None,
112 border_width: None,
113 child: None,
114 resize_mode: None,
115 app_paintable: None,
116 can_default: None,
117 can_focus: None,
118 events: None,
119 expand: None,
120 #[cfg(any(feature = "v3_20", feature = "dox"))]
121 focus_on_click: None,
122 halign: None,
123 has_default: None,
124 has_focus: None,
125 has_tooltip: None,
126 height_request: None,
127 hexpand: None,
128 hexpand_set: None,
129 is_focus: None,
130 margin: None,
131 margin_bottom: None,
132 margin_end: None,
133 margin_start: None,
134 margin_top: None,
135 name: None,
136 no_show_all: None,
137 opacity: None,
138 parent: None,
139 receives_default: None,
140 sensitive: None,
141 tooltip_markup: None,
142 tooltip_text: None,
143 valign: None,
144 vexpand: None,
145 vexpand_set: None,
146 visible: None,
147 width_request: None,
148 }
149 }
150
151 pub fn build(self) -> Notebook {
152 let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
153 if let Some(ref enable_popup) = self.enable_popup {
154 properties.push(("enable-popup", enable_popup));
155 }
156 if let Some(ref group_name) = self.group_name {
157 properties.push(("group-name", group_name));
158 }
159 if let Some(ref page) = self.page {
160 properties.push(("page", page));
161 }
162 if let Some(ref scrollable) = self.scrollable {
163 properties.push(("scrollable", scrollable));
164 }
165 if let Some(ref show_border) = self.show_border {
166 properties.push(("show-border", show_border));
167 }
168 if let Some(ref show_tabs) = self.show_tabs {
169 properties.push(("show-tabs", show_tabs));
170 }
171 if let Some(ref tab_pos) = self.tab_pos {
172 properties.push(("tab-pos", tab_pos));
173 }
174 if let Some(ref border_width) = self.border_width {
175 properties.push(("border-width", border_width));
176 }
177 if let Some(ref child) = self.child {
178 properties.push(("child", child));
179 }
180 if let Some(ref resize_mode) = self.resize_mode {
181 properties.push(("resize-mode", resize_mode));
182 }
183 if let Some(ref app_paintable) = self.app_paintable {
184 properties.push(("app-paintable", app_paintable));
185 }
186 if let Some(ref can_default) = self.can_default {
187 properties.push(("can-default", can_default));
188 }
189 if let Some(ref can_focus) = self.can_focus {
190 properties.push(("can-focus", can_focus));
191 }
192 if let Some(ref events) = self.events {
193 properties.push(("events", events));
194 }
195 if let Some(ref expand) = self.expand {
196 properties.push(("expand", expand));
197 }
198 #[cfg(any(feature = "v3_20", feature = "dox"))]
199 {
200 if let Some(ref focus_on_click) = self.focus_on_click {
201 properties.push(("focus-on-click", focus_on_click));
202 }
203 }
204 if let Some(ref halign) = self.halign {
205 properties.push(("halign", halign));
206 }
207 if let Some(ref has_default) = self.has_default {
208 properties.push(("has-default", has_default));
209 }
210 if let Some(ref has_focus) = self.has_focus {
211 properties.push(("has-focus", has_focus));
212 }
213 if let Some(ref has_tooltip) = self.has_tooltip {
214 properties.push(("has-tooltip", has_tooltip));
215 }
216 if let Some(ref height_request) = self.height_request {
217 properties.push(("height-request", height_request));
218 }
219 if let Some(ref hexpand) = self.hexpand {
220 properties.push(("hexpand", hexpand));
221 }
222 if let Some(ref hexpand_set) = self.hexpand_set {
223 properties.push(("hexpand-set", hexpand_set));
224 }
225 if let Some(ref is_focus) = self.is_focus {
226 properties.push(("is-focus", is_focus));
227 }
228 if let Some(ref margin) = self.margin {
229 properties.push(("margin", margin));
230 }
231 if let Some(ref margin_bottom) = self.margin_bottom {
232 properties.push(("margin-bottom", margin_bottom));
233 }
234 if let Some(ref margin_end) = self.margin_end {
235 properties.push(("margin-end", margin_end));
236 }
237 if let Some(ref margin_start) = self.margin_start {
238 properties.push(("margin-start", margin_start));
239 }
240 if let Some(ref margin_top) = self.margin_top {
241 properties.push(("margin-top", margin_top));
242 }
243 if let Some(ref name) = self.name {
244 properties.push(("name", name));
245 }
246 if let Some(ref no_show_all) = self.no_show_all {
247 properties.push(("no-show-all", no_show_all));
248 }
249 if let Some(ref opacity) = self.opacity {
250 properties.push(("opacity", opacity));
251 }
252 if let Some(ref parent) = self.parent {
253 properties.push(("parent", parent));
254 }
255 if let Some(ref receives_default) = self.receives_default {
256 properties.push(("receives-default", receives_default));
257 }
258 if let Some(ref sensitive) = self.sensitive {
259 properties.push(("sensitive", sensitive));
260 }
261 if let Some(ref tooltip_markup) = self.tooltip_markup {
262 properties.push(("tooltip-markup", tooltip_markup));
263 }
264 if let Some(ref tooltip_text) = self.tooltip_text {
265 properties.push(("tooltip-text", tooltip_text));
266 }
267 if let Some(ref valign) = self.valign {
268 properties.push(("valign", valign));
269 }
270 if let Some(ref vexpand) = self.vexpand {
271 properties.push(("vexpand", vexpand));
272 }
273 if let Some(ref vexpand_set) = self.vexpand_set {
274 properties.push(("vexpand-set", vexpand_set));
275 }
276 if let Some(ref visible) = self.visible {
277 properties.push(("visible", visible));
278 }
279 if let Some(ref width_request) = self.width_request {
280 properties.push(("width-request", width_request));
281 }
282 glib::Object::new(Notebook::static_type(), &properties)
283 .expect("object new")
284 .downcast()
285 .expect("downcast")
286 }
287
288 pub fn enable_popup(mut self, enable_popup: bool) -> Self {
289 self.enable_popup = Some(enable_popup);
290 self
291 }
292
293 pub fn group_name(mut self, group_name: &str) -> Self {
294 self.group_name = Some(group_name.to_string());
295 self
296 }
297
298 pub fn page(mut self, page: i32) -> Self {
299 self.page = Some(page);
300 self
301 }
302
303 pub fn scrollable(mut self, scrollable: bool) -> Self {
304 self.scrollable = Some(scrollable);
305 self
306 }
307
308 pub fn show_border(mut self, show_border: bool) -> Self {
309 self.show_border = Some(show_border);
310 self
311 }
312
313 pub fn show_tabs(mut self, show_tabs: bool) -> Self {
314 self.show_tabs = Some(show_tabs);
315 self
316 }
317
318 pub fn tab_pos(mut self, tab_pos: PositionType) -> Self {
319 self.tab_pos = Some(tab_pos);
320 self
321 }
322
323 pub fn border_width(mut self, border_width: u32) -> Self {
324 self.border_width = Some(border_width);
325 self
326 }
327
328 pub fn child(mut self, child: &Widget) -> Self {
329 self.child = Some(child.clone());
330 self
331 }
332
333 pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self {
334 self.resize_mode = Some(resize_mode);
335 self
336 }
337
338 pub fn app_paintable(mut self, app_paintable: bool) -> Self {
339 self.app_paintable = Some(app_paintable);
340 self
341 }
342
343 pub fn can_default(mut self, can_default: bool) -> Self {
344 self.can_default = Some(can_default);
345 self
346 }
347
348 pub fn can_focus(mut self, can_focus: bool) -> Self {
349 self.can_focus = Some(can_focus);
350 self
351 }
352
353 pub fn events(mut self, events: gdk::EventMask) -> Self {
354 self.events = Some(events);
355 self
356 }
357
358 pub fn expand(mut self, expand: bool) -> Self {
359 self.expand = Some(expand);
360 self
361 }
362
363 #[cfg(any(feature = "v3_20", feature = "dox"))]
364 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self {
365 self.focus_on_click = Some(focus_on_click);
366 self
367 }
368
369 pub fn halign(mut self, halign: Align) -> Self {
370 self.halign = Some(halign);
371 self
372 }
373
374 pub fn has_default(mut self, has_default: bool) -> Self {
375 self.has_default = Some(has_default);
376 self
377 }
378
379 pub fn has_focus(mut self, has_focus: bool) -> Self {
380 self.has_focus = Some(has_focus);
381 self
382 }
383
384 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self {
385 self.has_tooltip = Some(has_tooltip);
386 self
387 }
388
389 pub fn height_request(mut self, height_request: i32) -> Self {
390 self.height_request = Some(height_request);
391 self
392 }
393
394 pub fn hexpand(mut self, hexpand: bool) -> Self {
395 self.hexpand = Some(hexpand);
396 self
397 }
398
399 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self {
400 self.hexpand_set = Some(hexpand_set);
401 self
402 }
403
404 pub fn is_focus(mut self, is_focus: bool) -> Self {
405 self.is_focus = Some(is_focus);
406 self
407 }
408
409 pub fn margin(mut self, margin: i32) -> Self {
410 self.margin = Some(margin);
411 self
412 }
413
414 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self {
415 self.margin_bottom = Some(margin_bottom);
416 self
417 }
418
419 pub fn margin_end(mut self, margin_end: i32) -> Self {
420 self.margin_end = Some(margin_end);
421 self
422 }
423
424 pub fn margin_start(mut self, margin_start: i32) -> Self {
425 self.margin_start = Some(margin_start);
426 self
427 }
428
429 pub fn margin_top(mut self, margin_top: i32) -> Self {
430 self.margin_top = Some(margin_top);
431 self
432 }
433
434 pub fn name(mut self, name: &str) -> Self {
435 self.name = Some(name.to_string());
436 self
437 }
438
439 pub fn no_show_all(mut self, no_show_all: bool) -> Self {
440 self.no_show_all = Some(no_show_all);
441 self
442 }
443
444 pub fn opacity(mut self, opacity: f64) -> Self {
445 self.opacity = Some(opacity);
446 self
447 }
448
449 pub fn parent(mut self, parent: &Container) -> Self {
450 self.parent = Some(parent.clone());
451 self
452 }
453
454 pub fn receives_default(mut self, receives_default: bool) -> Self {
455 self.receives_default = Some(receives_default);
456 self
457 }
458
459 pub fn sensitive(mut self, sensitive: bool) -> Self {
460 self.sensitive = Some(sensitive);
461 self
462 }
463
464 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self {
465 self.tooltip_markup = Some(tooltip_markup.to_string());
466 self
467 }
468
469 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self {
470 self.tooltip_text = Some(tooltip_text.to_string());
471 self
472 }
473
474 pub fn valign(mut self, valign: Align) -> Self {
475 self.valign = Some(valign);
476 self
477 }
478
479 pub fn vexpand(mut self, vexpand: bool) -> Self {
480 self.vexpand = Some(vexpand);
481 self
482 }
483
484 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self {
485 self.vexpand_set = Some(vexpand_set);
486 self
487 }
488
489 pub fn visible(mut self, visible: bool) -> Self {
490 self.visible = Some(visible);
491 self
492 }
493
494 pub fn width_request(mut self, width_request: i32) -> Self {
495 self.width_request = Some(width_request);
496 self
497 }
498}
499
500pub const NONE_NOTEBOOK: Option<&Notebook> = None;
501
502pub trait NotebookExt: 'static {
503 #[cfg(any(feature = "v3_16", feature = "dox"))]
504 fn detach_tab<P: IsA<Widget>>(&self, child: &P);
505
506 fn get_action_widget(&self, pack_type: PackType) -> Option<Widget>;
507
508 fn get_group_name(&self) -> Option<GString>;
509
510 fn get_menu_label<P: IsA<Widget>>(&self, child: &P) -> Option<Widget>;
511
512 fn get_menu_label_text<P: IsA<Widget>>(&self, child: &P) -> Option<GString>;
513
514 fn get_scrollable(&self) -> bool;
515
516 fn get_show_border(&self) -> bool;
517
518 fn get_show_tabs(&self) -> bool;
519
520 fn get_tab_detachable<P: IsA<Widget>>(&self, child: &P) -> bool;
521
522 fn get_tab_label<P: IsA<Widget>>(&self, child: &P) -> Option<Widget>;
523
524 fn get_tab_label_text<P: IsA<Widget>>(&self, child: &P) -> Option<GString>;
525
526 fn get_tab_pos(&self) -> PositionType;
527
528 fn get_tab_reorderable<P: IsA<Widget>>(&self, child: &P) -> bool;
529
530 fn next_page(&self);
531
532 fn popup_disable(&self);
533
534 fn popup_enable(&self);
535
536 fn prev_page(&self);
537
538 fn set_action_widget<P: IsA<Widget>>(&self, widget: &P, pack_type: PackType);
539
540 fn set_group_name(&self, group_name: Option<&str>);
541
542 fn set_menu_label<P: IsA<Widget>, Q: IsA<Widget>>(&self, child: &P, menu_label: Option<&Q>);
543
544 fn set_menu_label_text<P: IsA<Widget>>(&self, child: &P, menu_text: &str);
545
546 fn set_scrollable(&self, scrollable: bool);
547
548 fn set_show_border(&self, show_border: bool);
549
550 fn set_show_tabs(&self, show_tabs: bool);
551
552 fn set_tab_detachable<P: IsA<Widget>>(&self, child: &P, detachable: bool);
553
554 fn set_tab_label<P: IsA<Widget>, Q: IsA<Widget>>(&self, child: &P, tab_label: Option<&Q>);
555
556 fn set_tab_label_text<P: IsA<Widget>>(&self, child: &P, tab_text: &str);
557
558 fn set_tab_pos(&self, pos: PositionType);
559
560 fn set_tab_reorderable<P: IsA<Widget>>(&self, child: &P, reorderable: bool);
561
562 fn get_property_enable_popup(&self) -> bool;
563
564 fn set_property_enable_popup(&self, enable_popup: bool);
565
566 fn get_property_page(&self) -> i32;
567
568 fn set_property_page(&self, page: i32);
569
570 #[doc(hidden)]
571 fn get_child_detachable<T: IsA<Widget>>(&self, item: &T) -> bool;
572
573 #[doc(hidden)]
574 fn set_child_detachable<T: IsA<Widget>>(&self, item: &T, detachable: bool);
575
576 #[doc(hidden)]
577 fn get_child_menu_label<T: IsA<Widget>>(&self, item: &T) -> Option<GString>;
578
579 #[doc(hidden)]
580 fn set_child_menu_label<T: IsA<Widget>>(&self, item: &T, menu_label: Option<&str>);
581
582 #[doc(hidden)]
583 fn get_child_position<T: IsA<Widget>>(&self, item: &T) -> i32;
584
585 #[doc(hidden)]
586 fn set_child_position<T: IsA<Widget>>(&self, item: &T, position: i32);
587
588 #[doc(hidden)]
589 fn get_child_reorderable<T: IsA<Widget>>(&self, item: &T) -> bool;
590
591 #[doc(hidden)]
592 fn set_child_reorderable<T: IsA<Widget>>(&self, item: &T, reorderable: bool);
593
594 #[doc(hidden)]
595 fn get_child_tab_expand<T: IsA<Widget>>(&self, item: &T) -> bool;
596
597 #[doc(hidden)]
598 fn set_child_tab_expand<T: IsA<Widget>>(&self, item: &T, tab_expand: bool);
599
600 #[doc(hidden)]
601 fn get_child_tab_fill<T: IsA<Widget>>(&self, item: &T) -> bool;
602
603 #[doc(hidden)]
604 fn set_child_tab_fill<T: IsA<Widget>>(&self, item: &T, tab_fill: bool);
605
606 #[doc(hidden)]
607 fn get_child_tab_label<T: IsA<Widget>>(&self, item: &T) -> Option<GString>;
608
609 #[doc(hidden)]
610 fn set_child_tab_label<T: IsA<Widget>>(&self, item: &T, tab_label: Option<&str>);
611
612 fn connect_change_current_page<F: Fn(&Self, i32) -> bool + 'static>(
613 &self,
614 f: F,
615 ) -> SignalHandlerId;
616
617 fn emit_change_current_page(&self, object: i32) -> bool;
618
619 fn connect_create_window<F: Fn(&Self, &Widget, i32, i32) -> Notebook + 'static>(
620 &self,
621 f: F,
622 ) -> SignalHandlerId;
623
624 fn connect_focus_tab<F: Fn(&Self, NotebookTab) -> bool + 'static>(
625 &self,
626 f: F,
627 ) -> SignalHandlerId;
628
629 fn emit_focus_tab(&self, object: NotebookTab) -> bool;
630
631 fn connect_move_focus_out<F: Fn(&Self, DirectionType) + 'static>(
632 &self,
633 f: F,
634 ) -> SignalHandlerId;
635
636 fn emit_move_focus_out(&self, object: DirectionType);
637
638 fn connect_page_added<F: Fn(&Self, &Widget, u32) + 'static>(&self, f: F) -> SignalHandlerId;
639
640 fn connect_page_removed<F: Fn(&Self, &Widget, u32) + 'static>(&self, f: F) -> SignalHandlerId;
641
642 fn connect_page_reordered<F: Fn(&Self, &Widget, u32) + 'static>(&self, f: F)
643 -> SignalHandlerId;
644
645 fn connect_reorder_tab<F: Fn(&Self, DirectionType, bool) -> bool + 'static>(
646 &self,
647 f: F,
648 ) -> SignalHandlerId;
649
650 fn emit_reorder_tab(&self, object: DirectionType, p0: bool) -> bool;
651
652 fn connect_select_page<F: Fn(&Self, bool) -> bool + 'static>(&self, f: F) -> SignalHandlerId;
653
654 fn emit_select_page(&self, object: bool) -> bool;
655
656 fn connect_switch_page<F: Fn(&Self, &Widget, u32) + 'static>(&self, f: F) -> SignalHandlerId;
657
658 fn connect_property_enable_popup_notify<F: Fn(&Self) + 'static>(&self, f: F)
659 -> SignalHandlerId;
660
661 fn connect_property_group_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
662
663 fn connect_property_page_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
664
665 fn connect_property_scrollable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
666
667 fn connect_property_show_border_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
668
669 fn connect_property_show_tabs_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
670
671 fn connect_property_tab_pos_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
672}
673
674impl<O: IsA<Notebook>> NotebookExt for O {
675 #[cfg(any(feature = "v3_16", feature = "dox"))]
676 fn detach_tab<P: IsA<Widget>>(&self, child: &P) {
677 unsafe {
678 gtk_sys::gtk_notebook_detach_tab(
679 self.as_ref().to_glib_none().0,
680 child.as_ref().to_glib_none().0,
681 );
682 }
683 }
684
685 fn get_action_widget(&self, pack_type: PackType) -> Option<Widget> {
686 unsafe {
687 from_glib_none(gtk_sys::gtk_notebook_get_action_widget(
688 self.as_ref().to_glib_none().0,
689 pack_type.to_glib(),
690 ))
691 }
692 }
693
694 fn get_group_name(&self) -> Option<GString> {
695 unsafe {
696 from_glib_none(gtk_sys::gtk_notebook_get_group_name(
697 self.as_ref().to_glib_none().0,
698 ))
699 }
700 }
701
702 fn get_menu_label<P: IsA<Widget>>(&self, child: &P) -> Option<Widget> {
703 unsafe {
704 from_glib_none(gtk_sys::gtk_notebook_get_menu_label(
705 self.as_ref().to_glib_none().0,
706 child.as_ref().to_glib_none().0,
707 ))
708 }
709 }
710
711 fn get_menu_label_text<P: IsA<Widget>>(&self, child: &P) -> Option<GString> {
712 unsafe {
713 from_glib_none(gtk_sys::gtk_notebook_get_menu_label_text(
714 self.as_ref().to_glib_none().0,
715 child.as_ref().to_glib_none().0,
716 ))
717 }
718 }
719
720 fn get_scrollable(&self) -> bool {
721 unsafe {
722 from_glib(gtk_sys::gtk_notebook_get_scrollable(
723 self.as_ref().to_glib_none().0,
724 ))
725 }
726 }
727
728 fn get_show_border(&self) -> bool {
729 unsafe {
730 from_glib(gtk_sys::gtk_notebook_get_show_border(
731 self.as_ref().to_glib_none().0,
732 ))
733 }
734 }
735
736 fn get_show_tabs(&self) -> bool {
737 unsafe {
738 from_glib(gtk_sys::gtk_notebook_get_show_tabs(
739 self.as_ref().to_glib_none().0,
740 ))
741 }
742 }
743
744 fn get_tab_detachable<P: IsA<Widget>>(&self, child: &P) -> bool {
745 unsafe {
746 from_glib(gtk_sys::gtk_notebook_get_tab_detachable(
747 self.as_ref().to_glib_none().0,
748 child.as_ref().to_glib_none().0,
749 ))
750 }
751 }
752
753 fn get_tab_label<P: IsA<Widget>>(&self, child: &P) -> Option<Widget> {
754 unsafe {
755 from_glib_none(gtk_sys::gtk_notebook_get_tab_label(
756 self.as_ref().to_glib_none().0,
757 child.as_ref().to_glib_none().0,
758 ))
759 }
760 }
761
762 fn get_tab_label_text<P: IsA<Widget>>(&self, child: &P) -> Option<GString> {
763 unsafe {
764 from_glib_none(gtk_sys::gtk_notebook_get_tab_label_text(
765 self.as_ref().to_glib_none().0,
766 child.as_ref().to_glib_none().0,
767 ))
768 }
769 }
770
771 fn get_tab_pos(&self) -> PositionType {
772 unsafe {
773 from_glib(gtk_sys::gtk_notebook_get_tab_pos(
774 self.as_ref().to_glib_none().0,
775 ))
776 }
777 }
778
779 fn get_tab_reorderable<P: IsA<Widget>>(&self, child: &P) -> bool {
780 unsafe {
781 from_glib(gtk_sys::gtk_notebook_get_tab_reorderable(
782 self.as_ref().to_glib_none().0,
783 child.as_ref().to_glib_none().0,
784 ))
785 }
786 }
787
788 fn next_page(&self) {
789 unsafe {
790 gtk_sys::gtk_notebook_next_page(self.as_ref().to_glib_none().0);
791 }
792 }
793
794 fn popup_disable(&self) {
795 unsafe {
796 gtk_sys::gtk_notebook_popup_disable(self.as_ref().to_glib_none().0);
797 }
798 }
799
800 fn popup_enable(&self) {
801 unsafe {
802 gtk_sys::gtk_notebook_popup_enable(self.as_ref().to_glib_none().0);
803 }
804 }
805
806 fn prev_page(&self) {
807 unsafe {
808 gtk_sys::gtk_notebook_prev_page(self.as_ref().to_glib_none().0);
809 }
810 }
811
812 fn set_action_widget<P: IsA<Widget>>(&self, widget: &P, pack_type: PackType) {
813 unsafe {
814 gtk_sys::gtk_notebook_set_action_widget(
815 self.as_ref().to_glib_none().0,
816 widget.as_ref().to_glib_none().0,
817 pack_type.to_glib(),
818 );
819 }
820 }
821
822 fn set_group_name(&self, group_name: Option<&str>) {
823 unsafe {
824 gtk_sys::gtk_notebook_set_group_name(
825 self.as_ref().to_glib_none().0,
826 group_name.to_glib_none().0,
827 );
828 }
829 }
830
831 fn set_menu_label<P: IsA<Widget>, Q: IsA<Widget>>(&self, child: &P, menu_label: Option<&Q>) {
832 unsafe {
833 gtk_sys::gtk_notebook_set_menu_label(
834 self.as_ref().to_glib_none().0,
835 child.as_ref().to_glib_none().0,
836 menu_label.map(|p| p.as_ref()).to_glib_none().0,
837 );
838 }
839 }
840
841 fn set_menu_label_text<P: IsA<Widget>>(&self, child: &P, menu_text: &str) {
842 unsafe {
843 gtk_sys::gtk_notebook_set_menu_label_text(
844 self.as_ref().to_glib_none().0,
845 child.as_ref().to_glib_none().0,
846 menu_text.to_glib_none().0,
847 );
848 }
849 }
850
851 fn set_scrollable(&self, scrollable: bool) {
852 unsafe {
853 gtk_sys::gtk_notebook_set_scrollable(
854 self.as_ref().to_glib_none().0,
855 scrollable.to_glib(),
856 );
857 }
858 }
859
860 fn set_show_border(&self, show_border: bool) {
861 unsafe {
862 gtk_sys::gtk_notebook_set_show_border(
863 self.as_ref().to_glib_none().0,
864 show_border.to_glib(),
865 );
866 }
867 }
868
869 fn set_show_tabs(&self, show_tabs: bool) {
870 unsafe {
871 gtk_sys::gtk_notebook_set_show_tabs(
872 self.as_ref().to_glib_none().0,
873 show_tabs.to_glib(),
874 );
875 }
876 }
877
878 fn set_tab_detachable<P: IsA<Widget>>(&self, child: &P, detachable: bool) {
879 unsafe {
880 gtk_sys::gtk_notebook_set_tab_detachable(
881 self.as_ref().to_glib_none().0,
882 child.as_ref().to_glib_none().0,
883 detachable.to_glib(),
884 );
885 }
886 }
887
888 fn set_tab_label<P: IsA<Widget>, Q: IsA<Widget>>(&self, child: &P, tab_label: Option<&Q>) {
889 unsafe {
890 gtk_sys::gtk_notebook_set_tab_label(
891 self.as_ref().to_glib_none().0,
892 child.as_ref().to_glib_none().0,
893 tab_label.map(|p| p.as_ref()).to_glib_none().0,
894 );
895 }
896 }
897
898 fn set_tab_label_text<P: IsA<Widget>>(&self, child: &P, tab_text: &str) {
899 unsafe {
900 gtk_sys::gtk_notebook_set_tab_label_text(
901 self.as_ref().to_glib_none().0,
902 child.as_ref().to_glib_none().0,
903 tab_text.to_glib_none().0,
904 );
905 }
906 }
907
908 fn set_tab_pos(&self, pos: PositionType) {
909 unsafe {
910 gtk_sys::gtk_notebook_set_tab_pos(self.as_ref().to_glib_none().0, pos.to_glib());
911 }
912 }
913
914 fn set_tab_reorderable<P: IsA<Widget>>(&self, child: &P, reorderable: bool) {
915 unsafe {
916 gtk_sys::gtk_notebook_set_tab_reorderable(
917 self.as_ref().to_glib_none().0,
918 child.as_ref().to_glib_none().0,
919 reorderable.to_glib(),
920 );
921 }
922 }
923
924 fn get_property_enable_popup(&self) -> bool {
925 unsafe {
926 let mut value = Value::from_type(<bool as StaticType>::static_type());
927 gobject_sys::g_object_get_property(
928 self.to_glib_none().0 as *mut gobject_sys::GObject,
929 b"enable-popup\0".as_ptr() as *const _,
930 value.to_glib_none_mut().0,
931 );
932 value.get().unwrap()
933 }
934 }
935
936 fn set_property_enable_popup(&self, enable_popup: bool) {
937 unsafe {
938 gobject_sys::g_object_set_property(
939 self.to_glib_none().0 as *mut gobject_sys::GObject,
940 b"enable-popup\0".as_ptr() as *const _,
941 Value::from(&enable_popup).to_glib_none().0,
942 );
943 }
944 }
945
946 fn get_property_page(&self) -> i32 {
947 unsafe {
948 let mut value = Value::from_type(<i32 as StaticType>::static_type());
949 gobject_sys::g_object_get_property(
950 self.to_glib_none().0 as *mut gobject_sys::GObject,
951 b"page\0".as_ptr() as *const _,
952 value.to_glib_none_mut().0,
953 );
954 value.get().unwrap()
955 }
956 }
957
958 fn set_property_page(&self, page: i32) {
959 unsafe {
960 gobject_sys::g_object_set_property(
961 self.to_glib_none().0 as *mut gobject_sys::GObject,
962 b"page\0".as_ptr() as *const _,
963 Value::from(&page).to_glib_none().0,
964 );
965 }
966 }
967
968 #[doc(hidden)]
969 fn get_child_detachable<T: IsA<Widget>>(&self, item: &T) -> bool {
970 unsafe {
971 let mut value = Value::from_type(<bool as StaticType>::static_type());
972 gtk_sys::gtk_container_child_get_property(
973 self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
974 item.to_glib_none().0 as *mut _,
975 b"detachable\0".as_ptr() as *const _,
976 value.to_glib_none_mut().0,
977 );
978 value.get().unwrap()
979 }
980 }
981
982 #[doc(hidden)]
983 fn set_child_detachable<T: IsA<Widget>>(&self, item: &T, detachable: bool) {
984 unsafe {
985 gtk_sys::gtk_container_child_set_property(
986 self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
987 item.to_glib_none().0 as *mut _,
988 b"detachable\0".as_ptr() as *const _,
989 Value::from(&detachable).to_glib_none().0,
990 );
991 }
992 }
993
994 #[doc(hidden)]
995 fn get_child_menu_label<T: IsA<Widget>>(&self, item: &T) -> Option<GString> {
996 unsafe {
997 let mut value = Value::from_type(<GString as StaticType>::static_type());
998 gtk_sys::gtk_container_child_get_property(
999 self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
1000 item.to_glib_none().0 as *mut _,
1001 b"menu-label\0".as_ptr() as *const _,
1002 value.to_glib_none_mut().0,
1003 );
1004 value.get()
1005 }
1006 }
1007
1008 #[doc(hidden)]
1009 fn set_child_menu_label<T: IsA<Widget>>(&self, item: &T, menu_label: Option<&str>) {
1010 unsafe {
1011 gtk_sys::gtk_container_child_set_property(
1012 self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
1013 item.to_glib_none().0 as *mut _,
1014 b"menu-label\0".as_ptr() as *const _,
1015 Value::from(menu_label).to_glib_none().0,
1016 );
1017 }
1018 }
1019
1020 #[doc(hidden)]
1021 fn get_child_position<T: IsA<Widget>>(&self, item: &T) -> i32 {
1022 unsafe {
1023 let mut value = Value::from_type(<i32 as StaticType>::static_type());
1024 gtk_sys::gtk_container_child_get_property(
1025 self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
1026 item.to_glib_none().0 as *mut _,
1027 b"position\0".as_ptr() as *const _,
1028 value.to_glib_none_mut().0,
1029 );
1030 value.get().unwrap()
1031 }
1032 }
1033
1034 #[doc(hidden)]
1035 fn set_child_position<T: IsA<Widget>>(&self, item: &T, position: i32) {
1036 unsafe {
1037 gtk_sys::gtk_container_child_set_property(
1038 self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
1039 item.to_glib_none().0 as *mut _,
1040 b"position\0".as_ptr() as *const _,
1041 Value::from(&position).to_glib_none().0,
1042 );
1043 }
1044 }
1045
1046 #[doc(hidden)]
1047 fn get_child_reorderable<T: IsA<Widget>>(&self, item: &T) -> bool {
1048 unsafe {
1049 let mut value = Value::from_type(<bool as StaticType>::static_type());
1050 gtk_sys::gtk_container_child_get_property(
1051 self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
1052 item.to_glib_none().0 as *mut _,
1053 b"reorderable\0".as_ptr() as *const _,
1054 value.to_glib_none_mut().0,
1055 );
1056 value.get().unwrap()
1057 }
1058 }
1059
1060 #[doc(hidden)]
1061 fn set_child_reorderable<T: IsA<Widget>>(&self, item: &T, reorderable: bool) {
1062 unsafe {
1063 gtk_sys::gtk_container_child_set_property(
1064 self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
1065 item.to_glib_none().0 as *mut _,
1066 b"reorderable\0".as_ptr() as *const _,
1067 Value::from(&reorderable).to_glib_none().0,
1068 );
1069 }
1070 }
1071
1072 #[doc(hidden)]
1073 fn get_child_tab_expand<T: IsA<Widget>>(&self, item: &T) -> bool {
1074 unsafe {
1075 let mut value = Value::from_type(<bool as StaticType>::static_type());
1076 gtk_sys::gtk_container_child_get_property(
1077 self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
1078 item.to_glib_none().0 as *mut _,
1079 b"tab-expand\0".as_ptr() as *const _,
1080 value.to_glib_none_mut().0,
1081 );
1082 value.get().unwrap()
1083 }
1084 }
1085
1086 #[doc(hidden)]
1087 fn set_child_tab_expand<T: IsA<Widget>>(&self, item: &T, tab_expand: bool) {
1088 unsafe {
1089 gtk_sys::gtk_container_child_set_property(
1090 self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
1091 item.to_glib_none().0 as *mut _,
1092 b"tab-expand\0".as_ptr() as *const _,
1093 Value::from(&tab_expand).to_glib_none().0,
1094 );
1095 }
1096 }
1097
1098 #[doc(hidden)]
1099 fn get_child_tab_fill<T: IsA<Widget>>(&self, item: &T) -> bool {
1100 unsafe {
1101 let mut value = Value::from_type(<bool as StaticType>::static_type());
1102 gtk_sys::gtk_container_child_get_property(
1103 self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
1104 item.to_glib_none().0 as *mut _,
1105 b"tab-fill\0".as_ptr() as *const _,
1106 value.to_glib_none_mut().0,
1107 );
1108 value.get().unwrap()
1109 }
1110 }
1111
1112 #[doc(hidden)]
1113 fn set_child_tab_fill<T: IsA<Widget>>(&self, item: &T, tab_fill: bool) {
1114 unsafe {
1115 gtk_sys::gtk_container_child_set_property(
1116 self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
1117 item.to_glib_none().0 as *mut _,
1118 b"tab-fill\0".as_ptr() as *const _,
1119 Value::from(&tab_fill).to_glib_none().0,
1120 );
1121 }
1122 }
1123
1124 #[doc(hidden)]
1125 fn get_child_tab_label<T: IsA<Widget>>(&self, item: &T) -> Option<GString> {
1126 unsafe {
1127 let mut value = Value::from_type(<GString as StaticType>::static_type());
1128 gtk_sys::gtk_container_child_get_property(
1129 self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
1130 item.to_glib_none().0 as *mut _,
1131 b"tab-label\0".as_ptr() as *const _,
1132 value.to_glib_none_mut().0,
1133 );
1134 value.get()
1135 }
1136 }
1137
1138 #[doc(hidden)]
1139 fn set_child_tab_label<T: IsA<Widget>>(&self, item: &T, tab_label: Option<&str>) {
1140 unsafe {
1141 gtk_sys::gtk_container_child_set_property(
1142 self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
1143 item.to_glib_none().0 as *mut _,
1144 b"tab-label\0".as_ptr() as *const _,
1145 Value::from(tab_label).to_glib_none().0,
1146 );
1147 }
1148 }
1149
1150 fn connect_change_current_page<F: Fn(&Self, i32) -> bool + 'static>(
1151 &self,
1152 f: F,
1153 ) -> SignalHandlerId {
1154 unsafe extern "C" fn change_current_page_trampoline<P, F: Fn(&P, i32) -> bool + 'static>(
1155 this: *mut gtk_sys::GtkNotebook,
1156 object: libc::c_int,
1157 f: glib_sys::gpointer,
1158 ) -> glib_sys::gboolean
1159 where
1160 P: IsA<Notebook>,
1161 {
1162 let f: &F = &*(f as *const F);
1163 f(&Notebook::from_glib_borrow(this).unsafe_cast(), object).to_glib()
1164 }
1165 unsafe {
1166 let f: Box_<F> = Box_::new(f);
1167 connect_raw(
1168 self.as_ptr() as *mut _,
1169 b"change-current-page\0".as_ptr() as *const _,
1170 Some(transmute(
1171 change_current_page_trampoline::<Self, F> as usize,
1172 )),
1173 Box_::into_raw(f),
1174 )
1175 }
1176 }
1177
1178 fn emit_change_current_page(&self, object: i32) -> bool {
1179 let res = unsafe {
1180 glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject)
1181 .emit("change-current-page", &[&object])
1182 .unwrap()
1183 };
1184 res.unwrap().get().unwrap()
1185 }
1186
1187 fn connect_create_window<F: Fn(&Self, &Widget, i32, i32) -> Notebook + 'static>(
1188 &self,
1189 f: F,
1190 ) -> SignalHandlerId {
1191 unsafe extern "C" fn create_window_trampoline<
1192 P,
1193 F: Fn(&P, &Widget, i32, i32) -> Notebook + 'static,
1194 >(
1195 this: *mut gtk_sys::GtkNotebook,
1196 page: *mut gtk_sys::GtkWidget,
1197 x: libc::c_int,
1198 y: libc::c_int,
1199 f: glib_sys::gpointer,
1200 ) -> *mut gtk_sys::GtkNotebook
1201 where
1202 P: IsA<Notebook>,
1203 {
1204 let f: &F = &*(f as *const F);
1205 f(
1206 &Notebook::from_glib_borrow(this).unsafe_cast(),
1207 &from_glib_borrow(page),
1208 x,
1209 y,
1210 ) .to_glib_none()
1212 .0
1213 }
1214 unsafe {
1215 let f: Box_<F> = Box_::new(f);
1216 connect_raw(
1217 self.as_ptr() as *mut _,
1218 b"create-window\0".as_ptr() as *const _,
1219 Some(transmute(create_window_trampoline::<Self, F> as usize)),
1220 Box_::into_raw(f),
1221 )
1222 }
1223 }
1224
1225 fn connect_focus_tab<F: Fn(&Self, NotebookTab) -> bool + 'static>(
1226 &self,
1227 f: F,
1228 ) -> SignalHandlerId {
1229 unsafe extern "C" fn focus_tab_trampoline<P, F: Fn(&P, NotebookTab) -> bool + 'static>(
1230 this: *mut gtk_sys::GtkNotebook,
1231 object: gtk_sys::GtkNotebookTab,
1232 f: glib_sys::gpointer,
1233 ) -> glib_sys::gboolean
1234 where
1235 P: IsA<Notebook>,
1236 {
1237 let f: &F = &*(f as *const F);
1238 f(
1239 &Notebook::from_glib_borrow(this).unsafe_cast(),
1240 from_glib(object),
1241 )
1242 .to_glib()
1243 }
1244 unsafe {
1245 let f: Box_<F> = Box_::new(f);
1246 connect_raw(
1247 self.as_ptr() as *mut _,
1248 b"focus-tab\0".as_ptr() as *const _,
1249 Some(transmute(focus_tab_trampoline::<Self, F> as usize)),
1250 Box_::into_raw(f),
1251 )
1252 }
1253 }
1254
1255 fn emit_focus_tab(&self, object: NotebookTab) -> bool {
1256 let res = unsafe {
1257 glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject)
1258 .emit("focus-tab", &[&object])
1259 .unwrap()
1260 };
1261 res.unwrap().get().unwrap()
1262 }
1263
1264 fn connect_move_focus_out<F: Fn(&Self, DirectionType) + 'static>(
1265 &self,
1266 f: F,
1267 ) -> SignalHandlerId {
1268 unsafe extern "C" fn move_focus_out_trampoline<P, F: Fn(&P, DirectionType) + 'static>(
1269 this: *mut gtk_sys::GtkNotebook,
1270 object: gtk_sys::GtkDirectionType,
1271 f: glib_sys::gpointer,
1272 ) where
1273 P: IsA<Notebook>,
1274 {
1275 let f: &F = &*(f as *const F);
1276 f(
1277 &Notebook::from_glib_borrow(this).unsafe_cast(),
1278 from_glib(object),
1279 )
1280 }
1281 unsafe {
1282 let f: Box_<F> = Box_::new(f);
1283 connect_raw(
1284 self.as_ptr() as *mut _,
1285 b"move-focus-out\0".as_ptr() as *const _,
1286 Some(transmute(move_focus_out_trampoline::<Self, F> as usize)),
1287 Box_::into_raw(f),
1288 )
1289 }
1290 }
1291
1292 fn emit_move_focus_out(&self, object: DirectionType) {
1293 let _ = unsafe {
1294 glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject)
1295 .emit("move-focus-out", &[&object])
1296 .unwrap()
1297 };
1298 }
1299
1300 fn connect_page_added<F: Fn(&Self, &Widget, u32) + 'static>(&self, f: F) -> SignalHandlerId {
1301 unsafe extern "C" fn page_added_trampoline<P, F: Fn(&P, &Widget, u32) + 'static>(
1302 this: *mut gtk_sys::GtkNotebook,
1303 child: *mut gtk_sys::GtkWidget,
1304 page_num: libc::c_uint,
1305 f: glib_sys::gpointer,
1306 ) where
1307 P: IsA<Notebook>,
1308 {
1309 let f: &F = &*(f as *const F);
1310 f(
1311 &Notebook::from_glib_borrow(this).unsafe_cast(),
1312 &from_glib_borrow(child),
1313 page_num,
1314 )
1315 }
1316 unsafe {
1317 let f: Box_<F> = Box_::new(f);
1318 connect_raw(
1319 self.as_ptr() as *mut _,
1320 b"page-added\0".as_ptr() as *const _,
1321 Some(transmute(page_added_trampoline::<Self, F> as usize)),
1322 Box_::into_raw(f),
1323 )
1324 }
1325 }
1326
1327 fn connect_page_removed<F: Fn(&Self, &Widget, u32) + 'static>(&self, f: F) -> SignalHandlerId {
1328 unsafe extern "C" fn page_removed_trampoline<P, F: Fn(&P, &Widget, u32) + 'static>(
1329 this: *mut gtk_sys::GtkNotebook,
1330 child: *mut gtk_sys::GtkWidget,
1331 page_num: libc::c_uint,
1332 f: glib_sys::gpointer,
1333 ) where
1334 P: IsA<Notebook>,
1335 {
1336 let f: &F = &*(f as *const F);
1337 f(
1338 &Notebook::from_glib_borrow(this).unsafe_cast(),
1339 &from_glib_borrow(child),
1340 page_num,
1341 )
1342 }
1343 unsafe {
1344 let f: Box_<F> = Box_::new(f);
1345 connect_raw(
1346 self.as_ptr() as *mut _,
1347 b"page-removed\0".as_ptr() as *const _,
1348 Some(transmute(page_removed_trampoline::<Self, F> as usize)),
1349 Box_::into_raw(f),
1350 )
1351 }
1352 }
1353
1354 fn connect_page_reordered<F: Fn(&Self, &Widget, u32) + 'static>(
1355 &self,
1356 f: F,
1357 ) -> SignalHandlerId {
1358 unsafe extern "C" fn page_reordered_trampoline<P, F: Fn(&P, &Widget, u32) + 'static>(
1359 this: *mut gtk_sys::GtkNotebook,
1360 child: *mut gtk_sys::GtkWidget,
1361 page_num: libc::c_uint,
1362 f: glib_sys::gpointer,
1363 ) where
1364 P: IsA<Notebook>,
1365 {
1366 let f: &F = &*(f as *const F);
1367 f(
1368 &Notebook::from_glib_borrow(this).unsafe_cast(),
1369 &from_glib_borrow(child),
1370 page_num,
1371 )
1372 }
1373 unsafe {
1374 let f: Box_<F> = Box_::new(f);
1375 connect_raw(
1376 self.as_ptr() as *mut _,
1377 b"page-reordered\0".as_ptr() as *const _,
1378 Some(transmute(page_reordered_trampoline::<Self, F> as usize)),
1379 Box_::into_raw(f),
1380 )
1381 }
1382 }
1383
1384 fn connect_reorder_tab<F: Fn(&Self, DirectionType, bool) -> bool + 'static>(
1385 &self,
1386 f: F,
1387 ) -> SignalHandlerId {
1388 unsafe extern "C" fn reorder_tab_trampoline<
1389 P,
1390 F: Fn(&P, DirectionType, bool) -> bool + 'static,
1391 >(
1392 this: *mut gtk_sys::GtkNotebook,
1393 object: gtk_sys::GtkDirectionType,
1394 p0: glib_sys::gboolean,
1395 f: glib_sys::gpointer,
1396 ) -> glib_sys::gboolean
1397 where
1398 P: IsA<Notebook>,
1399 {
1400 let f: &F = &*(f as *const F);
1401 f(
1402 &Notebook::from_glib_borrow(this).unsafe_cast(),
1403 from_glib(object),
1404 from_glib(p0),
1405 )
1406 .to_glib()
1407 }
1408 unsafe {
1409 let f: Box_<F> = Box_::new(f);
1410 connect_raw(
1411 self.as_ptr() as *mut _,
1412 b"reorder-tab\0".as_ptr() as *const _,
1413 Some(transmute(reorder_tab_trampoline::<Self, F> as usize)),
1414 Box_::into_raw(f),
1415 )
1416 }
1417 }
1418
1419 fn emit_reorder_tab(&self, object: DirectionType, p0: bool) -> bool {
1420 let res = unsafe {
1421 glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject)
1422 .emit("reorder-tab", &[&object, &p0])
1423 .unwrap()
1424 };
1425 res.unwrap().get().unwrap()
1426 }
1427
1428 fn connect_select_page<F: Fn(&Self, bool) -> bool + 'static>(&self, f: F) -> SignalHandlerId {
1429 unsafe extern "C" fn select_page_trampoline<P, F: Fn(&P, bool) -> bool + 'static>(
1430 this: *mut gtk_sys::GtkNotebook,
1431 object: glib_sys::gboolean,
1432 f: glib_sys::gpointer,
1433 ) -> glib_sys::gboolean
1434 where
1435 P: IsA<Notebook>,
1436 {
1437 let f: &F = &*(f as *const F);
1438 f(
1439 &Notebook::from_glib_borrow(this).unsafe_cast(),
1440 from_glib(object),
1441 )
1442 .to_glib()
1443 }
1444 unsafe {
1445 let f: Box_<F> = Box_::new(f);
1446 connect_raw(
1447 self.as_ptr() as *mut _,
1448 b"select-page\0".as_ptr() as *const _,
1449 Some(transmute(select_page_trampoline::<Self, F> as usize)),
1450 Box_::into_raw(f),
1451 )
1452 }
1453 }
1454
1455 fn emit_select_page(&self, object: bool) -> bool {
1456 let res = unsafe {
1457 glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject)
1458 .emit("select-page", &[&object])
1459 .unwrap()
1460 };
1461 res.unwrap().get().unwrap()
1462 }
1463
1464 fn connect_switch_page<F: Fn(&Self, &Widget, u32) + 'static>(&self, f: F) -> SignalHandlerId {
1465 unsafe extern "C" fn switch_page_trampoline<P, F: Fn(&P, &Widget, u32) + 'static>(
1466 this: *mut gtk_sys::GtkNotebook,
1467 page: *mut gtk_sys::GtkWidget,
1468 page_num: libc::c_uint,
1469 f: glib_sys::gpointer,
1470 ) where
1471 P: IsA<Notebook>,
1472 {
1473 let f: &F = &*(f as *const F);
1474 f(
1475 &Notebook::from_glib_borrow(this).unsafe_cast(),
1476 &from_glib_borrow(page),
1477 page_num,
1478 )
1479 }
1480 unsafe {
1481 let f: Box_<F> = Box_::new(f);
1482 connect_raw(
1483 self.as_ptr() as *mut _,
1484 b"switch-page\0".as_ptr() as *const _,
1485 Some(transmute(switch_page_trampoline::<Self, F> as usize)),
1486 Box_::into_raw(f),
1487 )
1488 }
1489 }
1490
1491 fn connect_property_enable_popup_notify<F: Fn(&Self) + 'static>(
1492 &self,
1493 f: F,
1494 ) -> SignalHandlerId {
1495 unsafe extern "C" fn notify_enable_popup_trampoline<P, F: Fn(&P) + 'static>(
1496 this: *mut gtk_sys::GtkNotebook,
1497 _param_spec: glib_sys::gpointer,
1498 f: glib_sys::gpointer,
1499 ) where
1500 P: IsA<Notebook>,
1501 {
1502 let f: &F = &*(f as *const F);
1503 f(&Notebook::from_glib_borrow(this).unsafe_cast())
1504 }
1505 unsafe {
1506 let f: Box_<F> = Box_::new(f);
1507 connect_raw(
1508 self.as_ptr() as *mut _,
1509 b"notify::enable-popup\0".as_ptr() as *const _,
1510 Some(transmute(
1511 notify_enable_popup_trampoline::<Self, F> as usize,
1512 )),
1513 Box_::into_raw(f),
1514 )
1515 }
1516 }
1517
1518 fn connect_property_group_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1519 unsafe extern "C" fn notify_group_name_trampoline<P, F: Fn(&P) + 'static>(
1520 this: *mut gtk_sys::GtkNotebook,
1521 _param_spec: glib_sys::gpointer,
1522 f: glib_sys::gpointer,
1523 ) where
1524 P: IsA<Notebook>,
1525 {
1526 let f: &F = &*(f as *const F);
1527 f(&Notebook::from_glib_borrow(this).unsafe_cast())
1528 }
1529 unsafe {
1530 let f: Box_<F> = Box_::new(f);
1531 connect_raw(
1532 self.as_ptr() as *mut _,
1533 b"notify::group-name\0".as_ptr() as *const _,
1534 Some(transmute(notify_group_name_trampoline::<Self, F> as usize)),
1535 Box_::into_raw(f),
1536 )
1537 }
1538 }
1539
1540 fn connect_property_page_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1541 unsafe extern "C" fn notify_page_trampoline<P, F: Fn(&P) + 'static>(
1542 this: *mut gtk_sys::GtkNotebook,
1543 _param_spec: glib_sys::gpointer,
1544 f: glib_sys::gpointer,
1545 ) where
1546 P: IsA<Notebook>,
1547 {
1548 let f: &F = &*(f as *const F);
1549 f(&Notebook::from_glib_borrow(this).unsafe_cast())
1550 }
1551 unsafe {
1552 let f: Box_<F> = Box_::new(f);
1553 connect_raw(
1554 self.as_ptr() as *mut _,
1555 b"notify::page\0".as_ptr() as *const _,
1556 Some(transmute(notify_page_trampoline::<Self, F> as usize)),
1557 Box_::into_raw(f),
1558 )
1559 }
1560 }
1561
1562 fn connect_property_scrollable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1563 unsafe extern "C" fn notify_scrollable_trampoline<P, F: Fn(&P) + 'static>(
1564 this: *mut gtk_sys::GtkNotebook,
1565 _param_spec: glib_sys::gpointer,
1566 f: glib_sys::gpointer,
1567 ) where
1568 P: IsA<Notebook>,
1569 {
1570 let f: &F = &*(f as *const F);
1571 f(&Notebook::from_glib_borrow(this).unsafe_cast())
1572 }
1573 unsafe {
1574 let f: Box_<F> = Box_::new(f);
1575 connect_raw(
1576 self.as_ptr() as *mut _,
1577 b"notify::scrollable\0".as_ptr() as *const _,
1578 Some(transmute(notify_scrollable_trampoline::<Self, F> as usize)),
1579 Box_::into_raw(f),
1580 )
1581 }
1582 }
1583
1584 fn connect_property_show_border_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1585 unsafe extern "C" fn notify_show_border_trampoline<P, F: Fn(&P) + 'static>(
1586 this: *mut gtk_sys::GtkNotebook,
1587 _param_spec: glib_sys::gpointer,
1588 f: glib_sys::gpointer,
1589 ) where
1590 P: IsA<Notebook>,
1591 {
1592 let f: &F = &*(f as *const F);
1593 f(&Notebook::from_glib_borrow(this).unsafe_cast())
1594 }
1595 unsafe {
1596 let f: Box_<F> = Box_::new(f);
1597 connect_raw(
1598 self.as_ptr() as *mut _,
1599 b"notify::show-border\0".as_ptr() as *const _,
1600 Some(transmute(notify_show_border_trampoline::<Self, F> as usize)),
1601 Box_::into_raw(f),
1602 )
1603 }
1604 }
1605
1606 fn connect_property_show_tabs_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1607 unsafe extern "C" fn notify_show_tabs_trampoline<P, F: Fn(&P) + 'static>(
1608 this: *mut gtk_sys::GtkNotebook,
1609 _param_spec: glib_sys::gpointer,
1610 f: glib_sys::gpointer,
1611 ) where
1612 P: IsA<Notebook>,
1613 {
1614 let f: &F = &*(f as *const F);
1615 f(&Notebook::from_glib_borrow(this).unsafe_cast())
1616 }
1617 unsafe {
1618 let f: Box_<F> = Box_::new(f);
1619 connect_raw(
1620 self.as_ptr() as *mut _,
1621 b"notify::show-tabs\0".as_ptr() as *const _,
1622 Some(transmute(notify_show_tabs_trampoline::<Self, F> as usize)),
1623 Box_::into_raw(f),
1624 )
1625 }
1626 }
1627
1628 fn connect_property_tab_pos_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1629 unsafe extern "C" fn notify_tab_pos_trampoline<P, F: Fn(&P) + 'static>(
1630 this: *mut gtk_sys::GtkNotebook,
1631 _param_spec: glib_sys::gpointer,
1632 f: glib_sys::gpointer,
1633 ) where
1634 P: IsA<Notebook>,
1635 {
1636 let f: &F = &*(f as *const F);
1637 f(&Notebook::from_glib_borrow(this).unsafe_cast())
1638 }
1639 unsafe {
1640 let f: Box_<F> = Box_::new(f);
1641 connect_raw(
1642 self.as_ptr() as *mut _,
1643 b"notify::tab-pos\0".as_ptr() as *const _,
1644 Some(transmute(notify_tab_pos_trampoline::<Self, F> as usize)),
1645 Box_::into_raw(f),
1646 )
1647 }
1648 }
1649}
1650
1651impl fmt::Display for Notebook {
1652 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1653 write!(f, "Notebook")
1654 }
1655}