glib/gobject/auto/
flags.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use crate::{bitflags::bitflags, ffi, prelude::*, translate::*};

bitflags! {
    /// Flags to be passed to [`ObjectExt::bind_property()`][crate::prelude::ObjectExt::bind_property()] or
    /// [`ObjectExt::bind_property_full()`][crate::prelude::ObjectExt::bind_property_full()].
    ///
    /// This enumeration can be extended at later date.
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "GBindingFlags")]
    pub struct BindingFlags: u32 {
        /// The default binding; if the source property
        ///  changes, the target property is updated with its value.
        #[doc(alias = "G_BINDING_DEFAULT")]
        const DEFAULT = crate::gobject_ffi::G_BINDING_DEFAULT as _;
        /// Bidirectional binding; if either the
        ///  property of the source or the property of the target changes,
        ///  the other is updated.
        #[doc(alias = "G_BINDING_BIDIRECTIONAL")]
        const BIDIRECTIONAL = crate::gobject_ffi::G_BINDING_BIDIRECTIONAL as _;
        /// Synchronize the values of the source and
        ///  target properties when creating the binding; the direction of
        ///  the synchronization is always from the source to the target.
        #[doc(alias = "G_BINDING_SYNC_CREATE")]
        const SYNC_CREATE = crate::gobject_ffi::G_BINDING_SYNC_CREATE as _;
        /// If the two properties being bound are
        ///  booleans, setting one to [`true`] will result in the other being
        ///  set to [`false`] and vice versa. This flag will only work for
        ///  boolean properties, and cannot be used when passing custom
        ///  transformation functions to [`ObjectExt::bind_property_full()`][crate::prelude::ObjectExt::bind_property_full()].
        #[doc(alias = "G_BINDING_INVERT_BOOLEAN")]
        const INVERT_BOOLEAN = crate::gobject_ffi::G_BINDING_INVERT_BOOLEAN as _;
    }
}

#[doc(hidden)]
impl IntoGlib for BindingFlags {
    type GlibType = crate::gobject_ffi::GBindingFlags;

