gtk/auto/
color_button.rs

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