libpanel/auto/
enums.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from
3// from gir-files (https://github.com/gtk-rs/gir-files.git)
4// DO NOT EDIT
5
6use crate::ffi;
7use glib::{prelude::*, translate::*};
8
9#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
10#[non_exhaustive]
11#[doc(alias = "PanelArea")]
12pub enum Area {
13    #[doc(alias = "PANEL_AREA_START")]
14    Start,
15    #[doc(alias = "PANEL_AREA_END")]
16    End,
17    #[doc(alias = "PANEL_AREA_TOP")]
18    Top,
19    #[doc(alias = "PANEL_AREA_BOTTOM")]
20    Bottom,
21    #[doc(alias = "PANEL_AREA_CENTER")]
22    Center,
23    #[doc(hidden)]
24    __Unknown(i32),
25}
26
27#[doc(hidden)]
28impl IntoGlib for Area {
29    type GlibType = ffi::PanelArea;
30
31    #[inline]
32    fn into_glib(self) -> ffi::PanelArea {
33        match self {
34            Self::Start => ffi::PANEL_AREA_START,
35            Self::End => ffi::PANEL_AREA_END,
36            Self::Top => ffi::PANEL_AREA_TOP,
37            Self::Bottom => ffi::PANEL_AREA_BOTTOM,
38            Self::Center => ffi::PANEL_AREA_CENTER,
39            Self::__Unknown(value) => value,
40        }
41    }
42}
43
44#[doc(hidden)]
45impl FromGlib<ffi::PanelArea> for Area {
46    #[inline]
47    unsafe fn from_glib(value: ffi::PanelArea) -> Self {
48        skip_assert_initialized!();
49
50        match value {
51            ffi::PANEL_AREA_START => Self::Start,
52            ffi::PANEL_AREA_END => Self::End,
53            ffi::PANEL_AREA_TOP => Self::Top,
54            ffi::PANEL_AREA_BOTTOM => Self::Bottom,
55            ffi::PANEL_AREA_CENTER => Self::Center,
56            value => Self::__Unknown(value),
57        }
58    }
59}
60
61impl StaticType for Area {
62    #[inline]
63    #[doc(alias = "panel_area_get_type")]
64    fn static_type() -> glib::Type {
65        unsafe { from_glib(ffi::panel_area_get_type()) }
66    }
67}
68
69impl glib::HasParamSpec for Area {
70    type ParamSpec = glib::ParamSpecEnum;
71    type SetValue = Self;
72    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
73
74    fn param_spec_builder() -> Self::BuilderFn {
75        Self::ParamSpec::builder_with_default
76    }
77}
78
79impl glib::value::ValueType for Area {
80    type Type = Self;
81}
82
83unsafe impl<'a> glib::value::FromValue<'a> for Area {
84    type Checker = glib::value::GenericValueTypeChecker<Self>;
85
86    #[inline]
87    unsafe fn from_value(value: &'a glib::Value) -> Self {
88        skip_assert_initialized!();
89        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
90    }
91}
92
93impl ToValue for Area {
94    #[inline]
95    fn to_value(&self) -> glib::Value {
96        let mut value = glib::Value::for_value_type::<Self>();
97        unsafe {
98            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
99        }
100        value
101    }
102
103    #[inline]
104    fn value_type(&self) -> glib::Type {
105        Self::static_type()
106    }
107}
108
109impl From<Area> for glib::Value {
110    #[inline]
111    fn from(v: Area) -> Self {
112        skip_assert_initialized!();
113        ToValue::to_value(&v)
114    }
115}