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_14")]
11bitflags! {
12    /// Flags that can be passed to gsk_path_foreach() to influence what
13    /// kinds of operations the path is decomposed into.
14    ///
15    /// By default, [`Path::foreach()`][crate::Path::foreach()] will only emit a path with all
16    /// operations flattened to straight lines to allow for maximum compatibility.
17    /// The only operations emitted will be `GSK_PATH_MOVE`, `GSK_PATH_LINE` and
18    /// `GSK_PATH_CLOSE`.
19    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
20    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
21    #[doc(alias = "GskPathForeachFlags")]
22    pub struct PathForeachFlags: u32 {
23        /// The default behavior, only allow lines.
24        #[doc(alias = "GSK_PATH_FOREACH_ALLOW_ONLY_LINES")]
25        const ONLY_LINES = ffi::GSK_PATH_FOREACH_ALLOW_ONLY_LINES as _;
26        /// Allow emission of `GSK_PATH_QUAD` operations
27        #[doc(alias = "GSK_PATH_FOREACH_ALLOW_QUAD")]
28        const QUAD = ffi::GSK_PATH_FOREACH_ALLOW_QUAD as _;
29        /// Allow emission of `GSK_PATH_CUBIC` operations.
30        #[doc(alias = "GSK_PATH_FOREACH_ALLOW_CUBIC")]
31        const CUBIC = ffi::GSK_PATH_FOREACH_ALLOW_CUBIC as _;
32        /// Allow emission of `GSK_PATH_CONIC` operations.
33        #[doc(alias = "GSK_PATH_FOREACH_ALLOW_CONIC")]
34        const CONIC = ffi::GSK_PATH_FOREACH_ALLOW_CONIC as _;
35    }
36}
37
38#[cfg(feature = "v4_14")]
39#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
40#[doc(hidden)]
41impl IntoGlib for PathForeachFlags {
42    type GlibType = ffi::GskPathForeachFlags;
43
44    #[inline]
45    fn into_glib(self) -> ffi::GskPathForeachFlags {
46        self.bits()
47    }
48}
49
50#[cfg(feature = "v4_14")]
51#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
52#[doc(hidden)]
53impl FromGlib<ffi::GskPathForeachFlags> for PathForeachFlags {
54    #[inline]
55    unsafe fn from_glib(value: ffi::GskPathForeachFlags) -> Self {
56        skip_assert_initialized!();
57        Self::from_bits_truncate(value)
58    }
59}
60
61#[cfg(feature = "v4_14")]
62#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
63impl StaticType for PathForeachFlags {
64    #[inline]
65    #[doc(alias = "gsk_path_foreach_flags_get_type")]
66    fn static_type() -> glib::Type {
67        unsafe { from_glib(ffi::gsk_path_foreach_flags_get_type()) }
68    }
69}
70
71#[cfg(feature = "v4_14")]
72#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
73impl glib::HasParamSpec for PathForeachFlags {
74    type ParamSpec = glib::ParamSpecFlags;
75    type SetValue = Self;
76    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;
77
78    fn param_spec_builder() -> Self::BuilderFn {
79        Self::ParamSpec::builder
80    }
81}
82
83#[cfg(feature = "v4_14")]
84#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
85impl glib::value::ValueType for PathForeachFlags {
86    type Type = Self;
87}
88
89#[cfg(feature = "v4_14")]
90#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
91unsafe impl<'a> glib::value::FromValue<'a> for PathForeachFlags {
92    type Checker = glib::value::GenericValueTypeChecker<Self>;
93
94    #[inline]
95    unsafe fn from_value(value: &'a glib::Value) -> Self {
96        skip_assert_initialized!();
97        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
98    }
99}
100
101#[cfg(feature = "v4_14")]
102#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
103impl ToValue for PathForeachFlags {
104    #[inline]
105    fn to_value(&self) -> glib::Value {
106        let mut value = glib::Value::for_value_type::<Self>();
107        unsafe {
108            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
109        }
110        value
111    }
112
113    #[inline]
114    fn value_type(&self) -> glib::Type {
115        Self::static_type()
116    }
117}
118
119#[cfg(feature = "v4_14")]
120#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
121impl From<PathForeachFlags> for glib::Value {
122    #[inline]
123    fn from(v: PathForeachFlags) -> Self {
124        skip_assert_initialized!();
125        ToValue::to_value(&v)
126    }
127}