// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/vhdirk/gir-files.git)
// from webkit2gtk-gir-files
// DO NOT EDIT

use bitflags::bitflags;
use glib::translate::*;
use glib::value::FromValue;
use glib::value::ToValue;
use glib::StaticType;
use glib::Type;
use std::fmt;

#[cfg(any(feature = "v2_10", feature = "dox"))]
bitflags! {
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v2_10")))]
    #[doc(alias = "WebKitEditorTypingAttributes")]
    pub struct EditorTypingAttributes: u32 {
        #[doc(alias = "WEBKIT_EDITOR_TYPING_ATTRIBUTE_NONE")]
        const NONE = ffi::WEBKIT_EDITOR_TYPING_ATTRIBUTE_NONE as u32;
        #[doc(alias = "WEBKIT_EDITOR_TYPING_ATTRIBUTE_BOLD")]
        const BOLD = ffi::WEBKIT_EDITOR_TYPING_ATTRIBUTE_BOLD as u32;
        #[doc(alias = "WEBKIT_EDITOR_TYPING_ATTRIBUTE_ITALIC")]
        const ITALIC = ffi::WEBKIT_EDITOR_TYPING_ATTRIBUTE_ITALIC as u32;
        #[doc(alias = "WEBKIT_EDITOR_TYPING_ATTRIBUTE_UNDERLINE")]
        const UNDERLINE = ffi::WEBKIT_EDITOR_TYPING_ATTRIBUTE_UNDERLINE as u32;
        #[doc(alias = "WEBKIT_EDITOR_TYPING_ATTRIBUTE_STRIKETHROUGH")]
        const STRIKETHROUGH = ffi::WEBKIT_EDITOR_TYPING_ATTRIBUTE_STRIKETHROUGH as u32;
    }
}

#[cfg(any(feature = "v2_10", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_10")))]
impl fmt::Display for EditorTypingAttributes {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[cfg(any(feature = "v2_10", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_10")))]
#[doc(hidden)]
impl IntoGlib for EditorTypingAttributes {
    type GlibType = ffi::WebKitEditorTypingAttributes;

    fn into_glib(self) -> ffi::WebKitEditorTypingAttributes {
        self.bits()
    }
}

#[cfg(any(feature = "v2_10", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_10")))]
#[doc(hidden)]
impl FromGlib<ffi::WebKitEditorTypingAttributes> for EditorTypingAttributes {
    unsafe fn from_glib(value: ffi::WebKitEditorTypingAttributes) -> Self {
        skip_assert_initialized!();
        Self::from_bits_truncate(value)
    }
}

#[cfg(any(feature = "v2_10", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_10")))]
impl StaticType for EditorTypingAttributes {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::webkit_editor_typing_attributes_get_type()) }
    }
}

#[cfg(any(feature = "v2_10", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_10")))]
impl glib::value::ValueType for EditorTypingAttributes {
    type Type = Self;
}

#[cfg(any(feature = "v2_10", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_10")))]
unsafe impl<'a> FromValue<'a> for EditorTypingAttributes {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        skip_assert_initialized!();
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

#[cfg(any(feature = "v2_10", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_10")))]
impl ToValue for EditorTypingAttributes {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    #[doc(alias = "WebKitFindOptions")]
    pub struct FindOptions: u32 {
        #[doc(alias = "WEBKIT_FIND_OPTIONS_NONE")]
        const NONE = ffi::WEBKIT_FIND_OPTIONS_NONE as u32;
        #[doc(alias = "WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE")]
        const CASE_INSENSITIVE = ffi::WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE as u32;
        #[doc(alias = "WEBKIT_FIND_OPTIONS_AT_WORD_STARTS")]
        const AT_WORD_STARTS = ffi::WEBKIT_FIND_OPTIONS_AT_WORD_STARTS as u32;
        #[doc(alias = "WEBKIT_FIND_OPTIONS_TREAT_MEDIAL_CAPITAL_AS_WORD_START")]
        const TREAT_MEDIAL_CAPITAL_AS_WORD_START = ffi::WEBKIT_FIND_OPTIONS_TREAT_MEDIAL_CAPITAL_AS_WORD_START as u32;
        #[doc(alias = "WEBKIT_FIND_OPTIONS_BACKWARDS")]
        const BACKWARDS = ffi::WEBKIT_FIND_OPTIONS_BACKWARDS as u32;
        #[doc(alias = "WEBKIT_FIND_OPTIONS_WRAP_AROUND")]
        const WRAP_AROUND = ffi::WEBKIT_FIND_OPTIONS_WRAP_AROUND as u32;
    }
}

impl fmt::Display for FindOptions {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for FindOptions {
    type GlibType = ffi::WebKitFindOptions;

