gtk 0.6.0

Rust bindings for the GTK+ 3 library
Documentation
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use Actionable;
use Bin;
use Buildable;
use Button;
#[cfg(any(feature = "v3_16", feature = "dox"))]
use ButtonRole;
use Container;
use Widget;
use ffi;
#[cfg(any(feature = "v3_16", feature = "dox"))]
use gio;
#[cfg(any(feature = "v3_16", feature = "dox"))]
use glib;
#[cfg(any(feature = "v3_16", feature = "dox"))]
use glib::GString;
#[cfg(any(feature = "v3_16", feature = "dox"))]
use glib::StaticType;
#[cfg(any(feature = "v3_16", feature = "dox"))]
use glib::Value;
use glib::object::Cast;
#[cfg(any(feature = "v3_16", feature = "dox"))]
use glib::object::IsA;
#[cfg(any(feature = "v3_16", feature = "dox"))]
use glib::object::ObjectType;
#[cfg(any(feature = "v3_16", feature = "dox"))]
use glib::signal::SignalHandlerId;
#[cfg(any(feature = "v3_16", feature = "dox"))]
use glib::signal::connect_raw;
use glib::translate::*;
#[cfg(any(feature = "v3_16", feature = "dox"))]
use glib_ffi;
#[cfg(any(feature = "v3_16", feature = "dox"))]
use gobject_ffi;
#[cfg(any(feature = "v3_16", feature = "dox"))]
use std::boxed::Box as Box_;
use std::fmt;
#[cfg(any(feature = "v3_16", feature = "dox"))]
use std::mem::transmute;

glib_wrapper! {
    pub struct ModelButton(Object<ffi::GtkModelButton, ModelButtonClass>) @extends Button, Bin, Container, Widget, @implements Buildable, Actionable;

    match fn {
        get_type => || ffi::gtk_model_button_get_type(),
    }
}

impl ModelButton {
    #[cfg(any(feature = "v3_16", feature = "dox"))]
    pub fn new() -> ModelButton {
        assert_initialized_main_thread!();
        unsafe {
            Widget::from_glib_none(ffi::gtk_model_button_new()).unsafe_cast()
        }
    }

