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