objc2-class-kit 0.3.2

Bindings to the ClassKit 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::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/classkit/clsbinaryvaluetype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CLSBinaryValueType(pub NSInteger);
impl CLSBinaryValueType {
    #[doc(alias = "CLSBinaryValueTypeTrueFalse")]
    pub const TrueFalse: Self = Self(0);
    #[doc(alias = "CLSBinaryValueTypePassFail")]
    pub const PassFail: Self = Self(1);
    #[doc(alias = "CLSBinaryValueTypeYesNo")]
    pub const YesNo: Self = Self(2);
    #[doc(alias = "CLSBinaryValueTypeCorrectIncorrect")]
    pub const CorrectIncorrect: Self = Self(3);
}

unsafe impl Encode for CLSBinaryValueType {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for CLSBinaryValueType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    /// CLSBinaryItem represents user generated information that is true or false, pass or fail, yes or no.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/classkit/clsbinaryitem?language=objc)
    #[unsafe(super(CLSActivityItem, CLSObject, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "CLSActivityItem", feature = "CLSObject"))]
    pub struct CLSBinaryItem;
);

#[cfg(all(feature = "CLSActivityItem", feature = "CLSObject"))]
extern_conformance!(
    unsafe impl NSCoding for CLSBinaryItem {}
);

#[cfg(all(feature = "CLSActivityItem", feature = "CLSObject"))]
extern_conformance!(
    unsafe impl NSObjectProtocol for CLSBinaryItem {}
);

#[cfg(all(feature = "CLSActivityItem", feature = "CLSObject"))]
extern_conformance!(
    unsafe impl NSSecureCoding for CLSBinaryItem {}
);

#[cfg(all(feature = "CLSActivityItem", feature = "CLSObject"))]
impl CLSBinaryItem {
    extern_methods!(
        /// True or false value.
        #[unsafe(method(value))]
        #[unsafe(method_family = none)]
        pub unsafe fn value(&self) -> bool;

        /// Setter for [`value`][Self::value].
        #[unsafe(method(setValue:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setValue(&self, value: bool);

        /// Value type of this CLSBinaryItem.
        ///
        /// The type that best describes this CLSBinaryItem value.
        #[unsafe(method(valueType))]
        #[unsafe(method_family = none)]
        pub unsafe fn valueType(&self) -> CLSBinaryValueType;

        /// Create an item that represents a binary value
        ///
        /// Parameter `title`: Title of the CLSBinaryItem.
        ///
        /// Parameter `identifier`: An identifier that is unique within its owning activity.
        ///
        /// Parameter `valueType`: The type of binary value. Ex. pass or fail.
        #[unsafe(method(initWithIdentifier:title:type:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithIdentifier_title_type(
            this: Allocated<Self>,
            identifier: &NSString,
            title: &NSString,
            value_type: CLSBinaryValueType,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `CLSActivityItem`.
#[cfg(all(feature = "CLSActivityItem", feature = "CLSObject"))]
impl CLSBinaryItem {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}