use crate::{ffi, CicpParams};
use glib::translate::*;
glib::wrapper! {
#[derive(Debug, PartialOrd, Ord, Hash)]
pub struct ColorState(Shared<ffi::GdkColorState>);
match fn {
ref => |ptr| ffi::gdk_color_state_ref(ptr),
unref => |ptr| ffi::gdk_color_state_unref(ptr),
type_ => || ffi::gdk_color_state_get_type(),
}
}
impl ColorState {
#[doc(alias = "gdk_color_state_create_cicp_params")]
pub fn create_cicp_params(&self) -> Option<CicpParams> {
unsafe {
from_glib_full(ffi::gdk_color_state_create_cicp_params(
self.to_glib_none().0,
))
}
}
#[doc(alias = "gdk_color_state_equal")]
fn equal(&self, other: &ColorState) -> bool {
unsafe {
from_glib(ffi::gdk_color_state_equal(
self.to_glib_none().0,
other.to_glib_none().0,
))
}
}
#[cfg(feature = "v4_20")]
#[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
#[doc(alias = "gdk_color_state_equivalent")]
pub fn equivalent(&self, other: &ColorState) -> bool {
unsafe {
from_glib(ffi::gdk_color_state_equivalent(
self.to_glib_none().0,
other.to_glib_none().0,
))
}
}
#[cfg(feature = "v4_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
#[doc(alias = "gdk_color_state_get_oklab")]
#[doc(alias = "get_oklab")]
pub fn oklab() -> ColorState {
assert_initialized_main_thread!();
unsafe { from_glib_full(ffi::gdk_color_state_get_oklab()) }
}
#[cfg(feature = "v4_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
#[doc(alias = "gdk_color_state_get_oklch")]
#[doc(alias = "get_oklch")]
pub fn oklch() -> ColorState {
assert_initialized_main_thread!();
unsafe { from_glib_full(ffi::gdk_color_state_get_oklch()) }
}
#[doc(alias = "gdk_color_state_get_rec2100_linear")]
#[doc(alias = "get_rec2100_linear")]
pub fn rec2100_linear() -> ColorState {
assert_initialized_main_thread!();
unsafe { from_glib_full(ffi::gdk_color_state_get_rec2100_linear()) }
}
#[doc(alias = "gdk_color_state_get_rec2100_pq")]
#[doc(alias = "get_rec2100_pq")]
pub fn rec2100_pq() -> ColorState {
assert_initialized_main_thread!();
unsafe { from_glib_full(ffi::gdk_color_state_get_rec2100_pq()) }
}
#[doc(alias = "gdk_color_state_get_srgb")]
#[doc(alias = "get_srgb")]
pub fn srgb() -> ColorState {
assert_initialized_main_thread!();
unsafe { from_glib_full(ffi::gdk_color_state_get_srgb()) }
}
#[doc(alias = "gdk_color_state_get_srgb_linear")]
#[doc(alias = "get_srgb_linear")]
pub fn srgb_linear() -> ColorState {
assert_initialized_main_thread!();
unsafe { from_glib_full(ffi::gdk_color_state_get_srgb_linear()) }
}
}
impl PartialEq for ColorState {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.equal(other)
}
}
impl Eq for ColorState {}