gdk4_win32/auto/
enums.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;
6use glib::translate::*;
7
8/// Error enumeration for GTK's Direct3D 12 integration.
9#[cfg(feature = "v4_20")]
10#[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
11#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
12#[non_exhaustive]
13#[doc(alias = "GdkD3D12Error")]
14pub enum D3D12Error {
15    /// D3D12 support is not available, because the OS
16    ///   is not Windows, the Windows version is not recent enough, or it was explicitly
17    ///   disabled at compile- or runtime
18    #[doc(alias = "GDK_D3D12_ERROR_NOT_AVAILABLE")]
19    NotAvailable,
20    /// The requested format is not supported
21    #[doc(alias = "GDK_D3D12_ERROR_UNSUPPORTED_FORMAT")]
22    UnsupportedFormat,
23    /// GTK failed to create the resource for other
24    ///   reasons
25    #[doc(alias = "GDK_D3D12_ERROR_CREATION_FAILED")]
26    CreationFailed,
27    #[doc(hidden)]
28    __Unknown(i32),
29}
30
31#[cfg(feature = "v4_20")]
32#[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
33#[doc(hidden)]
34impl IntoGlib for D3D12Error {
35    type GlibType = ffi::GdkD3D12Error;
36
37    #[inline]
38    fn into_glib(self) -> ffi::GdkD3D12Error {
39        match self {
40            Self::NotAvailable => ffi::GDK_D3D12_ERROR_NOT_AVAILABLE,
41            Self::UnsupportedFormat => ffi::GDK_D3D12_ERROR_UNSUPPORTED_FORMAT,
42            Self::CreationFailed => ffi::GDK_D3D12_ERROR_CREATION_FAILED,
43            Self::__Unknown(value) => value,
44        }
45    }
46}
47
48#[cfg(feature = "v4_20")]
49#[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
50#[doc(hidden)]
51impl FromGlib<ffi::GdkD3D12Error> for D3D12Error {
52    #[inline]
53    unsafe fn from_glib(value: ffi::GdkD3D12Error) -> Self {
54        skip_assert_initialized!();
55
56        match value {
57            ffi::GDK_D3D12_ERROR_NOT_AVAILABLE => Self::NotAvailable,
58            ffi::GDK_D3D12_ERROR_UNSUPPORTED_FORMAT => Self::UnsupportedFormat,
59            ffi::GDK_D3D12_ERROR_CREATION_FAILED => Self::CreationFailed,
60            value => Self::__Unknown(value),
61        }
62    }
63}
64
65/// Specifies the result of applying a `GdkWin32MessageFilterFunc` to a Windows message.
66#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
67#[non_exhaustive]
68#[doc(alias = "GdkWin32MessageFilterReturn")]
69pub enum Win32MessageFilterReturn {
70    /// event not handled, continue processing.
71    #[doc(alias = "GDK_WIN32_MESSAGE_FILTER_CONTINUE")]
72    Continue,
73    /// event handled, terminate processing.
74    #[doc(alias = "GDK_WIN32_MESSAGE_FILTER_REMOVE")]
75    Remove,
76    #[doc(hidden)]
77    __Unknown(i32),
78}
79
80#[doc(hidden)]
81impl IntoGlib for Win32MessageFilterReturn {
82    type GlibType = ffi::GdkWin32MessageFilterReturn;
83
84    #[inline]
85    fn into_glib(self) -> ffi::GdkWin32MessageFilterReturn {
86        match self {
87            Self::Continue => ffi::GDK_WIN32_MESSAGE_FILTER_CONTINUE,
88            Self::Remove => ffi::GDK_WIN32_MESSAGE_FILTER_REMOVE,
89            Self::__Unknown(value) => value,
90        }
91    }
92}
93
94#[doc(hidden)]
95impl FromGlib<ffi::GdkWin32MessageFilterReturn> for Win32MessageFilterReturn {
96    #[inline]
97    unsafe fn from_glib(value: ffi::GdkWin32MessageFilterReturn) -> Self {
98        skip_assert_initialized!();
99
100        match value {
101            ffi::GDK_WIN32_MESSAGE_FILTER_CONTINUE => Self::Continue,
102            ffi::GDK_WIN32_MESSAGE_FILTER_REMOVE => Self::Remove,
103            value => Self::__Unknown(value),
104        }
105    }
106}