gdk_pixbuf/auto/
pixbuf_format.rs1use gdk_pixbuf_sys;
6use glib::translate::*;
7use glib::GString;
8
9glib_wrapper! {
10 #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
11 pub struct PixbufFormat(Boxed<gdk_pixbuf_sys::GdkPixbufFormat>);
12
13 match fn {
14 copy => |ptr| gdk_pixbuf_sys::gdk_pixbuf_format_copy(mut_override(ptr)),
15 free => |ptr| gdk_pixbuf_sys::gdk_pixbuf_format_free(ptr),
16 get_type => || gdk_pixbuf_sys::gdk_pixbuf_format_get_type(),
17 }
18}
19
20impl PixbufFormat {
21 pub fn get_description(&self) -> Option<GString> {
22 unsafe {
23 from_glib_full(gdk_pixbuf_sys::gdk_pixbuf_format_get_description(
24 mut_override(self.to_glib_none().0),
25 ))
26 }
27 }
28
29 pub fn get_extensions(&self) -> Vec<GString> {
30 unsafe {
31 FromGlibPtrContainer::from_glib_full(gdk_pixbuf_sys::gdk_pixbuf_format_get_extensions(
32 mut_override(self.to_glib_none().0),
33 ))
34 }
35 }
36
37 pub fn get_license(&self) -> Option<GString> {
38 unsafe {
39 from_glib_full(gdk_pixbuf_sys::gdk_pixbuf_format_get_license(mut_override(
40 self.to_glib_none().0,
41 )))
42 }
43 }
44
45 pub fn get_mime_types(&self) -> Vec<GString> {
46 unsafe {
47 FromGlibPtrContainer::from_glib_full(gdk_pixbuf_sys::gdk_pixbuf_format_get_mime_types(
48 mut_override(self.to_glib_none().0),
49 ))
50 }
51 }
52
53 pub fn get_name(&self) -> Option<GString> {
54 unsafe {
55 from_glib_full(gdk_pixbuf_sys::gdk_pixbuf_format_get_name(mut_override(
56 self.to_glib_none().0,
57 )))
58 }
59 }
60
61 pub fn is_disabled(&self) -> bool {
62 unsafe {
63 from_glib(gdk_pixbuf_sys::gdk_pixbuf_format_is_disabled(mut_override(
64 self.to_glib_none().0,
65 )))
66 }
67 }
68
69 #[cfg(any(feature = "v2_36", feature = "dox"))]
70 pub fn is_save_option_supported(&self, option_key: &str) -> bool {
71 unsafe {
72 from_glib(gdk_pixbuf_sys::gdk_pixbuf_format_is_save_option_supported(
73 mut_override(self.to_glib_none().0),
74 option_key.to_glib_none().0,
75 ))
76 }
77 }
78
79 pub fn is_scalable(&self) -> bool {
80 unsafe {
81 from_glib(gdk_pixbuf_sys::gdk_pixbuf_format_is_scalable(mut_override(
82 self.to_glib_none().0,
83 )))
84 }
85 }
86
87 pub fn is_writable(&self) -> bool {
88 unsafe {
89 from_glib(gdk_pixbuf_sys::gdk_pixbuf_format_is_writable(mut_override(
90 self.to_glib_none().0,
91 )))
92 }
93 }
94
95 pub fn set_disabled(&mut self, disabled: bool) {
96 unsafe {
97 gdk_pixbuf_sys::gdk_pixbuf_format_set_disabled(
98 self.to_glib_none_mut().0,
99 disabled.to_glib(),
100 );
101 }
102 }
103}