objc2_ui_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")]
9use objc2_core_graphics::*;
10use objc2_foundation::*;
11
12use crate::*;
13
14extern_class!(
15    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nstextlinefragment?language=objc)
16    #[unsafe(super(NSObject))]
17    #[derive(Debug, PartialEq, Eq, Hash)]
18    pub struct NSTextLineFragment;
19);
20
21unsafe impl NSCoding for NSTextLineFragment {}
22
23unsafe impl NSObjectProtocol for NSTextLineFragment {}
24
25unsafe impl NSSecureCoding for NSTextLineFragment {}
26
27impl NSTextLineFragment {
28    extern_methods!(
29        #[unsafe(method(initWithAttributedString:range:))]
30        #[unsafe(method_family = init)]
31        pub unsafe fn initWithAttributedString_range(
32            this: Allocated<Self>,
33            attributed_string: &NSAttributedString,
34            range: NSRange,
35        ) -> Retained<Self>;
36
37        #[unsafe(method(initWithCoder:))]
38        #[unsafe(method_family = init)]
39        pub unsafe fn initWithCoder(
40            this: Allocated<Self>,
41            a_decoder: &NSCoder,
42        ) -> Option<Retained<Self>>;
43
44        #[unsafe(method(initWithString:attributes:range:))]
45        #[unsafe(method_family = init)]
46        pub unsafe fn initWithString_attributes_range(
47            this: Allocated<Self>,
48            string: &NSString,
49            attributes: &NSDictionary<NSAttributedStringKey, AnyObject>,
50            range: NSRange,
51        ) -> Retained<Self>;
52
53        #[unsafe(method(init))]
54        #[unsafe(method_family = init)]
55        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
56
57        #[unsafe(method(attributedString))]
58        #[unsafe(method_family = none)]
59        pub unsafe fn attributedString(&self) -> Retained<NSAttributedString>;
60
61        #[unsafe(method(characterRange))]
62        #[unsafe(method_family = none)]
63        pub unsafe fn characterRange(&self) -> NSRange;
64
65        #[cfg(feature = "objc2-core-foundation")]
66        #[unsafe(method(typographicBounds))]
67        #[unsafe(method_family = none)]
68        pub unsafe fn typographicBounds(&self) -> CGRect;
69
70        #[cfg(feature = "objc2-core-foundation")]
71        #[unsafe(method(glyphOrigin))]
72        #[unsafe(method_family = none)]
73        pub unsafe fn glyphOrigin(&self) -> CGPoint;
74
75        #[cfg(all(feature = "objc2-core-foundation", feature = "objc2-core-graphics"))]
76        #[unsafe(method(drawAtPoint:inContext:))]
77        #[unsafe(method_family = none)]
78        pub unsafe fn drawAtPoint_inContext(&self, point: CGPoint, context: &CGContext);
79
80        #[cfg(feature = "objc2-core-foundation")]
81        #[unsafe(method(locationForCharacterAtIndex:))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn locationForCharacterAtIndex(&self, index: NSInteger) -> CGPoint;
84
85        #[cfg(feature = "objc2-core-foundation")]
86        #[unsafe(method(characterIndexForPoint:))]
87        #[unsafe(method_family = none)]
88        pub unsafe fn characterIndexForPoint(&self, point: CGPoint) -> NSInteger;
89
90        #[cfg(feature = "objc2-core-foundation")]
91        #[unsafe(method(fractionOfDistanceThroughGlyphForPoint:))]
92        #[unsafe(method_family = none)]
93        pub unsafe fn fractionOfDistanceThroughGlyphForPoint(&self, point: CGPoint) -> CGFloat;
94    );
95}
96
97/// Methods declared on superclass `NSObject`.
98impl NSTextLineFragment {
99    extern_methods!(
100        #[unsafe(method(new))]
101        #[unsafe(method_family = new)]
102        pub unsafe fn new() -> Retained<Self>;
103    );
104}