1use crate::{ffi, CicpParams};
6use glib::translate::*;
7
8glib::wrapper! {
9 #[derive(Debug, PartialOrd, Ord, Hash)]
10 pub struct ColorState(Shared<ffi::GdkColorState>);
11
12 match fn {
13 ref => |ptr| ffi::gdk_color_state_ref(ptr),
14 unref => |ptr| ffi::gdk_color_state_unref(ptr),
15 type_ => || ffi::gdk_color_state_get_type(),
16 }
17}
18
19impl ColorState {
20 #[doc(alias = "gdk_color_state_create_cicp_params")]
21 pub fn create_cicp_params(&self) -> Option<CicpParams> {
22 unsafe {
23 from_glib_full(ffi::gdk_color_state_create_cicp_params(
24 self.to_glib_none().0,
25 ))
26 }
27 }
28
29 #[doc(alias = "gdk_color_state_equal")]
30 fn equal(&self, other: &ColorState) -> bool {
31 unsafe {
32 from_glib(ffi::gdk_color_state_equal(
33 self.to_glib_none().0,
34 other.to_glib_none().0,
35 ))
36 }
37 }
38
39 #[cfg(feature = "v4_20")]
40 #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
41 #[doc(alias = "gdk_color_state_equivalent")]
42 pub fn equivalent(&self, other: &ColorState) -> bool {
43 unsafe {
44 from_glib(ffi::gdk_color_state_equivalent(
45 self.to_glib_none().0,
46 other.to_glib_none().0,
47 ))
48 }
49 }
50
51 #[cfg(feature = "v4_18")]
52 #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
53 #[doc(alias = "gdk_color_state_get_oklab")]
54 #[doc(alias = "get_oklab")]
55 pub fn oklab() -> ColorState {
56 assert_initialized_main_thread!();
57 unsafe { from_glib_full(ffi::gdk_color_state_get_oklab()) }
58 }
59
60 #[cfg(feature = "v4_18")]
61 #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
62 #[doc(alias = "gdk_color_state_get_oklch")]
63 #[doc(alias = "get_oklch")]
64 pub fn oklch() -> ColorState {
65 assert_initialized_main_thread!();
66 unsafe { from_glib_full(ffi::gdk_color_state_get_oklch()) }
67 }
68
69 #[doc(alias = "gdk_color_state_get_rec2100_linear")]
70 #[doc(alias = "get_rec2100_linear")]
71 pub fn rec2100_linear() -> ColorState {
72 assert_initialized_main_thread!();
73 unsafe { from_glib_full(ffi::gdk_color_state_get_rec2100_linear()) }
74 }
75
76 #[doc(alias = "gdk_color_state_get_rec2100_pq")]
77 #[doc(alias = "get_rec2100_pq")]
78 pub fn rec2100_pq() -> ColorState {
79 assert_initialized_main_thread!();
80 unsafe { from_glib_full(ffi::gdk_color_state_get_rec2100_pq()) }
81 }
82
83 #[doc(alias = "gdk_color_state_get_srgb")]
84 #[doc(alias = "get_srgb")]
85 pub fn srgb() -> ColorState {
86 assert_initialized_main_thread!();
87 unsafe { from_glib_full(ffi::gdk_color_state_get_srgb()) }
88 }
89
90 #[doc(alias = "gdk_color_state_get_srgb_linear")]
91 #[doc(alias = "get_srgb_linear")]
92 pub fn srgb_linear() -> ColorState {
93 assert_initialized_main_thread!();
94 unsafe { from_glib_full(ffi::gdk_color_state_get_srgb_linear()) }
95 }
96}
97
98impl PartialEq for ColorState {
99 #[inline]
100 fn eq(&self, other: &Self) -> bool {
101 self.equal(other)
102 }
103}
104
105impl Eq for ColorState {}