1 // This file was generated by gir (https://github.com/gtk-rs/gir)
2 // from gir-files (https://github.com/gtk-rs/gir-files)
3 // DO NOT EDIT
4 
5 use crate::translate::*;
6 use crate::value::FromValue;
7 use crate::value::ToValue;
8 use crate::StaticType;
9 use crate::Type;
10 use bitflags::bitflags;
11 use std::fmt;
12 
13 bitflags! {
14     #[doc(alias = "GBindingFlags")]
15     pub struct BindingFlags: u32 {
16         #[doc(alias = "G_BINDING_DEFAULT")]
17         const DEFAULT = gobject_ffi::G_BINDING_DEFAULT as u32;
18         #[doc(alias = "G_BINDING_BIDIRECTIONAL")]
19         const BIDIRECTIONAL = gobject_ffi::G_BINDING_BIDIRECTIONAL as u32;
20         #[doc(alias = "G_BINDING_SYNC_CREATE")]
21         const SYNC_CREATE = gobject_ffi::G_BINDING_SYNC_CREATE as u32;
22         #[doc(alias = "G_BINDING_INVERT_BOOLEAN")]
23         const INVERT_BOOLEAN = gobject_ffi::G_BINDING_INVERT_BOOLEAN as u32;
24     }
25 }
26 
27 impl fmt::Display for BindingFlags {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result28     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
29         <Self as fmt::Debug>::fmt(self, f)
30     }
31 }
32 
33 #[doc(hidden)]
34 impl IntoGlib for BindingFlags {
35     type GlibType = gobject_ffi::GBindingFlags;
36 
into_glib(self) -> gobject_ffi::GBindingFlags37     fn into_glib(self) -> gobject_ffi::GBindingFlags {
38         self.bits()
39     }
40 }
41 
42 #[doc(hidden)]
43 impl FromGlib<gobject_ffi::GBindingFlags> for BindingFlags {
from_glib(value: gobject_ffi::GBindingFlags) -> Self44     unsafe fn from_glib(value: gobject_ffi::GBindingFlags) -> Self {
45         Self::from_bits_truncate(value)
46     }
47 }
48 
49 impl StaticType for BindingFlags {
static_type() -> Type50     fn static_type() -> Type {
51         unsafe { from_glib(gobject_ffi::g_binding_flags_get_type()) }
52     }
53 }
54 
55 impl crate::value::ValueType for BindingFlags {
56     type Type = Self;
57 }
58 
59 unsafe impl<'a> FromValue<'a> for BindingFlags {
60     type Checker = crate::value::GenericValueTypeChecker<Self>;
61 
from_value(value: &'a crate::Value) -> Self62     unsafe fn from_value(value: &'a crate::Value) -> Self {
63         from_glib(crate::gobject_ffi::g_value_get_flags(
64             value.to_glib_none().0,
65         ))
66     }
67 }
68 
69 impl ToValue for BindingFlags {
to_value(&self) -> crate::Value70     fn to_value(&self) -> crate::Value {
71         let mut value = crate::Value::for_value_type::<Self>();
72         unsafe {
73             crate::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
74         }
75         value
76     }
77 
value_type(&self) -> crate::Type78     fn value_type(&self) -> crate::Type {
79         Self::static_type()
80     }
81 }
82 
83 bitflags! {
84     #[doc(alias = "GSignalFlags")]
85     pub struct SignalFlags: u32 {
86         #[doc(alias = "G_SIGNAL_RUN_FIRST")]
87         const RUN_FIRST = gobject_ffi::G_SIGNAL_RUN_FIRST as u32;
88         #[doc(alias = "G_SIGNAL_RUN_LAST")]
89         const RUN_LAST = gobject_ffi::G_SIGNAL_RUN_LAST as u32;
90         #[doc(alias = "G_SIGNAL_RUN_CLEANUP")]
91         const RUN_CLEANUP = gobject_ffi::G_SIGNAL_RUN_CLEANUP as u32;
92         #[doc(alias = "G_SIGNAL_NO_RECURSE")]
93         const NO_RECURSE = gobject_ffi::G_SIGNAL_NO_RECURSE as u32;
94         #[doc(alias = "G_SIGNAL_DETAILED")]
95         const DETAILED = gobject_ffi::G_SIGNAL_DETAILED as u32;
96         #[doc(alias = "G_SIGNAL_ACTION")]
97         const ACTION = gobject_ffi::G_SIGNAL_ACTION as u32;
98         #[doc(alias = "G_SIGNAL_NO_HOOKS")]
99         const NO_HOOKS = gobject_ffi::G_SIGNAL_NO_HOOKS as u32;
100         #[doc(alias = "G_SIGNAL_MUST_COLLECT")]
101         const MUST_COLLECT = gobject_ffi::G_SIGNAL_MUST_COLLECT as u32;
102         #[doc(alias = "G_SIGNAL_DEPRECATED")]
103         const DEPRECATED = gobject_ffi::G_SIGNAL_DEPRECATED as u32;
104     }
105 }
106 
107 impl fmt::Display for SignalFlags {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result108     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
109         <Self as fmt::Debug>::fmt(self, f)
110     }
111 }
112 
113 #[doc(hidden)]
114 impl IntoGlib for SignalFlags {
115     type GlibType = gobject_ffi::GSignalFlags;
116 
into_glib(self) -> gobject_ffi::GSignalFlags117     fn into_glib(self) -> gobject_ffi::GSignalFlags {
118         self.bits()
119     }
120 }
121 
122 #[doc(hidden)]
123 impl FromGlib<gobject_ffi::GSignalFlags> for SignalFlags {
from_glib(value: gobject_ffi::GSignalFlags) -> Self124     unsafe fn from_glib(value: gobject_ffi::GSignalFlags) -> Self {
125         Self::from_bits_truncate(value)
126     }
127 }
128