1use gdk;
6use glib::object::Cast;
7use glib::object::IsA;
8use glib::signal::connect_raw;
9use glib::signal::SignalHandlerId;
10use glib::translate::*;
11use glib::GString;
12use glib::StaticType;
13use glib::ToValue;
14use glib::Value;
15use glib_sys;
16use gobject_sys;
17use gtk_sys;
18use std::boxed::Box as Box_;
19use std::fmt;
20use std::mem::transmute;
21use Align;
22use Buildable;
23use Container;
24use PackType;
25use ResizeMode;
26use Widget;
27
28glib_wrapper! {
29 pub struct HeaderBar(Object<gtk_sys::GtkHeaderBar, gtk_sys::GtkHeaderBarClass, HeaderBarClass>) @extends Container, Widget, @implements Buildable;
30
31 match fn {
32 get_type => || gtk_sys::gtk_header_bar_get_type(),
33 }
34}
35
36impl HeaderBar {
37 pub fn new() -> HeaderBar {
38 assert_initialized_main_thread!();
39 unsafe { Widget::from_glib_none(gtk_sys::gtk_header_bar_new()).unsafe_cast() }
40 }
41}
42
43impl Default for HeaderBar {
44 fn default() -> Self {
45 Self::new()
46 }
47}
48
49pub struct HeaderBarBuilder {
50 custom_title: Option<Widget>,
51 decoration_layout: Option<String>,
52 decoration_layout_set: Option<bool>,
53 has_subtitle: Option<bool>,
54 show_close_button: Option<bool>,
55 spacing: Option<i32>,
56 subtitle: Option<String>,
57 title: Option<String>,
58 border_width: Option<u32>,
59 child: Option<Widget>,
60 resize_mode: Option<ResizeMode>,
61 app_paintable: Option<bool>,
62 can_default: Option<bool>,
63 can_focus: Option<bool>,
64 events: Option<gdk::EventMask>,
65 expand: Option<bool>,
66 #[cfg(any(feature = "v3_20", feature = "dox"))]
67 focus_on_click: Option<bool>,
68 halign: Option<Align>,
69 has_default: Option<bool>,
70 has_focus: Option<bool>,
71 has_tooltip: Option<bool>,
72 height_request: Option<i32>,
73 hexpand: Option<bool>,
74 hexpand_set: Option<bool>,
75 is_focus: Option<bool>,
76 margin: Option<i32>,
77 margin_bottom: Option<i32>,
78 margin_end: Option<i32>,
79 margin_start: Option<i32>,
80 margin_top: Option<i32>,
81 name: Option<String>,
82 no_show_all: Option<bool>,
83 opacity: Option<f64>,
84 parent: Option<Container>,
85 receives_default: Option<bool>,
86 sensitive: Option<bool>,
87 tooltip_markup: Option<String>,
89 tooltip_text: Option<String>,
90 valign: Option<Align>,
91 vexpand: Option<bool>,
92 vexpand_set: Option<bool>,
93 visible: Option<bool>,
94 width_request: Option<i32>,
95}
96
97impl HeaderBarBuilder {
98 pub fn new() -> Self {
99 Self {
100 custom_title: None,
101 decoration_layout: None,
102 decoration_layout_set: None,
103 has_subtitle: None,
104 show_close_button: None,
105 spacing: None,
106 subtitle: None,
107 title: None,
108 border_width: None,
109 child: None,
110 resize_mode: None,
111 app_paintable: None,
112 can_default: None,
113 can_focus: None,
114 events: None,
115 expand: None,
116 #[cfg(any(feature = "v3_20", feature = "dox"))]
117 focus_on_click: None,
118 halign: None,
119 has_default: None,
120 has_focus: None,
121 has_tooltip: None,
122 height_request: None,
123 hexpand: None,
124 hexpand_set: None,
125 is_focus: None,
126 margin: None,
127 margin_bottom: None,
128 margin_end: None,
129 margin_start: None,
130 margin_top: None,
131 name: None,
132 no_show_all: None,
133 opacity: None,
134 parent: None,
135 receives_default: None,
136 sensitive: None,
137 tooltip_markup: None,
138 tooltip_text: None,
139 valign: None,
140 vexpand: None,
141 vexpand_set: None,
142 visible: None,
143 width_request: None,
144 }
145 }
146
147 pub fn build(self) -> HeaderBar {
148 let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
149 if let Some(ref custom_title) = self.custom_title {
150 properties.push(("custom-title", custom_title));
151 }
152 if let Some(ref decoration_layout) = self.decoration_layout {
153 properties.push(("decoration-layout", decoration_layout));
154 }
155 if let Some(ref decoration_layout_set) = self.decoration_layout_set {
156 properties.push(("decoration-layout-set", decoration_layout_set));
157 }
158 if let Some(ref has_subtitle) = self.has_subtitle {
159 properties.push(("has-subtitle", has_subtitle));
160 }
161 if let Some(ref show_close_button) = self.show_close_button {
162 properties.push(("show-close-button", show_close_button));
163 }
164 if let Some(ref spacing) = self.spacing {
165 properties.push(("spacing", spacing));
166 }
167 if let Some(ref subtitle) = self.subtitle {
168 properties.push(("subtitle", subtitle));
169 }
170 if let Some(ref title) = self.title {
171 properties.push(("title", title));
172 }
173 if let Some(ref border_width) = self.border_width {
174 properties.push(("border-width", border_width));
175 }
176 if let Some(ref child) = self.child {
177 properties.push(("child", child));
178 }
179 if let Some(ref resize_mode) = self.resize_mode {
180 properties.push(("resize-mode", resize_mode));
181 }
182 if let Some(ref app_paintable) = self.app_paintable {
183 properties.push(("app-paintable", app_paintable));
184 }
185 if let Some(ref can_default) = self.can_default {
186 properties.push(("can-default", can_default));
187 }
188 if let Some(ref can_focus) = self.can_focus {
189 properties.push(("can-focus", can_focus));
190 }
191 if let Some(ref events) = self.events {
192 properties.push(("events", events));
193 }
194 if let Some(ref expand) = self.expand {
195 properties.push(("expand", expand));
196 }
197 #[cfg(any(feature = "v3_20", feature = "dox"))]
198 {
199 if let Some(ref focus_on_click) = self.focus_on_click {
200 properties.push(("focus-on-click", focus_on_click));
201 }
202 }
203 if let Some(ref halign) = self.halign {
204 properties.push(("halign", halign));
205 }
206 if let Some(ref has_default) = self.has_default {
207 properties.push(("has-default", has_default));
208 }
209 if let Some(ref has_focus) = self.has_focus {
210 properties.push(("has-focus", has_focus));
211 }
212 if let Some(ref has_tooltip) = self.has_tooltip {
213 properties.push(("has-tooltip", has_tooltip));
214 }
215 if let Some(ref height_request) = self.height_request {
216 properties.push(("height-request", height_request));
217 }
218 if let Some(ref hexpand) = self.hexpand {
219 properties.push(("hexpand", hexpand));
220 }
221 if let Some(ref hexpand_set) = self.hexpand_set {
222 properties.push(("hexpand-set", hexpand_set));
223 }
224 if let Some(ref is_focus) = self.is_focus {
225 properties.push(("is-focus", is_focus));
226 }
227 if let Some(ref margin) = self.margin {
228 properties.push(("margin", margin));
229 }
230 if let Some(ref margin_bottom) = self.margin_bottom {
231 properties.push(("margin-bottom", margin_bottom));
232 }
233 if let Some(ref margin_end) = self.margin_end {
234 properties.push(("margin-end", margin_end));
235 }
236 if let Some(ref margin_start) = self.margin_start {
237 properties.push(("margin-start", margin_start));
238 }
239 if let Some(ref margin_top) = self.margin_top {
240 properties.push(("margin-top", margin_top));
241 }
242 if let Some(ref name) = self.name {
243 properties.push(("name", name));
244 }
245 if let Some(ref no_show_all) = self.no_show_all {
246 properties.push(("no-show-all", no_show_all));
247 }
248 if let Some(ref opacity) = self.opacity {
249 properties.push(("opacity", opacity));
250 }
251 if let Some(ref parent) = self.parent {
252 properties.push(("parent", parent));
253 }
254 if let Some(ref receives_default) = self.receives_default {
255 properties.push(("receives-default", receives_default));
256 }
257 if let Some(ref sensitive) = self.sensitive {
258 properties.push(("sensitive", sensitive));
259 }
260 if let Some(ref tooltip_markup) = self.tooltip_markup {
261 properties.push(("tooltip-markup", tooltip_markup));
262 }
263 if let Some(ref tooltip_text) = self.tooltip_text {
264 properties.push(("tooltip-text", tooltip_text));
265 }
266 if let Some(ref valign) = self.valign {
267 properties.push(("valign", valign));
268 }
269 if let Some(ref vexpand) = self.vexpand {
270 properties.push(("vexpand", vexpand));
271 }
272 if let Some(ref vexpand_set) = self.vexpand_set {
273 properties.push(("vexpand-set", vexpand_set));
274 }
275 if let Some(ref visible) = self.visible {
276 properties.push(("visible", visible));
277 }
278 if let Some(ref width_request) = self.width_request {
279 properties.push(("width-request", width_request));
280 }
281 glib::Object::new(HeaderBar::static_type(), &properties)
282 .expect("object new")
283 .downcast()
284 .expect("downcast")
285 }
286
287 pub fn custom_title(mut self, custom_title: &Widget) -> Self {
288 self.custom_title = Some(custom_title.clone());
289 self
290 }
291
292 pub fn decoration_layout(mut self, decoration_layout: &str) -> Self {
293 self.decoration_layout = Some(decoration_layout.to_string());
294 self
295 }
296
297 pub fn decoration_layout_set(mut self, decoration_layout_set: bool) -> Self {
298 self.decoration_layout_set = Some(decoration_layout_set);
299 self
300 }
301
302 pub fn has_subtitle(mut self, has_subtitle: bool) -> Self {
303 self.has_subtitle = Some(has_subtitle);
304 self
305 }
306
307 pub fn show_close_button(mut self, show_close_button: bool) -> Self {
308 self.show_close_button = Some(show_close_button);
309 self
310 }
311
312 pub fn spacing(mut self, spacing: i32) -> Self {
313 self.spacing = Some(spacing);
314 self
315 }
316
317 pub fn subtitle(mut self, subtitle: &str) -> Self {
318 self.subtitle = Some(subtitle.to_string());
319 self
320 }
321
322 pub fn title(mut self, title: &str) -> Self {
323 self.title = Some(title.to_string());
324 self
325 }
326
327 pub fn border_width(mut self, border_width: u32) -> Self {
328 self.border_width = Some(border_width);
329 self
330 }
331
332 pub fn child(mut self, child: &Widget) -> Self {
333 self.child = Some(child.clone());
334 self
335 }
336
337 pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self {
338 self.resize_mode = Some(resize_mode);
339 self
340 }
341
342 pub fn app_paintable(mut self, app_paintable: bool) -> Self {
343 self.app_paintable = Some(app_paintable);
344 self
345 }
346
347 pub fn can_default(mut self, can_default: bool) -> Self {
348 self.can_default = Some(can_default);
349 self
350 }
351
352 pub fn can_focus(mut self, can_focus: bool) -> Self {
353 self.can_focus = Some(can_focus);
354 self
355 }
356
357 pub fn events(mut self, events: gdk::EventMask) -> Self {
358 self.events = Some(events);
359 self
360 }
361
362 pub fn expand(mut self, expand: bool) -> Self {
363 self.expand = Some(expand);
364 self
365 }
366
367 #[cfg(any(feature = "v3_20", feature = "dox"))]
368 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self {
369 self.focus_on_click = Some(focus_on_click);
370 self
371 }
372
373 pub fn halign(mut self, halign: Align) -> Self {
374 self.halign = Some(halign);
375 self
376 }
377
378 pub fn has_default(mut self, has_default: bool) -> Self {
379 self.has_default = Some(has_default);
380 self
381 }
382
383 pub fn has_focus(mut self, has_focus: bool) -> Self {
384 self.has_focus = Some(has_focus);
385 self
386 }
387
388 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self {
389 self.has_tooltip = Some(has_tooltip);
390 self
391 }
392
393 pub fn height_request(mut self, height_request: i32) -> Self {
394 self.height_request = Some(height_request);
395 self
396 }
397
398 pub fn hexpand(mut self, hexpand: bool) -> Self {
399 self.hexpand = Some(hexpand);
400 self
401 }
402
403 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self {
404 self.hexpand_set = Some(hexpand_set);
405 self
406 }
407
408 pub fn is_focus(mut self, is_focus: bool) -> Self {
409 self.is_focus = Some(is_focus);
410 self
411 }
412
413 pub fn margin(mut self, margin: i32) -> Self {
414 self.margin = Some(margin);
415 self
416 }
417
418 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self {
419 self.margin_bottom = Some(margin_bottom);
420 self
421 }
422
423 pub fn margin_end(mut self, margin_end: i32) -> Self {
424 self.margin_end = Some(margin_end);
425 self
426 }
427
428 pub fn margin_start(mut self, margin_start: i32) -> Self {
429 self.margin_start = Some(margin_start);
430 self
431 }
432
433 pub fn margin_top(mut self, margin_top: i32) -> Self {
434 self.margin_top = Some(margin_top);
435 self
436 }
437
438 pub fn name(mut self, name: &str) -> Self {
439 self.name = Some(name.to_string());
440 self
441 }
442
443 pub fn no_show_all(mut self, no_show_all: bool) -> Self {
444 self.no_show_all = Some(no_show_all);
445 self
446 }
447
448 pub fn opacity(mut self, opacity: f64) -> Self {
449 self.opacity = Some(opacity);
450 self
451 }
452
453 pub fn parent(mut self, parent: &Container) -> Self {
454 self.parent = Some(parent.clone());
455 self
456 }
457
458 pub fn receives_default(mut self, receives_default: bool) -> Self {
459 self.receives_default = Some(receives_default);
460 self
461 }
462
463 pub fn sensitive(mut self, sensitive: bool) -> Self {
464 self.sensitive = Some(sensitive);
465 self
466 }
467
468 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self {
469 self.tooltip_markup = Some(tooltip_markup.to_string());
470 self
471 }
472
473 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self {
474 self.tooltip_text = Some(tooltip_text.to_string());
475 self
476 }
477
478 pub fn valign(mut self, valign: Align) -> Self {
479 self.valign = Some(valign);
480 self
481 }
482
483 pub fn vexpand(mut self, vexpand: bool) -> Self {
484 self.vexpand = Some(vexpand);
485 self
486 }
487
488 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self {
489 self.vexpand_set = Some(vexpand_set);
490 self
491 }
492
493 pub fn visible(mut self, visible: bool) -> Self {
494 self.visible = Some(visible);
495 self
496 }
497
498 pub fn width_request(mut self, width_request: i32) -> Self {
499 self.width_request = Some(width_request);
500 self
501 }
502}
503
504pub const NONE_HEADER_BAR: Option<&HeaderBar> = None;
505
506pub trait HeaderBarExt: 'static {
507 fn get_custom_title(&self) -> Option<Widget>;
508
509 fn get_decoration_layout(&self) -> Option<GString>;
510
511 fn get_has_subtitle(&self) -> bool;
512
513 fn get_show_close_button(&self) -> bool;
514
515 fn get_subtitle(&self) -> Option<GString>;
516
517 fn get_title(&self) -> Option<GString>;
518
519 fn pack_end<P: IsA<Widget>>(&self, child: &P);
520
521 fn pack_start<P: IsA<Widget>>(&self, child: &P);
522
523 fn set_custom_title<P: IsA<Widget>>(&self, title_widget: Option<&P>);
524
525 fn set_decoration_layout(&self, layout: Option<&str>);
526
527 fn set_has_subtitle(&self, setting: bool);
528
529 fn set_show_close_button(&self, setting: bool);
530
531 fn set_subtitle(&self, subtitle: Option<&str>);
532
533 fn set_title(&self, title: Option<&str>);
534
535 fn get_property_decoration_layout_set(&self) -> bool;
536
537 fn set_property_decoration_layout_set(&self, decoration_layout_set: bool);
538
539 fn get_property_spacing(&self) -> i32;
540
541 fn set_property_spacing(&self, spacing: i32);
542
543 fn get_child_pack_type<T: IsA<Widget>>(&self, item: &T) -> PackType;
544
545 fn set_child_pack_type<T: IsA<Widget>>(&self, item: &T, pack_type: PackType);
546
547 fn get_child_position<T: IsA<Widget>>(&self, item: &T) -> i32;
548
549 fn set_child_position<T: IsA<Widget>>(&self, item: &T, position: i32);
550
551 fn connect_property_custom_title_notify<F: Fn(&Self) + 'static>(&self, f: F)
552 -> SignalHandlerId;
553
554 fn connect_property_decoration_layout_notify<F: Fn(&Self) + 'static>(
555 &self,
556 f: F,
557 ) -> SignalHandlerId;
558
559 fn connect_property_decoration_layout_set_notify<F: Fn(&Self) + 'static>(
560 &self,
561 f: F,
562 ) -> SignalHandlerId;
563
564 fn connect_property_has_subtitle_notify<F: Fn(&Self) + 'static>(&self, f: F)
565 -> SignalHandlerId;
566
567 fn connect_property_show_close_button_notify<F: Fn(&Self) + 'static>(
568 &self,
569 f: F,
570 ) -> SignalHandlerId;
571
572 fn connect_property_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
573
574 fn connect_property_subtitle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
575
576 fn connect_property_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
577}
578
579impl<O: IsA<HeaderBar>> HeaderBarExt for O {
580 fn get_custom_title(&self) -> Option<Widget> {
581 unsafe {
582 from_glib_none(gtk_sys::gtk_header_bar_get_custom_title(
583 self.as_ref().to_glib_none().0,
584 ))
585 }
586 }
587
588 fn get_decoration_layout(&self) -> Option<GString> {
589 unsafe {
590 from_glib_none(gtk_sys::gtk_header_bar_get_decoration_layout(
591 self.as_ref().to_glib_none().0,
592 ))
593 }
594 }
595
596 fn get_has_subtitle(&self) -> bool {
597 unsafe {
598 from_glib(gtk_sys::gtk_header_bar_get_has_subtitle(
599 self.as_ref().to_glib_none().0,
600 ))
601 }
602 }
603
604 fn get_show_close_button(&self) -> bool {
605 unsafe {
606 from_glib(gtk_sys::gtk_header_bar_get_show_close_button(
607 self.as_ref().to_glib_none().0,
608 ))
609 }
610 }
611
612 fn get_subtitle(&self) -> Option<GString> {
613 unsafe {
614 from_glib_none(gtk_sys::gtk_header_bar_get_subtitle(
615 self.as_ref().to_glib_none().0,
616 ))
617 }
618 }
619
620 fn get_title(&self) -> Option<GString> {
621 unsafe {
622 from_glib_none(gtk_sys::gtk_header_bar_get_title(
623 self.as_ref().to_glib_none().0,
624 ))
625 }
626 }
627
628 fn pack_end<P: IsA<Widget>>(&self, child: &P) {
629 unsafe {
630 gtk_sys::gtk_header_bar_pack_end(
631 self.as_ref().to_glib_none().0,
632 child.as_ref().to_glib_none().0,
633 );
634 }
635 }
636
637 fn pack_start<P: IsA<Widget>>(&self, child: &P) {
638 unsafe {
639 gtk_sys::gtk_header_bar_pack_start(
640 self.as_ref().to_glib_none().0,
641 child.as_ref().to_glib_none().0,
642 );
643 }
644 }
645
646 fn set_custom_title<P: IsA<Widget>>(&self, title_widget: Option<&P>) {
647 unsafe {
648 gtk_sys::gtk_header_bar_set_custom_title(
649 self.as_ref().to_glib_none().0,
650 title_widget.map(|p| p.as_ref()).to_glib_none().0,
651 );
652 }
653 }
654
655 fn set_decoration_layout(&self, layout: Option<&str>) {
656 unsafe {
657 gtk_sys::gtk_header_bar_set_decoration_layout(
658 self.as_ref().to_glib_none().0,
659 layout.to_glib_none().0,
660 );
661 }
662 }
663
664 fn set_has_subtitle(&self, setting: bool) {
665 unsafe {
666 gtk_sys::gtk_header_bar_set_has_subtitle(
667 self.as_ref().to_glib_none().0,
668 setting.to_glib(),
669 );
670 }
671 }
672
673 fn set_show_close_button(&self, setting: bool) {
674 unsafe {
675 gtk_sys::gtk_header_bar_set_show_close_button(
676 self.as_ref().to_glib_none().0,
677 setting.to_glib(),
678 );
679 }
680 }
681
682 fn set_subtitle(&self, subtitle: Option<&str>) {
683 unsafe {
684 gtk_sys::gtk_header_bar_set_subtitle(
685 self.as_ref().to_glib_none().0,
686 subtitle.to_glib_none().0,
687 );
688 }
689 }
690
691 fn set_title(&self, title: Option<&str>) {
692 unsafe {
693 gtk_sys::gtk_header_bar_set_title(
694 self.as_ref().to_glib_none().0,
695 title.to_glib_none().0,
696 );
697 }
698 }
699
700 fn get_property_decoration_layout_set(&self) -> bool {
701 unsafe {
702 let mut value = Value::from_type(<bool as StaticType>::static_type());
703 gobject_sys::g_object_get_property(
704 self.to_glib_none().0 as *mut gobject_sys::GObject,
705 b"decoration-layout-set\0".as_ptr() as *const _,
706 value.to_glib_none_mut().0,
707 );
708 value.get().unwrap()
709 }
710 }
711
712 fn set_property_decoration_layout_set(&self, decoration_layout_set: bool) {
713 unsafe {
714 gobject_sys::g_object_set_property(
715 self.to_glib_none().0 as *mut gobject_sys::GObject,
716 b"decoration-layout-set\0".as_ptr() as *const _,
717 Value::from(&decoration_layout_set).to_glib_none().0,
718 );
719 }
720 }
721
722 fn get_property_spacing(&self) -> i32 {
723 unsafe {
724 let mut value = Value::from_type(<i32 as StaticType>::static_type());
725 gobject_sys::g_object_get_property(
726 self.to_glib_none().0 as *mut gobject_sys::GObject,
727 b"spacing\0".as_ptr() as *const _,
728 value.to_glib_none_mut().0,
729 );
730 value.get().unwrap()
731 }
732 }
733
734 fn set_property_spacing(&self, spacing: i32) {
735 unsafe {
736 gobject_sys::g_object_set_property(
737 self.to_glib_none().0 as *mut gobject_sys::GObject,
738 b"spacing\0".as_ptr() as *const _,
739 Value::from(&spacing).to_glib_none().0,
740 );
741 }
742 }
743
744 fn get_child_pack_type<T: IsA<Widget>>(&self, item: &T) -> PackType {
745 unsafe {
746 let mut value = Value::from_type(<PackType as StaticType>::static_type());
747 gtk_sys::gtk_container_child_get_property(
748 self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
749 item.to_glib_none().0 as *mut _,
750 b"pack-type\0".as_ptr() as *const _,
751 value.to_glib_none_mut().0,
752 );
753 value.get().unwrap()
754 }
755 }
756
757 fn set_child_pack_type<T: IsA<Widget>>(&self, item: &T, pack_type: PackType) {
758 unsafe {
759 gtk_sys::gtk_container_child_set_property(
760 self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
761 item.to_glib_none().0 as *mut _,
762 b"pack-type\0".as_ptr() as *const _,
763 Value::from(&pack_type).to_glib_none().0,
764 );
765 }
766 }
767
768 fn get_child_position<T: IsA<Widget>>(&self, item: &T) -> i32 {
769 unsafe {
770 let mut value = Value::from_type(<i32 as StaticType>::static_type());
771 gtk_sys::gtk_container_child_get_property(
772 self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
773 item.to_glib_none().0 as *mut _,
774 b"position\0".as_ptr() as *const _,
775 value.to_glib_none_mut().0,
776 );
777 value.get().unwrap()
778 }
779 }
780
781 fn set_child_position<T: IsA<Widget>>(&self, item: &T, position: i32) {
782 unsafe {
783 gtk_sys::gtk_container_child_set_property(
784 self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
785 item.to_glib_none().0 as *mut _,
786 b"position\0".as_ptr() as *const _,
787 Value::from(&position).to_glib_none().0,
788 );
789 }
790 }
791
792 fn connect_property_custom_title_notify<F: Fn(&Self) + 'static>(
793 &self,
794 f: F,
795 ) -> SignalHandlerId {
796 unsafe extern "C" fn notify_custom_title_trampoline<P, F: Fn(&P) + 'static>(
797 this: *mut gtk_sys::GtkHeaderBar,
798 _param_spec: glib_sys::gpointer,
799 f: glib_sys::gpointer,
800 ) where
801 P: IsA<HeaderBar>,
802 {
803 let f: &F = &*(f as *const F);
804 f(&HeaderBar::from_glib_borrow(this).unsafe_cast())
805 }
806 unsafe {
807 let f: Box_<F> = Box_::new(f);
808 connect_raw(
809 self.as_ptr() as *mut _,
810 b"notify::custom-title\0".as_ptr() as *const _,
811 Some(transmute(
812 notify_custom_title_trampoline::<Self, F> as usize,
813 )),
814 Box_::into_raw(f),
815 )
816 }
817 }
818
819 fn connect_property_decoration_layout_notify<F: Fn(&Self) + 'static>(
820 &self,
821 f: F,
822 ) -> SignalHandlerId {
823 unsafe extern "C" fn notify_decoration_layout_trampoline<P, F: Fn(&P) + 'static>(
824 this: *mut gtk_sys::GtkHeaderBar,
825 _param_spec: glib_sys::gpointer,
826 f: glib_sys::gpointer,
827 ) where
828 P: IsA<HeaderBar>,
829 {
830 let f: &F = &*(f as *const F);
831 f(&HeaderBar::from_glib_borrow(this).unsafe_cast())
832 }
833 unsafe {
834 let f: Box_<F> = Box_::new(f);
835 connect_raw(
836 self.as_ptr() as *mut _,
837 b"notify::decoration-layout\0".as_ptr() as *const _,
838 Some(transmute(
839 notify_decoration_layout_trampoline::<Self, F> as usize,
840 )),
841 Box_::into_raw(f),
842 )
843 }
844 }
845
846 fn connect_property_decoration_layout_set_notify<F: Fn(&Self) + 'static>(
847 &self,
848 f: F,
849 ) -> SignalHandlerId {
850 unsafe extern "C" fn notify_decoration_layout_set_trampoline<P, F: Fn(&P) + 'static>(
851 this: *mut gtk_sys::GtkHeaderBar,
852 _param_spec: glib_sys::gpointer,
853 f: glib_sys::gpointer,
854 ) where
855 P: IsA<HeaderBar>,
856 {
857 let f: &F = &*(f as *const F);
858 f(&HeaderBar::from_glib_borrow(this).unsafe_cast())
859 }
860 unsafe {
861 let f: Box_<F> = Box_::new(f);
862 connect_raw(
863 self.as_ptr() as *mut _,
864 b"notify::decoration-layout-set\0".as_ptr() as *const _,
865 Some(transmute(
866 notify_decoration_layout_set_trampoline::<Self, F> as usize,
867 )),
868 Box_::into_raw(f),
869 )
870 }
871 }
872
873 fn connect_property_has_subtitle_notify<F: Fn(&Self) + 'static>(
874 &self,
875 f: F,
876 ) -> SignalHandlerId {
877 unsafe extern "C" fn notify_has_subtitle_trampoline<P, F: Fn(&P) + 'static>(
878 this: *mut gtk_sys::GtkHeaderBar,
879 _param_spec: glib_sys::gpointer,
880 f: glib_sys::gpointer,
881 ) where
882 P: IsA<HeaderBar>,
883 {
884 let f: &F = &*(f as *const F);
885 f(&HeaderBar::from_glib_borrow(this).unsafe_cast())
886 }
887 unsafe {
888 let f: Box_<F> = Box_::new(f);
889 connect_raw(
890 self.as_ptr() as *mut _,
891 b"notify::has-subtitle\0".as_ptr() as *const _,
892 Some(transmute(
893 notify_has_subtitle_trampoline::<Self, F> as usize,
894 )),
895 Box_::into_raw(f),
896 )
897 }
898 }
899
900 fn connect_property_show_close_button_notify<F: Fn(&Self) + 'static>(
901 &self,
902 f: F,
903 ) -> SignalHandlerId {
904 unsafe extern "C" fn notify_show_close_button_trampoline<P, F: Fn(&P) + 'static>(
905 this: *mut gtk_sys::GtkHeaderBar,
906 _param_spec: glib_sys::gpointer,
907 f: glib_sys::gpointer,
908 ) where
909 P: IsA<HeaderBar>,
910 {
911 let f: &F = &*(f as *const F);
912 f(&HeaderBar::from_glib_borrow(this).unsafe_cast())
913 }
914 unsafe {
915 let f: Box_<F> = Box_::new(f);
916 connect_raw(
917 self.as_ptr() as *mut _,
918 b"notify::show-close-button\0".as_ptr() as *const _,
919 Some(transmute(
920 notify_show_close_button_trampoline::<Self, F> as usize,
921 )),
922 Box_::into_raw(f),
923 )
924 }
925 }
926
927 fn connect_property_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
928 unsafe extern "C" fn notify_spacing_trampoline<P, F: Fn(&P) + 'static>(
929 this: *mut gtk_sys::GtkHeaderBar,
930 _param_spec: glib_sys::gpointer,
931 f: glib_sys::gpointer,
932 ) where
933 P: IsA<HeaderBar>,
934 {
935 let f: &F = &*(f as *const F);
936 f(&HeaderBar::from_glib_borrow(this).unsafe_cast())
937 }
938 unsafe {
939 let f: Box_<F> = Box_::new(f);
940 connect_raw(
941 self.as_ptr() as *mut _,
942 b"notify::spacing\0".as_ptr() as *const _,
943 Some(transmute(notify_spacing_trampoline::<Self, F> as usize)),
944 Box_::into_raw(f),
945 )
946 }
947 }
948
949 fn connect_property_subtitle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
950 unsafe extern "C" fn notify_subtitle_trampoline<P, F: Fn(&P) + 'static>(
951 this: *mut gtk_sys::GtkHeaderBar,
952 _param_spec: glib_sys::gpointer,
953 f: glib_sys::gpointer,
954 ) where
955 P: IsA<HeaderBar>,
956 {
957 let f: &F = &*(f as *const F);
958 f(&HeaderBar::from_glib_borrow(this).unsafe_cast())
959 }
960 unsafe {
961 let f: Box_<F> = Box_::new(f);
962 connect_raw(
963 self.as_ptr() as *mut _,
964 b"notify::subtitle\0".as_ptr() as *const _,
965 Some(transmute(notify_subtitle_trampoline::<Self, F> as usize)),
966 Box_::into_raw(f),
967 )
968 }
969 }
970
971 fn connect_property_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
972 unsafe extern "C" fn notify_title_trampoline<P, F: Fn(&P) + 'static>(
973 this: *mut gtk_sys::GtkHeaderBar,
974 _param_spec: glib_sys::gpointer,
975 f: glib_sys::gpointer,
976 ) where
977 P: IsA<HeaderBar>,
978 {
979 let f: &F = &*(f as *const F);
980 f(&HeaderBar::from_glib_borrow(this).unsafe_cast())
981 }
982 unsafe {
983 let f: Box_<F> = Box_::new(f);
984 connect_raw(
985 self.as_ptr() as *mut _,
986 b"notify::title\0".as_ptr() as *const _,
987 Some(transmute(notify_title_trampoline::<Self, F> as usize)),
988 Box_::into_raw(f),
989 )
990 }
991 }
992}
993
994impl fmt::Display for HeaderBar {
995 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
996 write!(f, "HeaderBar")
997 }
998}