    #[cfg(any(feature = "v3_16", feature = "dox"))]
    pub fn get_property_active(&self) -> bool {
        unsafe {
            let mut value = Value::from_type(<bool as StaticType>::static_type());
            gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"active\0".as_ptr() as *const _, value.to_glib_none_mut().0);
            value.get().unwrap()
        }
    }

    #[cfg(any(feature = "v3_16", feature = "dox"))]
    pub fn set_property_active(&self, active: bool) {
        unsafe {
            gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"active\0".as_ptr() as *const _, Value::from(&active).to_glib_none().0);
        }
    }

    #[cfg(any(feature = "v3_16", feature = "dox"))]
    pub fn get_property_centered(&self) -> bool {
        unsafe {
            let mut value = Value::from_type(<bool as StaticType>::static_type());
            gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"centered\0".as_ptr() as *const _, value.to_glib_none_mut().0);
            value.get().unwrap()
        }
    }

    #[cfg(any(feature = "v3_16", feature = "dox"))]
    pub fn set_property_centered(&self, centered: bool) {
        unsafe {
            gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"centered\0".as_ptr() as *const _, Value::from(&centered).to_glib_none().0);
        }
    }

    #[cfg(any(feature = "v3_16", feature = "dox"))]
    pub fn get_property_icon(&self) -> Option<gio::Icon> {
        unsafe {
            let mut value = Value::from_type(<gio::Icon as StaticType>::static_type());
            gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"icon\0".as_ptr() as *const _, value.to_glib_none_mut().0);
            value.get()
        }
    }

    #[cfg(any(feature = "v3_16", feature = "dox"))]
    pub fn set_property_icon<P: IsA<gio::Icon> + glib::value::SetValueOptional>(&self, icon: Option<&P>) {
        unsafe {
            gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"icon\0".as_ptr() as *const _, Value::from(icon).to_glib_none().0);
        }
    }

    #[cfg(any(feature = "v3_16", feature = "dox"))]
    pub fn get_property_iconic(&self) -> bool {
        unsafe {
            let mut value = Value::from_type(<bool as StaticType>::static_type());
            gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"iconic\0".as_ptr() as *const _, value.to_glib_none_mut().0);
            value.get().unwrap()
        }
    }

    #[cfg(any(feature = "v3_16", feature = "dox"))]
    pub fn set_property_iconic(&self, iconic: bool) {
        unsafe {
            gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"iconic\0".as_ptr() as *const _, Value::from(&iconic).to_glib_none().0);
        }
    }

    #[cfg(any(feature = "v3_16", feature = "dox"))]
    pub fn get_property_inverted(&self) -> bool {
        unsafe {
            let mut value = Value::from_type(<bool as StaticType>::static_type());
            gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"inverted\0".as_ptr() as *const _, value.to_glib_none_mut().0);
            value.get().unwrap()
        }
    }

    #[cfg(any(feature = "v3_16", feature = "dox"))]
    pub fn set_property_inverted(&self, inverted: bool) {
        unsafe {
            gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"inverted\0".as_ptr() as *const _, Value::from(&inverted).to_glib_none().0);
        }
    }

    #[cfg(any(feature = "v3_16", feature = "dox"))]
    pub fn get_property_menu_name(&self) -> Option<GString> {
        unsafe {
            let mut value = Value::from_type(<GString as StaticType>::static_type());
            gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"menu-name\0".as_ptr() as *const _, value.to_glib_none_mut().0);
            value.get()
        }
    }

    #[cfg(any(feature = "v3_16", feature = "dox"))]
    pub fn set_property_menu_name<'a, P: Into<Option<&'a str>>>(&self, menu_name: P) {
        let menu_name = menu_name.into();
        unsafe {
            gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"menu-name\0".as_ptr() as *const _, Value::from(menu_name).to_glib_none().0);
        }
    }

    #[cfg(any(feature = "v3_16", feature = "dox"))]
    pub fn get_property_role(&self) -> ButtonRole {
        unsafe {
            let mut value = Value::from_type(<ButtonRole as StaticType>::static_type());
            gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"role\0".as_ptr() as *const _, value.to_glib_none_mut().0);
            value.get().unwrap()
        }
    }

    #[cfg(any(feature = "v3_16", feature = "dox"))]
    pub fn set_property_role(&self, role: ButtonRole) {
        unsafe {
            gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"role\0".as_ptr() as *const _, Value::from(&role).to_glib_none().0);
        }
    }

    #[cfg(any(feature = "v3_16", feature = "dox"))]
    pub fn get_property_text(&self) -> Option<GString> {
        unsafe {
            let mut value = Value::from_type(<GString as StaticType>::static_type());
            gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"text\0".as_ptr() as *const _, value.to_glib_none_mut().0);
            value.get()
        }
    }

    #[cfg(any(feature = "v3_16", feature = "dox"))]
    pub fn set_property_text<'a, P: Into<Option<&'a str>>>(&self, text: P) {
        let text = text.into();
        unsafe {
            gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"text\0".as_ptr() as *const _, Value::from(text).to_glib_none().0);
        }
    }

    #[cfg(any(feature = "v3_24", feature = "dox"))]
    pub fn get_property_use_markup(&self) -> bool {
        unsafe {
            let mut value = Value::from_type(<bool as StaticType>::static_type());
            gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"use-markup\0".as_ptr() as *const _, value.to_glib_none_mut().0);
            value.get().unwrap()
        }
    }

    #[cfg(any(feature = "v3_24", feature = "dox"))]
    pub fn set_property_use_markup(&self, use_markup: bool) {
        unsafe {
            gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"use-markup\0".as_ptr() as *const _, Value::from(&use_markup).to_glib_none().0);
        }
    }

    #[cfg(any(feature = "v3_16", feature = "dox"))]
    pub fn connect_property_active_notify<F: Fn(&ModelButton) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(self.as_ptr() as *mut _, b"notify::active\0".as_ptr() as *const _,
                Some(transmute(notify_active_trampoline::<F> as usize)), Box_::into_raw(f))
        }
    }

    #[cfg(any(feature = "v3_16", feature = "dox"))]
    pub fn connect_property_centered_notify<F: Fn(&ModelButton) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(self.as_ptr() as *mut _, b"notify::centered\0".as_ptr() as *const _,
                Some(transmute(notify_centered_trampoline::<F> as usize)), Box_::into_raw(f))
        }
    }

    #[cfg(any(feature = "v3_16", feature = "dox"))]
    pub fn connect_property_icon_notify<F: Fn(&ModelButton) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(self.as_ptr() as *mut _, b"notify::icon\0".as_ptr() as *const _,
                Some(transmute(notify_icon_trampoline::<F> as usize)), Box_::into_raw(f))
        }
    }

    #[cfg(any(feature = "v3_16", feature = "dox"))]
    pub fn connect_property_iconic_notify<F: Fn(&ModelButton) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(self.as_ptr() as *mut _, b"notify::iconic\0".as_ptr() as *const _,
                Some(transmute(notify_iconic_trampoline::<F> as usize)), Box_::into_raw(f))
        }
    }

    #[cfg(any(feature = "v3_16", feature = "dox"))]
    pub fn connect_property_inverted_notify<F: Fn(&ModelButton) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(self.as_ptr() as *mut _, b"notify::inverted\0".as_ptr() as *const _,
                Some(transmute(notify_inverted_trampoline::<F> as usize)), Box_::into_raw(f))
        }
    }

    #[cfg(any(feature = "v3_16", feature = "dox"))]
    pub fn connect_property_menu_name_notify<F: Fn(&ModelButton) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(self.as_ptr() as *mut _, b"notify::menu-name\0".as_ptr() as *const _,
                Some(transmute(notify_menu_name_trampoline::<F> as usize)), Box_::into_raw(f))
        }
    }

    #[cfg(any(feature = "v3_16", feature = "dox"))]
    pub fn connect_property_role_notify<F: Fn(&ModelButton) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(self.as_ptr() as *mut _, b"notify::role\0".as_ptr() as *const _,
                Some(transmute(notify_role_trampoline::<F> as usize)), Box_::into_raw(f))
        }
    }

    #[cfg(any(feature = "v3_16", feature = "dox"))]
    pub fn connect_property_text_notify<F: Fn(&ModelButton) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(self.as_ptr() as *mut _, b"notify::text\0".as_ptr() as *const _,
                Some(transmute(notify_text_trampoline::<F> as usize)), Box_::into_raw(f))
        }
    }

    #[cfg(any(feature = "v3_24", feature = "dox"))]
    pub fn connect_property_use_markup_notify<F: Fn(&ModelButton) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(self.as_ptr() as *mut _, b"notify::use-markup\0".as_ptr() as *const _,
                Some(transmute(notify_use_markup_trampoline::<F> as usize)), Box_::into_raw(f))
        }
    }
}

