use DOMDOMWindow;
use DOMEvent;
use DOMEventTarget;
use DOMNode;
use DOMObject;
use DOMUIEvent;
use glib::object::Cast;
use glib::object::IsA;
use glib::signal::SignalHandlerId;
use glib::signal::connect_raw;
use glib::translate::*;
use glib_sys;
use libc;
use std::boxed::Box as Box_;
use std::fmt;
use std::mem::transmute;
use webkit2_webextension_sys;
glib_wrapper! {
pub struct DOMMouseEvent(Object<webkit2_webextension_sys::WebKitDOMMouseEvent, webkit2_webextension_sys::WebKitDOMMouseEventClass, DOMMouseEventClass>) @extends DOMUIEvent, DOMEvent, DOMObject;
match fn {
get_type => || webkit2_webextension_sys::webkit_dom_mouse_event_get_type(),
}
}
pub const NONE_DOM_MOUSE_EVENT: Option<&DOMMouseEvent> = None;
pub trait DOMMouseEventExt: 'static {
#[cfg_attr(feature = "v2_22", deprecated)]
fn get_alt_key(&self) -> bool;
#[cfg_attr(feature = "v2_22", deprecated)]
fn get_button(&self) -> libc::c_ushort;
#[cfg_attr(feature = "v2_22", deprecated)]
fn get_client_x(&self) -> libc::c_long;
#[cfg_attr(feature = "v2_22", deprecated)]
fn get_client_y(&self) -> libc::c_long;
#[cfg_attr(feature = "v2_22", deprecated)]
fn get_ctrl_key(&self) -> bool;
#[cfg_attr(feature = "v2_22", deprecated)]
fn get_from_element(&self) -> Option<DOMNode>;
#[cfg_attr(feature = "v2_22", deprecated)]
fn get_meta_key(&self) -> bool;
#[cfg_attr(feature = "v2_22", deprecated)]
fn get_offset_x(&self) -> libc::c_long;
#[cfg_attr(feature = "v2_22", deprecated)]
fn get_offset_y(&self) -> libc::c_long;
#[cfg_attr(feature = "v2_22", deprecated)]
fn get_related_target(&self) -> Option<DOMEventTarget>;
#[cfg_attr(feature = "v2_22", deprecated)]
fn get_screen_x(&self) -> libc::c_long;
#[cfg_attr(feature = "v2_22", deprecated)]
fn get_screen_y(&self) -> libc::c_long;
#[cfg_attr(feature = "v2_22", deprecated)]
fn get_shift_key(&self) -> bool;
#[cfg_attr(feature = "v2_22", deprecated)]
fn get_to_element(&self) -> Option<DOMNode>;
#[cfg_attr(feature = "v2_22", deprecated)]
fn get_x(&self) -> libc::c_long;
#[cfg_attr(feature = "v2_22", deprecated)]
fn get_y(&self) -> libc::c_long;
#[cfg_attr(feature = "v2_22", deprecated)]
fn init_mouse_event<P: IsA<DOMDOMWindow>, Q: IsA<DOMEventTarget>>(&self, type_: &str, canBubble: bool, cancelable: bool, view: &P, detail: libc::c_long, screenX: libc::c_long, screenY: libc::c_long, clientX: libc::c_long, clientY: libc::c_long, ctrlKey: bool, altKey: bool, shiftKey: bool, metaKey: bool, button: libc::c_ushort, relatedTarget: &Q);
fn connect_property_alt_key_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_button_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_client_x_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_client_y_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_ctrl_key_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_from_element_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_meta_key_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_offset_x_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_offset_y_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_related_target_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_screen_x_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_screen_y_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_shift_key_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_to_element_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_x_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_y_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<DOMMouseEvent>> DOMMouseEventExt for O {
fn get_alt_key(&self) -> bool {
unsafe {
from_glib(webkit2_webextension_sys::webkit_dom_mouse_event_get_alt_key(self.as_ref().to_glib_none().0))
}
}
fn get_button(&self) -> libc::c_ushort {
unsafe {
webkit2_webextension_sys::webkit_dom_mouse_event_get_button(self.as_ref().to_glib_none().0)
}
}
fn get_client_x(&self) -> libc::c_long {
unsafe {
webkit2_webextension_sys::webkit_dom_mouse_event_get_client_x(self.as_ref().to_glib_none().0)
}
}
fn get_client_y(&self) -> libc::c_long {
unsafe {
webkit2_webextension_sys::webkit_dom_mouse_event_get_client_y(self.as_ref().to_glib_none().0)
}
}
fn get_ctrl_key(&self) -> bool {
unsafe {
from_glib(webkit2_webextension_sys::webkit_dom_mouse_event_get_ctrl_key(self.as_ref().to_glib_none().0))
}
}
fn get_from_element(&self) -> Option<DOMNode> {
unsafe {
from_glib_none(webkit2_webextension_sys::webkit_dom_mouse_event_get_from_element(self.as_ref().to_glib_none().0))
}
}
fn get_meta_key(&self) -> bool {
unsafe {
from_glib(webkit2_webextension_sys::webkit_dom_mouse_event_get_meta_key(self.as_ref().to_glib_none().0))
}
}
fn get_offset_x(&self) -> libc::c_long {
unsafe {
webkit2_webextension_sys::webkit_dom_mouse_event_get_offset_x(self.as_ref().to_glib_none().0)
}
}
fn get_offset_y(&self) -> libc::c_long {
unsafe {
webkit2_webextension_sys::webkit_dom_mouse_event_get_offset_y(self.as_ref().to_glib_none().0)
}
}
fn get_related_target(&self) -> Option<DOMEventTarget> {
unsafe {
from_glib_full(webkit2_webextension_sys::webkit_dom_mouse_event_get_related_target(self.as_ref().to_glib_none().0))
}
}
fn get_screen_x(&self) -> libc::c_long {
unsafe {
webkit2_webextension_sys::webkit_dom_mouse_event_get_screen_x(self.as_ref().to_glib_none().0)
}
}
fn get_screen_y(&self) -> libc::c_long {
unsafe {
webkit2_webextension_sys::webkit_dom_mouse_event_get_screen_y(self.as_ref().to_glib_none().0)
}
}
fn get_shift_key(&self) -> bool {
unsafe {
from_glib(webkit2_webextension_sys::webkit_dom_mouse_event_get_shift_key(self.as_ref().to_glib_none().0))
}
}
fn get_to_element(&self) -> Option<DOMNode> {
unsafe {
from_glib_none(webkit2_webextension_sys::webkit_dom_mouse_event_get_to_element(self.as_ref().to_glib_none().0))
}
}
fn get_x(&self) -> libc::c_long {
unsafe {
webkit2_webextension_sys::webkit_dom_mouse_event_get_x(self.as_ref().to_glib_none().0)
}
}
fn get_y(&self) -> libc::c_long {
unsafe {
webkit2_webextension_sys::webkit_dom_mouse_event_get_y(self.as_ref().to_glib_none().0)
}
}
fn init_mouse_event<P: IsA<DOMDOMWindow>, Q: IsA<DOMEventTarget>>(&self, type_: &str, canBubble: bool, cancelable: bool, view: &P, detail: libc::c_long, screenX: libc::c_long, screenY: libc::c_long, clientX: libc::c_long, clientY: libc::c_long, ctrlKey: bool, altKey: bool, shiftKey: bool, metaKey: bool, button: libc::c_ushort, relatedTarget: &Q) {
unsafe {
webkit2_webextension_sys::webkit_dom_mouse_event_init_mouse_event(self.as_ref().to_glib_none().0, type_.to_glib_none().0, canBubble.to_glib(), cancelable.to_glib(), view.as_ref().to_glib_none().0, detail, screenX, screenY, clientX, clientY, ctrlKey.to_glib(), altKey.to_glib(), shiftKey.to_glib(), metaKey.to_glib(), button, relatedTarget.as_ref().to_glib_none().0);
}
}
fn connect_property_alt_key_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_alt_key_trampoline<P, F: Fn(&P) + 'static>(this: *mut webkit2_webextension_sys::WebKitDOMMouseEvent, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer)
where P: IsA<DOMMouseEvent>
{
let f: &F = &*(f as *const F);
f(&DOMMouseEvent::from_glib_borrow(this).unsafe_cast())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::alt-key\0".as_ptr() as *const _,
Some(transmute(notify_alt_key_trampoline::<Self, F> as usize)), Box_::into_raw(f))
}
}
fn connect_property_button_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_button_trampoline<P, F: Fn(&P) + 'static>(this: *mut webkit2_webextension_sys::WebKitDOMMouseEvent, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer)
where P: IsA<DOMMouseEvent>
{
let f: &F = &*(f as *const F);
f(&DOMMouseEvent::from_glib_borrow(this).unsafe_cast())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::button\0".as_ptr() as *const _,
Some(transmute(notify_button_trampoline::<Self, F> as usize)), Box_::into_raw(f))
}
}
fn connect_property_client_x_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_client_x_trampoline<P, F: Fn(&P) + 'static>(this: *mut webkit2_webextension_sys::WebKitDOMMouseEvent, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer)
where P: IsA<DOMMouseEvent>
{
let f: &F = &*(f as *const F);
f(&DOMMouseEvent::from_glib_borrow(this).unsafe_cast())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::client-x\0".as_ptr() as *const _,
Some(transmute(notify_client_x_trampoline::<Self, F> as usize)), Box_::into_raw(f))
}
}
fn connect_property_client_y_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_client_y_trampoline<P, F: Fn(&P) + 'static>(this: *mut webkit2_webextension_sys::WebKitDOMMouseEvent, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer)
where P: IsA<DOMMouseEvent>
{
let f: &F = &*(f as *const F);
f(&DOMMouseEvent::from_glib_borrow(this).unsafe_cast())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::client-y\0".as_ptr() as *const _,
Some(transmute(notify_client_y_trampoline::<Self, F> as usize)), Box_::into_raw(f))
}
}
fn connect_property_ctrl_key_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_ctrl_key_trampoline<P, F: Fn(&P) + 'static>(this: *mut webkit2_webextension_sys::WebKitDOMMouseEvent, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer)
where P: IsA<DOMMouseEvent>
{
let f: &F = &*(f as *const F);
f(&DOMMouseEvent::from_glib_borrow(this).unsafe_cast())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::ctrl-key\0".as_ptr() as *const _,
Some(transmute(notify_ctrl_key_trampoline::<Self, F> as usize)), Box_::into_raw(f))
}
}
fn connect_property_from_element_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_from_element_trampoline<P, F: Fn(&P) + 'static>(this: *mut webkit2_webextension_sys::WebKitDOMMouseEvent, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer)
where P: IsA<DOMMouseEvent>
{
let f: &F = &*(f as *const F);
f(&DOMMouseEvent::from_glib_borrow(this).unsafe_cast())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::from-element\0".as_ptr() as *const _,
Some(transmute(notify_from_element_trampoline::<Self, F> as usize)), Box_::into_raw(f))
}
}
fn connect_property_meta_key_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_meta_key_trampoline<P, F: Fn(&P) + 'static>(this: *mut webkit2_webextension_sys::WebKitDOMMouseEvent, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer)
where P: IsA<DOMMouseEvent>
{
let f: &F = &*(f as *const F);
f(&DOMMouseEvent::from_glib_borrow(this).unsafe_cast())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::meta-key\0".as_ptr() as *const _,
Some(transmute(notify_meta_key_trampoline::<Self, F> as usize)), Box_::into_raw(f))
}
}
fn connect_property_offset_x_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_offset_x_trampoline<P, F: Fn(&P) + 'static>(this: *mut webkit2_webextension_sys::WebKitDOMMouseEvent, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer)
where P: IsA<DOMMouseEvent>
{
let f: &F = &*(f as *const F);
f(&DOMMouseEvent::from_glib_borrow(this).unsafe_cast())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::offset-x\0".as_ptr() as *const _,
Some(transmute(notify_offset_x_trampoline::<Self, F> as usize)), Box_::into_raw(f))
}
}
fn connect_property_offset_y_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_offset_y_trampoline<P, F: Fn(&P) + 'static>(this: *mut webkit2_webextension_sys::WebKitDOMMouseEvent, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer)
where P: IsA<DOMMouseEvent>
{
let f: &F = &*(f as *const F);
f(&DOMMouseEvent::from_glib_borrow(this).unsafe_cast())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::offset-y\0".as_ptr() as *const _,
Some(transmute(notify_offset_y_trampoline::<Self, F> as usize)), Box_::into_raw(f))
}
}
fn connect_property_related_target_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_related_target_trampoline<P, F: Fn(&P) + 'static>(this: *mut webkit2_webextension_sys::WebKitDOMMouseEvent, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer)
where P: IsA<DOMMouseEvent>
{
let f: &F = &*(f as *const F);
f(&DOMMouseEvent::from_glib_borrow(this).unsafe_cast())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::related-target\0".as_ptr() as *const _,
Some(transmute(notify_related_target_trampoline::<Self, F> as usize)), Box_::into_raw(f))
}
}
fn connect_property_screen_x_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_screen_x_trampoline<P, F: Fn(&P) + 'static>(this: *mut webkit2_webextension_sys::WebKitDOMMouseEvent, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer)
where P: IsA<DOMMouseEvent>
{
let f: &F = &*(f as *const F);
f(&DOMMouseEvent::from_glib_borrow(this).unsafe_cast())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::screen-x\0".as_ptr() as *const _,
Some(transmute(notify_screen_x_trampoline::<Self, F> as usize)), Box_::into_raw(f))
}
}
fn connect_property_screen_y_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_screen_y_trampoline<P, F: Fn(&P) + 'static>(this: *mut webkit2_webextension_sys::WebKitDOMMouseEvent, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer)
where P: IsA<DOMMouseEvent>
{
let f: &F = &*(f as *const F);
f(&DOMMouseEvent::from_glib_borrow(this).unsafe_cast())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::screen-y\0".as_ptr() as *const _,
Some(transmute(notify_screen_y_trampoline::<Self, F> as usize)), Box_::into_raw(f))
}
}
fn connect_property_shift_key_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_shift_key_trampoline<P, F: Fn(&P) + 'static>(this: *mut webkit2_webextension_sys::WebKitDOMMouseEvent, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer)
where P: IsA<DOMMouseEvent>
{
let f: &F = &*(f as *const F);
f(&DOMMouseEvent::from_glib_borrow(this).unsafe_cast())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::shift-key\0".as_ptr() as *const _,
Some(transmute(notify_shift_key_trampoline::<Self, F> as usize)), Box_::into_raw(f))
}
}
fn connect_property_to_element_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_to_element_trampoline<P, F: Fn(&P) + 'static>(this: *mut webkit2_webextension_sys::WebKitDOMMouseEvent, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer)
where P: IsA<DOMMouseEvent>
{
let f: &F = &*(f as *const F);
f(&DOMMouseEvent::from_glib_borrow(this).unsafe_cast())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::to-element\0".as_ptr() as *const _,
Some(transmute(notify_to_element_trampoline::<Self, F> as usize)), Box_::into_raw(f))
}
}
fn connect_property_x_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_x_trampoline<P, F: Fn(&P) + 'static>(this: *mut webkit2_webextension_sys::WebKitDOMMouseEvent, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer)
where P: IsA<DOMMouseEvent>
{
let f: &F = &*(f as *const F);
f(&DOMMouseEvent::from_glib_borrow(this).unsafe_cast())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::x\0".as_ptr() as *const _,
Some(transmute(notify_x_trampoline::<Self, F> as usize)), Box_::into_raw(f))
}
}
fn connect_property_y_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_y_trampoline<P, F: Fn(&P) + 'static>(this: *mut webkit2_webextension_sys::WebKitDOMMouseEvent, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer)
where P: IsA<DOMMouseEvent>
{
let f: &F = &*(f as *const F);
f(&DOMMouseEvent::from_glib_borrow(this).unsafe_cast())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::y\0".as_ptr() as *const _,
Some(transmute(notify_y_trampoline::<Self, F> as usize)), Box_::into_raw(f))
}
}
}
impl fmt::Display for DOMMouseEvent {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "DOMMouseEvent")
}
}