use Buildable;
use Container;
use Orientable;
use Orientation;
use ScrollType;
use Widget;
use ffi;
use gdk;
use glib;
use glib::StaticType;
use glib::Value;
use glib::object::Cast;
use glib::object::IsA;
use glib::object::ObjectExt;
use glib::signal::SignalHandlerId;
use glib::signal::connect_raw;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use std::boxed::Box as Box_;
use std::fmt;
use std::mem::transmute;
glib_wrapper! {
pub struct Paned(Object<ffi::GtkPaned, ffi::GtkPanedClass, PanedClass>) @extends Container, Widget, @implements Buildable, Orientable;
match fn {
get_type => || ffi::gtk_paned_get_type(),
}
}
impl Paned {
pub fn new(orientation: Orientation) -> Paned {
assert_initialized_main_thread!();
unsafe {
Widget::from_glib_none(ffi::gtk_paned_new(orientation.to_glib())).unsafe_cast()
}
}
}
pub const NONE_PANED: Option<&Paned> = None;
pub trait PanedExt: 'static {
fn add1<P: IsA<Widget>>(&self, child: &P);
fn add2<P: IsA<Widget>>(&self, child: &P);
fn get_child1(&self) -> Option<Widget>;
fn get_child2(&self) -> Option<Widget>;
fn get_handle_window(&self) -> Option<gdk::Window>;
fn get_position(&self) -> i32;
#[cfg(any(feature = "v3_16", feature = "dox"))]
fn get_wide_handle(&self) -> bool;
fn pack1<P: IsA<Widget>>(&self, child: &P, resize: bool, shrink: bool);
fn pack2<P: IsA<Widget>>(&self, child: &P, resize: bool, shrink: bool);
fn set_position(&self, position: i32);
#[cfg(any(feature = "v3_16", feature = "dox"))]
fn set_wide_handle(&self, wide: bool);
fn get_property_max_position(&self) -> i32;
fn get_property_min_position(&self) -> i32;
fn get_property_position_set(&self) -> bool;
fn set_property_position_set(&self, position_set: bool);
fn get_child_resize<T: IsA<Widget>>(&self, item: &T) -> bool;
fn set_child_resize<T: IsA<Widget>>(&self, item: &T, resize: bool);
fn get_child_shrink<T: IsA<Widget>>(&self, item: &T) -> bool;
fn set_child_shrink<T: IsA<Widget>>(&self, item: &T, shrink: bool);
fn connect_accept_position<F: Fn(&Self) -> bool + 'static>(&self, f: F) -> SignalHandlerId;
fn emit_accept_position(&self) -> bool;
fn connect_cancel_position<F: Fn(&Self) -> bool + 'static>(&self, f: F) -> SignalHandlerId;
fn emit_cancel_position(&self) -> bool;
fn connect_cycle_child_focus<F: Fn(&Self, bool) -> bool + 'static>(&self, f: F) -> SignalHandlerId;
fn emit_cycle_child_focus(&self, reversed: bool) -> bool;
fn connect_cycle_handle_focus<F: Fn(&Self, bool) -> bool + 'static>(&self, f: F) -> SignalHandlerId;
fn emit_cycle_handle_focus(&self, reversed: bool) -> bool;
fn connect_move_handle<F: Fn(&Self, ScrollType) -> bool + 'static>(&self, f: F) -> SignalHandlerId;
fn emit_move_handle(&self, scroll_type: ScrollType) -> bool;
fn connect_toggle_handle_focus<F: Fn(&Self) -> bool + 'static>(&self, f: F) -> SignalHandlerId;
fn emit_toggle_handle_focus(&self) -> bool;
fn connect_property_max_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_min_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_position_set_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
#[cfg(any(feature = "v3_16", feature = "dox"))]
fn connect_property_wide_handle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<Paned>> PanedExt for O {
fn add1<P: IsA<Widget>>(&self, child: &P) {
unsafe {
ffi::gtk_paned_add1(self.as_ref().to_glib_none().0, child.as_ref().to_glib_none().0);
}
}
fn add2<P: IsA<Widget>>(&self, child: &P) {
unsafe {
ffi::gtk_paned_add2(self.as_ref().to_glib_none().0, child.as_ref().to_glib_none().0);
}
}
fn get_child1(&self) -> Option<Widget> {
unsafe {
from_glib_none(ffi::gtk_paned_get_child1(self.as_ref().to_glib_none().0))
}
}
fn get_child2(&self) -> Option<Widget> {
unsafe {
from_glib_none(ffi::gtk_paned_get_child2(self.as_ref().to_glib_none().0))
}
}
fn get_handle_window(&self) -> Option<gdk::Window> {
unsafe {
from_glib_none(ffi::gtk_paned_get_handle_window(self.as_ref().to_glib_none().0))
}
}
fn get_position(&self) -> i32 {
unsafe {
ffi::gtk_paned_get_position(self.as_ref().to_glib_none().0)
}
}
#[cfg(any(feature = "v3_16", feature = "dox"))]
fn get_wide_handle(&self) -> bool {
unsafe {
from_glib(ffi::gtk_paned_get_wide_handle(self.as_ref().to_glib_none().0))
}
}
fn pack1<P: IsA<Widget>>(&self, child: &P, resize: bool, shrink: bool) {
unsafe {
ffi::gtk_paned_pack1(self.as_ref().to_glib_none().0, child.as_ref().to_glib_none().0, resize.to_glib(), shrink.to_glib());
}
}
fn pack2<P: IsA<Widget>>(&self, child: &P, resize: bool, shrink: bool) {
unsafe {
ffi::gtk_paned_pack2(self.as_ref().to_glib_none().0, child.as_ref().to_glib_none().0, resize.to_glib(), shrink.to_glib());
}
}
fn set_position(&self, position: i32) {
unsafe {
ffi::gtk_paned_set_position(self.as_ref().to_glib_none().0, position);
}
}
#[cfg(any(feature = "v3_16", feature = "dox"))]
fn set_wide_handle(&self, wide: bool) {
unsafe {
ffi::gtk_paned_set_wide_handle(self.as_ref().to_glib_none().0, wide.to_glib());
}
}
fn get_property_max_position(&self) -> i32 {
unsafe {
let mut value = Value::from_type(<i32 as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0 as *mut gobject_ffi::GObject, b"max-position\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get().unwrap()
}
}
fn get_property_min_position(&self) -> i32 {
unsafe {
let mut value = Value::from_type(<i32 as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0 as *mut gobject_ffi::GObject, b"min-position\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get().unwrap()
}
}
fn get_property_position_set(&self) -> bool {
unsafe {
let mut value = Value::from_type(<bool as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0 as *mut gobject_ffi::GObject, b"position-set\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get().unwrap()
}
}
fn set_property_position_set(&self, position_set: bool) {
unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0 as *mut gobject_ffi::GObject, b"position-set\0".as_ptr() as *const _, Value::from(&position_set).to_glib_none().0);
}
}
fn get_child_resize<T: IsA<Widget>>(&self, item: &T) -> bool {
unsafe {
let mut value = Value::from_type(<bool as StaticType>::static_type());
ffi::gtk_container_child_get_property(self.to_glib_none().0 as *mut ffi::GtkContainer, item.to_glib_none().0 as *mut _, b"resize\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get().unwrap()
}
}
fn set_child_resize<T: IsA<Widget>>(&self, item: &T, resize: bool) {
unsafe {
ffi::gtk_container_child_set_property(self.to_glib_none().0 as *mut ffi::GtkContainer, item.to_glib_none().0 as *mut _, b"resize\0".as_ptr() as *const _, Value::from(&resize).to_glib_none().0);
}
}
fn get_child_shrink<T: IsA<Widget>>(&self, item: &T) -> bool {
unsafe {
let mut value = Value::from_type(<bool as StaticType>::static_type());
ffi::gtk_container_child_get_property(self.to_glib_none().0 as *mut ffi::GtkContainer, item.to_glib_none().0 as *mut _, b"shrink\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get().unwrap()
}
}
fn set_child_shrink<T: IsA<Widget>>(&self, item: &T, shrink: bool) {
unsafe {
ffi::gtk_container_child_set_property(self.to_glib_none().0 as *mut ffi::GtkContainer, item.to_glib_none().0 as *mut _, b"shrink\0".as_ptr() as *const _, Value::from(&shrink).to_glib_none().0);
}
}
fn connect_accept_position<F: Fn(&Self) -> bool + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"accept-position\0".as_ptr() as *const _,
Some(transmute(accept_position_trampoline::<Self, F> as usize)), Box_::into_raw(f))
}
}
fn emit_accept_position(&self) -> bool {
let res = unsafe { glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_ffi::GObject).emit("accept-position", &[]).unwrap() };
res.unwrap().get().unwrap()
}
fn connect_cancel_position<F: Fn(&Self) -> bool + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"cancel-position\0".as_ptr() as *const _,
Some(transmute(cancel_position_trampoline::<Self, F> as usize)), Box_::into_raw(f))
}
}
fn emit_cancel_position(&self) -> bool {
let res = unsafe { glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_ffi::GObject).emit("cancel-position", &[]).unwrap() };
res.unwrap().get().unwrap()
}
fn connect_cycle_child_focus<F: Fn(&Self, bool) -> bool + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"cycle-child-focus\0".as_ptr() as *const _,
Some(transmute(cycle_child_focus_trampoline::<Self, F> as usize)), Box_::into_raw(f))
}
}
fn emit_cycle_child_focus(&self, reversed: bool) -> bool {
let res = unsafe { glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_ffi::GObject).emit("cycle-child-focus", &[&reversed]).unwrap() };
res.unwrap().get().unwrap()
}
fn connect_cycle_handle_focus<F: Fn(&Self, bool) -> bool + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"cycle-handle-focus\0".as_ptr() as *const _,
Some(transmute(cycle_handle_focus_trampoline::<Self, F> as usize)), Box_::into_raw(f))
}
}
fn emit_cycle_handle_focus(&self, reversed: bool) -> bool {
let res = unsafe { glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_ffi::GObject).emit("cycle-handle-focus", &[&reversed]).unwrap() };
res.unwrap().get().unwrap()
}
fn connect_move_handle<F: Fn(&Self, ScrollType) -> bool + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"move-handle\0".as_ptr() as *const _,
Some(transmute(move_handle_trampoline::<Self, F> as usize)), Box_::into_raw(f))
}
}
fn emit_move_handle(&self, scroll_type: ScrollType) -> bool {
let res = unsafe { glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_ffi::GObject).emit("move-handle", &[&scroll_type]).unwrap() };
res.unwrap().get().unwrap()
}
fn connect_toggle_handle_focus<F: Fn(&Self) -> bool + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"toggle-handle-focus\0".as_ptr() as *const _,
Some(transmute(toggle_handle_focus_trampoline::<Self, F> as usize)), Box_::into_raw(f))
}
}
fn emit_toggle_handle_focus(&self) -> bool {
let res = unsafe { glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_ffi::GObject).emit("toggle-handle-focus", &[]).unwrap() };
res.unwrap().get().unwrap()
}
fn connect_property_max_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::max-position\0".as_ptr() as *const _,
Some(transmute(notify_max_position_trampoline::<Self, F> as usize)), Box_::into_raw(f))
}
}
fn connect_property_min_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::min-position\0".as_ptr() as *const _,
Some(transmute(notify_min_position_trampoline::<Self, F> as usize)), Box_::into_raw(f))
}
}
fn connect_property_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::position\0".as_ptr() as *const _,
Some(transmute(notify_position_trampoline::<Self, F> as usize)), Box_::into_raw(f))
}
}
fn connect_property_position_set_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::position-set\0".as_ptr() as *const _,
Some(transmute(notify_position_set_trampoline::<Self, F> as usize)), Box_::into_raw(f))
}
}
#[cfg(any(feature = "v3_16", feature = "dox"))]
fn connect_property_wide_handle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::wide-handle\0".as_ptr() as *const _,
Some(transmute(notify_wide_handle_trampoline::<Self, F> as usize)), Box_::into_raw(f))
}
}
}
unsafe extern "C" fn accept_position_trampoline<P, F: Fn(&P) -> bool + 'static>(this: *mut ffi::GtkPaned, f: glib_ffi::gpointer) -> glib_ffi::gboolean
where P: IsA<Paned> {
let f: &F = transmute(f);
f(&Paned::from_glib_borrow(this).unsafe_cast()).to_glib()
}
unsafe extern "C" fn cancel_position_trampoline<P, F: Fn(&P) -> bool + 'static>(this: *mut ffi::GtkPaned, f: glib_ffi::gpointer) -> glib_ffi::gboolean
where P: IsA<Paned> {
let f: &F = transmute(f);
f(&Paned::from_glib_borrow(this).unsafe_cast()).to_glib()
}
unsafe extern "C" fn cycle_child_focus_trampoline<P, F: Fn(&P, bool) -> bool + 'static>(this: *mut ffi::GtkPaned, reversed: glib_ffi::gboolean, f: glib_ffi::gpointer) -> glib_ffi::gboolean
where P: IsA<Paned> {
let f: &F = transmute(f);
f(&Paned::from_glib_borrow(this).unsafe_cast(), from_glib(reversed)).to_glib()
}
unsafe extern "C" fn cycle_handle_focus_trampoline<P, F: Fn(&P, bool) -> bool + 'static>(this: *mut ffi::GtkPaned, reversed: glib_ffi::gboolean, f: glib_ffi::gpointer) -> glib_ffi::gboolean
where P: IsA<Paned> {
let f: &F = transmute(f);
f(&Paned::from_glib_borrow(this).unsafe_cast(), from_glib(reversed)).to_glib()
}
unsafe extern "C" fn move_handle_trampoline<P, F: Fn(&P, ScrollType) -> bool + 'static>(this: *mut ffi::GtkPaned, scroll_type: ffi::GtkScrollType, f: glib_ffi::gpointer) -> glib_ffi::gboolean
where P: IsA<Paned> {
let f: &F = transmute(f);
f(&Paned::from_glib_borrow(this).unsafe_cast(), from_glib(scroll_type)).to_glib()
}
unsafe extern "C" fn toggle_handle_focus_trampoline<P, F: Fn(&P) -> bool + 'static>(this: *mut ffi::GtkPaned, f: glib_ffi::gpointer) -> glib_ffi::gboolean
where P: IsA<Paned> {
let f: &F = transmute(f);
f(&Paned::from_glib_borrow(this).unsafe_cast()).to_glib()
}
unsafe extern "C" fn notify_max_position_trampoline<P, F: Fn(&P) + 'static>(this: *mut ffi::GtkPaned, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Paned> {
let f: &F = transmute(f);
f(&Paned::from_glib_borrow(this).unsafe_cast())
}
unsafe extern "C" fn notify_min_position_trampoline<P, F: Fn(&P) + 'static>(this: *mut ffi::GtkPaned, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Paned> {
let f: &F = transmute(f);
f(&Paned::from_glib_borrow(this).unsafe_cast())
}
unsafe extern "C" fn notify_position_trampoline<P, F: Fn(&P) + 'static>(this: *mut ffi::GtkPaned, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Paned> {
let f: &F = transmute(f);
f(&Paned::from_glib_borrow(this).unsafe_cast())
}
unsafe extern "C" fn notify_position_set_trampoline<P, F: Fn(&P) + 'static>(this: *mut ffi::GtkPaned, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Paned> {
let f: &F = transmute(f);
f(&Paned::from_glib_borrow(this).unsafe_cast())
}
#[cfg(any(feature = "v3_16", feature = "dox"))]
unsafe extern "C" fn notify_wide_handle_trampoline<P, F: Fn(&P) + 'static>(this: *mut ffi::GtkPaned, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Paned> {
let f: &F = transmute(f);
f(&Paned::from_glib_borrow(this).unsafe_cast())
}
impl fmt::Display for Paned {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "Paned")
}
}