objc2-color-sync 0.3.2

Bindings to the ColorSync framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2_core_foundation::*;

use crate::*;

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncdeviceid?language=objc)
    pub static kColorSyncDeviceID: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncdeviceclass?language=objc)
    pub static kColorSyncDeviceClass: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsynccameradeviceclass?language=objc)
    pub static kColorSyncCameraDeviceClass: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncdisplaydeviceclass?language=objc)
    pub static kColorSyncDisplayDeviceClass: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncprinterdeviceclass?language=objc)
    pub static kColorSyncPrinterDeviceClass: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncscannerdeviceclass?language=objc)
    pub static kColorSyncScannerDeviceClass: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncdeviceprofileurl?language=objc)
    pub static kColorSyncDeviceProfileURL: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncdevicedescription?language=objc)
    pub static kColorSyncDeviceDescription: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncdevicedescriptions?language=objc)
    pub static kColorSyncDeviceDescriptions: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncfactoryprofiles?language=objc)
    pub static kColorSyncFactoryProfiles: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsynccustomprofiles?language=objc)
    pub static kColorSyncCustomProfiles: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncdevicemodedescription?language=objc)
    pub static kColorSyncDeviceModeDescription: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncdevicemodedescriptions?language=objc)
    pub static kColorSyncDeviceModeDescriptions: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncdevicedefaultprofileid?language=objc)
    pub static kColorSyncDeviceDefaultProfileID: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncdevicehostscope?language=objc)
    pub static kColorSyncDeviceHostScope: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncdeviceuserscope?language=objc)
    pub static kColorSyncDeviceUserScope: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncprofilehostscope?language=objc)
    pub static kColorSyncProfileHostScope: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncprofileuserscope?language=objc)
    pub static kColorSyncProfileUserScope: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncdeviceprofileisfactory?language=objc)
    pub static kColorSyncDeviceProfileIsFactory: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncdeviceprofileisdefault?language=objc)
    pub static kColorSyncDeviceProfileIsDefault: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncdeviceprofileiscurrent?language=objc)
    pub static kColorSyncDeviceProfileIsCurrent: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncdeviceprofileid?language=objc)
    pub static kColorSyncDeviceProfileID: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncdeviceregisterednotification?language=objc)
    pub static kColorSyncDeviceRegisteredNotification: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncdeviceunregisterednotification?language=objc)
    pub static kColorSyncDeviceUnregisteredNotification: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncdeviceprofilesnotification?language=objc)
    pub static kColorSyncDeviceProfilesNotification: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncdisplaydeviceprofilesnotification?language=objc)
    pub static kColorSyncDisplayDeviceProfilesNotification: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncprofilerepositorychangenotification?language=objc)
    pub static kColorSyncProfileRepositoryChangeNotification: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/colorsync/kcolorsyncregistrationupdatewindowserver?language=objc)
    pub static kColorSyncRegistrationUpdateWindowServer: &'static CFString;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `device_info` generics must be of the correct type.
    pub fn ColorSyncRegisterDevice(
        device_class: &CFString,
        device_id: &CFUUID,
        device_info: &CFDictionary,
    ) -> bool;
}

extern "C-unwind" {
    pub fn ColorSyncUnregisterDevice(device_class: &CFString, device_id: &CFUUID) -> bool;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `profile_info` generics must be of the correct type.
    pub fn ColorSyncDeviceSetCustomProfiles(
        device_class: &CFString,
        device_id: &CFUUID,
        profile_info: &CFDictionary,
    ) -> bool;
}

#[inline]
pub unsafe extern "C-unwind" fn ColorSyncDeviceCopyDeviceInfo(
    device_class: &CFString,
    dev_id: &CFUUID,
) -> Option<CFRetained<CFDictionary>> {
    extern "C-unwind" {
        fn ColorSyncDeviceCopyDeviceInfo(
            device_class: &CFString,
            dev_id: &CFUUID,
        ) -> Option<NonNull<CFDictionary>>;
    }
    let ret = unsafe { ColorSyncDeviceCopyDeviceInfo(device_class, dev_id) };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

/// [Apple's documentation](https://developer.apple.com/documentation/colorsync/colorsyncdeviceprofileiteratecallback?language=objc)
pub type ColorSyncDeviceProfileIterateCallback =
    Option<unsafe extern "C-unwind" fn(NonNull<CFDictionary>, *mut c_void) -> bool>;

extern "C-unwind" {
    /// # Safety
    ///
    /// - `call_back` must be implemented correctly.
    /// - `user_info` must be a valid pointer or null.
    pub fn ColorSyncIterateDeviceProfiles(
        call_back: ColorSyncDeviceProfileIterateCallback,
        user_info: *mut c_void,
    );
}

#[inline]
pub unsafe extern "C-unwind" fn CGDisplayCreateUUIDFromDisplayID(
    display_id: u32,
) -> CFRetained<CFUUID> {
    extern "C-unwind" {
        fn CGDisplayCreateUUIDFromDisplayID(display_id: u32) -> Option<NonNull<CFUUID>>;
    }
    let ret = unsafe { CGDisplayCreateUUIDFromDisplayID(display_id) };
    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
    unsafe { CFRetained::from_raw(ret) }
}

extern "C-unwind" {
    pub fn CGDisplayGetDisplayIDFromUUID(uuid: &CFUUID) -> u32;
}