glib/gobject/
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
// Take a look at the license at the top of the repository in the LICENSE file.

use crate::{gobject_ffi, translate::*};

bitflags::bitflags! {
    /// Through the [`ParamFlags`][crate::ParamFlags] flag values, certain aspects of parameters
    /// can be configured.
    ///
    /// See also: `G_PARAM_STATIC_STRINGS`
    #[doc(alias = "GParamFlags")]
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    pub struct ParamFlags: u32 {
        /// the parameter is readable
        #[doc(alias = "G_PARAM_READABLE")]
        const READABLE = gobject_ffi::G_PARAM_READABLE as _;
        /// the parameter is writable
        #[doc(alias = "G_PARAM_WRITABLE")]
        const WRITABLE = gobject_ffi::G_PARAM_WRITABLE as _;
        /// alias for [`READABLE`][Self::READABLE] | [`WRITABLE`][Self::WRITABLE]
        #[doc(alias = "G_PARAM_READWRITE")]
        const READWRITE = gobject_ffi::G_PARAM_READWRITE as _;
        /// the parameter will be set upon object construction.
        ///  See [vfunc`Object`] for more details
        #[doc(alias = "G_PARAM_CONSTRUCT")]
        const CONSTRUCT = gobject_ffi::G_PARAM_CONSTRUCT as _;
        /// the parameter can only be set upon object construction.
        ///  See [vfunc`Object`] for more details
        #[doc(alias = "G_PARAM_CONSTRUCT_ONLY")]
        const CONSTRUCT_ONLY = gobject_ffi::G_PARAM_CONSTRUCT_ONLY as _;
        /// upon parameter conversion (see `g_param_value_convert()`)
        ///  strict validation is not required
        #[doc(alias = "G_PARAM_LAX_VALIDATION")]
        const LAX_VALIDATION = gobject_ffi::G_PARAM_LAX_VALIDATION as _;
        const USER_0 = 256;
        const USER_1 = 512;
        const USER_2 = 1024;
        const USER_3 = 2048;
        const USER_4 = 4096;
        const USER_5 = 8192;
        const USER_6 = 16384;
        const USER_7 = 32768;
        const USER_8 = 65536;
        /// calls to [`ObjectExt::set_property()`][crate::prelude::ObjectExt::set_property()] for this
        ///  property will not automatically result in a "notify" signal being
        ///  emitted: the implementation must call [`ObjectExt::notify()`][crate::prelude::ObjectExt::notify()] themselves
        ///  in case the property actually changes. Since: 2.42.
        #[doc(alias = "G_PARAM_EXPLICIT_NOTIFY")]
        const EXPLICIT_NOTIFY = gobject_ffi::G_PARAM_EXPLICIT_NOTIFY as _;
        /// the parameter is deprecated and will be removed
        ///  in a future version. A warning will be generated if it is used
        ///  while running with G_ENABLE_DIAGNOSTIC=1.
        ///  Since 2.26
        #[doc(alias = "G_PARAM_DEPRECATED")]
        const DEPRECATED = gobject_ffi::G_PARAM_DEPRECATED as _;
    }
}

impl Default for ParamFlags {
    fn default() -> Self {
        ParamFlags::READWRITE
    }
}

#[doc(hidden)]
impl IntoGlib for ParamFlags {
    type GlibType = gobject_ffi::GParamFlags;

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

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