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 gio;
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_sys;
13 use gtk_source_sys;
14 use std::boxed::Box as Box_;
15 use std::fmt;
16 use std::mem::transmute;
17 use SpaceLocationFlags;
18 use SpaceTypeFlags;
19 
20 glib_wrapper! {
21     pub struct SpaceDrawer(Object<gtk_source_sys::GtkSourceSpaceDrawer, gtk_source_sys::GtkSourceSpaceDrawerClass, SpaceDrawerClass>);
22 
23     match fn {
24         get_type => || gtk_source_sys::gtk_source_space_drawer_get_type(),
25     }
26 }
27 
28 impl SpaceDrawer {
new() -> SpaceDrawer29     pub fn new() -> SpaceDrawer {
30         assert_initialized_main_thread!();
31         unsafe {
32             from_glib_full(gtk_source_sys::gtk_source_space_drawer_new())
33         }
34     }
35 }
36 
37 impl Default for SpaceDrawer {
default() -> Self38     fn default() -> Self {
39         Self::new()
40     }
41 }
42 
43 pub const NONE_SPACE_DRAWER: Option<&SpaceDrawer> = None;
44 
45 pub trait SpaceDrawerExt: 'static {
bind_matrix_setting<P: IsA<gio::Settings>>(&self, settings: &P, key: &str, flags: gio::SettingsBindFlags)46     fn bind_matrix_setting<P: IsA<gio::Settings>>(&self, settings: &P, key: &str, flags: gio::SettingsBindFlags);
47 
get_enable_matrix(&self) -> bool48     fn get_enable_matrix(&self) -> bool;
49 
get_matrix(&self) -> Option<glib::Variant>50     fn get_matrix(&self) -> Option<glib::Variant>;
51 
get_types_for_locations(&self, locations: SpaceLocationFlags) -> SpaceTypeFlags52     fn get_types_for_locations(&self, locations: SpaceLocationFlags) -> SpaceTypeFlags;
53 
set_enable_matrix(&self, enable_matrix: bool)54     fn set_enable_matrix(&self, enable_matrix: bool);
55 
set_matrix(&self, matrix: Option<&glib::Variant>)56     fn set_matrix(&self, matrix: Option<&glib::Variant>);
57 
set_types_for_locations(&self, locations: SpaceLocationFlags, types: SpaceTypeFlags)58     fn set_types_for_locations(&self, locations: SpaceLocationFlags, types: SpaceTypeFlags);
59 
connect_property_enable_matrix_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId60     fn connect_property_enable_matrix_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
61 
connect_property_matrix_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId62     fn connect_property_matrix_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
63 }
64 
65 impl<O: IsA<SpaceDrawer>> SpaceDrawerExt for O {
bind_matrix_setting<P: IsA<gio::Settings>>(&self, settings: &P, key: &str, flags: gio::SettingsBindFlags)66     fn bind_matrix_setting<P: IsA<gio::Settings>>(&self, settings: &P, key: &str, flags: gio::SettingsBindFlags) {
67         unsafe {
68             gtk_source_sys::gtk_source_space_drawer_bind_matrix_setting(self.as_ref().to_glib_none().0, settings.as_ref().to_glib_none().0, key.to_glib_none().0, flags.to_glib());
69         }
70     }
71 
get_enable_matrix(&self) -> bool72     fn get_enable_matrix(&self) -> bool {
73         unsafe {
74             from_glib(gtk_source_sys::gtk_source_space_drawer_get_enable_matrix(self.as_ref().to_glib_none().0))
75         }
76     }
77 
get_matrix(&self) -> Option<glib::Variant>78     fn get_matrix(&self) -> Option<glib::Variant> {
79         unsafe {
80             from_glib_full(gtk_source_sys::gtk_source_space_drawer_get_matrix(self.as_ref().to_glib_none().0))
81         }
82     }
83 
get_types_for_locations(&self, locations: SpaceLocationFlags) -> SpaceTypeFlags84     fn get_types_for_locations(&self, locations: SpaceLocationFlags) -> SpaceTypeFlags {
85         unsafe {
86             from_glib(gtk_source_sys::gtk_source_space_drawer_get_types_for_locations(self.as_ref().to_glib_none().0, locations.to_glib()))
87         }
88     }
89 
set_enable_matrix(&self, enable_matrix: bool)90     fn set_enable_matrix(&self, enable_matrix: bool) {
91         unsafe {
92             gtk_source_sys::gtk_source_space_drawer_set_enable_matrix(self.as_ref().to_glib_none().0, enable_matrix.to_glib());
93         }
94     }
95 
set_matrix(&self, matrix: Option<&glib::Variant>)96     fn set_matrix(&self, matrix: Option<&glib::Variant>) {
97         unsafe {
98             gtk_source_sys::gtk_source_space_drawer_set_matrix(self.as_ref().to_glib_none().0, matrix.to_glib_none().0);
99         }
100     }
101 
set_types_for_locations(&self, locations: SpaceLocationFlags, types: SpaceTypeFlags)102     fn set_types_for_locations(&self, locations: SpaceLocationFlags, types: SpaceTypeFlags) {
103         unsafe {
104             gtk_source_sys::gtk_source_space_drawer_set_types_for_locations(self.as_ref().to_glib_none().0, locations.to_glib(), types.to_glib());
105         }
106     }
107 
connect_property_enable_matrix_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId108     fn connect_property_enable_matrix_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
109         unsafe extern "C" fn notify_enable_matrix_trampoline<P, F: Fn(&P) + 'static>(this: *mut gtk_source_sys::GtkSourceSpaceDrawer, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer)
110             where P: IsA<SpaceDrawer>
111         {
112             let f: &F = &*(f as *const F);
113             f(&SpaceDrawer::from_glib_borrow(this).unsafe_cast())
114         }
115         unsafe {
116             let f: Box_<F> = Box_::new(f);
117             connect_raw(self.as_ptr() as *mut _, b"notify::enable-matrix\0".as_ptr() as *const _,
118                 Some(transmute(notify_enable_matrix_trampoline::<Self, F> as usize)), Box_::into_raw(f))
119         }
120     }
121 
connect_property_matrix_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId122     fn connect_property_matrix_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
123         unsafe extern "C" fn notify_matrix_trampoline<P, F: Fn(&P) + 'static>(this: *mut gtk_source_sys::GtkSourceSpaceDrawer, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer)
124             where P: IsA<SpaceDrawer>
125         {
126             let f: &F = &*(f as *const F);
127             f(&SpaceDrawer::from_glib_borrow(this).unsafe_cast())
128         }
129         unsafe {
130             let f: Box_<F> = Box_::new(f);
131             connect_raw(self.as_ptr() as *mut _, b"notify::matrix\0".as_ptr() as *const _,
132                 Some(transmute(notify_matrix_trampoline::<Self, F> as usize)), Box_::into_raw(f))
133         }
134     }
135 }
136 
137 impl fmt::Display for SpaceDrawer {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result138     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
139         write!(f, "SpaceDrawer")
140     }
141 }
142