//! 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/appkit/nsshowcontrolglyphs?language=objc)
pub const NSShowControlGlyphs: c_uint = 1 << 0;
/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsshowinvisibleglyphs?language=objc)
pub const NSShowInvisibleGlyphs: c_uint = 1 << 1;
/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nswantsbidilevels?language=objc)
pub const NSWantsBidiLevels: c_uint = 1 << 2;

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsglyphstorage?language=objc)
    pub unsafe trait NSGlyphStorage {
        #[cfg(feature = "NSFont")]
        /// # Safety
        ///
        /// `glyphs` must be a valid pointer.
        #[unsafe(method(insertGlyphs:length:forStartingGlyphAtIndex:characterIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn insertGlyphs_length_forStartingGlyphAtIndex_characterIndex(
            &self,
            glyphs: NonNull<NSGlyph>,
            length: NSUInteger,
            glyph_index: NSUInteger,
            char_index: NSUInteger,
        );

        #[unsafe(method(setIntAttribute:value:forGlyphAtIndex:))]
        #[unsafe(method_family = none)]
        fn setIntAttribute_value_forGlyphAtIndex(
            &self,
            attribute_tag: NSInteger,
            val: NSInteger,
            glyph_index: NSUInteger,
        );

        #[unsafe(method(attributedString))]
        #[unsafe(method_family = none)]
        fn attributedString(&self) -> Retained<NSAttributedString>;

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

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

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

impl NSGlyphGenerator {
    extern_methods!(
        /// # Safety
        ///
        /// - `glyph_index` must be a valid pointer or null.
        /// - `char_index` must be a valid pointer or null.
        #[unsafe(method(generateGlyphsForGlyphStorage:desiredNumberOfCharacters:glyphIndex:characterIndex:))]
        #[unsafe(method_family = none)]
        pub unsafe fn generateGlyphsForGlyphStorage_desiredNumberOfCharacters_glyphIndex_characterIndex(
            &self,
            glyph_storage: &ProtocolObject<dyn NSGlyphStorage>,
            n_chars: NSUInteger,
            glyph_index: *mut NSUInteger,
            char_index: *mut NSUInteger,
        );

        #[unsafe(method(sharedGlyphGenerator))]
        #[unsafe(method_family = none)]
        pub fn sharedGlyphGenerator() -> Retained<NSGlyphGenerator>;
    );
}

/// Methods declared on superclass `NSObject`.
impl NSGlyphGenerator {
    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 NSGlyphGenerator {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}
