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
74extern_conformance!(
75 unsafe impl NSCoding for NSTextLayoutFragment {}
76);
77
78extern_conformance!(
79 unsafe impl NSObjectProtocol for NSTextLayoutFragment {}
80);
81
82extern_conformance!(
83 unsafe impl NSSecureCoding for NSTextLayoutFragment {}
84);
85
86impl NSTextLayoutFragment {
87 extern_methods!(
88 #[cfg(all(feature = "NSTextElement", feature = "NSTextRange"))]
89 #[unsafe(method(initWithTextElement:range:))]
90 #[unsafe(method_family = init)]
91 pub unsafe fn initWithTextElement_range(
92 this: Allocated<Self>,
93 text_element: &NSTextElement,
94 range_in_element: Option<&NSTextRange>,
95 ) -> Retained<Self>;
96
97 #[unsafe(method(initWithCoder:))]
98 #[unsafe(method_family = init)]
99 pub unsafe fn initWithCoder(
100 this: Allocated<Self>,
101 coder: &NSCoder,
102 ) -> Option<Retained<Self>>;
103
104 #[unsafe(method(init))]
105 #[unsafe(method_family = init)]
106 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
107
108 #[cfg(feature = "NSTextLayoutManager")]
109 #[unsafe(method(textLayoutManager))]
110 #[unsafe(method_family = none)]
111 pub unsafe fn textLayoutManager(&self) -> Option<Retained<NSTextLayoutManager>>;
112
113 #[cfg(feature = "NSTextElement")]
114 #[unsafe(method(textElement))]
115 #[unsafe(method_family = none)]
116 pub unsafe fn textElement(&self) -> Option<Retained<NSTextElement>>;
117
118 #[cfg(feature = "NSTextRange")]
119 #[unsafe(method(rangeInElement))]
120 #[unsafe(method_family = none)]
121 pub unsafe fn rangeInElement(&self) -> Retained<NSTextRange>;
122
123 #[cfg(feature = "NSTextLineFragment")]
124 #[unsafe(method(textLineFragments))]
125 #[unsafe(method_family = none)]
126 pub unsafe fn textLineFragments(&self) -> Retained<NSArray<NSTextLineFragment>>;
127
128 #[cfg(all(feature = "NSTextLineFragment", feature = "objc2-core-foundation"))]
129 #[unsafe(method(textLineFragmentForVerticalOffset:requiresExactMatch:))]
130 #[unsafe(method_family = none)]
131 pub unsafe fn textLineFragmentForVerticalOffset_requiresExactMatch(
132 &self,
133 vertical_offset: CGFloat,
134 requires_exact_match: bool,
135 ) -> Option<Retained<NSTextLineFragment>>;
136
137 #[cfg(all(feature = "NSTextLineFragment", feature = "NSTextRange"))]
138 #[unsafe(method(textLineFragmentForTextLocation:isUpstreamAffinity:))]
139 #[unsafe(method_family = none)]
140 pub unsafe fn textLineFragmentForTextLocation_isUpstreamAffinity(
141 &self,
142 text_location: &ProtocolObject<dyn NSTextLocation>,
143 is_upstream_affinity: bool,
144 ) -> Option<Retained<NSTextLineFragment>>;
145
146 #[unsafe(method(layoutQueue))]
147 #[unsafe(method_family = none)]
148 pub unsafe fn layoutQueue(&self) -> Option<Retained<NSOperationQueue>>;
149
150 #[unsafe(method(setLayoutQueue:))]
152 #[unsafe(method_family = none)]
153 pub unsafe fn setLayoutQueue(&self, layout_queue: Option<&NSOperationQueue>);
154
155 #[unsafe(method(state))]
156 #[unsafe(method_family = none)]
157 pub unsafe fn state(&self) -> NSTextLayoutFragmentState;
158
159 #[unsafe(method(invalidateLayout))]
160 #[unsafe(method_family = none)]
161 pub unsafe fn invalidateLayout(&self);
162
163 #[cfg(feature = "objc2-core-foundation")]
164 #[unsafe(method(layoutFragmentFrame))]
165 #[unsafe(method_family = none)]
166 pub unsafe fn layoutFragmentFrame(&self) -> CGRect;
167
168 #[cfg(feature = "objc2-core-foundation")]
169 #[unsafe(method(renderingSurfaceBounds))]
170 #[unsafe(method_family = none)]
171 pub unsafe fn renderingSurfaceBounds(&self) -> CGRect;
172
173 #[cfg(feature = "objc2-core-foundation")]
174 #[unsafe(method(leadingPadding))]
175 #[unsafe(method_family = none)]
176 pub unsafe fn leadingPadding(&self) -> CGFloat;
177
178 #[cfg(feature = "objc2-core-foundation")]
179 #[unsafe(method(trailingPadding))]
180 #[unsafe(method_family = none)]
181 pub unsafe fn trailingPadding(&self) -> CGFloat;
182
183 #[cfg(feature = "objc2-core-foundation")]
184 #[unsafe(method(topMargin))]
185 #[unsafe(method_family = none)]
186 pub unsafe fn topMargin(&self) -> CGFloat;
187
188 #[cfg(feature = "objc2-core-foundation")]
189 #[unsafe(method(bottomMargin))]
190 #[unsafe(method_family = none)]
191 pub unsafe fn bottomMargin(&self) -> CGFloat;
192
193 #[cfg(all(feature = "objc2-core-foundation", feature = "objc2-core-graphics"))]
194 #[cfg(target_vendor = "apple")]
195 #[unsafe(method(drawAtPoint:inContext:))]
196 #[unsafe(method_family = none)]
197 pub unsafe fn drawAtPoint_inContext(&self, point: CGPoint, context: &CGContext);
198
199 #[cfg(feature = "NSTextAttachment")]
200 #[unsafe(method(textAttachmentViewProviders))]
201 #[unsafe(method_family = none)]
202 pub unsafe fn textAttachmentViewProviders(
203 &self,
204 ) -> Retained<NSArray<NSTextAttachmentViewProvider>>;
205
206 #[cfg(all(feature = "NSTextRange", feature = "objc2-core-foundation"))]
207 #[unsafe(method(frameForTextAttachmentAtLocation:))]
208 #[unsafe(method_family = none)]
209 pub unsafe fn frameForTextAttachmentAtLocation(
210 &self,
211 location: &ProtocolObject<dyn NSTextLocation>,
212 ) -> CGRect;
213 );
214}
215
216impl NSTextLayoutFragment {
218 extern_methods!(
219 #[unsafe(method(new))]
220 #[unsafe(method_family = new)]
221 pub unsafe fn new() -> Retained<Self>;
222 );
223}