use crate::DOMDOMWindow;
use crate::DOMEvent;
use crate::DOMObject;
use glib::object::Cast;
use glib::object::IsA;
use glib::signal::connect_raw;
use glib::signal::SignalHandlerId;
use glib::translate::*;
use std::boxed::Box as Box_;
use std::fmt;
use std::mem::transmute;
glib::wrapper! {
#[doc(alias = "WebKitDOMUIEvent")]
pub struct DOMUIEvent(Object<ffi::WebKitDOMUIEvent, ffi::WebKitDOMUIEventClass>) @extends DOMEvent, DOMObject;
match fn {
type_ => || ffi::webkit_dom_ui_event_get_type(),
}
}
impl DOMUIEvent {
pub const NONE: Option<&'static DOMUIEvent> = None;
}
pub trait DOMUIEventExt: 'static {
#[cfg_attr(feature = "v2_22", deprecated = "Since 2.22")]
#[doc(alias = "webkit_dom_ui_event_get_char_code")]
#[doc(alias = "get_char_code")]
fn char_code(&self) -> libc::c_long;
#[cfg_attr(feature = "v2_22", deprecated = "Since 2.22")]
#[doc(alias = "webkit_dom_ui_event_get_detail")]
#[doc(alias = "get_detail")]
fn detail(&self) -> libc::c_long;
#[cfg_attr(feature = "v2_22", deprecated = "Since 2.22")]
#[doc(alias = "webkit_dom_ui_event_get_key_code")]
#[doc(alias = "get_key_code")]
fn key_code(&self) -> libc::c_long;
#[cfg_attr(feature = "v2_22", deprecated = "Since 2.22")]
#[doc(alias = "webkit_dom_ui_event_get_layer_x")]
#[doc(alias = "get_layer_x")]
fn layer_x(&self) -> libc::c_long;
#[cfg_attr(feature = "v2_22", deprecated = "Since 2.22")]
#[doc(alias = "webkit_dom_ui_event_get_layer_y")]
#[doc(alias = "get_layer_y")]
fn layer_y(&self) -> libc::c_long;
#[cfg_attr(feature = "v2_22", deprecated = "Since 2.22")]
#[doc(alias = "webkit_dom_ui_event_get_page_x")]
#[doc(alias = "get_page_x")]
fn page_x(&self) -> libc::c_long;
#[cfg_attr(feature = "v2_22", deprecated = "Since 2.22")]
#[doc(alias = "webkit_dom_ui_event_get_page_y")]
#[doc(alias = "get_page_y")]
fn page_y(&self) -> libc::c_long;
#[cfg_attr(feature = "v2_22", deprecated = "Since 2.22")]
#[doc(alias = "webkit_dom_ui_event_get_view")]
#[doc(alias = "get_view")]
fn view(&self) -> Option<DOMDOMWindow>;
#[cfg_attr(feature = "v2_22", deprecated = "Since 2.22")]
#[doc(alias = "webkit_dom_ui_event_init_ui_event")]
fn init_ui_event(&self, type_: &str, canBubble: bool, cancelable: bool, view: &impl IsA<DOMDOMWindow>, detail: libc::c_long);
#[doc(alias = "char-code")]
fn connect_char_code_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
#[doc(alias = "detail")]
fn connect_detail_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
#[doc(alias = "key-code")]
fn connect_key_code_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
#[doc(alias = "layer-x")]
fn connect_layer_x_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
#[doc(alias = "layer-y")]
fn connect_layer_y_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
#[doc(alias = "page-x")]
fn connect_page_x_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
#[doc(alias = "page-y")]
fn connect_page_y_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
#[doc(alias = "view")]
fn connect_view_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<DOMUIEvent>> DOMUIEventExt for O {
fn char_code(&self) -> libc::c_long {
unsafe {
ffi::webkit_dom_ui_event_get_char_code(self.as_ref().to_glib_none().0)
}
}
fn detail(&self) -> libc::c_long {
unsafe {
ffi::webkit_dom_ui_event_get_detail(self.as_ref().to_glib_none().0)
}
}
fn key_code(&self) -> libc::c_long {
unsafe {
ffi::webkit_dom_ui_event_get_key_code(self.as_ref().to_glib_none().0)
}
}
fn layer_x(&self) -> libc::c_long {
unsafe {
ffi::webkit_dom_ui_event_get_layer_x(self.as_ref().to_glib_none().0)
}
}
fn layer_y(&self) -> libc::c_long {
unsafe {
ffi::webkit_dom_ui_event_get_layer_y(self.as_ref().to_glib_none().0)
}
}
fn page_x(&self) -> libc::c_long {
unsafe {
ffi::webkit_dom_ui_event_get_page_x(self.as_ref().to_glib_none().0)
}
}
fn page_y(&self) -> libc::c_long {
unsafe {
ffi::webkit_dom_ui_event_get_page_y(self.as_ref().to_glib_none().0)
}
}
fn view(&self) -> Option<DOMDOMWindow> {
unsafe {
from_glib_full(ffi::webkit_dom_ui_event_get_view(self.as_ref().to_glib_none().0))
}
}
fn init_ui_event(&self, type_: &str, canBubble: bool, cancelable: bool, view: &impl IsA<DOMDOMWindow>, detail: libc::c_long) {
unsafe {
ffi::webkit_dom_ui_event_init_ui_event(self.as_ref().to_glib_none().0, type_.to_glib_none().0, canBubble.into_glib(), cancelable.into_glib(), view.as_ref().to_glib_none().0, detail);
}
}
fn connect_char_code_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_char_code_trampoline<P: IsA<DOMUIEvent>, F: Fn(&P) + 'static>(this: *mut ffi::WebKitDOMUIEvent, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(DOMUIEvent::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::char-code\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(notify_char_code_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
}
}
fn connect_detail_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_detail_trampoline<P: IsA<DOMUIEvent>, F: Fn(&P) + 'static>(this: *mut ffi::WebKitDOMUIEvent, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(DOMUIEvent::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::detail\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(notify_detail_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
}
}
fn connect_key_code_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_key_code_trampoline<P: IsA<DOMUIEvent>, F: Fn(&P) + 'static>(this: *mut ffi::WebKitDOMUIEvent, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(DOMUIEvent::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::key-code\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(notify_key_code_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
}
}
fn connect_layer_x_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_layer_x_trampoline<P: IsA<DOMUIEvent>, F: Fn(&P) + 'static>(this: *mut ffi::WebKitDOMUIEvent, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(DOMUIEvent::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::layer-x\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(notify_layer_x_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
}
}
fn connect_layer_y_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_layer_y_trampoline<P: IsA<DOMUIEvent>, F: Fn(&P) + 'static>(this: *mut ffi::WebKitDOMUIEvent, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(DOMUIEvent::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::layer-y\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(notify_layer_y_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
}
}
fn connect_page_x_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_page_x_trampoline<P: IsA<DOMUIEvent>, F: Fn(&P) + 'static>(this: *mut ffi::WebKitDOMUIEvent, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(DOMUIEvent::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::page-x\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(notify_page_x_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
}
}
fn connect_page_y_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_page_y_trampoline<P: IsA<DOMUIEvent>, F: Fn(&P) + 'static>(this: *mut ffi::WebKitDOMUIEvent, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(DOMUIEvent::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::page-y\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(notify_page_y_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
}
}
fn connect_view_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_view_trampoline<P: IsA<DOMUIEvent>, F: Fn(&P) + 'static>(this: *mut ffi::WebKitDOMUIEvent, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(DOMUIEvent::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::view\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(notify_view_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
}
}
}
impl fmt::Display for DOMUIEvent {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str("DOMUIEvent")
}
}