    #[inline]
    fn into_glib(self) -> crate::gobject_ffi::GBindingFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<crate::gobject_ffi::GBindingFlags> for BindingFlags {
    #[inline]
    unsafe fn from_glib(value: crate::gobject_ffi::GBindingFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

impl StaticType for BindingFlags {
    #[inline]
    #[doc(alias = "g_binding_flags_get_type")]
    fn static_type() -> crate::Type {
        unsafe { from_glib(crate::gobject_ffi::g_binding_flags_get_type()) }
    }
}

impl crate::HasParamSpec for BindingFlags {
    type ParamSpec = crate::ParamSpecFlags;
    type SetValue = Self;
    type BuilderFn = fn(&str) -> crate::ParamSpecFlagsBuilder<Self>;

    fn param_spec_builder() -> Self::BuilderFn {
        Self::ParamSpec::builder
    }
}

impl crate::value::ValueType for BindingFlags {
    type Type = Self;
}

unsafe impl<'a> crate::value::FromValue<'a> for BindingFlags {
    type Checker = crate::value::GenericValueTypeChecker<Self>;

    #[inline]
    unsafe fn from_value(value: &'a crate::Value) -> Self {
        from_glib(crate::gobject_ffi::g_value_get_flags(
            value.to_glib_none().0,
        ))
    }
}

impl ToValue for BindingFlags {
    #[inline]
    fn to_value(&self) -> crate::Value {
        let mut value = crate::Value::for_value_type::<Self>();
        unsafe {
            crate::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    #[inline]
    fn value_type(&self) -> crate::Type {
        Self::static_type()
    }
}

impl From<BindingFlags> for crate::Value {
    #[inline]
    fn from(v: BindingFlags) -> Self {
        ToValue::to_value(&v)
    }
}

bitflags! {
    /// The signal flags are used to specify a signal's behaviour.
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "GSignalFlags")]
    pub struct SignalFlags: u32 {
        /// Invoke the object method handler in the first emission stage.
        #[doc(alias = "G_SIGNAL_RUN_FIRST")]
        const RUN_FIRST = crate::gobject_ffi::G_SIGNAL_RUN_FIRST as _;
        /// Invoke the object method handler in the third emission stage.
        #[doc(alias = "G_SIGNAL_RUN_LAST")]
        const RUN_LAST = crate::gobject_ffi::G_SIGNAL_RUN_LAST as _;
        /// Invoke the object method handler in the last emission stage.
        #[doc(alias = "G_SIGNAL_RUN_CLEANUP")]
        const RUN_CLEANUP = crate::gobject_ffi::G_SIGNAL_RUN_CLEANUP as _;
        /// Signals being emitted for an object while currently being in
        ///  emission for this very object will not be emitted recursively,
        ///  but instead cause the first emission to be restarted.
        #[doc(alias = "G_SIGNAL_NO_RECURSE")]
        const NO_RECURSE = crate::gobject_ffi::G_SIGNAL_NO_RECURSE as _;
        /// This signal supports "::detail" appendices to the signal name
        ///  upon handler connections and emissions.
        #[doc(alias = "G_SIGNAL_DETAILED")]
        const DETAILED = crate::gobject_ffi::G_SIGNAL_DETAILED as _;
        /// Action signals are signals that may freely be emitted on alive
        ///  objects from user code via `g_signal_emit()` and friends, without
        ///  the need of being embedded into extra code that performs pre or
        ///  post emission adjustments on the object. They can also be thought
        ///  of as object methods which can be called generically by
        ///  third-party code.
        #[doc(alias = "G_SIGNAL_ACTION")]
        const ACTION = crate::gobject_ffi::G_SIGNAL_ACTION as _;
        /// No emissions hooks are supported for this signal.
        #[doc(alias = "G_SIGNAL_NO_HOOKS")]
        const NO_HOOKS = crate::gobject_ffi::G_SIGNAL_NO_HOOKS as _;
        /// Varargs signal emission will always collect the
        ///  arguments, even if there are no signal handlers connected. Since 2.30.
        #[doc(alias = "G_SIGNAL_MUST_COLLECT")]
        const MUST_COLLECT = crate::gobject_ffi::G_SIGNAL_MUST_COLLECT as _;
        /// The signal is deprecated and will be removed
        ///  in a future version. A warning will be generated if it is connected while
        ///  running with G_ENABLE_DIAGNOSTIC=1. Since 2.32.
        #[doc(alias = "G_SIGNAL_DEPRECATED")]
        const DEPRECATED = crate::gobject_ffi::G_SIGNAL_DEPRECATED as _;
        /// Only used in `GSignalAccumulator` accumulator
        ///  functions for the `GSignalInvocationHint::run_type` field to mark the first
        ///  call to the accumulator function for a signal emission. Since 2.68.
        #[doc(alias = "G_SIGNAL_ACCUMULATOR_FIRST_RUN")]
        const ACCUMULATOR_FIRST_RUN = crate::gobject_ffi::G_SIGNAL_ACCUMULATOR_FIRST_RUN as _;
    }
}

#[doc(hidden)]
impl IntoGlib for SignalFlags {
    type GlibType = crate::gobject_ffi::GSignalFlags;

    #[inline]
    fn into_glib(self) -> crate::gobject_ffi::GSignalFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<crate::gobject_ffi::GSignalFlags> for SignalFlags {
    #[inline]
    unsafe fn from_glib(value: crate::gobject_ffi::GSignalFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

bitflags! {
    /// Bit masks used to check or determine characteristics of a type.
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "GTypeFlags")]
    pub struct TypeFlags: u32 {
        /// No special flags. Since: 2.74
        #[doc(alias = "G_TYPE_FLAG_NONE")]
        const NONE = crate::gobject_ffi::G_TYPE_FLAG_NONE as _;
        /// Indicates an abstract type. No instances can be
        ///  created for an abstract type
        #[doc(alias = "G_TYPE_FLAG_ABSTRACT")]
        const ABSTRACT = crate::gobject_ffi::G_TYPE_FLAG_ABSTRACT as _;
        /// Indicates an abstract value type, i.e. a type
        ///  that introduces a value table, but can't be used for
        ///  [`Value::init()`][crate::Value::init()]
        #[doc(alias = "G_TYPE_FLAG_VALUE_ABSTRACT")]
        const VALUE_ABSTRACT = crate::gobject_ffi::G_TYPE_FLAG_VALUE_ABSTRACT as _;
        /// Indicates a final type. A final type is a non-derivable
        ///  leaf node in a deep derivable type hierarchy tree. Since: 2.70
        #[doc(alias = "G_TYPE_FLAG_FINAL")]
        const FINAL = crate::gobject_ffi::G_TYPE_FLAG_FINAL as _;
        /// The type is deprecated and may be removed in a
        ///  future version. A warning will be emitted if it is instantiated while
        ///  running with `G_ENABLE_DIAGNOSTIC=1`. Since 2.76
        #[doc(alias = "G_TYPE_FLAG_DEPRECATED")]
        const DEPRECATED = crate::gobject_ffi::G_TYPE_FLAG_DEPRECATED as _;
    }
}

#[doc(hidden)]
impl IntoGlib for TypeFlags {
    type GlibType = crate::gobject_ffi::GTypeFlags;

    #[inline]
    fn into_glib(self) -> crate::gobject_ffi::GTypeFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<crate::gobject_ffi::GTypeFlags> for TypeFlags {
    #[inline]
    unsafe fn from_glib(value: crate::gobject_ffi::GTypeFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}