objc2_app_kit/generated/
NSTextLayoutFragment.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")]
9#[cfg(target_vendor = "apple")]
10use objc2_core_graphics::*;
11use objc2_foundation::*;
12
13use crate::*;
14
15#[repr(transparent)]
18#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
19pub struct NSTextLayoutFragmentEnumerationOptions(pub NSUInteger);
20bitflags::bitflags! {
21 impl NSTextLayoutFragmentEnumerationOptions: NSUInteger {
22 #[doc(alias = "NSTextLayoutFragmentEnumerationOptionsNone")]
23 const None = 0;
24 #[doc(alias = "NSTextLayoutFragmentEnumerationOptionsReverse")]
25 const Reverse = 1<<0;
26 #[doc(alias = "NSTextLayoutFragmentEnumerationOptionsEstimatesSize")]
27 const EstimatesSize = 1<<1;
28 #[doc(alias = "NSTextLayoutFragmentEnumerationOptionsEnsuresLayout")]
29 const EnsuresLayout = 1<<2;
30 #[doc(alias = "NSTextLayoutFragmentEnumerationOptionsEnsuresExtraLineFragment")]
31 const EnsuresExtraLineFragment = 1<<3;
32 }
33}
34
35unsafe impl Encode for NSTextLayoutFragmentEnumerationOptions {
36 const ENCODING: Encoding = NSUInteger::ENCODING;
37}
38
39unsafe impl RefEncode for NSTextLayoutFragmentEnumerationOptions {
40 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
41}
42
43#[repr(transparent)]
46#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
47pub struct NSTextLayoutFragmentState(pub NSUInteger);
48impl NSTextLayoutFragmentState {
49 #[doc(alias = "NSTextLayoutFragmentStateNone")]
50 pub const None: Self = Self(0);
51 #[doc(alias = "NSTextLayoutFragmentStateEstimatedUsageBounds")]
52 pub const EstimatedUsageBounds: Self = Self(1);
53 #[doc(alias = "NSTextLayoutFragmentStateCalculatedUsageBounds")]
54 pub const CalculatedUsageBounds: Self = Self(2);
55 #[doc(alias = "NSTextLayoutFragmentStateLayoutAvailable")]
56 pub const LayoutAvailable: Self = Self(3);
57}
58
59unsafe impl Encode for NSTextLayoutFragmentState {
60 const ENCODING: Encoding = NSUInteger::ENCODING;
61}
62
63unsafe impl RefEncode for NSTextLayoutFragmentState {
64 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
65}
66
67extern_class!(
68 #[unsafe(super(NSObject))]
70 #[derive(Debug, PartialEq, Eq, Hash)]
71 pub struct NSTextLayoutFragment;
72);
73
74unsafe impl NSCoding for NSTextLayoutFragment {}
75
76unsafe impl NSObjectProtocol for NSTextLayoutFragment {}
77
78unsafe impl NSSecureCoding for NSTextLayoutFragment {}
79
80impl NSTextLayoutFragment {
81 extern_methods!(
82 #[cfg(all(feature = "NSTextElement", feature = "NSTextRange"))]
83 #[unsafe(method(initWithTextElement:range:))]
84 #[unsafe(method_family = init)]
85 pub unsafe fn initWithTextElement_range(
86 this: Allocated<Self>,
87 text_element: &NSTextElement,
88 range_in_element: Option<&NSTextRange>,
89 ) -> Retained<Self>;
90
91 #[unsafe(method(initWithCoder:))]
92 #[unsafe(method_family = init)]
93 pub unsafe fn initWithCoder(
94 this: Allocated<Self>,
95 coder: &NSCoder,
96 ) -> Option<Retained<Self>>;
97
98 #[unsafe(method(init))]
99 #[unsafe(method_family = init)]
100 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
101
102 #[cfg(feature = "NSTextLayoutManager")]
103 #[unsafe(method(textLayoutManager))]
104 #[unsafe(method_family = none)]
105 pub unsafe fn textLayoutManager(&self) -> Option<Retained<NSTextLayoutManager>>;
106
107 #[cfg(feature = "NSTextElement")]
108 #[unsafe(method(textElement))]
109 #[unsafe(method_family = none)]
110 pub unsafe fn textElement(&self) -> Option<Retained<NSTextElement>>;
111
112 #[cfg(feature = "NSTextRange")]
113 #[unsafe(method(rangeInElement))]
114 #[unsafe(method_family = none)]
115 pub unsafe fn rangeInElement(&self) -> Retained<NSTextRange>;
116
117 #[cfg(feature = "NSTextLineFragment")]
118 #[unsafe(method(textLineFragments))]
119 #[unsafe(method_family = none)]
120 pub unsafe fn textLineFragments(&self) -> Retained<NSArray<NSTextLineFragment>>;
121
122 #[cfg(all(feature = "NSTextLineFragment", feature = "objc2-core-foundation"))]
123 #[unsafe(method(textLineFragmentForVerticalOffset:requiresExactMatch:))]
124 #[unsafe(method_family = none)]
125 pub unsafe fn textLineFragmentForVerticalOffset_requiresExactMatch(
126 &self,
127 vertical_offset: CGFloat,
128 requires_exact_match: bool,
129 ) -> Option<Retained<NSTextLineFragment>>;
130
131 #[cfg(all(feature = "NSTextLineFragment", feature = "NSTextRange"))]
132 #[unsafe(method(textLineFragmentForTextLocation:isUpstreamAffinity:))]
133 #[unsafe(method_family = none)]
134 pub unsafe fn textLineFragmentForTextLocation_isUpstreamAffinity(
135 &self,
136 text_location: &ProtocolObject<dyn NSTextLocation>,
137 is_upstream_affinity: bool,
138 ) -> Option<Retained<NSTextLineFragment>>;
139
140 #[unsafe(method(layoutQueue))]
141 #[unsafe(method_family = none)]
142 pub unsafe fn layoutQueue(&self) -> Option<Retained<NSOperationQueue>>;
143
144 #[unsafe(method(setLayoutQueue:))]
146 #[unsafe(method_family = none)]
147 pub unsafe fn setLayoutQueue(&self, layout_queue: Option<&NSOperationQueue>);
148
149 #[unsafe(method(state))]
150 #[unsafe(method_family = none)]
151 pub unsafe fn state(&self) -> NSTextLayoutFragmentState;
152
153 #[unsafe(method(invalidateLayout))]
154 #[unsafe(method_family = none)]
155 pub unsafe fn invalidateLayout(&self);
156
157 #[cfg(feature = "objc2-core-foundation")]
158 #[unsafe(method(layoutFragmentFrame))]
159 #[unsafe(method_family = none)]
160 pub unsafe fn layoutFragmentFrame(&self) -> CGRect;
161
162 #[cfg(feature = "objc2-core-foundation")]
163 #[unsafe(method(renderingSurfaceBounds))]
164 #[unsafe(method_family = none)]
165 pub unsafe fn renderingSurfaceBounds(&self) -> CGRect;
166
167 #[cfg(feature = "objc2-core-foundation")]
168 #[unsafe(method(leadingPadding))]
169 #[unsafe(method_family = none)]
170 pub unsafe fn leadingPadding(&self) -> CGFloat;
171
172 #[cfg(feature = "objc2-core-foundation")]
173 #[unsafe(method(trailingPadding))]
174 #[unsafe(method_family = none)]
175 pub unsafe fn trailingPadding(&self) -> CGFloat;
176
177 #[cfg(feature = "objc2-core-foundation")]
178 #[unsafe(method(topMargin))]
179 #[unsafe(method_family = none)]
180 pub unsafe fn topMargin(&self) -> CGFloat;
181
182 #[cfg(feature = "objc2-core-foundation")]
183 #[unsafe(method(bottomMargin))]
184 #[unsafe(method_family = none)]
185 pub unsafe fn bottomMargin(&self) -> CGFloat;
186
187 #[cfg(all(feature = "objc2-core-foundation", feature = "objc2-core-graphics"))]
188 #[cfg(target_vendor = "apple")]
189 #[unsafe(method(drawAtPoint:inContext:))]
190 #[unsafe(method_family = none)]
191 pub unsafe fn drawAtPoint_inContext(&self, point: CGPoint, context: &CGContext);
192
193 #[cfg(feature = "NSTextAttachment")]
194 #[unsafe(method(textAttachmentViewProviders))]
195 #[unsafe(method_family = none)]
196 pub unsafe fn textAttachmentViewProviders(
197 &self,
198 ) -> Retained<NSArray<NSTextAttachmentViewProvider>>;
199
200 #[cfg(all(feature = "NSTextRange", feature = "objc2-core-foundation"))]
201 #[unsafe(method(frameForTextAttachmentAtLocation:))]
202 #[unsafe(method_family = none)]
203 pub unsafe fn frameForTextAttachmentAtLocation(
204 &self,
205 location: &ProtocolObject<dyn NSTextLocation>,
206 ) -> CGRect;
207 );
208}
209
210impl NSTextLayoutFragment {
212 extern_methods!(
213 #[unsafe(method(new))]
214 #[unsafe(method_family = new)]
215 pub unsafe fn new() -> Retained<Self>;
216 );
217}