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_sys;
15use gtk_sys;
16use std::boxed::Box as Box_;
17use std::fmt;
18use std::mem::transmute;
19use Actionable;
20use Align;
21use Bin;
22use Buildable;
23use Button;
24use Container;
25use FontChooser;
26use PositionType;
27use ReliefStyle;
28use ResizeMode;
29use Widget;
30
31glib_wrapper! {
32 pub struct FontButton(Object<gtk_sys::GtkFontButton, gtk_sys::GtkFontButtonClass, FontButtonClass>) @extends Button, Bin, Container, Widget, @implements Buildable, Actionable, FontChooser;
33
34 match fn {
35 get_type => || gtk_sys::gtk_font_button_get_type(),
36 }
37}
38
39impl FontButton {
40 pub fn new() -> FontButton {
41 assert_initialized_main_thread!();
42 unsafe { Widget::from_glib_none(gtk_sys::gtk_font_button_new()).unsafe_cast() }
43 }
44
45 pub fn new_with_font(fontname: &str) -> FontButton {
46 assert_initialized_main_thread!();
47 unsafe {
48 Widget::from_glib_none(gtk_sys::gtk_font_button_new_with_font(
49 fontname.to_glib_none().0,
50 ))
51 .unsafe_cast()
52 }
53 }
54}
55
56impl Default for FontButton {
57 fn default() -> Self {
58 Self::new()
59 }
60}
61
62pub struct FontButtonBuilder {
63 font_name: Option<String>,
64 show_size: Option<bool>,
65 show_style: Option<bool>,
66 title: Option<String>,
67 use_font: Option<bool>,
68 use_size: Option<bool>,
69 always_show_image: Option<bool>,
70 image: Option<Widget>,
71 image_position: Option<PositionType>,
72 label: Option<String>,
73 relief: Option<ReliefStyle>,
74 use_underline: Option<bool>,
75 border_width: Option<u32>,
76 child: Option<Widget>,
77 resize_mode: Option<ResizeMode>,
78 app_paintable: Option<bool>,
79 can_default: Option<bool>,
80 can_focus: Option<bool>,
81 events: Option<gdk::EventMask>,
82 expand: Option<bool>,
83 #[cfg(any(feature = "v3_20", feature = "dox"))]
84 focus_on_click: Option<bool>,
85 halign: Option<Align>,
86 has_default: Option<bool>,
87 has_focus: Option<bool>,
88 has_tooltip: Option<bool>,
89 height_request: Option<i32>,
90 hexpand: Option<bool>,
91 hexpand_set: Option<bool>,
92 is_focus: Option<bool>,
93 margin: Option<i32>,
94 margin_bottom: Option<i32>,
95 margin_end: Option<i32>,
96 margin_start: Option<i32>,
97 margin_top: Option<i32>,
98 name: Option<String>,
99 no_show_all: Option<bool>,
100 opacity: Option<f64>,
101 parent: Option<Container>,
102 receives_default: Option<bool>,
103 sensitive: Option<bool>,
104 tooltip_markup: Option<String>,
106 tooltip_text: Option<String>,
107 valign: Option<Align>,
108 vexpand: Option<bool>,
109 vexpand_set: Option<bool>,
110 visible: Option<bool>,
111 width_request: Option<i32>,
112}
113
114impl FontButtonBuilder {
115 pub fn new() -> Self {
116 Self {
117 font_name: None,
118 show_size: None,
119 show_style: None,
120 title: None,
121 use_font: None,
122 use_size: None,
123 always_show_image: None,
124 image: None,
125 image_position: None,
126 label: None,
127 relief: None,
128 use_underline: None,
129 border_width: None,
130 child: None,
131 resize_mode: None,
132 app_paintable: None,
133 can_default: None,
134 can_focus: None,
135 events: None,
136 expand: None,
137 #[cfg(any(feature = "v3_20", feature = "dox"))]
138 focus_on_click: None,
139 halign: None,
140 has_default: None,
141 has_focus: None,
142 has_tooltip: None,
143 height_request: None,
144 hexpand: None,
145 hexpand_set: None,
146 is_focus: None,
147 margin: None,
148 margin_bottom: None,
149 margin_end: None,
150 margin_start: None,
151 margin_top: None,
152 name: None,
153 no_show_all: None,
154 opacity: None,
155 parent: None,
156 receives_default: None,
157 sensitive: None,
158 tooltip_markup: None,
159 tooltip_text: None,
160 valign: None,
161 vexpand: None,
162 vexpand_set: None,
163 visible: None,
164 width_request: None,
165 }
166 }
167
168 pub fn build(self) -> FontButton {
169 let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
170 if let Some(ref font_name) = self.font_name {
171 properties.push(("font-name", font_name));
172 }
173 if let Some(ref show_size) = self.show_size {
174 properties.push(("show-size", show_size));
175 }
176 if let Some(ref show_style) = self.show_style {
177 properties.push(("show-style", show_style));
178 }
179 if let Some(ref title) = self.title {
180 properties.push(("title", title));
181 }
182 if let Some(ref use_font) = self.use_font {
183 properties.push(("use-font", use_font));
184 }
185 if let Some(ref use_size) = self.use_size {
186 properties.push(("use-size", use_size));
187 }
188 if let Some(ref always_show_image) = self.always_show_image {
189 properties.push(("always-show-image", always_show_image));
190 }
191 if let Some(ref image) = self.image {
192 properties.push(("image", image));
193 }
194 if let Some(ref image_position) = self.image_position {
195 properties.push(("image-position", image_position));
196 }
197 if let Some(ref label) = self.label {
198 properties.push(("label", label));
199 }
200 if let Some(ref relief) = self.relief {
201 properties.push(("relief", relief));
202 }
203 if let Some(ref use_underline) = self.use_underline {
204 properties.push(("use-underline", use_underline));
205 }
206 if let Some(ref border_width) = self.border_width {
207 properties.push(("border-width", border_width));
208 }
209 if let Some(ref child) = self.child {
210 properties.push(("child", child));
211 }
212 if let Some(ref resize_mode) = self.resize_mode {
213 properties.push(("resize-mode", resize_mode));
214 }
215 if let Some(ref app_paintable) = self.app_paintable {
216 properties.push(("app-paintable", app_paintable));
217 }
218 if let Some(ref can_default) = self.can_default {
219 properties.push(("can-default", can_default));
220 }
221 if let Some(ref can_focus) = self.can_focus {
222 properties.push(("can-focus", can_focus));
223 }
224 if let Some(ref events) = self.events {
225 properties.push(("events", events));
226 }
227 if let Some(ref expand) = self.expand {
228 properties.push(("expand", expand));
229 }
230 #[cfg(any(feature = "v3_20", feature = "dox"))]
231 {
232 if let Some(ref focus_on_click) = self.focus_on_click {
233 properties.push(("focus-on-click", focus_on_click));
234 }
235 }
236 if let Some(ref halign) = self.halign {
237 properties.push(("halign", halign));
238 }
239 if let Some(ref has_default) = self.has_default {
240 properties.push(("has-default", has_default));
241 }
242 if let Some(ref has_focus) = self.has_focus {
243 properties.push(("has-focus", has_focus));
244 }
245 if let Some(ref has_tooltip) = self.has_tooltip {
246 properties.push(("has-tooltip", has_tooltip));
247 }
248 if let Some(ref height_request) = self.height_request {
249 properties.push(("height-request", height_request));
250 }
251 if let Some(ref hexpand) = self.hexpand {
252 properties.push(("hexpand", hexpand));
253 }
254 if let Some(ref hexpand_set) = self.hexpand_set {
255 properties.push(("hexpand-set", hexpand_set));
256 }
257 if let Some(ref is_focus) = self.is_focus {
258 properties.push(("is-focus", is_focus));
259 }
260 if let Some(ref margin) = self.margin {
261 properties.push(("margin", margin));
262 }
263 if let Some(ref margin_bottom) = self.margin_bottom {
264 properties.push(("margin-bottom", margin_bottom));
265 }
266 if let Some(ref margin_end) = self.margin_end {
267 properties.push(("margin-end", margin_end));
268 }
269 if let Some(ref margin_start) = self.margin_start {
270 properties.push(("margin-start", margin_start));
271 }
272 if let Some(ref margin_top) = self.margin_top {
273 properties.push(("margin-top", margin_top));
274 }
275 if let Some(ref name) = self.name {
276 properties.push(("name", name));
277 }
278 if let Some(ref no_show_all) = self.no_show_all {
279 properties.push(("no-show-all", no_show_all));
280 }
281 if let Some(ref opacity) = self.opacity {
282 properties.push(("opacity", opacity));
283 }
284 if let Some(ref parent) = self.parent {
285 properties.push(("parent", parent));
286 }
287 if let Some(ref receives_default) = self.receives_default {
288 properties.push(("receives-default", receives_default));
289 }
290 if let Some(ref sensitive) = self.sensitive {
291 properties.push(("sensitive", sensitive));
292 }
293 if let Some(ref tooltip_markup) = self.tooltip_markup {
294 properties.push(("tooltip-markup", tooltip_markup));
295 }
296 if let Some(ref tooltip_text) = self.tooltip_text {
297 properties.push(("tooltip-text", tooltip_text));
298 }
299 if let Some(ref valign) = self.valign {
300 properties.push(("valign", valign));
301 }
302 if let Some(ref vexpand) = self.vexpand {
303 properties.push(("vexpand", vexpand));
304 }
305 if let Some(ref vexpand_set) = self.vexpand_set {
306 properties.push(("vexpand-set", vexpand_set));
307 }
308 if let Some(ref visible) = self.visible {
309 properties.push(("visible", visible));
310 }
311 if let Some(ref width_request) = self.width_request {
312 properties.push(("width-request", width_request));
313 }
314 glib::Object::new(FontButton::static_type(), &properties)
315 .expect("object new")
316 .downcast()
317 .expect("downcast")
318 }
319
320 pub fn font_name(mut self, font_name: &str) -> Self {
321 self.font_name = Some(font_name.to_string());
322 self
323 }
324
325 pub fn show_size(mut self, show_size: bool) -> Self {
326 self.show_size = Some(show_size);
327 self
328 }
329
330 pub fn show_style(mut self, show_style: bool) -> Self {
331 self.show_style = Some(show_style);
332 self
333 }
334
335 pub fn title(mut self, title: &str) -> Self {
336 self.title = Some(title.to_string());
337 self
338 }
339
340 pub fn use_font(mut self, use_font: bool) -> Self {
341 self.use_font = Some(use_font);
342 self
343 }
344
345 pub fn use_size(mut self, use_size: bool) -> Self {
346 self.use_size = Some(use_size);
347 self
348 }
349
350 pub fn always_show_image(mut self, always_show_image: bool) -> Self {
351 self.always_show_image = Some(always_show_image);
352 self
353 }
354
355 pub fn image(mut self, image: &Widget) -> Self {
356 self.image = Some(image.clone());
357 self
358 }
359
360 pub fn image_position(mut self, image_position: PositionType) -> Self {
361 self.image_position = Some(image_position);
362 self
363 }
364
365 pub fn label(mut self, label: &str) -> Self {
366 self.label = Some(label.to_string());
367 self
368 }
369
370 pub fn relief(mut self, relief: ReliefStyle) -> Self {
371 self.relief = Some(relief);
372 self
373 }
374
375 pub fn use_underline(mut self, use_underline: bool) -> Self {
376 self.use_underline = Some(use_underline);
377 self
378 }
379
380 pub fn border_width(mut self, border_width: u32) -> Self {
381 self.border_width = Some(border_width);
382 self
383 }
384
385 pub fn child(mut self, child: &Widget) -> Self {
386 self.child = Some(child.clone());
387 self
388 }
389
390 pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self {
391 self.resize_mode = Some(resize_mode);
392 self
393 }
394
395 pub fn app_paintable(mut self, app_paintable: bool) -> Self {
396 self.app_paintable = Some(app_paintable);
397 self
398 }
399
400 pub fn can_default(mut self, can_default: bool) -> Self {
401 self.can_default = Some(can_default);
402 self
403 }
404
405 pub fn can_focus(mut self, can_focus: bool) -> Self {
406 self.can_focus = Some(can_focus);
407 self
408 }
409
410 pub fn events(mut self, events: gdk::EventMask) -> Self {
411 self.events = Some(events);
412 self
413 }
414
415 pub fn expand(mut self, expand: bool) -> Self {
416 self.expand = Some(expand);
417 self
418 }
419
420 #[cfg(any(feature = "v3_20", feature = "dox"))]
421 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self {
422 self.focus_on_click = Some(focus_on_click);
423 self
424 }
425
426 pub fn halign(mut self, halign: Align) -> Self {
427 self.halign = Some(halign);
428 self
429 }
430
431 pub fn has_default(mut self, has_default: bool) -> Self {
432 self.has_default = Some(has_default);
433 self
434 }
435
436 pub fn has_focus(mut self, has_focus: bool) -> Self {
437 self.has_focus = Some(has_focus);
438 self
439 }
440
441 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self {
442 self.has_tooltip = Some(has_tooltip);
443 self
444 }
445
446 pub fn height_request(mut self, height_request: i32) -> Self {
447 self.height_request = Some(height_request);
448 self
449 }
450
451 pub fn hexpand(mut self, hexpand: bool) -> Self {
452 self.hexpand = Some(hexpand);
453 self
454 }
455
456 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self {
457 self.hexpand_set = Some(hexpand_set);
458 self
459 }
460
461 pub fn is_focus(mut self, is_focus: bool) -> Self {
462 self.is_focus = Some(is_focus);
463 self
464 }
465
466 pub fn margin(mut self, margin: i32) -> Self {
467 self.margin = Some(margin);
468 self
469 }
470
471 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self {
472 self.margin_bottom = Some(margin_bottom);
473 self
474 }
475
476 pub fn margin_end(mut self, margin_end: i32) -> Self {
477 self.margin_end = Some(margin_end);
478 self
479 }
480
481 pub fn margin_start(mut self, margin_start: i32) -> Self {
482 self.margin_start = Some(margin_start);
483 self
484 }
485
486 pub fn margin_top(mut self, margin_top: i32) -> Self {
487 self.margin_top = Some(margin_top);
488 self
489 }
490
491 pub fn name(mut self, name: &str) -> Self {
492 self.name = Some(name.to_string());
493 self
494 }
495
496 pub fn no_show_all(mut self, no_show_all: bool) -> Self {
497 self.no_show_all = Some(no_show_all);
498 self
499 }
500
501 pub fn opacity(mut self, opacity: f64) -> Self {
502 self.opacity = Some(opacity);
503 self
504 }
505
506 pub fn parent(mut self, parent: &Container) -> Self {
507 self.parent = Some(parent.clone());
508 self
509 }
510
511 pub fn receives_default(mut self, receives_default: bool) -> Self {
512 self.receives_default = Some(receives_default);
513 self
514 }
515
516 pub fn sensitive(mut self, sensitive: bool) -> Self {
517 self.sensitive = Some(sensitive);
518 self
519 }
520
521 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self {
522 self.tooltip_markup = Some(tooltip_markup.to_string());
523 self
524 }
525
526 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self {
527 self.tooltip_text = Some(tooltip_text.to_string());
528 self
529 }
530
531 pub fn valign(mut self, valign: Align) -> Self {
532 self.valign = Some(valign);
533 self
534 }
535
536 pub fn vexpand(mut self, vexpand: bool) -> Self {
537 self.vexpand = Some(vexpand);
538 self
539 }
540
541 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self {
542 self.vexpand_set = Some(vexpand_set);
543 self
544 }
545
546 pub fn visible(mut self, visible: bool) -> Self {
547 self.visible = Some(visible);
548 self
549 }
550
551 pub fn width_request(mut self, width_request: i32) -> Self {
552 self.width_request = Some(width_request);
553 self
554 }
555}
556
557pub const NONE_FONT_BUTTON: Option<&FontButton> = None;
558
559pub trait FontButtonExt: 'static {
560 #[cfg_attr(feature = "v3_22", deprecated)]
561 fn get_font_name(&self) -> Option<GString>;
562
563 fn get_show_size(&self) -> bool;
564
565 fn get_show_style(&self) -> bool;
566
567 fn get_title(&self) -> Option<GString>;
568
569 fn get_use_font(&self) -> bool;
570
571 fn get_use_size(&self) -> bool;
572
573 #[cfg_attr(feature = "v3_22", deprecated)]
574 fn set_font_name(&self, fontname: &str) -> bool;
575
576 fn set_show_size(&self, show_size: bool);
577
578 fn set_show_style(&self, show_style: bool);
579
580 fn set_title(&self, title: &str);
581
582 fn set_use_font(&self, use_font: bool);
583
584 fn set_use_size(&self, use_size: bool);
585
586 fn connect_font_set<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
587
588 #[cfg_attr(feature = "v3_22", deprecated)]
589 fn connect_property_font_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
590
591 fn connect_property_show_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
592
593 fn connect_property_show_style_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
594
595 fn connect_property_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
596
597 fn connect_property_use_font_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
598
599 fn connect_property_use_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
600}
601
602impl<O: IsA<FontButton>> FontButtonExt for O {
603 fn get_font_name(&self) -> Option<GString> {
604 unsafe {
605 from_glib_none(gtk_sys::gtk_font_button_get_font_name(
606 self.as_ref().to_glib_none().0,
607 ))
608 }
609 }
610
611 fn get_show_size(&self) -> bool {
612 unsafe {
613 from_glib(gtk_sys::gtk_font_button_get_show_size(
614 self.as_ref().to_glib_none().0,
615 ))
616 }
617 }
618
619 fn get_show_style(&self) -> bool {
620 unsafe {
621 from_glib(gtk_sys::gtk_font_button_get_show_style(
622 self.as_ref().to_glib_none().0,
623 ))
624 }
625 }
626
627 fn get_title(&self) -> Option<GString> {
628 unsafe {
629 from_glib_none(gtk_sys::gtk_font_button_get_title(
630 self.as_ref().to_glib_none().0,
631 ))
632 }
633 }
634
635 fn get_use_font(&self) -> bool {
636 unsafe {
637 from_glib(gtk_sys::gtk_font_button_get_use_font(
638 self.as_ref().to_glib_none().0,
639 ))
640 }
641 }
642
643 fn get_use_size(&self) -> bool {
644 unsafe {
645 from_glib(gtk_sys::gtk_font_button_get_use_size(
646 self.as_ref().to_glib_none().0,
647 ))
648 }
649 }
650
651 fn set_font_name(&self, fontname: &str) -> bool {
652 unsafe {
653 from_glib(gtk_sys::gtk_font_button_set_font_name(
654 self.as_ref().to_glib_none().0,
655 fontname.to_glib_none().0,
656 ))
657 }
658 }
659
660 fn set_show_size(&self, show_size: bool) {
661 unsafe {
662 gtk_sys::gtk_font_button_set_show_size(
663 self.as_ref().to_glib_none().0,
664 show_size.to_glib(),
665 );
666 }
667 }
668
669 fn set_show_style(&self, show_style: bool) {
670 unsafe {
671 gtk_sys::gtk_font_button_set_show_style(
672 self.as_ref().to_glib_none().0,
673 show_style.to_glib(),
674 );
675 }
676 }
677
678 fn set_title(&self, title: &str) {
679 unsafe {
680 gtk_sys::gtk_font_button_set_title(
681 self.as_ref().to_glib_none().0,
682 title.to_glib_none().0,
683 );
684 }
685 }
686
687 fn set_use_font(&self, use_font: bool) {
688 unsafe {
689 gtk_sys::gtk_font_button_set_use_font(
690 self.as_ref().to_glib_none().0,
691 use_font.to_glib(),
692 );
693 }
694 }
695
696 fn set_use_size(&self, use_size: bool) {
697 unsafe {
698 gtk_sys::gtk_font_button_set_use_size(
699 self.as_ref().to_glib_none().0,
700 use_size.to_glib(),
701 );
702 }
703 }
704
705 fn connect_font_set<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
706 unsafe extern "C" fn font_set_trampoline<P, F: Fn(&P) + 'static>(
707 this: *mut gtk_sys::GtkFontButton,
708 f: glib_sys::gpointer,
709 ) where
710 P: IsA<FontButton>,
711 {
712 let f: &F = &*(f as *const F);
713 f(&FontButton::from_glib_borrow(this).unsafe_cast())
714 }
715 unsafe {
716 let f: Box_<F> = Box_::new(f);
717 connect_raw(
718 self.as_ptr() as *mut _,
719 b"font-set\0".as_ptr() as *const _,
720 Some(transmute(font_set_trampoline::<Self, F> as usize)),
721 Box_::into_raw(f),
722 )
723 }
724 }
725
726 fn connect_property_font_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
727 unsafe extern "C" fn notify_font_name_trampoline<P, F: Fn(&P) + 'static>(
728 this: *mut gtk_sys::GtkFontButton,
729 _param_spec: glib_sys::gpointer,
730 f: glib_sys::gpointer,
731 ) where
732 P: IsA<FontButton>,
733 {
734 let f: &F = &*(f as *const F);
735 f(&FontButton::from_glib_borrow(this).unsafe_cast())
736 }
737 unsafe {
738 let f: Box_<F> = Box_::new(f);
739 connect_raw(
740 self.as_ptr() as *mut _,
741 b"notify::font-name\0".as_ptr() as *const _,
742 Some(transmute(notify_font_name_trampoline::<Self, F> as usize)),
743 Box_::into_raw(f),
744 )
745 }
746 }
747
748 fn connect_property_show_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
749 unsafe extern "C" fn notify_show_size_trampoline<P, F: Fn(&P) + 'static>(
750 this: *mut gtk_sys::GtkFontButton,
751 _param_spec: glib_sys::gpointer,
752 f: glib_sys::gpointer,
753 ) where
754 P: IsA<FontButton>,
755 {
756 let f: &F = &*(f as *const F);
757 f(&FontButton::from_glib_borrow(this).unsafe_cast())
758 }
759 unsafe {
760 let f: Box_<F> = Box_::new(f);
761 connect_raw(
762 self.as_ptr() as *mut _,
763 b"notify::show-size\0".as_ptr() as *const _,
764 Some(transmute(notify_show_size_trampoline::<Self, F> as usize)),
765 Box_::into_raw(f),
766 )
767 }
768 }
769
770 fn connect_property_show_style_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
771 unsafe extern "C" fn notify_show_style_trampoline<P, F: Fn(&P) + 'static>(
772 this: *mut gtk_sys::GtkFontButton,
773 _param_spec: glib_sys::gpointer,
774 f: glib_sys::gpointer,
775 ) where
776 P: IsA<FontButton>,
777 {
778 let f: &F = &*(f as *const F);
779 f(&FontButton::from_glib_borrow(this).unsafe_cast())
780 }
781 unsafe {
782 let f: Box_<F> = Box_::new(f);
783 connect_raw(
784 self.as_ptr() as *mut _,
785 b"notify::show-style\0".as_ptr() as *const _,
786 Some(transmute(notify_show_style_trampoline::<Self, F> as usize)),
787 Box_::into_raw(f),
788 )
789 }
790 }
791
792 fn connect_property_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
793 unsafe extern "C" fn notify_title_trampoline<P, F: Fn(&P) + 'static>(
794 this: *mut gtk_sys::GtkFontButton,
795 _param_spec: glib_sys::gpointer,
796 f: glib_sys::gpointer,
797 ) where
798 P: IsA<FontButton>,
799 {
800 let f: &F = &*(f as *const F);
801 f(&FontButton::from_glib_borrow(this).unsafe_cast())
802 }
803 unsafe {
804 let f: Box_<F> = Box_::new(f);
805 connect_raw(
806 self.as_ptr() as *mut _,
807 b"notify::title\0".as_ptr() as *const _,
808 Some(transmute(notify_title_trampoline::<Self, F> as usize)),
809 Box_::into_raw(f),
810 )
811 }
812 }
813
814 fn connect_property_use_font_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
815 unsafe extern "C" fn notify_use_font_trampoline<P, F: Fn(&P) + 'static>(
816 this: *mut gtk_sys::GtkFontButton,
817 _param_spec: glib_sys::gpointer,
818 f: glib_sys::gpointer,
819 ) where
820 P: IsA<FontButton>,
821 {
822 let f: &F = &*(f as *const F);
823 f(&FontButton::from_glib_borrow(this).unsafe_cast())
824 }
825 unsafe {
826 let f: Box_<F> = Box_::new(f);
827 connect_raw(
828 self.as_ptr() as *mut _,
829 b"notify::use-font\0".as_ptr() as *const _,
830 Some(transmute(notify_use_font_trampoline::<Self, F> as usize)),
831 Box_::into_raw(f),
832 )
833 }
834 }
835
836 fn connect_property_use_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
837 unsafe extern "C" fn notify_use_size_trampoline<P, F: Fn(&P) + 'static>(
838 this: *mut gtk_sys::GtkFontButton,
839 _param_spec: glib_sys::gpointer,
840 f: glib_sys::gpointer,
841 ) where
842 P: IsA<FontButton>,
843 {
844 let f: &F = &*(f as *const F);
845 f(&FontButton::from_glib_borrow(this).unsafe_cast())
846 }
847 unsafe {
848 let f: Box_<F> = Box_::new(f);
849 connect_raw(
850 self.as_ptr() as *mut _,
851 b"notify::use-size\0".as_ptr() as *const _,
852 Some(transmute(notify_use_size_trampoline::<Self, F> as usize)),
853 Box_::into_raw(f),
854 )
855 }
856 }
857}
858
859impl fmt::Display for FontButton {
860 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
861 write!(f, "FontButton")
862 }
863}