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::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/classkit/clsprogressreportingcapabilitykind?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CLSProgressReportingCapabilityKind(pub NSInteger);
impl CLSProgressReportingCapabilityKind {
    #[doc(alias = "CLSProgressReportingCapabilityKindDuration")]
    pub const Duration: Self = Self(0);
    #[doc(alias = "CLSProgressReportingCapabilityKindPercent")]
    pub const Percent: Self = Self(1);
    #[doc(alias = "CLSProgressReportingCapabilityKindBinary")]
    pub const Binary: Self = Self(2);
    #[doc(alias = "CLSProgressReportingCapabilityKindQuantity")]
    pub const Quantity: Self = Self(3);
    #[doc(alias = "CLSProgressReportingCapabilityKindScore")]
    pub const Score: Self = Self(4);
}

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

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

extern_class!(
    /// This class specifies progress reporting capability of a ClassKit client app
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/classkit/clsprogressreportingcapability?language=objc)
    #[unsafe(super(CLSObject, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "CLSObject")]
    pub struct CLSProgressReportingCapability;
);

#[cfg(feature = "CLSObject")]
extern_conformance!(
    unsafe impl NSCoding for CLSProgressReportingCapability {}
);

#[cfg(feature = "CLSObject")]
extern_conformance!(
    unsafe impl NSObjectProtocol for CLSProgressReportingCapability {}
);

#[cfg(feature = "CLSObject")]
extern_conformance!(
    unsafe impl NSSecureCoding for CLSProgressReportingCapability {}
);

#[cfg(feature = "CLSObject")]
impl CLSProgressReportingCapability {
    extern_methods!(
        /// Returns the kind of progress reporting capability
        #[unsafe(method(kind))]
        #[unsafe(method_family = none)]
        pub unsafe fn kind(&self) -> CLSProgressReportingCapabilityKind;

        /// Returns progress reporting details
        #[unsafe(method(details))]
        #[unsafe(method_family = none)]
        pub unsafe fn details(&self) -> Option<Retained<NSString>>;

        /// Initialize and configure the type of progress reporting capability
        ///
        /// Parameter `kind`: The kind of progress reporting capability
        ///
        /// Parameter `details`: An optional localized string describing the capability. For example: "Reports percentage of progress", "Reports overall score". Schoolwork will use an appropriate default string if one is not provided.
        #[unsafe(method(initWithKind:details:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithKind_details(
            this: Allocated<Self>,
            kind: CLSProgressReportingCapabilityKind,
            details: Option<&NSString>,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `CLSObject`.
#[cfg(feature = "CLSObject")]
impl CLSProgressReportingCapability {
    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>;
    );
}