//! 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-foundation")]
use objc2_core_foundation::*;
#[cfg(feature = "objc2-core-text")]
use objc2_core_text::*;
use objc2_foundation::*;

use crate::*;

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

unsafe impl Send for UIFont {}

unsafe impl Sync for UIFont {}

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

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

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

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

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

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

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

impl UIFont {
    extern_methods!(
        #[cfg(feature = "UIFontDescriptor")]
        #[unsafe(method(preferredFontForTextStyle:))]
        #[unsafe(method_family = none)]
        pub fn preferredFontForTextStyle(style: &UIFontTextStyle) -> Retained<UIFont>;

        #[cfg(all(feature = "UIFontDescriptor", feature = "UITraitCollection"))]
        #[unsafe(method(preferredFontForTextStyle:compatibleWithTraitCollection:))]
        #[unsafe(method_family = none)]
        pub fn preferredFontForTextStyle_compatibleWithTraitCollection(
            style: &UIFontTextStyle,
            trait_collection: Option<&UITraitCollection>,
        ) -> Retained<UIFont>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(fontWithName:size:))]
        #[unsafe(method_family = none)]
        pub fn fontWithName_size(
            font_name: &NSString,
            font_size: CGFloat,
        ) -> Option<Retained<UIFont>>;

        #[unsafe(method(familyNames))]
        #[unsafe(method_family = none)]
        pub fn familyNames() -> Retained<NSArray<NSString>>;

        #[unsafe(method(fontNamesForFamilyName:))]
        #[unsafe(method_family = none)]
        pub fn fontNamesForFamilyName(family_name: &NSString) -> Retained<NSArray<NSString>>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(systemFontOfSize:))]
        #[unsafe(method_family = none)]
        pub fn systemFontOfSize(font_size: CGFloat) -> Retained<UIFont>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(boldSystemFontOfSize:))]
        #[unsafe(method_family = none)]
        pub fn boldSystemFontOfSize(font_size: CGFloat) -> Retained<UIFont>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(italicSystemFontOfSize:))]
        #[unsafe(method_family = none)]
        pub fn italicSystemFontOfSize(font_size: CGFloat) -> Retained<UIFont>;

        #[cfg(all(feature = "UIFontDescriptor", feature = "objc2-core-foundation"))]
        #[unsafe(method(systemFontOfSize:weight:))]
        #[unsafe(method_family = none)]
        pub fn systemFontOfSize_weight(
            font_size: CGFloat,
            weight: UIFontWeight,
        ) -> Retained<UIFont>;

        #[cfg(all(feature = "UIFontDescriptor", feature = "objc2-core-foundation"))]
        #[unsafe(method(monospacedDigitSystemFontOfSize:weight:))]
        #[unsafe(method_family = none)]
        pub fn monospacedDigitSystemFontOfSize_weight(
            font_size: CGFloat,
            weight: UIFontWeight,
        ) -> Retained<UIFont>;

        #[cfg(all(feature = "UIFontDescriptor", feature = "objc2-core-foundation"))]
        #[unsafe(method(systemFontOfSize:weight:width:))]
        #[unsafe(method_family = none)]
        pub fn systemFontOfSize_weight_width(
            font_size: CGFloat,
            weight: UIFontWeight,
            width: UIFontWidth,
        ) -> Retained<UIFont>;

        #[cfg(all(feature = "UIFontDescriptor", feature = "objc2-core-foundation"))]
        #[unsafe(method(monospacedSystemFontOfSize:weight:))]
        #[unsafe(method_family = none)]
        pub fn monospacedSystemFontOfSize_weight(
            font_size: CGFloat,
            weight: UIFontWeight,
        ) -> Retained<UIFont>;

        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(familyName))]
        #[unsafe(method_family = none)]
        pub unsafe fn familyName(&self) -> Retained<NSString>;

        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(fontName))]
        #[unsafe(method_family = none)]
        pub unsafe fn fontName(&self) -> Retained<NSString>;

        #[cfg(feature = "objc2-core-foundation")]
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(pointSize))]
        #[unsafe(method_family = none)]
        pub unsafe fn pointSize(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(ascender))]
        #[unsafe(method_family = none)]
        pub unsafe fn ascender(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(descender))]
        #[unsafe(method_family = none)]
        pub unsafe fn descender(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(capHeight))]
        #[unsafe(method_family = none)]
        pub unsafe fn capHeight(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(xHeight))]
        #[unsafe(method_family = none)]
        pub unsafe fn xHeight(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(lineHeight))]
        #[unsafe(method_family = none)]
        pub unsafe fn lineHeight(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(leading))]
        #[unsafe(method_family = none)]
        pub unsafe fn leading(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(fontWithSize:))]
        #[unsafe(method_family = none)]
        pub fn fontWithSize(&self, font_size: CGFloat) -> Retained<UIFont>;

        #[cfg(all(feature = "UIFontDescriptor", feature = "objc2-core-foundation"))]
        #[unsafe(method(fontWithDescriptor:size:))]
        #[unsafe(method_family = none)]
        pub fn fontWithDescriptor_size(
            descriptor: &UIFontDescriptor,
            point_size: CGFloat,
        ) -> Retained<UIFont>;

        #[cfg(feature = "UIFontDescriptor")]
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(fontDescriptor))]
        #[unsafe(method_family = none)]
        pub unsafe fn fontDescriptor(&self) -> Retained<UIFontDescriptor>;
    );
}

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