1use gdk;
6use glib::object::Cast;
7use glib::object::IsA;
8use glib::translate::*;
9use gtk_sys;
10use std::mem;
11use ColorButton;
12use Widget;
13
14pub trait ColorButtonExtManual: 'static {
15 fn new_with_color(color: &gdk::Color) -> ColorButton;
16
17 fn get_color(&self) -> gdk::Color;
18
19 fn set_color(&self, color: &gdk::Color);
20}
21
22impl<O: IsA<ColorButton>> ColorButtonExtManual for O {
23 fn new_with_color(color: &gdk::Color) -> ColorButton {
24 assert_initialized_main_thread!();
25 unsafe {
26 Widget::from_glib_none(gtk_sys::gtk_color_button_new_with_color(color)).unsafe_cast()
27 }
28 }
29
30 fn get_color(&self) -> gdk::Color {
31 unsafe {
32 let mut color = mem::uninitialized();
33 gtk_sys::gtk_color_button_get_color(self.as_ref().to_glib_none().0, &mut color);
34 color
35 }
36 }
37
38 fn set_color(&self, color: &gdk::Color) {
39 unsafe { gtk_sys::gtk_color_button_set_color(self.as_ref().to_glib_none().0, color) }
40 }
41}