    fn into_glib(self) -> ffi::WebKitFindOptions {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::WebKitFindOptions> for FindOptions {
    unsafe fn from_glib(value: ffi::WebKitFindOptions) -> Self {
        skip_assert_initialized!();
        Self::from_bits_truncate(value)
    }
}

impl StaticType for FindOptions {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::webkit_find_options_get_type()) }
    }
}

impl glib::value::ValueType for FindOptions {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for FindOptions {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        skip_assert_initialized!();
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for FindOptions {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    #[doc(alias = "WebKitHitTestResultContext")]
    pub struct HitTestResultContext: u32 {
        #[doc(alias = "WEBKIT_HIT_TEST_RESULT_CONTEXT_DOCUMENT")]
        const DOCUMENT = ffi::WEBKIT_HIT_TEST_RESULT_CONTEXT_DOCUMENT as u32;
        #[doc(alias = "WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK")]
        const LINK = ffi::WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK as u32;
        #[doc(alias = "WEBKIT_HIT_TEST_RESULT_CONTEXT_IMAGE")]
        const IMAGE = ffi::WEBKIT_HIT_TEST_RESULT_CONTEXT_IMAGE as u32;
        #[doc(alias = "WEBKIT_HIT_TEST_RESULT_CONTEXT_MEDIA")]
        const MEDIA = ffi::WEBKIT_HIT_TEST_RESULT_CONTEXT_MEDIA as u32;
        #[doc(alias = "WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE")]
        const EDITABLE = ffi::WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE as u32;
        #[doc(alias = "WEBKIT_HIT_TEST_RESULT_CONTEXT_SCROLLBAR")]
        const SCROLLBAR = ffi::WEBKIT_HIT_TEST_RESULT_CONTEXT_SCROLLBAR as u32;
        #[doc(alias = "WEBKIT_HIT_TEST_RESULT_CONTEXT_SELECTION")]
        const SELECTION = ffi::WEBKIT_HIT_TEST_RESULT_CONTEXT_SELECTION as u32;
    }
}

impl fmt::Display for HitTestResultContext {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for HitTestResultContext {
    type GlibType = ffi::WebKitHitTestResultContext;