#[cfg(any(feature = "v3_16", feature = "dox"))]
impl Default for ModelButton {
    fn default() -> Self {
        Self::new()
    }
}

#[cfg(any(feature = "v3_16", feature = "dox"))]
unsafe extern "C" fn notify_active_trampoline<F: Fn(&ModelButton) + 'static>(this: *mut ffi::GtkModelButton, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
    let f: &F = transmute(f);
    f(&from_glib_borrow(this))
}

#[cfg(any(feature = "v3_16", feature = "dox"))]
unsafe extern "C" fn notify_centered_trampoline<F: Fn(&ModelButton) + 'static>(this: *mut ffi::GtkModelButton, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
    let f: &F = transmute(f);
    f(&from_glib_borrow(this))
}

#[cfg(any(feature = "v3_16", feature = "dox"))]
unsafe extern "C" fn notify_icon_trampoline<F: Fn(&ModelButton) + 'static>(this: *mut ffi::GtkModelButton, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
    let f: &F = transmute(f);
    f(&from_glib_borrow(this))
}

#[cfg(any(feature = "v3_16", feature = "dox"))]
unsafe extern "C" fn notify_iconic_trampoline<F: Fn(&ModelButton) + 'static>(this: *mut ffi::GtkModelButton, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
    let f: &F = transmute(f);
    f(&from_glib_borrow(this))
}

#[cfg(any(feature = "v3_16", feature = "dox"))]
unsafe extern "C" fn notify_inverted_trampoline<F: Fn(&ModelButton) + 'static>(this: *mut ffi::GtkModelButton, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
    let f: &F = transmute(f);
    f(&from_glib_borrow(this))
}

#[cfg(any(feature = "v3_16", feature = "dox"))]
unsafe extern "C" fn notify_menu_name_trampoline<F: Fn(&ModelButton) + 'static>(this: *mut ffi::GtkModelButton, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
    let f: &F = transmute(f);
    f(&from_glib_borrow(this))
}

#[cfg(any(feature = "v3_16", feature = "dox"))]
unsafe extern "C" fn notify_role_trampoline<F: Fn(&ModelButton) + 'static>(this: *mut ffi::GtkModelButton, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
    let f: &F = transmute(f);
    f(&from_glib_borrow(this))
}

#[cfg(any(feature = "v3_16", feature = "dox"))]
unsafe extern "C" fn notify_text_trampoline<F: Fn(&ModelButton) + 'static>(this: *mut ffi::GtkModelButton, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
    let f: &F = transmute(f);
    f(&from_glib_borrow(this))
}

#[cfg(any(feature = "v3_24", feature = "dox"))]
unsafe extern "C" fn notify_use_markup_trampoline<F: Fn(&ModelButton) + 'static>(this: *mut ffi::GtkModelButton, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
    let f: &F = transmute(f);
    f(&from_glib_borrow(this))
}

impl fmt::Display for ModelButton {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "ModelButton")
    }
}