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

use ffi;
use glib::StaticType;
use glib::Type;
use glib::translate::*;
use glib::value::FromValue;
use glib::value::FromValueOptional;
use glib::value::SetValue;
use glib::value::Value;
use gobject_ffi;

bitflags! {
    pub struct HandleFlags: u32 {
        const FLAGS_NONE = 0;
        const FLAG_UNLIMITED = 1;
        const FLAG_KEEP_IMAGE_DATA = 2;
    }
}

#[doc(hidden)]
impl ToGlib for HandleFlags {
    type GlibType = ffi::RsvgHandleFlags;

    fn to_glib(&self) -> ffi::RsvgHandleFlags {
        ffi::RsvgHandleFlags::from_bits_truncate(self.bits())
    }
}

#[doc(hidden)]
impl FromGlib<ffi::RsvgHandleFlags> for HandleFlags {
    fn from_glib(value: ffi::RsvgHandleFlags) -> HandleFlags {
        HandleFlags::from_bits_truncate(value.bits())
    }
}

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

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

impl<'a> FromValue<'a> for HandleFlags {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(ffi::RsvgHandleFlags::from_bits_truncate(gobject_ffi::g_value_get_flags(value.to_glib_none().0)))
    }
}

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

