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