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 glib::object::Cast; 6 use glib::object::IsA; 7 use glib::signal::connect_raw; 8 use glib::signal::SignalHandlerId; 9 use glib::translate::*; 10 use glib_sys; 11 use gtk; 12 use handy_sys; 13 use std::boxed::Box as Box_; 14 use std::fmt; 15 use std::mem::transmute; 16 17 glib_wrapper! { 18 pub struct HeaderGroup(Object<handy_sys::HdyHeaderGroup, handy_sys::HdyHeaderGroupClass, HeaderGroupClass>); 19 20 match fn { 21 get_type => || handy_sys::hdy_header_group_get_type(), 22 } 23 } 24 25 impl HeaderGroup { new() -> HeaderGroup26 pub fn new() -> HeaderGroup { 27 assert_initialized_main_thread!(); 28 unsafe { 29 from_glib_full(handy_sys::hdy_header_group_new()) 30 } 31 } 32 } 33 34 impl Default for HeaderGroup { default() -> Self35 fn default() -> Self { 36 Self::new() 37 } 38 } 39 40 pub const NONE_HEADER_GROUP: Option<&HeaderGroup> = None; 41 42 pub trait HeaderGroupExt: 'static { add_header_bar<P: IsA<gtk::HeaderBar>>(&self, header_bar: &P)43 fn add_header_bar<P: IsA<gtk::HeaderBar>>(&self, header_bar: &P); 44 get_focus(&self) -> Option<gtk::HeaderBar>45 fn get_focus(&self) -> Option<gtk::HeaderBar>; 46 get_header_bars(&self) -> Vec<gtk::HeaderBar>47 fn get_header_bars(&self) -> Vec<gtk::HeaderBar>; 48 remove_header_bar<P: IsA<gtk::HeaderBar>>(&self, header_bar: &P)49 fn remove_header_bar<P: IsA<gtk::HeaderBar>>(&self, header_bar: &P); 50 set_focus<P: IsA<gtk::HeaderBar>>(&self, header_bar: Option<&P>)51 fn set_focus<P: IsA<gtk::HeaderBar>>(&self, header_bar: Option<&P>); 52 connect_property_focus_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId53 fn connect_property_focus_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 54 } 55 56 impl<O: IsA<HeaderGroup>> HeaderGroupExt for O { add_header_bar<P: IsA<gtk::HeaderBar>>(&self, header_bar: &P)57 fn add_header_bar<P: IsA<gtk::HeaderBar>>(&self, header_bar: &P) { 58 unsafe { 59 handy_sys::hdy_header_group_add_header_bar(self.as_ref().to_glib_none().0, header_bar.as_ref().to_glib_none().0); 60 } 61 } 62 get_focus(&self) -> Option<gtk::HeaderBar>63 fn get_focus(&self) -> Option<gtk::HeaderBar> { 64 unsafe { 65 from_glib_none(handy_sys::hdy_header_group_get_focus(self.as_ref().to_glib_none().0)) 66 } 67 } 68 get_header_bars(&self) -> Vec<gtk::HeaderBar>69 fn get_header_bars(&self) -> Vec<gtk::HeaderBar> { 70 unsafe { 71 FromGlibPtrContainer::from_glib_none(handy_sys::hdy_header_group_get_header_bars(self.as_ref().to_glib_none().0)) 72 } 73 } 74 remove_header_bar<P: IsA<gtk::HeaderBar>>(&self, header_bar: &P)75 fn remove_header_bar<P: IsA<gtk::HeaderBar>>(&self, header_bar: &P) { 76 unsafe { 77 handy_sys::hdy_header_group_remove_header_bar(self.as_ref().to_glib_none().0, header_bar.as_ref().to_glib_none().0); 78 } 79 } 80 set_focus<P: IsA<gtk::HeaderBar>>(&self, header_bar: Option<&P>)81 fn set_focus<P: IsA<gtk::HeaderBar>>(&self, header_bar: Option<&P>) { 82 unsafe { 83 handy_sys::hdy_header_group_set_focus(self.as_ref().to_glib_none().0, header_bar.map(|p| p.as_ref()).to_glib_none().0); 84 } 85 } 86 connect_property_focus_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId87 fn connect_property_focus_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 88 unsafe extern "C" fn notify_focus_trampoline<P, F: Fn(&P) + 'static>(this: *mut handy_sys::HdyHeaderGroup, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) 89 where P: IsA<HeaderGroup> 90 { 91 let f: &F = &*(f as *const F); 92 f(&HeaderGroup::from_glib_borrow(this).unsafe_cast()) 93 } 94 unsafe { 95 let f: Box_<F> = Box_::new(f); 96 connect_raw(self.as_ptr() as *mut _, b"notify::focus\0".as_ptr() as *const _, 97 Some(transmute(notify_focus_trampoline::<Self, F> as usize)), Box_::into_raw(f)) 98 } 99 } 100 } 101 102 impl fmt::Display for HeaderGroup { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result103 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 104 write!(f, "HeaderGroup") 105 } 106 } 107