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 
5 use gdk;
6 use glib;
7 use glib::object::Cast;
8 use glib::object::IsA;
9 use glib::signal::connect_raw;
10 use glib::signal::SignalHandlerId;
11 use glib::translate::*;
12 use glib::GString;
13 use glib::StaticType;
14 use glib::ToValue;
15 use glib::Value;
16 use glib_sys;
17 use gobject_sys;
18 use gtk_sys;
19 use std::boxed::Box as Box_;
20 use std::fmt;
21 use std::mem::transmute;
22 use Actionable;
23 use Align;
24 use Bin;
25 use Buildable;
26 use Button;
27 use ColorChooser;
28 use Container;
29 use PositionType;
30 use ReliefStyle;
31 use ResizeMode;
32 use Widget;
33 
34 glib_wrapper! {
35     pub struct ColorButton(Object<gtk_sys::GtkColorButton, gtk_sys::GtkColorButtonClass, ColorButtonClass>) @extends Button, Bin, Container, Widget, @implements Buildable, Actionable, ColorChooser;
36 
37     match fn {
38         get_type => || gtk_sys::gtk_color_button_get_type(),
39     }
40 }
41 
42 impl ColorButton {
new() -> ColorButton43     pub fn new() -> ColorButton {
44         assert_initialized_main_thread!();
45         unsafe { Widget::from_glib_none(gtk_sys::gtk_color_button_new()).unsafe_cast() }
46     }
47 
new_with_rgba(rgba: &gdk::RGBA) -> ColorButton48     pub fn new_with_rgba(rgba: &gdk::RGBA) -> ColorButton {
49         assert_initialized_main_thread!();
50         unsafe {
51             Widget::from_glib_none(gtk_sys::gtk_color_button_new_with_rgba(
52                 rgba.to_glib_none().0,
53             ))
54             .unsafe_cast()
55         }
56     }
57 }
58 
59 impl Default for ColorButton {
default() -> Self60     fn default() -> Self {
61         Self::new()
62     }
63 }
64 
65 #[derive(Clone, Default)]
66 pub struct ColorButtonBuilder {
67     alpha: Option<u32>,
68     rgba: Option<gdk::RGBA>,
69     #[cfg(any(feature = "v3_20", feature = "dox"))]
70     show_editor: Option<bool>,
71     title: Option<String>,
72     use_alpha: Option<bool>,
73     always_show_image: Option<bool>,
74     image: Option<Widget>,
75     image_position: Option<PositionType>,
76     label: Option<String>,
77     relief: Option<ReliefStyle>,
78     use_underline: Option<bool>,
79     border_width: Option<u32>,
80     child: Option<Widget>,
81     resize_mode: Option<ResizeMode>,
82     app_paintable: Option<bool>,
83     can_default: Option<bool>,
84     can_focus: Option<bool>,
85     events: Option<gdk::EventMask>,
86     expand: Option<bool>,
87     #[cfg(any(feature = "v3_20", feature = "dox"))]
88     focus_on_click: Option<bool>,
89     halign: Option<Align>,
90     has_default: Option<bool>,
91     has_focus: Option<bool>,
92     has_tooltip: Option<bool>,
93     height_request: Option<i32>,
94     hexpand: Option<bool>,
95     hexpand_set: Option<bool>,
96     is_focus: Option<bool>,
97     margin: Option<i32>,
98     margin_bottom: Option<i32>,
99     margin_end: Option<i32>,
100     margin_start: Option<i32>,
101     margin_top: Option<i32>,
102     name: Option<String>,
103     no_show_all: Option<bool>,
104     opacity: Option<f64>,
105     parent: Option<Container>,
106     receives_default: Option<bool>,
107     sensitive: Option<bool>,
108     tooltip_markup: Option<String>,
109     tooltip_text: Option<String>,
110     valign: Option<Align>,
111     vexpand: Option<bool>,
112     vexpand_set: Option<bool>,
113     visible: Option<bool>,
114     width_request: Option<i32>,
115     action_name: Option<String>,
116     action_target: Option<glib::Variant>,
117 }
118 
119 impl ColorButtonBuilder {
new() -> Self120     pub fn new() -> Self {
121         Self::default()
122     }
123 
build(self) -> ColorButton124     pub fn build(self) -> ColorButton {
125         let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
126         if let Some(ref alpha) = self.alpha {
127             properties.push(("alpha", alpha));
128         }
129         if let Some(ref rgba) = self.rgba {
130             properties.push(("rgba", rgba));
131         }
132         #[cfg(any(feature = "v3_20", feature = "dox"))]
133         {
134             if let Some(ref show_editor) = self.show_editor {
135                 properties.push(("show-editor", show_editor));
136             }
137         }
138         if let Some(ref title) = self.title {
139             properties.push(("title", title));
140         }
141         if let Some(ref use_alpha) = self.use_alpha {
142             properties.push(("use-alpha", use_alpha));
143         }
144         if let Some(ref always_show_image) = self.always_show_image {
145             properties.push(("always-show-image", always_show_image));
146         }
147         if let Some(ref image) = self.image {
148             properties.push(("image", image));
149         }
150         if let Some(ref image_position) = self.image_position {
151             properties.push(("image-position", image_position));
152         }
153         if let Some(ref label) = self.label {
154             properties.push(("label", label));
155         }
156         if let Some(ref relief) = self.relief {
157             properties.push(("relief", relief));
158         }
159         if let Some(ref use_underline) = self.use_underline {
160             properties.push(("use-underline", use_underline));
161         }
162         if let Some(ref border_width) = self.border_width {
163             properties.push(("border-width", border_width));
164         }
165         if let Some(ref child) = self.child {
166             properties.push(("child", child));
167         }
168         if let Some(ref resize_mode) = self.resize_mode {
169             properties.push(("resize-mode", resize_mode));
170         }
171         if let Some(ref app_paintable) = self.app_paintable {
172             properties.push(("app-paintable", app_paintable));
173         }
174         if let Some(ref can_default) = self.can_default {
175             properties.push(("can-default", can_default));
176         }
177         if let Some(ref can_focus) = self.can_focus {
178             properties.push(("can-focus", can_focus));
179         }
180         if let Some(ref events) = self.events {
181             properties.push(("events", events));
182         }
183         if let Some(ref expand) = self.expand {
184             properties.push(("expand", expand));
185         }
186         #[cfg(any(feature = "v3_20", feature = "dox"))]
187         {
188             if let Some(ref focus_on_click) = self.focus_on_click {
189                 properties.push(("focus-on-click", focus_on_click));
190             }
191         }
192         if let Some(ref halign) = self.halign {
193             properties.push(("halign", halign));
194         }
195         if let Some(ref has_default) = self.has_default {
196             properties.push(("has-default", has_default));
197         }
198         if let Some(ref has_focus) = self.has_focus {
199             properties.push(("has-focus", has_focus));
200         }
201         if let Some(ref has_tooltip) = self.has_tooltip {
202             properties.push(("has-tooltip", has_tooltip));
203         }
204         if let Some(ref height_request) = self.height_request {
205             properties.push(("height-request", height_request));
206         }
207         if let Some(ref hexpand) = self.hexpand {
208             properties.push(("hexpand", hexpand));
209         }
210         if let Some(ref hexpand_set) = self.hexpand_set {
211             properties.push(("hexpand-set", hexpand_set));
212         }
213         if let Some(ref is_focus) = self.is_focus {
214             properties.push(("is-focus", is_focus));
215         }
216         if let Some(ref margin) = self.margin {
217             properties.push(("margin", margin));
218         }
219         if let Some(ref margin_bottom) = self.margin_bottom {
220             properties.push(("margin-bottom", margin_bottom));
221         }
222         if let Some(ref margin_end) = self.margin_end {
223             properties.push(("margin-end", margin_end));
224         }
225         if let Some(ref margin_start) = self.margin_start {
226             properties.push(("margin-start", margin_start));
227         }
228         if let Some(ref margin_top) = self.margin_top {
229             properties.push(("margin-top", margin_top));
230         }
231         if let Some(ref name) = self.name {
232             properties.push(("name", name));
233         }
234         if let Some(ref no_show_all) = self.no_show_all {
235             properties.push(("no-show-all", no_show_all));
236         }
237         if let Some(ref opacity) = self.opacity {
238             properties.push(("opacity", opacity));
239         }
240         if let Some(ref parent) = self.parent {
241             properties.push(("parent", parent));
242         }
243         if let Some(ref receives_default) = self.receives_default {
244             properties.push(("receives-default", receives_default));
245         }
246         if let Some(ref sensitive) = self.sensitive {
247             properties.push(("sensitive", sensitive));
248         }
249         if let Some(ref tooltip_markup) = self.tooltip_markup {
250             properties.push(("tooltip-markup", tooltip_markup));
251         }
252         if let Some(ref tooltip_text) = self.tooltip_text {
253             properties.push(("tooltip-text", tooltip_text));
254         }
255         if let Some(ref valign) = self.valign {
256             properties.push(("valign", valign));
257         }
258         if let Some(ref vexpand) = self.vexpand {
259             properties.push(("vexpand", vexpand));
260         }
261         if let Some(ref vexpand_set) = self.vexpand_set {
262             properties.push(("vexpand-set", vexpand_set));
263         }
264         if let Some(ref visible) = self.visible {
265             properties.push(("visible", visible));
266         }
267         if let Some(ref width_request) = self.width_request {
268             properties.push(("width-request", width_request));
269         }
270         if let Some(ref action_name) = self.action_name {
271             properties.push(("action-name", action_name));
272         }
273         if let Some(ref action_target) = self.action_target {
274             properties.push(("action-target", action_target));
275         }
276         glib::Object::new(ColorButton::static_type(), &properties)
277             .expect("object new")
278             .downcast()
279             .expect("downcast")
280     }
281 
alpha(mut self, alpha: u32) -> Self282     pub fn alpha(mut self, alpha: u32) -> Self {
283         self.alpha = Some(alpha);
284         self
285     }
286 
rgba(mut self, rgba: &gdk::RGBA) -> Self287     pub fn rgba(mut self, rgba: &gdk::RGBA) -> Self {
288         self.rgba = Some(rgba.clone());
289         self
290     }
291 
292     #[cfg(any(feature = "v3_20", feature = "dox"))]
show_editor(mut self, show_editor: bool) -> Self293     pub fn show_editor(mut self, show_editor: bool) -> Self {
294         self.show_editor = Some(show_editor);
295         self
296     }
297 
title(mut self, title: &str) -> Self298     pub fn title(mut self, title: &str) -> Self {
299         self.title = Some(title.to_string());
300         self
301     }
302 
use_alpha(mut self, use_alpha: bool) -> Self303     pub fn use_alpha(mut self, use_alpha: bool) -> Self {
304         self.use_alpha = Some(use_alpha);
305         self
306     }
307 
always_show_image(mut self, always_show_image: bool) -> Self308     pub fn always_show_image(mut self, always_show_image: bool) -> Self {
309         self.always_show_image = Some(always_show_image);
310         self
311     }
312 
image<P: IsA<Widget>>(mut self, image: &P) -> Self313     pub fn image<P: IsA<Widget>>(mut self, image: &P) -> Self {
314         self.image = Some(image.clone().upcast());
315         self
316     }
317 
image_position(mut self, image_position: PositionType) -> Self318     pub fn image_position(mut self, image_position: PositionType) -> Self {
319         self.image_position = Some(image_position);
320         self
321     }
322 
label(mut self, label: &str) -> Self323     pub fn label(mut self, label: &str) -> Self {
324         self.label = Some(label.to_string());
325         self
326     }
327 
relief(mut self, relief: ReliefStyle) -> Self328     pub fn relief(mut self, relief: ReliefStyle) -> Self {
329         self.relief = Some(relief);
330         self
331     }
332 
use_underline(mut self, use_underline: bool) -> Self333     pub fn use_underline(mut self, use_underline: bool) -> Self {
334         self.use_underline = Some(use_underline);
335         self
336     }
337 
border_width(mut self, border_width: u32) -> Self338     pub fn border_width(mut self, border_width: u32) -> Self {
339         self.border_width = Some(border_width);
340         self
341     }
342 
child<P: IsA<Widget>>(mut self, child: &P) -> Self343     pub fn child<P: IsA<Widget>>(mut self, child: &P) -> Self {
344         self.child = Some(child.clone().upcast());
345         self
346     }
347 
resize_mode(mut self, resize_mode: ResizeMode) -> Self348     pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self {
349         self.resize_mode = Some(resize_mode);
350         self
351     }
352 
app_paintable(mut self, app_paintable: bool) -> Self353     pub fn app_paintable(mut self, app_paintable: bool) -> Self {
354         self.app_paintable = Some(app_paintable);
355         self
356     }
357 
can_default(mut self, can_default: bool) -> Self358     pub fn can_default(mut self, can_default: bool) -> Self {
359         self.can_default = Some(can_default);
360         self
361     }
362 
can_focus(mut self, can_focus: bool) -> Self363     pub fn can_focus(mut self, can_focus: bool) -> Self {
364         self.can_focus = Some(can_focus);
365         self
366     }
367 
events(mut self, events: gdk::EventMask) -> Self368     pub fn events(mut self, events: gdk::EventMask) -> Self {
369         self.events = Some(events);
370         self
371     }
372 
expand(mut self, expand: bool) -> Self373     pub fn expand(mut self, expand: bool) -> Self {
374         self.expand = Some(expand);
375         self
376     }
377 
378     #[cfg(any(feature = "v3_20", feature = "dox"))]
focus_on_click(mut self, focus_on_click: bool) -> Self379     pub fn focus_on_click(mut self, focus_on_click: bool) -> Self {
380         self.focus_on_click = Some(focus_on_click);
381         self
382     }
383 
halign(mut self, halign: Align) -> Self384     pub fn halign(mut self, halign: Align) -> Self {
385         self.halign = Some(halign);
386         self
387     }
388 
has_default(mut self, has_default: bool) -> Self389     pub fn has_default(mut self, has_default: bool) -> Self {
390         self.has_default = Some(has_default);
391         self
392     }
393 
has_focus(mut self, has_focus: bool) -> Self394     pub fn has_focus(mut self, has_focus: bool) -> Self {
395         self.has_focus = Some(has_focus);
396         self
397     }
398 
has_tooltip(mut self, has_tooltip: bool) -> Self399     pub fn has_tooltip(mut self, has_tooltip: bool) -> Self {
400         self.has_tooltip = Some(has_tooltip);
401         self
402     }
403 
height_request(mut self, height_request: i32) -> Self404     pub fn height_request(mut self, height_request: i32) -> Self {
405         self.height_request = Some(height_request);
406         self
407     }
408 
hexpand(mut self, hexpand: bool) -> Self409     pub fn hexpand(mut self, hexpand: bool) -> Self {
410         self.hexpand = Some(hexpand);
411         self
412     }
413 
hexpand_set(mut self, hexpand_set: bool) -> Self414     pub fn hexpand_set(mut self, hexpand_set: bool) -> Self {
415         self.hexpand_set = Some(hexpand_set);
416         self
417     }
418 
is_focus(mut self, is_focus: bool) -> Self419     pub fn is_focus(mut self, is_focus: bool) -> Self {
420         self.is_focus = Some(is_focus);
421         self
422     }
423 
margin(mut self, margin: i32) -> Self424     pub fn margin(mut self, margin: i32) -> Self {
425         self.margin = Some(margin);
426         self
427     }
428 
margin_bottom(mut self, margin_bottom: i32) -> Self429     pub fn margin_bottom(mut self, margin_bottom: i32) -> Self {
430         self.margin_bottom = Some(margin_bottom);
431         self
432     }
433 
margin_end(mut self, margin_end: i32) -> Self434     pub fn margin_end(mut self, margin_end: i32) -> Self {
435         self.margin_end = Some(margin_end);
436         self
437     }
438 
margin_start(mut self, margin_start: i32) -> Self439     pub fn margin_start(mut self, margin_start: i32) -> Self {
440         self.margin_start = Some(margin_start);
441         self
442     }
443 
margin_top(mut self, margin_top: i32) -> Self444     pub fn margin_top(mut self, margin_top: i32) -> Self {
445         self.margin_top = Some(margin_top);
446         self
447     }
448 
name(mut self, name: &str) -> Self449     pub fn name(mut self, name: &str) -> Self {
450         self.name = Some(name.to_string());
451         self
452     }
453 
no_show_all(mut self, no_show_all: bool) -> Self454     pub fn no_show_all(mut self, no_show_all: bool) -> Self {
455         self.no_show_all = Some(no_show_all);
456         self
457     }
458 
opacity(mut self, opacity: f64) -> Self459     pub fn opacity(mut self, opacity: f64) -> Self {
460         self.opacity = Some(opacity);
461         self
462     }
463 
parent<P: IsA<Container>>(mut self, parent: &P) -> Self464     pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self {
465         self.parent = Some(parent.clone().upcast());
466         self
467     }
468 
receives_default(mut self, receives_default: bool) -> Self469     pub fn receives_default(mut self, receives_default: bool) -> Self {
470         self.receives_default = Some(receives_default);
471         self
472     }
473 
sensitive(mut self, sensitive: bool) -> Self474     pub fn sensitive(mut self, sensitive: bool) -> Self {
475         self.sensitive = Some(sensitive);
476         self
477     }
478 
tooltip_markup(mut self, tooltip_markup: &str) -> Self479     pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self {
480         self.tooltip_markup = Some(tooltip_markup.to_string());
481         self
482     }
483 
tooltip_text(mut self, tooltip_text: &str) -> Self484     pub fn tooltip_text(mut self, tooltip_text: &str) -> Self {
485         self.tooltip_text = Some(tooltip_text.to_string());
486         self
487     }
488 
valign(mut self, valign: Align) -> Self489     pub fn valign(mut self, valign: Align) -> Self {
490         self.valign = Some(valign);
491         self
492     }
493 
vexpand(mut self, vexpand: bool) -> Self494     pub fn vexpand(mut self, vexpand: bool) -> Self {
495         self.vexpand = Some(vexpand);
496         self
497     }
498 
vexpand_set(mut self, vexpand_set: bool) -> Self499     pub fn vexpand_set(mut self, vexpand_set: bool) -> Self {
500         self.vexpand_set = Some(vexpand_set);
501         self
502     }
503 
visible(mut self, visible: bool) -> Self504     pub fn visible(mut self, visible: bool) -> Self {
505         self.visible = Some(visible);
506         self
507     }
508 
width_request(mut self, width_request: i32) -> Self509     pub fn width_request(mut self, width_request: i32) -> Self {
510         self.width_request = Some(width_request);
511         self
512     }
513 
action_name(mut self, action_name: &str) -> Self514     pub fn action_name(mut self, action_name: &str) -> Self {
515         self.action_name = Some(action_name.to_string());
516         self
517     }
518 
action_target(mut self, action_target: &glib::Variant) -> Self519     pub fn action_target(mut self, action_target: &glib::Variant) -> Self {
520         self.action_target = Some(action_target.clone());
521         self
522     }
523 }
524 
525 pub const NONE_COLOR_BUTTON: Option<&ColorButton> = None;
526 
527 pub trait ColorButtonExt: 'static {
get_title(&self) -> Option<GString>528     fn get_title(&self) -> Option<GString>;
529 
set_title(&self, title: &str)530     fn set_title(&self, title: &str);
531 
get_property_alpha(&self) -> u32532     fn get_property_alpha(&self) -> u32;
533 
set_property_alpha(&self, alpha: u32)534     fn set_property_alpha(&self, alpha: u32);
535 
536     #[cfg(any(feature = "v3_20", feature = "dox"))]
get_property_show_editor(&self) -> bool537     fn get_property_show_editor(&self) -> bool;
538 
539     #[cfg(any(feature = "v3_20", feature = "dox"))]
set_property_show_editor(&self, show_editor: bool)540     fn set_property_show_editor(&self, show_editor: bool);
541 
connect_color_set<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId542     fn connect_color_set<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
543 
connect_property_alpha_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId544     fn connect_property_alpha_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
545 
connect_property_rgba_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId546     fn connect_property_rgba_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
547 
548     #[cfg(any(feature = "v3_20", feature = "dox"))]
connect_property_show_editor_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId549     fn connect_property_show_editor_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
550 
connect_property_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId551     fn connect_property_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
552 
connect_property_use_alpha_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId553     fn connect_property_use_alpha_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
554 }
555 
556 impl<O: IsA<ColorButton>> ColorButtonExt for O {
get_title(&self) -> Option<GString>557     fn get_title(&self) -> Option<GString> {
558         unsafe {
559             from_glib_none(gtk_sys::gtk_color_button_get_title(
560                 self.as_ref().to_glib_none().0,
561             ))
562         }
563     }
564 
set_title(&self, title: &str)565     fn set_title(&self, title: &str) {
566         unsafe {
567             gtk_sys::gtk_color_button_set_title(
568                 self.as_ref().to_glib_none().0,
569                 title.to_glib_none().0,
570             );
571         }
572     }
573 
get_property_alpha(&self) -> u32574     fn get_property_alpha(&self) -> u32 {
575         unsafe {
576             let mut value = Value::from_type(<u32 as StaticType>::static_type());
577             gobject_sys::g_object_get_property(
578                 self.to_glib_none().0 as *mut gobject_sys::GObject,
579                 b"alpha\0".as_ptr() as *const _,
580                 value.to_glib_none_mut().0,
581             );
582             value
583                 .get()
584                 .expect("Return Value for property `alpha` getter")
585                 .unwrap()
586         }
587     }
588 
set_property_alpha(&self, alpha: u32)589     fn set_property_alpha(&self, alpha: u32) {
590         unsafe {
591             gobject_sys::g_object_set_property(
592                 self.to_glib_none().0 as *mut gobject_sys::GObject,
593                 b"alpha\0".as_ptr() as *const _,
594                 Value::from(&alpha).to_glib_none().0,
595             );
596         }
597     }
598 
599     #[cfg(any(feature = "v3_20", feature = "dox"))]
get_property_show_editor(&self) -> bool600     fn get_property_show_editor(&self) -> bool {
601         unsafe {
602             let mut value = Value::from_type(<bool as StaticType>::static_type());
603             gobject_sys::g_object_get_property(
604                 self.to_glib_none().0 as *mut gobject_sys::GObject,
605                 b"show-editor\0".as_ptr() as *const _,
606                 value.to_glib_none_mut().0,
607             );
608             value
609                 .get()
610                 .expect("Return Value for property `show-editor` getter")
611                 .unwrap()
612         }
613     }
614 
615     #[cfg(any(feature = "v3_20", feature = "dox"))]
set_property_show_editor(&self, show_editor: bool)616     fn set_property_show_editor(&self, show_editor: bool) {
617         unsafe {
618             gobject_sys::g_object_set_property(
619                 self.to_glib_none().0 as *mut gobject_sys::GObject,
620                 b"show-editor\0".as_ptr() as *const _,
621                 Value::from(&show_editor).to_glib_none().0,
622             );
623         }
624     }
625 
connect_color_set<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId626     fn connect_color_set<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
627         unsafe extern "C" fn color_set_trampoline<P, F: Fn(&P) + 'static>(
628             this: *mut gtk_sys::GtkColorButton,
629             f: glib_sys::gpointer,
630         ) where
631             P: IsA<ColorButton>,
632         {
633             let f: &F = &*(f as *const F);
634             f(&ColorButton::from_glib_borrow(this).unsafe_cast())
635         }
636         unsafe {
637             let f: Box_<F> = Box_::new(f);
638             connect_raw(
639                 self.as_ptr() as *mut _,
640                 b"color-set\0".as_ptr() as *const _,
641                 Some(transmute(color_set_trampoline::<Self, F> as usize)),
642                 Box_::into_raw(f),
643             )
644         }
645     }
646 
connect_property_alpha_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId647     fn connect_property_alpha_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
648         unsafe extern "C" fn notify_alpha_trampoline<P, F: Fn(&P) + 'static>(
649             this: *mut gtk_sys::GtkColorButton,
650             _param_spec: glib_sys::gpointer,
651             f: glib_sys::gpointer,
652         ) where
653             P: IsA<ColorButton>,
654         {
655             let f: &F = &*(f as *const F);
656             f(&ColorButton::from_glib_borrow(this).unsafe_cast())
657         }
658         unsafe {
659             let f: Box_<F> = Box_::new(f);
660             connect_raw(
661                 self.as_ptr() as *mut _,
662                 b"notify::alpha\0".as_ptr() as *const _,
663                 Some(transmute(notify_alpha_trampoline::<Self, F> as usize)),
664                 Box_::into_raw(f),
665             )
666         }
667     }
668 
connect_property_rgba_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId669     fn connect_property_rgba_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
670         unsafe extern "C" fn notify_rgba_trampoline<P, F: Fn(&P) + 'static>(
671             this: *mut gtk_sys::GtkColorButton,
672             _param_spec: glib_sys::gpointer,
673             f: glib_sys::gpointer,
674         ) where
675             P: IsA<ColorButton>,
676         {
677             let f: &F = &*(f as *const F);
678             f(&ColorButton::from_glib_borrow(this).unsafe_cast())
679         }
680         unsafe {
681             let f: Box_<F> = Box_::new(f);
682             connect_raw(
683                 self.as_ptr() as *mut _,
684                 b"notify::rgba\0".as_ptr() as *const _,
685                 Some(transmute(notify_rgba_trampoline::<Self, F> as usize)),
686                 Box_::into_raw(f),
687             )
688         }
689     }
690 
691     #[cfg(any(feature = "v3_20", feature = "dox"))]
connect_property_show_editor_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId692     fn connect_property_show_editor_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
693         unsafe extern "C" fn notify_show_editor_trampoline<P, F: Fn(&P) + 'static>(
694             this: *mut gtk_sys::GtkColorButton,
695             _param_spec: glib_sys::gpointer,
696             f: glib_sys::gpointer,
697         ) where
698             P: IsA<ColorButton>,
699         {
700             let f: &F = &*(f as *const F);
701             f(&ColorButton::from_glib_borrow(this).unsafe_cast())
702         }
703         unsafe {
704             let f: Box_<F> = Box_::new(f);
705             connect_raw(
706                 self.as_ptr() as *mut _,
707                 b"notify::show-editor\0".as_ptr() as *const _,
708                 Some(transmute(notify_show_editor_trampoline::<Self, F> as usize)),
709                 Box_::into_raw(f),
710             )
711         }
712     }
713 
connect_property_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId714     fn connect_property_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
715         unsafe extern "C" fn notify_title_trampoline<P, F: Fn(&P) + 'static>(
716             this: *mut gtk_sys::GtkColorButton,
717             _param_spec: glib_sys::gpointer,
718             f: glib_sys::gpointer,
719         ) where
720             P: IsA<ColorButton>,
721         {
722             let f: &F = &*(f as *const F);
723             f(&ColorButton::from_glib_borrow(this).unsafe_cast())
724         }
725         unsafe {
726             let f: Box_<F> = Box_::new(f);
727             connect_raw(
728                 self.as_ptr() as *mut _,
729                 b"notify::title\0".as_ptr() as *const _,
730                 Some(transmute(notify_title_trampoline::<Self, F> as usize)),
731                 Box_::into_raw(f),
732             )
733         }
734     }
735 
connect_property_use_alpha_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId736     fn connect_property_use_alpha_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
737         unsafe extern "C" fn notify_use_alpha_trampoline<P, F: Fn(&P) + 'static>(
738             this: *mut gtk_sys::GtkColorButton,
739             _param_spec: glib_sys::gpointer,
740             f: glib_sys::gpointer,
741         ) where
742             P: IsA<ColorButton>,
743         {
744             let f: &F = &*(f as *const F);
745             f(&ColorButton::from_glib_borrow(this).unsafe_cast())
746         }
747         unsafe {
748             let f: Box_<F> = Box_::new(f);
749             connect_raw(
750                 self.as_ptr() as *mut _,
751                 b"notify::use-alpha\0".as_ptr() as *const _,
752                 Some(transmute(notify_use_alpha_trampoline::<Self, F> as usize)),
753                 Box_::into_raw(f),
754             )
755         }
756     }
757 }
758 
759 impl fmt::Display for ColorButton {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result760     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
761         write!(f, "ColorButton")
762     }
763 }
764