//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-graphics")]
#[cfg(target_vendor = "apple")]
use objc2_core_graphics::*;
#[cfg(feature = "objc2-core-text")]
#[cfg(target_vendor = "apple")]
use objc2_core_text::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsglyphinfo?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSGlyphInfo;
);

#[cfg(feature = "objc2-core-text")]
#[cfg(target_vendor = "apple")]
impl AsRef<NSGlyphInfo> for CTGlyphInfo {
    #[inline]
    fn as_ref(&self) -> &NSGlyphInfo {
        unsafe { &*((self as *const Self).cast()) }
    }
}

#[cfg(feature = "objc2-core-text")]
#[cfg(target_vendor = "apple")]
impl AsRef<CTGlyphInfo> for NSGlyphInfo {
    #[inline]
    fn as_ref(&self) -> &CTGlyphInfo {
        unsafe { &*((self as *const Self).cast()) }
    }
}

extern_conformance!(
    unsafe impl NSCoding for NSGlyphInfo {}
);

extern_conformance!(
    unsafe impl NSCopying for NSGlyphInfo {}
);

unsafe impl CopyingHelper for NSGlyphInfo {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for NSGlyphInfo {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for NSGlyphInfo {}
);

impl NSGlyphInfo {
    extern_methods!(
        #[cfg(all(feature = "NSFont", feature = "objc2-core-graphics"))]
        #[cfg(target_vendor = "apple")]
        #[unsafe(method(glyphInfoWithCGGlyph:forFont:baseString:))]
        #[unsafe(method_family = none)]
        pub fn glyphInfoWithCGGlyph_forFont_baseString(
            glyph: CGGlyph,
            font: &NSFont,
            string: &NSString,
        ) -> Option<Retained<NSGlyphInfo>>;

        #[cfg(feature = "objc2-core-graphics")]
        #[cfg(target_vendor = "apple")]
        #[unsafe(method(glyphID))]
        #[unsafe(method_family = none)]
        pub fn glyphID(&self) -> CGGlyph;

        #[unsafe(method(baseString))]
        #[unsafe(method_family = none)]
        pub fn baseString(&self) -> Retained<NSString>;
    );
}

/// Methods declared on superclass `NSObject`.
impl NSGlyphInfo {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new() -> Retained<Self>;
    );
}

impl DefaultRetained for NSGlyphInfo {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscharactercollection?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSCharacterCollection(pub NSUInteger);
impl NSCharacterCollection {
    #[doc(alias = "NSIdentityMappingCharacterCollection")]
    pub const IdentityMappingCharacterCollection: Self = Self(0);
    #[doc(alias = "NSAdobeCNS1CharacterCollection")]
    pub const AdobeCNS1CharacterCollection: Self = Self(1);
    #[doc(alias = "NSAdobeGB1CharacterCollection")]
    pub const AdobeGB1CharacterCollection: Self = Self(2);
    #[doc(alias = "NSAdobeJapan1CharacterCollection")]
    pub const AdobeJapan1CharacterCollection: Self = Self(3);
    #[doc(alias = "NSAdobeJapan2CharacterCollection")]
    pub const AdobeJapan2CharacterCollection: Self = Self(4);
    #[doc(alias = "NSAdobeKorea1CharacterCollection")]
    pub const AdobeKorea1CharacterCollection: Self = Self(5);
}

unsafe impl Encode for NSCharacterCollection {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

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

/// NSGlyphInfo_Deprecated.
impl NSGlyphInfo {
    extern_methods!(
        #[cfg(feature = "NSFont")]
        #[unsafe(method(glyphInfoWithGlyphName:forFont:baseString:))]
        #[unsafe(method_family = none)]
        pub fn glyphInfoWithGlyphName_forFont_baseString(
            glyph_name: &NSString,
            font: &NSFont,
            string: &NSString,
        ) -> Option<Retained<NSGlyphInfo>>;

        #[cfg(feature = "NSFont")]
        #[unsafe(method(glyphInfoWithGlyph:forFont:baseString:))]
        #[unsafe(method_family = none)]
        pub fn glyphInfoWithGlyph_forFont_baseString(
            glyph: NSGlyph,
            font: &NSFont,
            string: &NSString,
        ) -> Option<Retained<NSGlyphInfo>>;

        #[unsafe(method(glyphInfoWithCharacterIdentifier:collection:baseString:))]
        #[unsafe(method_family = none)]
        pub fn glyphInfoWithCharacterIdentifier_collection_baseString(
            cid: NSUInteger,
            character_collection: NSCharacterCollection,
            string: &NSString,
        ) -> Option<Retained<NSGlyphInfo>>;

        #[unsafe(method(glyphName))]
        #[unsafe(method_family = none)]
        pub fn glyphName(&self) -> Option<Retained<NSString>>;

        #[unsafe(method(characterIdentifier))]
        #[unsafe(method_family = none)]
        pub fn characterIdentifier(&self) -> NSUInteger;

        #[unsafe(method(characterCollection))]
        #[unsafe(method_family = none)]
        pub fn characterCollection(&self) -> NSCharacterCollection;
    );
}