    fn into_glib(self) -> ffi::WebKitHitTestResultContext {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::WebKitHitTestResultContext> for HitTestResultContext {
    unsafe fn from_glib(value: ffi::WebKitHitTestResultContext) -> Self {
        skip_assert_initialized!();
        Self::from_bits_truncate(value)
    }
}

impl StaticType for HitTestResultContext {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::webkit_hit_test_result_context_get_type()) }
    }
}

impl glib::value::ValueType for HitTestResultContext {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for HitTestResultContext {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        skip_assert_initialized!();
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for HitTestResultContext {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

#[cfg(any(feature = "v2_28", feature = "dox"))]
bitflags! {
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v2_28")))]
    #[doc(alias = "WebKitInputHints")]
    pub struct InputHints: u32 {
        #[doc(alias = "WEBKIT_INPUT_HINT_NONE")]
        const NONE = ffi::WEBKIT_INPUT_HINT_NONE as u32;
        #[doc(alias = "WEBKIT_INPUT_HINT_SPELLCHECK")]
        const SPELLCHECK = ffi::WEBKIT_INPUT_HINT_SPELLCHECK as u32;
        #[doc(alias = "WEBKIT_INPUT_HINT_LOWERCASE")]
        const LOWERCASE = ffi::WEBKIT_INPUT_HINT_LOWERCASE as u32;
        #[doc(alias = "WEBKIT_INPUT_HINT_UPPERCASE_CHARS")]
        const UPPERCASE_CHARS = ffi::WEBKIT_INPUT_HINT_UPPERCASE_CHARS as u32;
        #[doc(alias = "WEBKIT_INPUT_HINT_UPPERCASE_WORDS")]
        const UPPERCASE_WORDS = ffi::WEBKIT_INPUT_HINT_UPPERCASE_WORDS as u32;
        #[doc(alias = "WEBKIT_INPUT_HINT_UPPERCASE_SENTENCES")]
        const UPPERCASE_SENTENCES = ffi::WEBKIT_INPUT_HINT_UPPERCASE_SENTENCES as u32;
        #[doc(alias = "WEBKIT_INPUT_HINT_INHIBIT_OSK")]
        const INHIBIT_OSK = ffi::WEBKIT_INPUT_HINT_INHIBIT_OSK as u32;
    }
}

#[cfg(any(feature = "v2_28", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_28")))]
impl fmt::Display for InputHints {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[cfg(any(feature = "v2_28", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_28")))]
#[doc(hidden)]
impl IntoGlib for InputHints {
    type GlibType = ffi::WebKitInputHints;

    fn into_glib(self) -> ffi::WebKitInputHints {
        self.bits()
    }
}

#[cfg(any(feature = "v2_28", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_28")))]
#[doc(hidden)]
impl FromGlib<ffi::WebKitInputHints> for InputHints {
    unsafe fn from_glib(value: ffi::WebKitInputHints) -> Self {
        skip_assert_initialized!();
        Self::from_bits_truncate(value)
    }
}

#[cfg(any(feature = "v2_28", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_28")))]
impl StaticType for InputHints {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::webkit_input_hints_get_type()) }
    }
}

#[cfg(any(feature = "v2_28", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_28")))]
impl glib::value::ValueType for InputHints {
    type Type = Self;
}

#[cfg(any(feature = "v2_28", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_28")))]
unsafe impl<'a> FromValue<'a> for InputHints {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        skip_assert_initialized!();
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

#[cfg(any(feature = "v2_28", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_28")))]
impl ToValue for InputHints {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    #[doc(alias = "WebKitSnapshotOptions")]
    pub struct SnapshotOptions: u32 {
        #[doc(alias = "WEBKIT_SNAPSHOT_OPTIONS_NONE")]
        const NONE = ffi::WEBKIT_SNAPSHOT_OPTIONS_NONE as u32;
        #[doc(alias = "WEBKIT_SNAPSHOT_OPTIONS_INCLUDE_SELECTION_HIGHLIGHTING")]
        const INCLUDE_SELECTION_HIGHLIGHTING = ffi::WEBKIT_SNAPSHOT_OPTIONS_INCLUDE_SELECTION_HIGHLIGHTING as u32;
        #[doc(alias = "WEBKIT_SNAPSHOT_OPTIONS_TRANSPARENT_BACKGROUND")]
        const TRANSPARENT_BACKGROUND = ffi::WEBKIT_SNAPSHOT_OPTIONS_TRANSPARENT_BACKGROUND as u32;
    }
}

impl fmt::Display for SnapshotOptions {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for SnapshotOptions {
    type GlibType = ffi::WebKitSnapshotOptions;

    fn into_glib(self) -> ffi::WebKitSnapshotOptions {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::WebKitSnapshotOptions> for SnapshotOptions {
    unsafe fn from_glib(value: ffi::WebKitSnapshotOptions) -> Self {
        skip_assert_initialized!();
        Self::from_bits_truncate(value)
    }
}

impl StaticType for SnapshotOptions {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::webkit_snapshot_options_get_type()) }
    }
}

impl glib::value::ValueType for SnapshotOptions {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for SnapshotOptions {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        skip_assert_initialized!();
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for SnapshotOptions {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

#[cfg(any(feature = "v2_16", feature = "dox"))]
bitflags! {
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v2_16")))]
    #[doc(alias = "WebKitWebsiteDataTypes")]
    pub struct WebsiteDataTypes: u32 {
        #[doc(alias = "WEBKIT_WEBSITE_DATA_MEMORY_CACHE")]
        const MEMORY_CACHE = ffi::WEBKIT_WEBSITE_DATA_MEMORY_CACHE as u32;
        #[doc(alias = "WEBKIT_WEBSITE_DATA_DISK_CACHE")]
        const DISK_CACHE = ffi::WEBKIT_WEBSITE_DATA_DISK_CACHE as u32;
        #[doc(alias = "WEBKIT_WEBSITE_DATA_OFFLINE_APPLICATION_CACHE")]
        const OFFLINE_APPLICATION_CACHE = ffi::WEBKIT_WEBSITE_DATA_OFFLINE_APPLICATION_CACHE as u32;
        #[doc(alias = "WEBKIT_WEBSITE_DATA_SESSION_STORAGE")]
        const SESSION_STORAGE = ffi::WEBKIT_WEBSITE_DATA_SESSION_STORAGE as u32;
        #[doc(alias = "WEBKIT_WEBSITE_DATA_LOCAL_STORAGE")]
        const LOCAL_STORAGE = ffi::WEBKIT_WEBSITE_DATA_LOCAL_STORAGE as u32;
        #[doc(alias = "WEBKIT_WEBSITE_DATA_WEBSQL_DATABASES")]
        const WEBSQL_DATABASES = ffi::WEBKIT_WEBSITE_DATA_WEBSQL_DATABASES as u32;
        #[doc(alias = "WEBKIT_WEBSITE_DATA_INDEXEDDB_DATABASES")]
        const INDEXEDDB_DATABASES = ffi::WEBKIT_WEBSITE_DATA_INDEXEDDB_DATABASES as u32;
        #[doc(alias = "WEBKIT_WEBSITE_DATA_PLUGIN_DATA")]
        const PLUGIN_DATA = ffi::WEBKIT_WEBSITE_DATA_PLUGIN_DATA as u32;
        #[doc(alias = "WEBKIT_WEBSITE_DATA_COOKIES")]
        const COOKIES = ffi::WEBKIT_WEBSITE_DATA_COOKIES as u32;
        #[doc(alias = "WEBKIT_WEBSITE_DATA_DEVICE_ID_HASH_SALT")]
        const DEVICE_ID_HASH_SALT = ffi::WEBKIT_WEBSITE_DATA_DEVICE_ID_HASH_SALT as u32;
        #[doc(alias = "WEBKIT_WEBSITE_DATA_HSTS_CACHE")]
        const HSTS_CACHE = ffi::WEBKIT_WEBSITE_DATA_HSTS_CACHE as u32;
        #[doc(alias = "WEBKIT_WEBSITE_DATA_ITP")]
        const ITP = ffi::WEBKIT_WEBSITE_DATA_ITP as u32;
        #[doc(alias = "WEBKIT_WEBSITE_DATA_SERVICE_WORKER_REGISTRATIONS")]
        const SERVICE_WORKER_REGISTRATIONS = ffi::WEBKIT_WEBSITE_DATA_SERVICE_WORKER_REGISTRATIONS as u32;
        #[doc(alias = "WEBKIT_WEBSITE_DATA_DOM_CACHE")]
        const DOM_CACHE = ffi::WEBKIT_WEBSITE_DATA_DOM_CACHE as u32;
        #[doc(alias = "WEBKIT_WEBSITE_DATA_ALL")]
        const ALL = ffi::WEBKIT_WEBSITE_DATA_ALL as u32;
    }
}

#[cfg(any(feature = "v2_16", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_16")))]
impl fmt::Display for WebsiteDataTypes {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[cfg(any(feature = "v2_16", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_16")))]
#[doc(hidden)]
impl IntoGlib for WebsiteDataTypes {
    type GlibType = ffi::WebKitWebsiteDataTypes;

    fn into_glib(self) -> ffi::WebKitWebsiteDataTypes {
        self.bits()
    }
}

#[cfg(any(feature = "v2_16", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_16")))]
#[doc(hidden)]
impl FromGlib<ffi::WebKitWebsiteDataTypes> for WebsiteDataTypes {
    unsafe fn from_glib(value: ffi::WebKitWebsiteDataTypes) -> Self {
        skip_assert_initialized!();
        Self::from_bits_truncate(value)
    }
}

#[cfg(any(feature = "v2_16", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_16")))]
impl StaticType for WebsiteDataTypes {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::webkit_website_data_types_get_type()) }
    }
}

#[cfg(any(feature = "v2_16", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_16")))]
impl glib::value::ValueType for WebsiteDataTypes {
    type Type = Self;
}

#[cfg(any(feature = "v2_16", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_16")))]
unsafe impl<'a> FromValue<'a> for WebsiteDataTypes {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        skip_assert_initialized!();
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

#[cfg(any(feature = "v2_16", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_16")))]
impl ToValue for WebsiteDataTypes {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}
