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

use crate::*;

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

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

impl NSStringDrawingContext {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(minimumScaleFactor))]
        #[unsafe(method_family = none)]
        pub fn minimumScaleFactor(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`minimumScaleFactor`][Self::minimumScaleFactor].
        #[unsafe(method(setMinimumScaleFactor:))]
        #[unsafe(method_family = none)]
        pub fn setMinimumScaleFactor(&self, minimum_scale_factor: CGFloat);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(actualScaleFactor))]
        #[unsafe(method_family = none)]
        pub fn actualScaleFactor(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(totalBounds))]
        #[unsafe(method_family = none)]
        pub fn totalBounds(&self) -> CGRect;
    );
}

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

mod private_NSStringDrawing {
    pub trait Sealed {}
}

/// Category on [`NSString`].
pub unsafe trait NSStringDrawing:
    ClassType + Sized + private_NSStringDrawing::Sealed
{
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        /// # Safety
        ///
        /// `attrs` generic should be of the correct type.
        #[unsafe(method(sizeWithAttributes:))]
        #[unsafe(method_family = none)]
        unsafe fn sizeWithAttributes(
            &self,
            attrs: Option<&NSDictionary<NSAttributedStringKey, AnyObject>>,
        ) -> CGSize;

        #[cfg(feature = "objc2-core-foundation")]
        /// # Safety
        ///
        /// `attrs` generic should be of the correct type.
        #[unsafe(method(drawAtPoint:withAttributes:))]
        #[unsafe(method_family = none)]
        unsafe fn drawAtPoint_withAttributes(
            &self,
            point: CGPoint,
            attrs: Option<&NSDictionary<NSAttributedStringKey, AnyObject>>,
        );

        #[cfg(feature = "objc2-core-foundation")]
        /// # Safety
        ///
        /// `attrs` generic should be of the correct type.
        #[unsafe(method(drawInRect:withAttributes:))]
        #[unsafe(method_family = none)]
        unsafe fn drawInRect_withAttributes(
            &self,
            rect: CGRect,
            attrs: Option<&NSDictionary<NSAttributedStringKey, AnyObject>>,
        );
    );
}

impl private_NSStringDrawing::Sealed for NSString {}
unsafe impl NSStringDrawing for NSString {}

mod private_NSAttributedStringNSStringDrawing {
    pub trait Sealed {}
}

/// Category "NSStringDrawing" on [`NSAttributedString`].
#[doc(alias = "NSStringDrawing")]
pub unsafe trait NSAttributedStringNSStringDrawing:
    ClassType + Sized + private_NSAttributedStringNSStringDrawing::Sealed
{
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(size))]
        #[unsafe(method_family = none)]
        fn size(&self) -> CGSize;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(drawAtPoint:))]
        #[unsafe(method_family = none)]
        fn drawAtPoint(&self, point: CGPoint);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(drawInRect:))]
        #[unsafe(method_family = none)]
        fn drawInRect(&self, rect: CGRect);
    );
}

impl private_NSAttributedStringNSStringDrawing::Sealed for NSAttributedString {}
unsafe impl NSAttributedStringNSStringDrawing for NSAttributedString {}

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsstringdrawingoptions?language=objc)
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSStringDrawingOptions(pub NSInteger);
bitflags::bitflags! {
    impl NSStringDrawingOptions: NSInteger {
        #[doc(alias = "NSStringDrawingUsesLineFragmentOrigin")]
        const UsesLineFragmentOrigin = 1<<0;
        #[doc(alias = "NSStringDrawingUsesFontLeading")]
        const UsesFontLeading = 1<<1;
        #[doc(alias = "NSStringDrawingUsesDeviceMetrics")]
        const UsesDeviceMetrics = 1<<3;
        #[doc(alias = "NSStringDrawingTruncatesLastVisibleLine")]
        const TruncatesLastVisibleLine = 1<<5;
/// Specifies the behavior for resolving ``NSTextAlignment.natural`` to the visual alignment.
///
/// When set, the resolved visual alignment is determined by the resolved base writing direction; otherwise, it is using the user’s preferred language.
        #[doc(alias = "NSStringDrawingOptionsResolvesNaturalAlignmentWithBaseWritingDirection")]
        const OptionsResolvesNaturalAlignmentWithBaseWritingDirection = 1<<9;
/// Specifies the behavior for resolving ``NSTextAlignment.natural`` to the visual alignment.
///
/// When set, the resolved visual alignment is determined by the resolved base writing direction; otherwise, it is using the user’s preferred language.
        #[doc(alias = "NSStringDrawingDisableScreenFontSubstitution")]
#[deprecated]
        const DisableScreenFontSubstitution = 1<<2;
/// Specifies the behavior for resolving ``NSTextAlignment.natural`` to the visual alignment.
///
/// When set, the resolved visual alignment is determined by the resolved base writing direction; otherwise, it is using the user’s preferred language.
        #[doc(alias = "NSStringDrawingOneShot")]
#[deprecated]
        const OneShot = 1<<4;
    }
}

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

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

mod private_NSStringNSExtendedStringDrawing {
    pub trait Sealed {}
}

