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