objc2_app_kit/generated/
NSTextLineFragment.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8#[cfg(feature = "objc2-core-graphics")]
9#[cfg(target_vendor = "apple")]
10use objc2_core_graphics::*;
11use objc2_foundation::*;
12
13use crate::*;
14
15extern_class!(
16    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextlinefragment?language=objc)
17    #[unsafe(super(NSObject))]
18    #[derive(Debug, PartialEq, Eq, Hash)]
19    pub struct NSTextLineFragment;
20);
21
22extern_conformance!(
23    unsafe impl NSCoding for NSTextLineFragment {}
24);
25
26extern_conformance!(
27    unsafe impl NSObjectProtocol for NSTextLineFragment {}
28);
29
30extern_conformance!(
31    unsafe impl NSSecureCoding for NSTextLineFragment {}
32);
33
34impl NSTextLineFragment {
35    extern_methods!(
36        #[unsafe(method(initWithAttributedString:range:))]
37        #[unsafe(method_family = init)]
38        pub fn initWithAttributedString_range(
39            this: Allocated<Self>,
40            attributed_string: &NSAttributedString,
41            range: NSRange,
42        ) -> Retained<Self>;
43
44        /// # Safety
45        ///
46        /// `a_decoder` possibly has further requirements.
47        #[unsafe(method(initWithCoder:))]
48        #[unsafe(method_family = init)]
49        pub unsafe fn initWithCoder(
50            this: Allocated<Self>,
51            a_decoder: &NSCoder,
52        ) -> Option<Retained<Self>>;
53
54        /// # Safety
55        ///
56        /// `attributes` generic should be of the correct type.
57        #[unsafe(method(initWithString:attributes:range:))]
58        #[unsafe(method_family = init)]
59        pub unsafe fn initWithString_attributes_range(
60            this: Allocated<Self>,
61            string: &NSString,
62            attributes: &NSDictionary<NSAttributedStringKey, AnyObject>,
63            range: NSRange,
64        ) -> Retained<Self>;
65
66        #[unsafe(method(init))]
67        #[unsafe(method_family = init)]
68        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
69
70        #[unsafe(method(attributedString))]
71        #[unsafe(method_family = none)]
72        pub fn attributedString(&self) -> Retained<NSAttributedString>;
73
74        #[unsafe(method(characterRange))]
75        #[unsafe(method_family = none)]
76        pub fn characterRange(&self) -> NSRange;
77
78        #[cfg(feature = "objc2-core-foundation")]
79        #[unsafe(method(typographicBounds))]
80        #[unsafe(method_family = none)]
81        pub fn typographicBounds(&self) -> CGRect;
82
83        #[cfg(feature = "objc2-core-foundation")]
84        #[unsafe(method(glyphOrigin))]
85        #[unsafe(method_family = none)]
86        pub fn glyphOrigin(&self) -> CGPoint;
87
88        #[cfg(all(feature = "objc2-core-foundation", feature = "objc2-core-graphics"))]
89        #[cfg(target_vendor = "apple")]
90        #[unsafe(method(drawAtPoint:inContext:))]
91        #[unsafe(method_family = none)]
92        pub fn drawAtPoint_inContext(&self, point: CGPoint, context: &CGContext);
93
94        #[cfg(feature = "objc2-core-foundation")]
95        #[unsafe(method(locationForCharacterAtIndex:))]
96        #[unsafe(method_family = none)]
97        pub fn locationForCharacterAtIndex(&self, index: NSInteger) -> CGPoint;
98
99        #[cfg(feature = "objc2-core-foundation")]
100        #[unsafe(method(characterIndexForPoint:))]
101        #[unsafe(method_family = none)]
102        pub fn characterIndexForPoint(&self, point: CGPoint) -> NSInteger;
103
104        #[cfg(feature = "objc2-core-foundation")]
105        #[unsafe(method(fractionOfDistanceThroughGlyphForPoint:))]
106        #[unsafe(method_family = none)]
107        pub fn fractionOfDistanceThroughGlyphForPoint(&self, point: CGPoint) -> CGFloat;
108    );
109}
110
111/// Methods declared on superclass `NSObject`.
112impl NSTextLineFragment {
113    extern_methods!(
114        #[unsafe(method(new))]
115        #[unsafe(method_family = new)]
116        pub unsafe fn new() -> Retained<Self>;
117    );
118}