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