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

use gobject_sys;
use translate::*;
use value::FromValue;
use value::FromValueOptional;
use value::SetValue;
use value::Value;
use StaticType;
use Type;

bitflags! {
    pub struct BindingFlags: u32 {
        const DEFAULT = 0;
        const BIDIRECTIONAL = 1;
        const SYNC_CREATE = 2;
        const INVERT_BOOLEAN = 4;
    }
}

#[doc(hidden)]
impl ToGlib for BindingFlags {
    type GlibType = gobject_sys::GBindingFlags;

    fn to_glib(&self) -> gobject_sys::GBindingFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<gobject_sys::GBindingFlags> for BindingFlags {
    fn from_glib(value: gobject_sys::GBindingFlags) -> BindingFlags {
        BindingFlags::from_bits_truncate(value)
    }
}

impl StaticType for BindingFlags {
    fn static_type() -> Type {
        unsafe { from_glib(gobject_sys::g_binding_flags_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for BindingFlags {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for BindingFlags {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
    }
}

impl SetValue for BindingFlags {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
    }
}

bitflags! {
    pub struct ParamFlags: u32 {
        const READABLE = 1;
        const WRITABLE = 2;
        const READWRITE = 3;
        const CONSTRUCT = 4;
        const CONSTRUCT_ONLY = 8;
        const LAX_VALIDATION = 16;
        const STATIC_NAME = 32;
        const PRIVATE = 32;
        const STATIC_NICK = 64;
        const STATIC_BLURB = 128;
        const EXPLICIT_NOTIFY = 1073741824;
        const DEPRECATED = 2147483648;
    }
}

#[doc(hidden)]
impl ToGlib for ParamFlags {
    type GlibType = gobject_sys::GParamFlags;

    fn to_glib(&self) -> gobject_sys::GParamFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<gobject_sys::GParamFlags> for ParamFlags {
    fn from_glib(value: gobject_sys::GParamFlags) -> ParamFlags {
        ParamFlags::from_bits_truncate(value)
    }
}

bitflags! {
    pub struct SignalFlags: u32 {
        const RUN_FIRST = 1;
        const RUN_LAST = 2;
        const RUN_CLEANUP = 4;
        const NO_RECURSE = 8;
        const DETAILED = 16;
        const ACTION = 32;
        const NO_HOOKS = 64;
        const MUST_COLLECT = 128;
        const DEPRECATED = 256;
    }
}

#[doc(hidden)]
impl ToGlib for SignalFlags {
    type GlibType = gobject_sys::GSignalFlags;

    fn to_glib(&self) -> gobject_sys::GSignalFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<gobject_sys::GSignalFlags> for SignalFlags {
    fn from_glib(value: gobject_sys::GSignalFlags) -> SignalFlags {
        SignalFlags::from_bits_truncate(value)
    }
}
