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 unsafe fn initWithAttributedString_range(
39            this: Allocated<Self>,
40            attributed_string: &NSAttributedString,
41            range: NSRange,
42        ) -> Retained<Self>;
43
44        #[unsafe(method(initWithCoder:))]
45        #[unsafe(method_family = init)]
46        pub unsafe fn initWithCoder(
47            this: Allocated<Self>,
48            a_decoder: &NSCoder,
49        ) -> Option<Retained<Self>>;
50
51        #[unsafe(method(initWithString:attributes:range:))]
52        #[unsafe(method_family = init)]
53        pub unsafe fn initWithString_attributes_range(
54            this: Allocated<Self>,
55            string: &NSString,
56            attributes: &NSDictionary<NSAttributedStringKey, AnyObject>,
57            range: NSRange,
58        ) -> Retained<Self>;
59
60        #[unsafe(method(init))]
61        #[unsafe(method_family = init)]
62        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
63
64        #[unsafe(method(attributedString))]
65        #[unsafe(method_family = none)]
66        pub unsafe fn attributedString(&self) -> Retained<NSAttributedString>;
67
68        #[unsafe(method(characterRange))]
69        #[unsafe(method_family = none)]
70        pub unsafe fn characterRange(&self) -> NSRange;
71
72        #[cfg(feature = "objc2-core-foundation")]
73        #[unsafe(method(typographicBounds))]
74        #[unsafe(method_family = none)]
75        pub unsafe fn typographicBounds(&self) -> CGRect;
76
77        #[cfg(feature = "objc2-core-foundation")]
78        #[unsafe(method(glyphOrigin))]
79        #[unsafe(method_family = none)]
80        pub unsafe fn glyphOrigin(&self) -> CGPoint;
81
82        #[cfg(all(feature = "objc2-core-foundation", feature = "objc2-core-graphics"))]
83        #[cfg(target_vendor = "apple")]
84        #[unsafe(method(drawAtPoint:inContext:))]
85        #[unsafe(method_family = none)]
86        pub unsafe fn drawAtPoint_inContext(&self, point: CGPoint, context: &CGContext);
87
88        #[cfg(feature = "objc2-core-foundation")]
89        #[unsafe(method(locationForCharacterAtIndex:))]
90        #[unsafe(method_family = none)]
91        pub unsafe fn locationForCharacterAtIndex(&self, index: NSInteger) -> CGPoint;
92
93        #[cfg(feature = "objc2-core-foundation")]
94        #[unsafe(method(characterIndexForPoint:))]
95        #[unsafe(method_family = none)]
96        pub unsafe fn characterIndexForPoint(&self, point: CGPoint) -> NSInteger;
97
98        #[cfg(feature = "objc2-core-foundation")]
99        #[unsafe(method(fractionOfDistanceThroughGlyphForPoint:))]
100        #[unsafe(method_family = none)]
101        pub unsafe fn fractionOfDistanceThroughGlyphForPoint(&self, point: CGPoint) -> CGFloat;
102    );
103}
104
105/// Methods declared on superclass `NSObject`.
106impl NSTextLineFragment {
107    extern_methods!(
108        #[unsafe(method(new))]
109        #[unsafe(method_family = new)]
110        pub unsafe fn new() -> Retained<Self>;
111    );
112}