gsk4/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::ffi;
6#[cfg(feature = "v4_14")]
7#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
8use glib::{bitflags::bitflags, prelude::*, translate::*};
9
10#[cfg(feature = "v4_22")]
11bitflags! {
12    /// These flags describe the types of isolations possible with a
13    /// [`IsolationNode`][crate::IsolationNode].
14    ///
15    /// More isolation options may be added in the future.
16    #[cfg_attr(docsrs, doc(cfg(feature = "v4_22")))]
17    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
18    #[doc(alias = "GskIsolation")]
19    pub struct Isolation: u32 {
20        /// No isolation is defined.
21        #[doc(alias = "GSK_ISOLATION_NONE")]
22        const NONE = ffi::GSK_ISOLATION_NONE as _;
23        /// If the background should be made available.
24        ///   If the background is not available, future operations will be rendered
25        ///   to a transparent background and added to the existing background later.
26        #[doc(alias = "GSK_ISOLATION_BACKGROUND")]
27        const BACKGROUND = ffi::GSK_ISOLATION_BACKGROUND as _;
28        /// If copies should be available to paste nodes.
29        ///   If copies are not available, paste nodes can only paste from copies that
30        ///   are made inside the isolated contents.
31        #[doc(alias = "GSK_ISOLATION_COPY_PASTE")]
32        const COPY_PASTE = ffi::GSK_ISOLATION_COPY_PASTE as _;
33        /// Isolate everything. This will include features that
34        ///   are added in the future.
35        #[doc(alias = "GSK_ISOLATION_ALL")]
36        const ALL = ffi::GSK_ISOLATION_ALL as _;
37    }
38}
39
40#[cfg(feature = "v4_22")]
41#[cfg_attr(docsrs, doc(cfg(feature = "v4_22")))]
42#[doc(hidden)]
43impl IntoGlib for Isolation {
44    type GlibType = ffi::GskIsolation;
45
46    #[inline]
47    fn into_glib(self) -> ffi::GskIsolation {
48        self.bits()
49    }
50}
51
52#[cfg(feature = "v4_22")]
53#[cfg_attr(docsrs, doc(cfg(feature = "v4_22")))]
54#[doc(hidden)]
55impl FromGlib<ffi::GskIsolation> for Isolation {
56    #[inline]
57    unsafe fn from_glib(value: ffi::GskIsolation) -> Self {
58        skip_assert_initialized!();
59        Self::from_bits_truncate(value)
60    }
61}
62
63#[cfg(feature = "v4_22")]
64#[cfg_attr(docsrs, doc(cfg(feature = "v4_22")))]
65impl StaticType for Isolation {
66    #[inline]
67    #[doc(alias = "gsk_isolation_get_type")]
68    fn static_type() -> glib::Type {
69        unsafe { from_glib(ffi::gsk_isolation_get_type()) }
70    }
71}
72
73#[cfg(feature = "v4_22")]
74#[cfg_attr(docsrs, doc(cfg(feature = "v4_22")))]
75impl glib::HasParamSpec for Isolation {
76    type ParamSpec = glib::ParamSpecFlags;
77    type SetValue = Self;
78    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;
79
80    fn param_spec_builder() -> Self::BuilderFn {
81        Self::ParamSpec::builder
82    }
83}
84
85#[cfg(feature = "v4_22")]
86#[cfg_attr(docsrs, doc(cfg(feature = "v4_22")))]
87impl glib::value::ValueType for Isolation {
88    type Type = Self;
89}
90
91#[cfg(feature = "v4_22")]
92#[cfg_attr(docsrs, doc(cfg(feature = "v4_22")))]
93unsafe impl<'a> glib::value::FromValue<'a> for Isolation {
94    type Checker = glib::value::GenericValueTypeChecker<Self>;
95
96    #[inline]
97    unsafe fn from_value(value: &'a glib::Value) -> Self {
98        skip_assert_initialized!();
99        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
100    }
101}
102
103#[cfg(feature = "v4_22")]
104#[cfg_attr(docsrs, doc(cfg(feature = "v4_22")))]
105impl ToValue for Isolation {
106    #[inline]
107    fn to_value(&self) -> glib::Value {
108        let mut value = glib::Value::for_value_type::<Self>();
109        unsafe {
110            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
111        }
112        value
113    }
114
115    #[inline]
116    fn value_type(&self) -> glib::Type {
117        Self::static_type()
118    }
119}
120
121#[cfg(feature = "v4_22")]
122#[cfg_attr(docsrs, doc(cfg(feature = "v4_22")))]
123impl From<Isolation> for glib::Value {
124    #[inline]
125    fn from(v: Isolation) -> Self {
126        skip_assert_initialized!();
127        ToValue::to_value(&v)
128    }
129}
130
131#[cfg(feature = "v4_14")]
132bitflags! {
133    /// Flags that can be passed to gsk_path_foreach() to influence what
134    /// kinds of operations the path is decomposed into.
135    ///
136    /// By default, [`Path::foreach()`][crate::Path::foreach()] will only emit a path with all
137    /// operations flattened to straight lines to allow for maximum compatibility.
138    /// The only operations emitted will be `GSK_PATH_MOVE`, `GSK_PATH_LINE` and
139    /// `GSK_PATH_CLOSE`.
140    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
141    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
142    #[doc(alias = "GskPathForeachFlags")]
143    pub struct PathForeachFlags: u32 {
144        /// The default behavior, only allow lines.
145        #[doc(alias = "GSK_PATH_FOREACH_ALLOW_ONLY_LINES")]
146        const ONLY_LINES = ffi::GSK_PATH_FOREACH_ALLOW_ONLY_LINES as _;
147        /// Allow emission of `GSK_PATH_QUAD` operations
148        #[doc(alias = "GSK_PATH_FOREACH_ALLOW_QUAD")]
149        const QUAD = ffi::GSK_PATH_FOREACH_ALLOW_QUAD as _;
150        /// Allow emission of `GSK_PATH_CUBIC` operations.
151        #[doc(alias = "GSK_PATH_FOREACH_ALLOW_CUBIC")]
152        const CUBIC = ffi::GSK_PATH_FOREACH_ALLOW_CUBIC as _;
153        /// Allow emission of `GSK_PATH_CONIC` operations.
154        #[doc(alias = "GSK_PATH_FOREACH_ALLOW_CONIC")]
155        const CONIC = ffi::GSK_PATH_FOREACH_ALLOW_CONIC as _;
156    }
157}
158
159#[cfg(feature = "v4_14")]
160#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
161#[doc(hidden)]
162impl IntoGlib for PathForeachFlags {
163    type GlibType = ffi::GskPathForeachFlags;
164
165    #[inline]
166    fn into_glib(self) -> ffi::GskPathForeachFlags {
167        self.bits()
168    }
169}
170
171#[cfg(feature = "v4_14")]
172#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
173#[doc(hidden)]
174impl FromGlib<ffi::GskPathForeachFlags> for PathForeachFlags {
175    #[inline]
176    unsafe fn from_glib(value: ffi::GskPathForeachFlags) -> Self {
177        skip_assert_initialized!();
178        Self::from_bits_truncate(value)
179    }
180}
181
182#[cfg(feature = "v4_14")]
183#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
184impl StaticType for PathForeachFlags {
185    #[inline]
186    #[doc(alias = "gsk_path_foreach_flags_get_type")]
187    fn static_type() -> glib::Type {
188        unsafe { from_glib(ffi::gsk_path_foreach_flags_get_type()) }
189    }
190}
191
192#[cfg(feature = "v4_14")]
193#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
194impl glib::HasParamSpec for PathForeachFlags {
195    type ParamSpec = glib::ParamSpecFlags;
196    type SetValue = Self;
197    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;
198
199    fn param_spec_builder() -> Self::BuilderFn {
200        Self::ParamSpec::builder
201    }
202}
203
204#[cfg(feature = "v4_14")]
205#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
206impl glib::value::ValueType for PathForeachFlags {
207    type Type = Self;
208}
209
210#[cfg(feature = "v4_14")]
211#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
212unsafe impl<'a> glib::value::FromValue<'a> for PathForeachFlags {
213    type Checker = glib::value::GenericValueTypeChecker<Self>;
214
215    #[inline]
216    unsafe fn from_value(value: &'a glib::Value) -> Self {
217        skip_assert_initialized!();
218        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
219    }
220}
221
222#[cfg(feature = "v4_14")]
223#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
224impl ToValue for PathForeachFlags {
225    #[inline]
226    fn to_value(&self) -> glib::Value {
227        let mut value = glib::Value::for_value_type::<Self>();
228        unsafe {
229            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
230        }
231        value
232    }
233
234    #[inline]
235    fn value_type(&self) -> glib::Type {
236        Self::static_type()
237    }
238}
239
240#[cfg(feature = "v4_14")]
241#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
242impl From<PathForeachFlags> for glib::Value {
243    #[inline]
244    fn from(v: PathForeachFlags) -> Self {
245        skip_assert_initialized!();
246        ToValue::to_value(&v)
247    }
248}