objc2_ui_kit/generated/
UILabel.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9#[cfg(feature = "objc2-quartz-core")]
10#[cfg(not(target_os = "watchos"))]
11use objc2_quartz_core::*;
12
13use crate::*;
14
15#[repr(transparent)]
18#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
19pub struct UILabelVibrancy(pub NSInteger);
20impl UILabelVibrancy {
21 #[doc(alias = "UILabelVibrancyNone")]
22 pub const None: Self = Self(0);
23 #[doc(alias = "UILabelVibrancyAutomatic")]
24 pub const Automatic: Self = Self(1);
25}
26
27unsafe impl Encode for UILabelVibrancy {
28 const ENCODING: Encoding = NSInteger::ENCODING;
29}
30
31unsafe impl RefEncode for UILabelVibrancy {
32 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
33}
34
35extern_class!(
36 #[unsafe(super(UIView, UIResponder, NSObject))]
38 #[thread_kind = MainThreadOnly]
39 #[derive(Debug, PartialEq, Eq, Hash)]
40 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
41 pub struct UILabel;
42);
43
44#[cfg(all(
45 feature = "UIResponder",
46 feature = "UIView",
47 feature = "objc2-quartz-core"
48))]
49#[cfg(not(target_os = "watchos"))]
50extern_conformance!(
51 unsafe impl CALayerDelegate for UILabel {}
52);
53
54#[cfg(all(feature = "UIResponder", feature = "UIView"))]
55extern_conformance!(
56 unsafe impl NSCoding for UILabel {}
57);
58
59#[cfg(all(feature = "UIResponder", feature = "UIView"))]
60extern_conformance!(
61 unsafe impl NSObjectProtocol for UILabel {}
62);
63
64#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
65extern_conformance!(
66 unsafe impl UIAppearance for UILabel {}
67);
68
69#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
70extern_conformance!(
71 unsafe impl UIAppearanceContainer for UILabel {}
72);
73
74#[cfg(all(
75 feature = "UIContentSizeCategoryAdjusting",
76 feature = "UIResponder",
77 feature = "UIView"
78))]
79extern_conformance!(
80 unsafe impl UIContentSizeCategoryAdjusting for UILabel {}
81);
82
83#[cfg(all(feature = "UIResponder", feature = "UIView"))]
84extern_conformance!(
85 unsafe impl UICoordinateSpace for UILabel {}
86);
87
88#[cfg(all(
89 feature = "UIDynamicBehavior",
90 feature = "UIResponder",
91 feature = "UIView"
92))]
93extern_conformance!(
94 unsafe impl UIDynamicItem for UILabel {}
95);
96
97#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
98extern_conformance!(
99 unsafe impl UIFocusEnvironment for UILabel {}
100);
101
102#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
103extern_conformance!(
104 unsafe impl UIFocusItem for UILabel {}
105);
106
107#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
108extern_conformance!(
109 unsafe impl UIFocusItemContainer for UILabel {}
110);
111
112#[cfg(all(
113 feature = "UILetterformAwareAdjusting",
114 feature = "UIResponder",
115 feature = "UIView"
116))]
117extern_conformance!(
118 unsafe impl UILetterformAwareAdjusting for UILabel {}
119);
120
121#[cfg(all(feature = "UIResponder", feature = "UIView"))]
122extern_conformance!(
123 unsafe impl UIResponderStandardEditActions for UILabel {}
124);
125
126#[cfg(all(
127 feature = "UIResponder",
128 feature = "UITraitCollection",
129 feature = "UIView"
130))]
131extern_conformance!(
132 unsafe impl UITraitEnvironment for UILabel {}
133);
134
135#[cfg(all(feature = "UIResponder", feature = "UIView"))]
136impl UILabel {
137 extern_methods!(
138 #[unsafe(method(text))]
139 #[unsafe(method_family = none)]
140 pub unsafe fn text(&self) -> Option<Retained<NSString>>;
141
142 #[unsafe(method(setText:))]
144 #[unsafe(method_family = none)]
145 pub unsafe fn setText(&self, text: Option<&NSString>);
146
147 #[cfg(feature = "UIFont")]
148 #[unsafe(method(font))]
149 #[unsafe(method_family = none)]
150 pub unsafe fn font(&self) -> Option<Retained<UIFont>>;
151
152 #[cfg(feature = "UIFont")]
153 #[unsafe(method(setFont:))]
155 #[unsafe(method_family = none)]
156 pub unsafe fn setFont(&self, font: Option<&UIFont>);
157
158 #[cfg(feature = "UIColor")]
159 #[unsafe(method(textColor))]
160 #[unsafe(method_family = none)]
161 pub unsafe fn textColor(&self) -> Option<Retained<UIColor>>;
162
163 #[cfg(feature = "UIColor")]
164 #[unsafe(method(setTextColor:))]
166 #[unsafe(method_family = none)]
167 pub unsafe fn setTextColor(&self, text_color: Option<&UIColor>);
168
169 #[unsafe(method(preferredVibrancy))]
170 #[unsafe(method_family = none)]
171 pub unsafe fn preferredVibrancy(&self) -> UILabelVibrancy;
172
173 #[unsafe(method(setPreferredVibrancy:))]
175 #[unsafe(method_family = none)]
176 pub unsafe fn setPreferredVibrancy(&self, preferred_vibrancy: UILabelVibrancy);
177
178 #[cfg(feature = "UIColor")]
179 #[unsafe(method(shadowColor))]
180 #[unsafe(method_family = none)]
181 pub unsafe fn shadowColor(&self) -> Option<Retained<UIColor>>;
182
183 #[cfg(feature = "UIColor")]
184 #[unsafe(method(setShadowColor:))]
186 #[unsafe(method_family = none)]
187 pub unsafe fn setShadowColor(&self, shadow_color: Option<&UIColor>);
188
189 #[cfg(feature = "objc2-core-foundation")]
190 #[unsafe(method(shadowOffset))]
191 #[unsafe(method_family = none)]
192 pub unsafe fn shadowOffset(&self) -> CGSize;
193
194 #[cfg(feature = "objc2-core-foundation")]
195 #[unsafe(method(setShadowOffset:))]
197 #[unsafe(method_family = none)]
198 pub unsafe fn setShadowOffset(&self, shadow_offset: CGSize);
199
200 #[cfg(feature = "NSText")]
201 #[unsafe(method(textAlignment))]
202 #[unsafe(method_family = none)]
203 pub unsafe fn textAlignment(&self) -> NSTextAlignment;
204
205 #[cfg(feature = "NSText")]
206 #[unsafe(method(setTextAlignment:))]
208 #[unsafe(method_family = none)]
209 pub unsafe fn setTextAlignment(&self, text_alignment: NSTextAlignment);
210
211 #[cfg(feature = "NSParagraphStyle")]
212 #[unsafe(method(lineBreakMode))]
213 #[unsafe(method_family = none)]
214 pub unsafe fn lineBreakMode(&self) -> NSLineBreakMode;
215
216 #[cfg(feature = "NSParagraphStyle")]
217 #[unsafe(method(setLineBreakMode:))]
219 #[unsafe(method_family = none)]
220 pub unsafe fn setLineBreakMode(&self, line_break_mode: NSLineBreakMode);
221
222 #[unsafe(method(attributedText))]
223 #[unsafe(method_family = none)]
224 pub unsafe fn attributedText(&self) -> Option<Retained<NSAttributedString>>;
225
226 #[unsafe(method(setAttributedText:))]
228 #[unsafe(method_family = none)]
229 pub unsafe fn setAttributedText(&self, attributed_text: Option<&NSAttributedString>);
230
231 #[cfg(feature = "UIColor")]
232 #[unsafe(method(highlightedTextColor))]
233 #[unsafe(method_family = none)]
234 pub unsafe fn highlightedTextColor(&self) -> Option<Retained<UIColor>>;
235
236 #[cfg(feature = "UIColor")]
237 #[unsafe(method(setHighlightedTextColor:))]
239 #[unsafe(method_family = none)]
240 pub unsafe fn setHighlightedTextColor(&self, highlighted_text_color: Option<&UIColor>);
241
242 #[unsafe(method(isHighlighted))]
243 #[unsafe(method_family = none)]
244 pub unsafe fn isHighlighted(&self) -> bool;
245
246 #[unsafe(method(setHighlighted:))]
248 #[unsafe(method_family = none)]
249 pub unsafe fn setHighlighted(&self, highlighted: bool);
250
251 #[unsafe(method(isUserInteractionEnabled))]
252 #[unsafe(method_family = none)]
253 pub unsafe fn isUserInteractionEnabled(&self) -> bool;
254
255 #[unsafe(method(setUserInteractionEnabled:))]
257 #[unsafe(method_family = none)]
258 pub unsafe fn setUserInteractionEnabled(&self, user_interaction_enabled: bool);
259
260 #[unsafe(method(isEnabled))]
261 #[unsafe(method_family = none)]
262 pub unsafe fn isEnabled(&self) -> bool;
263
264 #[unsafe(method(setEnabled:))]
266 #[unsafe(method_family = none)]
267 pub unsafe fn setEnabled(&self, enabled: bool);
268
269 #[unsafe(method(numberOfLines))]
270 #[unsafe(method_family = none)]
271 pub unsafe fn numberOfLines(&self) -> NSInteger;
272
273 #[unsafe(method(setNumberOfLines:))]
275 #[unsafe(method_family = none)]
276 pub unsafe fn setNumberOfLines(&self, number_of_lines: NSInteger);
277
278 #[unsafe(method(adjustsFontSizeToFitWidth))]
279 #[unsafe(method_family = none)]
280 pub unsafe fn adjustsFontSizeToFitWidth(&self) -> bool;
281
282 #[unsafe(method(setAdjustsFontSizeToFitWidth:))]
284 #[unsafe(method_family = none)]
285 pub unsafe fn setAdjustsFontSizeToFitWidth(&self, adjusts_font_size_to_fit_width: bool);
286
287 #[cfg(feature = "UIStringDrawing")]
288 #[unsafe(method(baselineAdjustment))]
289 #[unsafe(method_family = none)]
290 pub unsafe fn baselineAdjustment(&self) -> UIBaselineAdjustment;
291
292 #[cfg(feature = "UIStringDrawing")]
293 #[unsafe(method(setBaselineAdjustment:))]
295 #[unsafe(method_family = none)]
296 pub unsafe fn setBaselineAdjustment(&self, baseline_adjustment: UIBaselineAdjustment);
297
298 #[cfg(feature = "objc2-core-foundation")]
299 #[unsafe(method(minimumScaleFactor))]
300 #[unsafe(method_family = none)]
301 pub unsafe fn minimumScaleFactor(&self) -> CGFloat;
302
303 #[cfg(feature = "objc2-core-foundation")]
304 #[unsafe(method(setMinimumScaleFactor:))]
306 #[unsafe(method_family = none)]
307 pub unsafe fn setMinimumScaleFactor(&self, minimum_scale_factor: CGFloat);
308
309 #[unsafe(method(allowsDefaultTighteningForTruncation))]
310 #[unsafe(method_family = none)]
311 pub unsafe fn allowsDefaultTighteningForTruncation(&self) -> bool;
312
313 #[unsafe(method(setAllowsDefaultTighteningForTruncation:))]
315 #[unsafe(method_family = none)]
316 pub unsafe fn setAllowsDefaultTighteningForTruncation(
317 &self,
318 allows_default_tightening_for_truncation: bool,
319 );
320
321 #[cfg(feature = "NSParagraphStyle")]
322 #[unsafe(method(lineBreakStrategy))]
323 #[unsafe(method_family = none)]
324 pub unsafe fn lineBreakStrategy(&self) -> NSLineBreakStrategy;
325
326 #[cfg(feature = "NSParagraphStyle")]
327 #[unsafe(method(setLineBreakStrategy:))]
329 #[unsafe(method_family = none)]
330 pub unsafe fn setLineBreakStrategy(&self, line_break_strategy: NSLineBreakStrategy);
331
332 #[cfg(feature = "objc2-core-foundation")]
333 #[unsafe(method(textRectForBounds:limitedToNumberOfLines:))]
334 #[unsafe(method_family = none)]
335 pub unsafe fn textRectForBounds_limitedToNumberOfLines(
336 &self,
337 bounds: CGRect,
338 number_of_lines: NSInteger,
339 ) -> CGRect;
340
341 #[cfg(feature = "objc2-core-foundation")]
342 #[unsafe(method(drawTextInRect:))]
343 #[unsafe(method_family = none)]
344 pub unsafe fn drawTextInRect(&self, rect: CGRect);
345
346 #[cfg(feature = "objc2-core-foundation")]
347 #[unsafe(method(preferredMaxLayoutWidth))]
348 #[unsafe(method_family = none)]
349 pub unsafe fn preferredMaxLayoutWidth(&self) -> CGFloat;
350
351 #[cfg(feature = "objc2-core-foundation")]
352 #[unsafe(method(setPreferredMaxLayoutWidth:))]
354 #[unsafe(method_family = none)]
355 pub unsafe fn setPreferredMaxLayoutWidth(&self, preferred_max_layout_width: CGFloat);
356
357 #[unsafe(method(enablesMarqueeWhenAncestorFocused))]
358 #[unsafe(method_family = none)]
359 pub unsafe fn enablesMarqueeWhenAncestorFocused(&self) -> bool;
360
361 #[unsafe(method(setEnablesMarqueeWhenAncestorFocused:))]
363 #[unsafe(method_family = none)]
364 pub unsafe fn setEnablesMarqueeWhenAncestorFocused(
365 &self,
366 enables_marquee_when_ancestor_focused: bool,
367 );
368
369 #[unsafe(method(showsExpansionTextWhenTruncated))]
371 #[unsafe(method_family = none)]
372 pub unsafe fn showsExpansionTextWhenTruncated(&self) -> bool;
373
374 #[unsafe(method(setShowsExpansionTextWhenTruncated:))]
376 #[unsafe(method_family = none)]
377 pub unsafe fn setShowsExpansionTextWhenTruncated(
378 &self,
379 shows_expansion_text_when_truncated: bool,
380 );
381
382 #[cfg(feature = "objc2-core-foundation")]
383 #[deprecated]
384 #[unsafe(method(minimumFontSize))]
385 #[unsafe(method_family = none)]
386 pub unsafe fn minimumFontSize(&self) -> CGFloat;
387
388 #[cfg(feature = "objc2-core-foundation")]
389 #[deprecated]
391 #[unsafe(method(setMinimumFontSize:))]
392 #[unsafe(method_family = none)]
393 pub unsafe fn setMinimumFontSize(&self, minimum_font_size: CGFloat);
394
395 #[deprecated]
396 #[unsafe(method(adjustsLetterSpacingToFitWidth))]
397 #[unsafe(method_family = none)]
398 pub unsafe fn adjustsLetterSpacingToFitWidth(&self) -> bool;
399
400 #[deprecated]
402 #[unsafe(method(setAdjustsLetterSpacingToFitWidth:))]
403 #[unsafe(method_family = none)]
404 pub unsafe fn setAdjustsLetterSpacingToFitWidth(
405 &self,
406 adjusts_letter_spacing_to_fit_width: bool,
407 );
408 );
409}
410
411#[cfg(all(feature = "UIResponder", feature = "UIView"))]
413impl UILabel {
414 extern_methods!(
415 #[cfg(feature = "objc2-core-foundation")]
416 #[unsafe(method(initWithFrame:))]
417 #[unsafe(method_family = init)]
418 pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
419
420 #[unsafe(method(initWithCoder:))]
421 #[unsafe(method_family = init)]
422 pub unsafe fn initWithCoder(
423 this: Allocated<Self>,
424 coder: &NSCoder,
425 ) -> Option<Retained<Self>>;
426 );
427}
428
429#[cfg(all(feature = "UIResponder", feature = "UIView"))]
431impl UILabel {
432 extern_methods!(
433 #[unsafe(method(init))]
434 #[unsafe(method_family = init)]
435 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
436
437 #[unsafe(method(new))]
438 #[unsafe(method_family = new)]
439 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
440 );
441}