/// Category "NSExtendedStringDrawing" on [`NSString`].
#[doc(alias = "NSExtendedStringDrawing")]
pub unsafe trait NSStringNSExtendedStringDrawing:
    ClassType + Sized + private_NSStringNSExtendedStringDrawing::Sealed
{
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        /// # Safety
        ///
        /// `attributes` generic should be of the correct type.
        #[unsafe(method(drawWithRect:options:attributes:context:))]
        #[unsafe(method_family = none)]
        unsafe fn drawWithRect_options_attributes_context(
            &self,
            rect: CGRect,
            options: NSStringDrawingOptions,
            attributes: Option<&NSDictionary<NSAttributedStringKey, AnyObject>>,
            context: Option<&NSStringDrawingContext>,
        );

        #[cfg(feature = "objc2-core-foundation")]
        /// # Safety
        ///
        /// `attributes` generic should be of the correct type.
        #[unsafe(method(boundingRectWithSize:options:attributes:context:))]
        #[unsafe(method_family = none)]
        unsafe fn boundingRectWithSize_options_attributes_context(
            &self,
            size: CGSize,
            options: NSStringDrawingOptions,
            attributes: Option<&NSDictionary<NSAttributedStringKey, AnyObject>>,
            context: Option<&NSStringDrawingContext>,
        ) -> CGRect;
    );
}

impl private_NSStringNSExtendedStringDrawing::Sealed for NSString {}
unsafe impl NSStringNSExtendedStringDrawing for NSString {}

mod private_NSAttributedStringNSExtendedStringDrawing {
    pub trait Sealed {}
}

/// Category "NSExtendedStringDrawing" on [`NSAttributedString`].
#[doc(alias = "NSExtendedStringDrawing")]
pub unsafe trait NSAttributedStringNSExtendedStringDrawing:
    ClassType + Sized + private_NSAttributedStringNSExtendedStringDrawing::Sealed
{
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(drawWithRect:options:context:))]
        #[unsafe(method_family = none)]
        fn drawWithRect_options_context(
            &self,
            rect: CGRect,
            options: NSStringDrawingOptions,
            context: Option<&NSStringDrawingContext>,
        );

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(boundingRectWithSize:options:context:))]
        #[unsafe(method_family = none)]
        fn boundingRectWithSize_options_context(
            &self,
            size: CGSize,
            options: NSStringDrawingOptions,
            context: Option<&NSStringDrawingContext>,
        ) -> CGRect;
    );
}

impl private_NSAttributedStringNSExtendedStringDrawing::Sealed for NSAttributedString {}
unsafe impl NSAttributedStringNSExtendedStringDrawing for NSAttributedString {}

mod private_NSStringDrawingDeprecated {
    pub trait Sealed {}
}

/// Category on [`NSString`].
///
/// ********************** Deprecated ***********************
pub unsafe trait NSStringDrawingDeprecated:
    ClassType + Sized + private_NSStringDrawingDeprecated::Sealed
{
    extern_methods!(
        /// # Safety
        ///
        /// `attributes` generic should be of the correct type.
        #[unsafe(method(drawWithRect:options:attributes:))]
        #[unsafe(method_family = none)]
        unsafe fn drawWithRect_options_attributes(
            &self,
            rect: NSRect,
            options: NSStringDrawingOptions,
            attributes: Option<&NSDictionary<NSAttributedStringKey, AnyObject>>,
        );

        /// # Safety
        ///
        /// `attributes` generic should be of the correct type.
        #[unsafe(method(boundingRectWithSize:options:attributes:))]
        #[unsafe(method_family = none)]
        unsafe fn boundingRectWithSize_options_attributes(
            &self,
            size: NSSize,
            options: NSStringDrawingOptions,
            attributes: Option<&NSDictionary<NSAttributedStringKey, AnyObject>>,
        ) -> NSRect;
    );
}

impl private_NSStringDrawingDeprecated::Sealed for NSString {}
unsafe impl NSStringDrawingDeprecated for NSString {}

mod private_NSAttributedStringNSStringDrawingDeprecated {
    pub trait Sealed {}
}

/// Category "NSStringDrawingDeprecated" on [`NSAttributedString`].
#[doc(alias = "NSStringDrawingDeprecated")]
pub unsafe trait NSAttributedStringNSStringDrawingDeprecated:
    ClassType + Sized + private_NSAttributedStringNSStringDrawingDeprecated::Sealed
{
    extern_methods!(
        #[unsafe(method(drawWithRect:options:))]
        #[unsafe(method_family = none)]
        fn drawWithRect_options(&self, rect: NSRect, options: NSStringDrawingOptions);

        #[unsafe(method(boundingRectWithSize:options:))]
        #[unsafe(method_family = none)]
        fn boundingRectWithSize_options(
            &self,
            size: NSSize,
            options: NSStringDrawingOptions,
        ) -> NSRect;
    );
}

impl private_NSAttributedStringNSStringDrawingDeprecated::Sealed for NSAttributedString {}
unsafe impl NSAttributedStringNSStringDrawingDeprecated for NSAttributedString {}
