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

use crate::*;

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

unsafe impl NSCoding for NSTextLineFragment {}

unsafe impl NSObjectProtocol for NSTextLineFragment {}

unsafe impl NSSecureCoding for NSTextLineFragment {}

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

        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            a_decoder: &NSCoder,
        ) -> Option<Retained<Self>>;

        #[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 unsafe fn attributedString(&self) -> Retained<NSAttributedString>;

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

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

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

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

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

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

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(fractionOfDistanceThroughGlyphForPoint:))]
        #[unsafe(method_family = none)]
        pub unsafe 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>;
    );
}
