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

use crate::*;

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

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

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

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

impl NSTextLineFragment {
    extern_methods!(
        #[unsafe(method(initWithAttributedString:range:))]
        #[unsafe(method_family = init)]
        pub fn initWithAttributedString_range(
            this: Allocated<Self>,
            attributed_string: &NSAttributedString,
            range: NSRange,
        ) -> Retained<Self>;

        /// # Safety
        ///
        /// `a_decoder` possibly has further requirements.
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            a_decoder: &NSCoder,
        ) -> Option<Retained<Self>>;

        /// # Safety
        ///
        /// `attributes` generic should be of the correct type.
        #[unsafe(method(initWithString:attributes:range:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithString_attributes_range(
            this: Allocated<Self>,
            string: &NSString,
            attributes: &NSDictionary<NSAttributedStringKey, AnyObject>,
            range: NSRange,
        ) -> Retained<Self>;

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

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

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

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

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

        #[cfg(all(feature = "objc2-core-foundation", feature = "objc2-core-graphics"))]
        #[unsafe(method(drawAtPoint:inContext:))]
        #[unsafe(method_family = none)]
        pub fn drawAtPoint_inContext(&self, point: CGPoint, context: &CGContext);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(locationForCharacterAtIndex:))]
        #[unsafe(method_family = none)]
        pub fn locationForCharacterAtIndex(&self, index: NSInteger) -> CGPoint;

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

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

/// Methods declared on superclass `NSObject`.
impl NSTextLineFragment {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}
