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 gdk_pixbuf; 7 use gio; 8 use glib::object::Cast; 9 use glib::object::IsA; 10 use glib::signal::connect_raw; 11 use glib::signal::SignalHandlerId; 12 use glib::translate::*; 13 use glib::GString; 14 use glib_sys; 15 use gtk; 16 use gtk_source_sys; 17 use libc; 18 use std::boxed::Box as Box_; 19 use std::fmt; 20 use std::mem::transmute; 21 use Mark; 22 23 glib_wrapper! { 24 pub struct MarkAttributes(Object<gtk_source_sys::GtkSourceMarkAttributes, gtk_source_sys::GtkSourceMarkAttributesClass, MarkAttributesClass>); 25 26 match fn { 27 get_type => || gtk_source_sys::gtk_source_mark_attributes_get_type(), 28 } 29 } 30 31 impl MarkAttributes { new() -> MarkAttributes32 pub fn new() -> MarkAttributes { 33 assert_initialized_main_thread!(); 34 unsafe { 35 from_glib_full(gtk_source_sys::gtk_source_mark_attributes_new()) 36 } 37 } 38 } 39 40 impl Default for MarkAttributes { default() -> Self41 fn default() -> Self { 42 Self::new() 43 } 44 } 45 46 pub const NONE_MARK_ATTRIBUTES: Option<&MarkAttributes> = None; 47 48 pub trait MarkAttributesExt: 'static { get_background(&self) -> Option<gdk::RGBA>49 fn get_background(&self) -> Option<gdk::RGBA>; 50 get_gicon(&self) -> Option<gio::Icon>51 fn get_gicon(&self) -> Option<gio::Icon>; 52 get_icon_name(&self) -> Option<GString>53 fn get_icon_name(&self) -> Option<GString>; 54 get_pixbuf(&self) -> Option<gdk_pixbuf::Pixbuf>55 fn get_pixbuf(&self) -> Option<gdk_pixbuf::Pixbuf>; 56 get_tooltip_markup<P: IsA<Mark>>(&self, mark: &P) -> Option<GString>57 fn get_tooltip_markup<P: IsA<Mark>>(&self, mark: &P) -> Option<GString>; 58 get_tooltip_text<P: IsA<Mark>>(&self, mark: &P) -> Option<GString>59 fn get_tooltip_text<P: IsA<Mark>>(&self, mark: &P) -> Option<GString>; 60 render_icon<P: IsA<gtk::Widget>>(&self, widget: &P, size: i32) -> Option<gdk_pixbuf::Pixbuf>61 fn render_icon<P: IsA<gtk::Widget>>(&self, widget: &P, size: i32) -> Option<gdk_pixbuf::Pixbuf>; 62 set_background(&self, background: &gdk::RGBA)63 fn set_background(&self, background: &gdk::RGBA); 64 set_gicon<P: IsA<gio::Icon>>(&self, gicon: &P)65 fn set_gicon<P: IsA<gio::Icon>>(&self, gicon: &P); 66 set_icon_name(&self, icon_name: &str)67 fn set_icon_name(&self, icon_name: &str); 68 set_pixbuf(&self, pixbuf: &gdk_pixbuf::Pixbuf)69 fn set_pixbuf(&self, pixbuf: &gdk_pixbuf::Pixbuf); 70 connect_query_tooltip_markup<F: Fn(&Self, &Mark) -> String + 'static>(&self, f: F) -> SignalHandlerId71 fn connect_query_tooltip_markup<F: Fn(&Self, &Mark) -> String + 'static>(&self, f: F) -> SignalHandlerId; 72 connect_query_tooltip_text<F: Fn(&Self, &Mark) -> String + 'static>(&self, f: F) -> SignalHandlerId73 fn connect_query_tooltip_text<F: Fn(&Self, &Mark) -> String + 'static>(&self, f: F) -> SignalHandlerId; 74 connect_property_background_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId75 fn connect_property_background_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 76 connect_property_gicon_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId77 fn connect_property_gicon_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 78 connect_property_icon_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId79 fn connect_property_icon_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 80 connect_property_pixbuf_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId81 fn connect_property_pixbuf_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 82 } 83 84 impl<O: IsA<MarkAttributes>> MarkAttributesExt for O { get_background(&self) -> Option<gdk::RGBA>85 fn get_background(&self) -> Option<gdk::RGBA> { 86 unsafe { 87 let mut background = gdk::RGBA::uninitialized(); 88 let ret = from_glib(gtk_source_sys::gtk_source_mark_attributes_get_background(self.as_ref().to_glib_none().0, background.to_glib_none_mut().0)); 89 if ret { Some(background) } else { None } 90 } 91 } 92 get_gicon(&self) -> Option<gio::Icon>93 fn get_gicon(&self) -> Option<gio::Icon> { 94 unsafe { 95 from_glib_none(gtk_source_sys::gtk_source_mark_attributes_get_gicon(self.as_ref().to_glib_none().0)) 96 } 97 } 98 get_icon_name(&self) -> Option<GString>99 fn get_icon_name(&self) -> Option<GString> { 100 unsafe { 101 from_glib_none(gtk_source_sys::gtk_source_mark_attributes_get_icon_name(self.as_ref().to_glib_none().0)) 102 } 103 } 104 get_pixbuf(&self) -> Option<gdk_pixbuf::Pixbuf>105 fn get_pixbuf(&self) -> Option<gdk_pixbuf::Pixbuf> { 106 unsafe { 107 from_glib_none(gtk_source_sys::gtk_source_mark_attributes_get_pixbuf(self.as_ref().to_glib_none().0)) 108 } 109 } 110 get_tooltip_markup<P: IsA<Mark>>(&self, mark: &P) -> Option<GString>111 fn get_tooltip_markup<P: IsA<Mark>>(&self, mark: &P) -> Option<GString> { 112 unsafe { 113 from_glib_full(gtk_source_sys::gtk_source_mark_attributes_get_tooltip_markup(self.as_ref().to_glib_none().0, mark.as_ref().to_glib_none().0)) 114 } 115 } 116 get_tooltip_text<P: IsA<Mark>>(&self, mark: &P) -> Option<GString>117 fn get_tooltip_text<P: IsA<Mark>>(&self, mark: &P) -> Option<GString> { 118 unsafe { 119 from_glib_full(gtk_source_sys::gtk_source_mark_attributes_get_tooltip_text(self.as_ref().to_glib_none().0, mark.as_ref().to_glib_none().0)) 120 } 121 } 122 render_icon<P: IsA<gtk::Widget>>(&self, widget: &P, size: i32) -> Option<gdk_pixbuf::Pixbuf>123 fn render_icon<P: IsA<gtk::Widget>>(&self, widget: &P, size: i32) -> Option<gdk_pixbuf::Pixbuf> { 124 unsafe { 125 from_glib_none(gtk_source_sys::gtk_source_mark_attributes_render_icon(self.as_ref().to_glib_none().0, widget.as_ref().to_glib_none().0, size)) 126 } 127 } 128 set_background(&self, background: &gdk::RGBA)129 fn set_background(&self, background: &gdk::RGBA) { 130 unsafe { 131 gtk_source_sys::gtk_source_mark_attributes_set_background(self.as_ref().to_glib_none().0, background.to_glib_none().0); 132 } 133 } 134 set_gicon<P: IsA<gio::Icon>>(&self, gicon: &P)135 fn set_gicon<P: IsA<gio::Icon>>(&self, gicon: &P) { 136 unsafe { 137 gtk_source_sys::gtk_source_mark_attributes_set_gicon(self.as_ref().to_glib_none().0, gicon.as_ref().to_glib_none().0); 138 } 139 } 140 set_icon_name(&self, icon_name: &str)141 fn set_icon_name(&self, icon_name: &str) { 142 unsafe { 143 gtk_source_sys::gtk_source_mark_attributes_set_icon_name(self.as_ref().to_glib_none().0, icon_name.to_glib_none().0); 144 } 145 } 146 set_pixbuf(&self, pixbuf: &gdk_pixbuf::Pixbuf)147 fn set_pixbuf(&self, pixbuf: &gdk_pixbuf::Pixbuf) { 148 unsafe { 149 gtk_source_sys::gtk_source_mark_attributes_set_pixbuf(self.as_ref().to_glib_none().0, pixbuf.to_glib_none().0); 150 } 151 } 152 connect_query_tooltip_markup<F: Fn(&Self, &Mark) -> String + 'static>(&self, f: F) -> SignalHandlerId153 fn connect_query_tooltip_markup<F: Fn(&Self, &Mark) -> String + 'static>(&self, f: F) -> SignalHandlerId { 154 unsafe extern "C" fn query_tooltip_markup_trampoline<P, F: Fn(&P, &Mark) -> String + 'static>(this: *mut gtk_source_sys::GtkSourceMarkAttributes, mark: *mut gtk_source_sys::GtkSourceMark, f: glib_sys::gpointer) -> *mut libc::c_char 155 where P: IsA<MarkAttributes> 156 { 157 let f: &F = &*(f as *const F); 158 f(&MarkAttributes::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(mark)).to_glib_full() 159 } 160 unsafe { 161 let f: Box_<F> = Box_::new(f); 162 connect_raw(self.as_ptr() as *mut _, b"query-tooltip-markup\0".as_ptr() as *const _, 163 Some(transmute(query_tooltip_markup_trampoline::<Self, F> as usize)), Box_::into_raw(f)) 164 } 165 } 166 connect_query_tooltip_text<F: Fn(&Self, &Mark) -> String + 'static>(&self, f: F) -> SignalHandlerId167 fn connect_query_tooltip_text<F: Fn(&Self, &Mark) -> String + 'static>(&self, f: F) -> SignalHandlerId { 168 unsafe extern "C" fn query_tooltip_text_trampoline<P, F: Fn(&P, &Mark) -> String + 'static>(this: *mut gtk_source_sys::GtkSourceMarkAttributes, mark: *mut gtk_source_sys::GtkSourceMark, f: glib_sys::gpointer) -> *mut libc::c_char 169 where P: IsA<MarkAttributes> 170 { 171 let f: &F = &*(f as *const F); 172 f(&MarkAttributes::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(mark)).to_glib_full() 173 } 174 unsafe { 175 let f: Box_<F> = Box_::new(f); 176 connect_raw(self.as_ptr() as *mut _, b"query-tooltip-text\0".as_ptr() as *const _, 177 Some(transmute(query_tooltip_text_trampoline::<Self, F> as usize)), Box_::into_raw(f)) 178 } 179 } 180 connect_property_background_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId181 fn connect_property_background_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 182 unsafe extern "C" fn notify_background_trampoline<P, F: Fn(&P) + 'static>(this: *mut gtk_source_sys::GtkSourceMarkAttributes, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) 183 where P: IsA<MarkAttributes> 184 { 185 let f: &F = &*(f as *const F); 186 f(&MarkAttributes::from_glib_borrow(this).unsafe_cast()) 187 } 188 unsafe { 189 let f: Box_<F> = Box_::new(f); 190 connect_raw(self.as_ptr() as *mut _, b"notify::background\0".as_ptr() as *const _, 191 Some(transmute(notify_background_trampoline::<Self, F> as usize)), Box_::into_raw(f)) 192 } 193 } 194 connect_property_gicon_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId195 fn connect_property_gicon_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 196 unsafe extern "C" fn notify_gicon_trampoline<P, F: Fn(&P) + 'static>(this: *mut gtk_source_sys::GtkSourceMarkAttributes, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) 197 where P: IsA<MarkAttributes> 198 { 199 let f: &F = &*(f as *const F); 200 f(&MarkAttributes::from_glib_borrow(this).unsafe_cast()) 201 } 202 unsafe { 203 let f: Box_<F> = Box_::new(f); 204 connect_raw(self.as_ptr() as *mut _, b"notify::gicon\0".as_ptr() as *const _, 205 Some(transmute(notify_gicon_trampoline::<Self, F> as usize)), Box_::into_raw(f)) 206 } 207 } 208 connect_property_icon_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId209 fn connect_property_icon_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 210 unsafe extern "C" fn notify_icon_name_trampoline<P, F: Fn(&P) + 'static>(this: *mut gtk_source_sys::GtkSourceMarkAttributes, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) 211 where P: IsA<MarkAttributes> 212 { 213 let f: &F = &*(f as *const F); 214 f(&MarkAttributes::from_glib_borrow(this).unsafe_cast()) 215 } 216 unsafe { 217 let f: Box_<F> = Box_::new(f); 218 connect_raw(self.as_ptr() as *mut _, b"notify::icon-name\0".as_ptr() as *const _, 219 Some(transmute(notify_icon_name_trampoline::<Self, F> as usize)), Box_::into_raw(f)) 220 } 221 } 222 connect_property_pixbuf_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId223 fn connect_property_pixbuf_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 224 unsafe extern "C" fn notify_pixbuf_trampoline<P, F: Fn(&P) + 'static>(this: *mut gtk_source_sys::GtkSourceMarkAttributes, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) 225 where P: IsA<MarkAttributes> 226 { 227 let f: &F = &*(f as *const F); 228 f(&MarkAttributes::from_glib_borrow(this).unsafe_cast()) 229 } 230 unsafe { 231 let f: Box_<F> = Box_::new(f); 232 connect_raw(self.as_ptr() as *mut _, b"notify::pixbuf\0".as_ptr() as *const _, 233 Some(transmute(notify_pixbuf_trampoline::<Self, F> as usize)), Box_::into_raw(f)) 234 } 235 } 236 } 237 238 impl fmt::Display for MarkAttributes { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result239 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 240 write!(f, "MarkAttributes") 241 } 242 } 243