glib/gobject/auto/
flags.rs

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
5use crate::{bitflags::bitflags, ffi, prelude::*, translate::*};
6
7bitflags! {
8    /// Flags to be passed to [`ObjectExt::bind_property()`][crate::prelude::ObjectExt::bind_property()] or
9    /// [`ObjectExt::bind_property_full()`][crate::prelude::ObjectExt::bind_property_full()].
10    ///
11    /// This enumeration can be extended at later date.
12    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
13    #[doc(alias = "GBindingFlags")]
14    pub struct BindingFlags: u32 {
15        /// The default binding; if the source property
16        ///  changes, the target property is updated with its value.
17        #[doc(alias = "G_BINDING_DEFAULT")]
18        const DEFAULT = crate::gobject_ffi::G_BINDING_DEFAULT as _;
19        /// Bidirectional binding; if either the
20        ///  property of the source or the property of the target changes,
21        ///  the other is updated.
22        #[doc(alias = "G_BINDING_BIDIRECTIONAL")]
23        const BIDIRECTIONAL = crate::gobject_ffi::G_BINDING_BIDIRECTIONAL as _;
24        /// Synchronize the values of the source and
25        ///  target properties when creating the binding; the direction of
26        ///  the synchronization is always from the source to the target.
27        #[doc(alias = "G_BINDING_SYNC_CREATE")]
28        const SYNC_CREATE = crate::gobject_ffi::G_BINDING_SYNC_CREATE as _;
29        /// If the two properties being bound are
30        ///  booleans, setting one to [`true`] will result in the other being
31        ///  set to [`false`] and vice versa. This flag will only work for
32        ///  boolean properties, and cannot be used when passing custom
33        ///  transformation functions to [`ObjectExt::bind_property_full()`][crate::prelude::ObjectExt::bind_property_full()].
34        #[doc(alias = "G_BINDING_INVERT_BOOLEAN")]
35        const INVERT_BOOLEAN = crate::gobject_ffi::G_BINDING_INVERT_BOOLEAN as _;
36    }
37}
38
39#[doc(hidden)]
40impl IntoGlib for BindingFlags {
41    type GlibType = crate::gobject_ffi::GBindingFlags;
42
43    #[inline]
44    fn into_glib(self) -> crate::gobject_ffi::GBindingFlags {
45        self.bits()
46    }
47}
48
49#[doc(hidden)]
50impl FromGlib<crate::gobject_ffi::GBindingFlags> for BindingFlags {
51    #[inline]
52    unsafe fn from_glib(value: crate::gobject_ffi::GBindingFlags) -> Self {
53        Self::from_bits_truncate(value)
54    }
55}
56
57impl StaticType for BindingFlags {
58    #[inline]
59    #[doc(alias = "g_binding_flags_get_type")]
60    fn static_type() -> crate::Type {
61        unsafe { from_glib(crate::gobject_ffi::g_binding_flags_get_type()) }
62    }
63}
64
65impl crate::HasParamSpec for BindingFlags {
66    type ParamSpec = crate::ParamSpecFlags;
67    type SetValue = Self;
68    type BuilderFn = fn(&str) -> crate::ParamSpecFlagsBuilder<Self>;
69
70    fn param_spec_builder() -> Self::BuilderFn {
71        Self::ParamSpec::builder
72    }
73}
74
75impl crate::value::ValueType for BindingFlags {
76    type Type = Self;
77}
78
79unsafe impl<'a> crate::value::FromValue<'a> for BindingFlags {
80    type Checker = crate::value::GenericValueTypeChecker<Self>;
81
82    #[inline]
83    unsafe fn from_value(value: &'a crate::Value) -> Self {
84        from_glib(crate::gobject_ffi::g_value_get_flags(
85            value.to_glib_none().0,
86        ))
87    }
88}
89
90impl ToValue for BindingFlags {
91    #[inline]
92    fn to_value(&self) -> crate::Value {
93        let mut value = crate::Value::for_value_type::<Self>();
94        unsafe {
95            crate::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
96        }
97        value
98    }
99
100    #[inline]
101    fn value_type(&self) -> crate::Type {
102        Self::static_type()
103    }
104}
105
106impl From<BindingFlags> for crate::Value {
107    #[inline]
108    fn from(v: BindingFlags) -> Self {
109        ToValue::to_value(&v)
110    }
111}
112
113bitflags! {
114    /// The signal flags are used to specify a signal's behaviour.
115    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
116    #[doc(alias = "GSignalFlags")]
117    pub struct SignalFlags: u32 {
118        /// Invoke the object method handler in the first emission stage.
119        #[doc(alias = "G_SIGNAL_RUN_FIRST")]
120        const RUN_FIRST = crate::gobject_ffi::G_SIGNAL_RUN_FIRST as _;
121        /// Invoke the object method handler in the third emission stage.
122        #[doc(alias = "G_SIGNAL_RUN_LAST")]
123        const RUN_LAST = crate::gobject_ffi::G_SIGNAL_RUN_LAST as _;
124        /// Invoke the object method handler in the last emission stage.
125        #[doc(alias = "G_SIGNAL_RUN_CLEANUP")]
126        const RUN_CLEANUP = crate::gobject_ffi::G_SIGNAL_RUN_CLEANUP as _;
127        /// Signals being emitted for an object while currently being in
128        ///  emission for this very object will not be emitted recursively,
129        ///  but instead cause the first emission to be restarted.
130        #[doc(alias = "G_SIGNAL_NO_RECURSE")]
131        const NO_RECURSE = crate::gobject_ffi::G_SIGNAL_NO_RECURSE as _;
132        /// This signal supports "::detail" appendices to the signal name
133        ///  upon handler connections and emissions.
134        #[doc(alias = "G_SIGNAL_DETAILED")]
135        const DETAILED = crate::gobject_ffi::G_SIGNAL_DETAILED as _;
136        /// Action signals are signals that may freely be emitted on alive
137        ///  objects from user code via `g_signal_emit()` and friends, without
138        ///  the need of being embedded into extra code that performs pre or
139        ///  post emission adjustments on the object. They can also be thought
140        ///  of as object methods which can be called generically by
141        ///  third-party code.
142        #[doc(alias = "G_SIGNAL_ACTION")]
143        const ACTION = crate::gobject_ffi::G_SIGNAL_ACTION as _;
144        /// No emissions hooks are supported for this signal.
145        #[doc(alias = "G_SIGNAL_NO_HOOKS")]
146        const NO_HOOKS = crate::gobject_ffi::G_SIGNAL_NO_HOOKS as _;
147        /// Varargs signal emission will always collect the arguments, even if there
148        /// are no signal handlers connected.
149        #[doc(alias = "G_SIGNAL_MUST_COLLECT")]
150        const MUST_COLLECT = crate::gobject_ffi::G_SIGNAL_MUST_COLLECT as _;
151        /// The signal is deprecated and will be removed in a future version.
152        ///
153        /// A warning will be generated if it is connected while running with
154        /// `G_ENABLE_DIAGNOSTIC=1`.
155        #[doc(alias = "G_SIGNAL_DEPRECATED")]
156        const DEPRECATED = crate::gobject_ffi::G_SIGNAL_DEPRECATED as _;
157        /// The signal accumulator was invoked for the first time.
158        ///
159        /// This flag is only used in [callback[`Object`][crate::Object]][accumulator functions]
160        /// for the `run_type` field of the [struct[`Object`][crate::Object]], to
161        /// mark the first call to the accumulator function for a signal emission.
162        #[cfg(feature = "v2_68")]
163        #[cfg_attr(docsrs, doc(cfg(feature = "v2_68")))]
164        #[doc(alias = "G_SIGNAL_ACCUMULATOR_FIRST_RUN")]
165        const ACCUMULATOR_FIRST_RUN = crate::gobject_ffi::G_SIGNAL_ACCUMULATOR_FIRST_RUN as _;
166    }
167}
168
169#[doc(hidden)]
170impl IntoGlib for SignalFlags {
171    type GlibType = crate::gobject_ffi::GSignalFlags;
172
173    #[inline]
174    fn into_glib(self) -> crate::gobject_ffi::GSignalFlags {
175        self.bits()
176    }
177}
178
179#[doc(hidden)]
180impl FromGlib<crate::gobject_ffi::GSignalFlags> for SignalFlags {
181    #[inline]
182    unsafe fn from_glib(value: crate::gobject_ffi::GSignalFlags) -> Self {
183        Self::from_bits_truncate(value)
184    }
185}
186
187bitflags! {
188    /// Bit masks used to check or determine characteristics of a type.
189    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
190    #[doc(alias = "GTypeFlags")]
191    pub struct TypeFlags: u32 {
192        /// No special flags. Since: 2.74
193        #[doc(alias = "G_TYPE_FLAG_NONE")]
194        const NONE = crate::gobject_ffi::G_TYPE_FLAG_NONE as _;
195        /// Indicates an abstract type. No instances can be
196        ///  created for an abstract type
197        #[doc(alias = "G_TYPE_FLAG_ABSTRACT")]
198        const ABSTRACT = crate::gobject_ffi::G_TYPE_FLAG_ABSTRACT as _;
199        /// Indicates an abstract value type, i.e. a type
200        ///  that introduces a value table, but can't be used for
201        ///  [`Value::init()`][crate::Value::init()]
202        #[doc(alias = "G_TYPE_FLAG_VALUE_ABSTRACT")]
203        const VALUE_ABSTRACT = crate::gobject_ffi::G_TYPE_FLAG_VALUE_ABSTRACT as _;
204        /// Indicates a final type. A final type is a non-derivable
205        ///  leaf node in a deep derivable type hierarchy tree. Since: 2.70
206        #[doc(alias = "G_TYPE_FLAG_FINAL")]
207        const FINAL = crate::gobject_ffi::G_TYPE_FLAG_FINAL as _;
208        /// The type is deprecated and may be removed in a
209        ///  future version. A warning will be emitted if it is instantiated while
210        ///  running with `G_ENABLE_DIAGNOSTIC=1`. Since 2.76
211        #[doc(alias = "G_TYPE_FLAG_DEPRECATED")]
212        const DEPRECATED = crate::gobject_ffi::G_TYPE_FLAG_DEPRECATED as _;
213    }
214}
215
216#[doc(hidden)]
217impl IntoGlib for TypeFlags {
218    type GlibType = crate::gobject_ffi::GTypeFlags;
219
220    #[inline]
221    fn into_glib(self) -> crate::gobject_ffi::GTypeFlags {
222        self.bits()
223    }
224}
225
226#[doc(hidden)]
227impl FromGlib<crate::gobject_ffi::GTypeFlags> for TypeFlags {
228    #[inline]
229    unsafe fn from_glib(value: crate::gobject_ffi::GTypeFlags) -> Self {
230        Self::from_bits_truncate(value)
231    }
232}