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        unsafe {
85            from_glib(crate::gobject_ffi::g_value_get_flags(
86                value.to_glib_none().0,
87            ))
88        }
89    }
90}
91
92impl ToValue for BindingFlags {
93    #[inline]
94    fn to_value(&self) -> crate::Value {
95        let mut value = crate::Value::for_value_type::<Self>();
96        unsafe {
97            crate::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
98        }
99        value
100    }
101
102    #[inline]
103    fn value_type(&self) -> crate::Type {
104        Self::static_type()
105    }
106}
107
108impl From<BindingFlags> for crate::Value {
109    #[inline]
110    fn from(v: BindingFlags) -> Self {
111        ToValue::to_value(&v)
112    }
113}
114
115bitflags! {
116    /// The signal flags are used to specify a signal's behaviour.
117    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
118    #[doc(alias = "GSignalFlags")]
119    pub struct SignalFlags: u32 {
120        /// Invoke the object method handler in the first emission stage.
121        #[doc(alias = "G_SIGNAL_RUN_FIRST")]
122        const RUN_FIRST = crate::gobject_ffi::G_SIGNAL_RUN_FIRST as _;
123        /// Invoke the object method handler in the third emission stage.
124        #[doc(alias = "G_SIGNAL_RUN_LAST")]
125        const RUN_LAST = crate::gobject_ffi::G_SIGNAL_RUN_LAST as _;
126        /// Invoke the object method handler in the last emission stage.
127        #[doc(alias = "G_SIGNAL_RUN_CLEANUP")]
128        const RUN_CLEANUP = crate::gobject_ffi::G_SIGNAL_RUN_CLEANUP as _;
129        /// Signals being emitted for an object while currently being in
130        ///  emission for this very object will not be emitted recursively,
131        ///  but instead cause the first emission to be restarted.
132        #[doc(alias = "G_SIGNAL_NO_RECURSE")]
133        const NO_RECURSE = crate::gobject_ffi::G_SIGNAL_NO_RECURSE as _;
134        /// This signal supports "::detail" appendices to the signal name
135        ///  upon handler connections and emissions.
136        #[doc(alias = "G_SIGNAL_DETAILED")]
137        const DETAILED = crate::gobject_ffi::G_SIGNAL_DETAILED as _;
138        /// Action signals are signals that may freely be emitted on alive
139        ///  objects from user code via `g_signal_emit()` and friends, without
140        ///  the need of being embedded into extra code that performs pre or
141        ///  post emission adjustments on the object. They can also be thought
142        ///  of as object methods which can be called generically by
143        ///  third-party code.
144        #[doc(alias = "G_SIGNAL_ACTION")]
145        const ACTION = crate::gobject_ffi::G_SIGNAL_ACTION as _;
146        /// No emissions hooks are supported for this signal.
147        #[doc(alias = "G_SIGNAL_NO_HOOKS")]
148        const NO_HOOKS = crate::gobject_ffi::G_SIGNAL_NO_HOOKS as _;
149        /// Varargs signal emission will always collect the arguments, even if there
150        /// are no signal handlers connected.
151        #[doc(alias = "G_SIGNAL_MUST_COLLECT")]
152        const MUST_COLLECT = crate::gobject_ffi::G_SIGNAL_MUST_COLLECT as _;
153        /// The signal is deprecated and will be removed in a future version.
154        ///
155        /// A warning will be generated if it is connected while running with
156        /// `G_ENABLE_DIAGNOSTIC=1`.
157        #[doc(alias = "G_SIGNAL_DEPRECATED")]
158        const DEPRECATED = crate::gobject_ffi::G_SIGNAL_DEPRECATED as _;
159        /// The signal accumulator was invoked for the first time.
160        ///
161        /// This flag is only used in [callback[`Object`][crate::Object]][accumulator functions]
162        /// for the `run_type` field of the [struct[`Object`][crate::Object]], to
163        /// mark the first call to the accumulator function for a signal emission.
164        #[cfg(feature = "v2_68")]
165        #[cfg_attr(docsrs, doc(cfg(feature = "v2_68")))]
166        #[doc(alias = "G_SIGNAL_ACCUMULATOR_FIRST_RUN")]
167        const ACCUMULATOR_FIRST_RUN = crate::gobject_ffi::G_SIGNAL_ACCUMULATOR_FIRST_RUN as _;
168    }
169}
170
171#[doc(hidden)]
172impl IntoGlib for SignalFlags {
173    type GlibType = crate::gobject_ffi::GSignalFlags;
174
175    #[inline]
176    fn into_glib(self) -> crate::gobject_ffi::GSignalFlags {
177        self.bits()
178    }
179}
180
181#[doc(hidden)]
182impl FromGlib<crate::gobject_ffi::GSignalFlags> for SignalFlags {
183    #[inline]
184    unsafe fn from_glib(value: crate::gobject_ffi::GSignalFlags) -> Self {
185        Self::from_bits_truncate(value)
186    }
187}
188
189bitflags! {
190    /// Bit masks used to check or determine characteristics of a type.
191    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
192    #[doc(alias = "GTypeFlags")]
193    pub struct TypeFlags: u32 {
194        /// No special flags. Since: 2.74
195        #[doc(alias = "G_TYPE_FLAG_NONE")]
196        const NONE = crate::gobject_ffi::G_TYPE_FLAG_NONE as _;
197        /// Indicates an abstract type. No instances can be
198        ///  created for an abstract type
199        #[doc(alias = "G_TYPE_FLAG_ABSTRACT")]
200        const ABSTRACT = crate::gobject_ffi::G_TYPE_FLAG_ABSTRACT as _;
201        /// Indicates an abstract value type, i.e. a type
202        ///  that introduces a value table, but can't be used for
203        ///  [`Value::init()`][crate::Value::init()]
204        #[doc(alias = "G_TYPE_FLAG_VALUE_ABSTRACT")]
205        const VALUE_ABSTRACT = crate::gobject_ffi::G_TYPE_FLAG_VALUE_ABSTRACT as _;
206        /// Indicates a final type. A final type is a non-derivable
207        ///  leaf node in a deep derivable type hierarchy tree. Since: 2.70
208        #[doc(alias = "G_TYPE_FLAG_FINAL")]
209        const FINAL = crate::gobject_ffi::G_TYPE_FLAG_FINAL as _;
210        /// The type is deprecated and may be removed in a
211        ///  future version. A warning will be emitted if it is instantiated while
212        ///  running with `G_ENABLE_DIAGNOSTIC=1`. Since 2.76
213        #[doc(alias = "G_TYPE_FLAG_DEPRECATED")]
214        const DEPRECATED = crate::gobject_ffi::G_TYPE_FLAG_DEPRECATED as _;
215    }
216}
217
218#[doc(hidden)]
219impl IntoGlib for TypeFlags {
220    type GlibType = crate::gobject_ffi::GTypeFlags;
221
222    #[inline]
223    fn into_glib(self) -> crate::gobject_ffi::GTypeFlags {
224        self.bits()
225    }
226}
227
228#[doc(hidden)]
229impl FromGlib<crate::gobject_ffi::GTypeFlags> for TypeFlags {
230    #[inline]
231    unsafe fn from_glib(value: crate::gobject_ffi::GTypeFlags) -> Self {
232        Self::from_bits_truncate(value)
233    }
234}