use crate::DOMElement;
use crate::DOMEventTarget;
use crate::DOMHTMLElement;
use crate::DOMHTMLFormElement;
use crate::DOMNode;
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 = "WebKitDOMHTMLOptionElement")]
pub struct DOMHTMLOptionElement(Object<ffi::WebKitDOMHTMLOptionElement, ffi::WebKitDOMHTMLOptionElementClass>) @extends DOMHTMLElement, DOMElement, DOMNode, DOMObject, @implements DOMEventTarget;
match fn {
type_ => || ffi::webkit_dom_html_option_element_get_type(),
}
}
impl DOMHTMLOptionElement {
pub const NONE: Option<&'static DOMHTMLOptionElement> = None;
}
pub trait DOMHTMLOptionElementExt: 'static {
#[cfg_attr(feature = "v2_22", deprecated = "Since 2.22")]
#[doc(alias = "webkit_dom_html_option_element_get_default_selected")]
#[doc(alias = "get_default_selected")]
fn is_default_selected(&self) -> bool;
#[cfg_attr(feature = "v2_22", deprecated = "Since 2.22")]
#[doc(alias = "webkit_dom_html_option_element_get_disabled")]
#[doc(alias = "get_disabled")]
fn is_disabled(&self) -> bool;
#[cfg_attr(feature = "v2_22", deprecated = "Since 2.22")]
#[doc(alias = "webkit_dom_html_option_element_get_form")]
#[doc(alias = "get_form")]
fn form(&self) -> Option<DOMHTMLFormElement>;
#[cfg_attr(feature = "v2_22", deprecated = "Since 2.22")]
#[doc(alias = "webkit_dom_html_option_element_get_index")]
#[doc(alias = "get_index")]
fn index(&self) -> libc::c_long;
#[cfg_attr(feature = "v2_22", deprecated = "Since 2.22")]
#[doc(alias = "webkit_dom_html_option_element_get_label")]
#[doc(alias = "get_label")]
fn label(&self) -> Option<glib::GString>;
#[cfg_attr(feature = "v2_22", deprecated = "Since 2.22")]
#[doc(alias = "webkit_dom_html_option_element_get_selected")]
#[doc(alias = "get_selected")]
fn is_selected(&self) -> bool;
#[cfg_attr(feature = "v2_22", deprecated = "Since 2.22")]
#[doc(alias = "webkit_dom_html_option_element_get_text")]
#[doc(alias = "get_text")]
fn text(&self) -> Option<glib::GString>;
#[cfg_attr(feature = "v2_22", deprecated = "Since 2.22")]
#[doc(alias = "webkit_dom_html_option_element_get_value")]
#[doc(alias = "get_value")]
fn value(&self) -> Option<glib::GString>;
#[cfg_attr(feature = "v2_22", deprecated = "Since 2.22")]
#[doc(alias = "webkit_dom_html_option_element_set_default_selected")]
fn set_default_selected(&self, value: bool);
#[cfg_attr(feature = "v2_22", deprecated = "Since 2.22")]
#[doc(alias = "webkit_dom_html_option_element_set_disabled")]
fn set_disabled(&self, value: bool);
#[cfg_attr(feature = "v2_22", deprecated = "Since 2.22")]
#[doc(alias = "webkit_dom_html_option_element_set_label")]
fn set_label(&self, value: &str);
#[cfg_attr(feature = "v2_22", deprecated = "Since 2.22")]
#[doc(alias = "webkit_dom_html_option_element_set_selected")]
fn set_selected(&self, value: bool);
#[cfg_attr(feature = "v2_22", deprecated = "Since 2.22")]
#[doc(alias = "webkit_dom_html_option_element_set_value")]
fn set_value(&self, value: &str);
#[doc(alias = "default-selected")]
fn connect_default_selected_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
#[doc(alias = "disabled")]
fn connect_disabled_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
#[doc(alias = "form")]
fn connect_form_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
#[doc(alias = "index")]
fn connect_index_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
#[doc(alias = "label")]
fn connect_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
#[doc(alias = "selected")]
fn connect_selected_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
#[doc(alias = "text")]
fn connect_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
#[doc(alias = "value")]
fn connect_value_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<DOMHTMLOptionElement>> DOMHTMLOptionElementExt for O {
fn is_default_selected(&self) -> bool {
unsafe {
from_glib(ffi::webkit_dom_html_option_element_get_default_selected(self.as_ref().to_glib_none().0))
}
}
fn is_disabled(&self) -> bool {
unsafe {
from_glib(ffi::webkit_dom_html_option_element_get_disabled(self.as_ref().to_glib_none().0))
}
}
fn form(&self) -> Option<DOMHTMLFormElement> {
unsafe {
from_glib_none(ffi::webkit_dom_html_option_element_get_form(self.as_ref().to_glib_none().0))
}
}
fn index(&self) -> libc::c_long {
unsafe {
ffi::webkit_dom_html_option_element_get_index(self.as_ref().to_glib_none().0)
}
}
fn label(&self) -> Option<glib::GString> {
unsafe {
from_glib_full(ffi::webkit_dom_html_option_element_get_label(self.as_ref().to_glib_none().0))
}
}
fn is_selected(&self) -> bool {
unsafe {
from_glib(ffi::webkit_dom_html_option_element_get_selected(self.as_ref().to_glib_none().0))
}
}
fn text(&self) -> Option<glib::GString> {
unsafe {
from_glib_full(ffi::webkit_dom_html_option_element_get_text(self.as_ref().to_glib_none().0))
}
}
fn value(&self) -> Option<glib::GString> {
unsafe {
from_glib_full(ffi::webkit_dom_html_option_element_get_value(self.as_ref().to_glib_none().0))
}
}
fn set_default_selected(&self, value: bool) {
unsafe {
ffi::webkit_dom_html_option_element_set_default_selected(self.as_ref().to_glib_none().0, value.into_glib());
}
}
fn set_disabled(&self, value: bool) {
unsafe {
ffi::webkit_dom_html_option_element_set_disabled(self.as_ref().to_glib_none().0, value.into_glib());
}
}
fn set_label(&self, value: &str) {
unsafe {
ffi::webkit_dom_html_option_element_set_label(self.as_ref().to_glib_none().0, value.to_glib_none().0);
}
}
fn set_selected(&self, value: bool) {
unsafe {
ffi::webkit_dom_html_option_element_set_selected(self.as_ref().to_glib_none().0, value.into_glib());
}
}
fn set_value(&self, value: &str) {
unsafe {
ffi::webkit_dom_html_option_element_set_value(self.as_ref().to_glib_none().0, value.to_glib_none().0);
}
}
fn connect_default_selected_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_default_selected_trampoline<P: IsA<DOMHTMLOptionElement>, F: Fn(&P) + 'static>(this: *mut ffi::WebKitDOMHTMLOptionElement, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(DOMHTMLOptionElement::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::default-selected\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(notify_default_selected_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
}
}
fn connect_disabled_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_disabled_trampoline<P: IsA<DOMHTMLOptionElement>, F: Fn(&P) + 'static>(this: *mut ffi::WebKitDOMHTMLOptionElement, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(DOMHTMLOptionElement::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::disabled\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(notify_disabled_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
}
}
fn connect_form_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_form_trampoline<P: IsA<DOMHTMLOptionElement>, F: Fn(&P) + 'static>(this: *mut ffi::WebKitDOMHTMLOptionElement, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(DOMHTMLOptionElement::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::form\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(notify_form_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
}
}
fn connect_index_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_index_trampoline<P: IsA<DOMHTMLOptionElement>, F: Fn(&P) + 'static>(this: *mut ffi::WebKitDOMHTMLOptionElement, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(DOMHTMLOptionElement::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::index\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(notify_index_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
}
}
fn connect_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_label_trampoline<P: IsA<DOMHTMLOptionElement>, F: Fn(&P) + 'static>(this: *mut ffi::WebKitDOMHTMLOptionElement, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(DOMHTMLOptionElement::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::label\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(notify_label_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
}
}
fn connect_selected_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_selected_trampoline<P: IsA<DOMHTMLOptionElement>, F: Fn(&P) + 'static>(this: *mut ffi::WebKitDOMHTMLOptionElement, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(DOMHTMLOptionElement::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::selected\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(notify_selected_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
}
}
fn connect_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_text_trampoline<P: IsA<DOMHTMLOptionElement>, F: Fn(&P) + 'static>(this: *mut ffi::WebKitDOMHTMLOptionElement, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(DOMHTMLOptionElement::from_glib_borrow(this).unsafe_cast_ref())
}
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::<_, unsafe extern "C" fn()>(notify_text_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
}
}
fn connect_value_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_value_trampoline<P: IsA<DOMHTMLOptionElement>, F: Fn(&P) + 'static>(this: *mut ffi::WebKitDOMHTMLOptionElement, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(DOMHTMLOptionElement::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::value\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(notify_value_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
}
}
}
impl fmt::Display for DOMHTMLOptionElement {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str("DOMHTMLOptionElement")
}
}