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"))]
50unsafe impl CALayerDelegate for UILabel {}
51
52#[cfg(all(feature = "UIResponder", feature = "UIView"))]
53unsafe impl NSCoding for UILabel {}
54
55#[cfg(all(feature = "UIResponder", feature = "UIView"))]
56unsafe impl NSObjectProtocol for UILabel {}
57
58#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
59unsafe impl UIAppearance for UILabel {}
60
61#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
62unsafe impl UIAppearanceContainer for UILabel {}
63
64#[cfg(all(
65 feature = "UIContentSizeCategoryAdjusting",
66 feature = "UIResponder",
67 feature = "UIView"
68))]
69unsafe impl UIContentSizeCategoryAdjusting for UILabel {}
70
71#[cfg(all(feature = "UIResponder", feature = "UIView"))]
72unsafe impl UICoordinateSpace for UILabel {}
73
74#[cfg(all(
75 feature = "UIDynamicBehavior",
76 feature = "UIResponder",
77 feature = "UIView"
78))]
79unsafe impl UIDynamicItem for UILabel {}
80
81#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
82unsafe impl UIFocusEnvironment for UILabel {}
83
84#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
85unsafe impl UIFocusItem for UILabel {}
86
87#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
88unsafe impl UIFocusItemContainer for UILabel {}
89
90#[cfg(all(
91 feature = "UILetterformAwareAdjusting",
92 feature = "UIResponder",
93 feature = "UIView"
94))]
95unsafe impl UILetterformAwareAdjusting for UILabel {}
96
97#[cfg(all(feature = "UIResponder", feature = "UIView"))]
98unsafe impl UIResponderStandardEditActions for UILabel {}
99
100#[cfg(all(
101 feature = "UIResponder",
102 feature = "UITraitCollection",
103 feature = "UIView"
104))]
105unsafe impl UITraitEnvironment for UILabel {}
106
107#[cfg(all(feature = "UIResponder", feature = "UIView"))]
108impl UILabel {
109 extern_methods!(
110 #[unsafe(method(text))]
111 #[unsafe(method_family = none)]
112 pub unsafe fn text(&self) -> Option<Retained<NSString>>;
113
114 #[unsafe(method(setText:))]
116 #[unsafe(method_family = none)]
117 pub unsafe fn setText(&self, text: Option<&NSString>);
118
119 #[cfg(feature = "UIFont")]
120 #[unsafe(method(font))]
121 #[unsafe(method_family = none)]
122 pub unsafe fn font(&self) -> Option<Retained<UIFont>>;
123
124 #[cfg(feature = "UIFont")]
125 #[unsafe(method(setFont:))]
127 #[unsafe(method_family = none)]
128 pub unsafe fn setFont(&self, font: Option<&UIFont>);
129
130 #[cfg(feature = "UIColor")]
131 #[unsafe(method(textColor))]
132 #[unsafe(method_family = none)]
133 pub unsafe fn textColor(&self) -> Option<Retained<UIColor>>;
134
135 #[cfg(feature = "UIColor")]
136 #[unsafe(method(setTextColor:))]
138 #[unsafe(method_family = none)]
139 pub unsafe fn setTextColor(&self, text_color: Option<&UIColor>);
140
141 #[unsafe(method(preferredVibrancy))]
142 #[unsafe(method_family = none)]
143 pub unsafe fn preferredVibrancy(&self) -> UILabelVibrancy;
144
145 #[unsafe(method(setPreferredVibrancy:))]
147 #[unsafe(method_family = none)]
148 pub unsafe fn setPreferredVibrancy(&self, preferred_vibrancy: UILabelVibrancy);
149
150 #[cfg(feature = "UIColor")]
151 #[unsafe(method(shadowColor))]
152 #[unsafe(method_family = none)]
153 pub unsafe fn shadowColor(&self) -> Option<Retained<UIColor>>;
154
155 #[cfg(feature = "UIColor")]
156 #[unsafe(method(setShadowColor:))]
158 #[unsafe(method_family = none)]
159 pub unsafe fn setShadowColor(&self, shadow_color: Option<&UIColor>);
160
161 #[cfg(feature = "objc2-core-foundation")]
162 #[unsafe(method(shadowOffset))]
163 #[unsafe(method_family = none)]
164 pub unsafe fn shadowOffset(&self) -> CGSize;
165
166 #[cfg(feature = "objc2-core-foundation")]
167 #[unsafe(method(setShadowOffset:))]
169 #[unsafe(method_family = none)]
170 pub unsafe fn setShadowOffset(&self, shadow_offset: CGSize);
171
172 #[cfg(feature = "NSText")]
173 #[unsafe(method(textAlignment))]
174 #[unsafe(method_family = none)]
175 pub unsafe fn textAlignment(&self) -> NSTextAlignment;
176
177 #[cfg(feature = "NSText")]
178 #[unsafe(method(setTextAlignment:))]
180 #[unsafe(method_family = none)]
181 pub unsafe fn setTextAlignment(&self, text_alignment: NSTextAlignment);
182
183 #[cfg(feature = "NSParagraphStyle")]
184 #[unsafe(method(lineBreakMode))]
185 #[unsafe(method_family = none)]
186 pub unsafe fn lineBreakMode(&self) -> NSLineBreakMode;
187
188 #[cfg(feature = "NSParagraphStyle")]
189 #[unsafe(method(setLineBreakMode:))]
191 #[unsafe(method_family = none)]
192 pub unsafe fn setLineBreakMode(&self, line_break_mode: NSLineBreakMode);
193
194 #[unsafe(method(attributedText))]
195 #[unsafe(method_family = none)]
196 pub unsafe fn attributedText(&self) -> Option<Retained<NSAttributedString>>;
197
198 #[unsafe(method(setAttributedText:))]
200 #[unsafe(method_family = none)]
201 pub unsafe fn setAttributedText(&self, attributed_text: Option<&NSAttributedString>);
202
203 #[cfg(feature = "UIColor")]
204 #[unsafe(method(highlightedTextColor))]
205 #[unsafe(method_family = none)]
206 pub unsafe fn highlightedTextColor(&self) -> Option<Retained<UIColor>>;
207
208 #[cfg(feature = "UIColor")]
209 #[unsafe(method(setHighlightedTextColor:))]
211 #[unsafe(method_family = none)]
212 pub unsafe fn setHighlightedTextColor(&self, highlighted_text_color: Option<&UIColor>);
213
214 #[unsafe(method(isHighlighted))]
215 #[unsafe(method_family = none)]
216 pub unsafe fn isHighlighted(&self) -> bool;
217
218 #[unsafe(method(setHighlighted:))]
220 #[unsafe(method_family = none)]
221 pub unsafe fn setHighlighted(&self, highlighted: bool);
222
223 #[unsafe(method(isUserInteractionEnabled))]
224 #[unsafe(method_family = none)]
225 pub unsafe fn isUserInteractionEnabled(&self) -> bool;
226
227 #[unsafe(method(setUserInteractionEnabled:))]
229 #[unsafe(method_family = none)]
230 pub unsafe fn setUserInteractionEnabled(&self, user_interaction_enabled: bool);
231
232 #[unsafe(method(isEnabled))]
233 #[unsafe(method_family = none)]
234 pub unsafe fn isEnabled(&self) -> bool;
235
236 #[unsafe(method(setEnabled:))]
238 #[unsafe(method_family = none)]
239 pub unsafe fn setEnabled(&self, enabled: bool);
240
241 #[unsafe(method(numberOfLines))]
242 #[unsafe(method_family = none)]
243 pub unsafe fn numberOfLines(&self) -> NSInteger;
244
245 #[unsafe(method(setNumberOfLines:))]
247 #[unsafe(method_family = none)]
248 pub unsafe fn setNumberOfLines(&self, number_of_lines: NSInteger);
249
250 #[unsafe(method(adjustsFontSizeToFitWidth))]
251 #[unsafe(method_family = none)]
252 pub unsafe fn adjustsFontSizeToFitWidth(&self) -> bool;
253
254 #[unsafe(method(setAdjustsFontSizeToFitWidth:))]
256 #[unsafe(method_family = none)]
257 pub unsafe fn setAdjustsFontSizeToFitWidth(&self, adjusts_font_size_to_fit_width: bool);
258
259 #[cfg(feature = "UIStringDrawing")]
260 #[unsafe(method(baselineAdjustment))]
261 #[unsafe(method_family = none)]
262 pub unsafe fn baselineAdjustment(&self) -> UIBaselineAdjustment;
263
264 #[cfg(feature = "UIStringDrawing")]
265 #[unsafe(method(setBaselineAdjustment:))]
267 #[unsafe(method_family = none)]
268 pub unsafe fn setBaselineAdjustment(&self, baseline_adjustment: UIBaselineAdjustment);
269
270 #[cfg(feature = "objc2-core-foundation")]
271 #[unsafe(method(minimumScaleFactor))]
272 #[unsafe(method_family = none)]
273 pub unsafe fn minimumScaleFactor(&self) -> CGFloat;
274
275 #[cfg(feature = "objc2-core-foundation")]
276 #[unsafe(method(setMinimumScaleFactor:))]
278 #[unsafe(method_family = none)]
279 pub unsafe fn setMinimumScaleFactor(&self, minimum_scale_factor: CGFloat);
280
281 #[unsafe(method(allowsDefaultTighteningForTruncation))]
282 #[unsafe(method_family = none)]
283 pub unsafe fn allowsDefaultTighteningForTruncation(&self) -> bool;
284
285 #[unsafe(method(setAllowsDefaultTighteningForTruncation:))]
287 #[unsafe(method_family = none)]
288 pub unsafe fn setAllowsDefaultTighteningForTruncation(
289 &self,
290 allows_default_tightening_for_truncation: bool,
291 );
292
293 #[cfg(feature = "NSParagraphStyle")]
294 #[unsafe(method(lineBreakStrategy))]
295 #[unsafe(method_family = none)]
296 pub unsafe fn lineBreakStrategy(&self) -> NSLineBreakStrategy;
297
298 #[cfg(feature = "NSParagraphStyle")]
299 #[unsafe(method(setLineBreakStrategy:))]
301 #[unsafe(method_family = none)]
302 pub unsafe fn setLineBreakStrategy(&self, line_break_strategy: NSLineBreakStrategy);
303
304 #[cfg(feature = "objc2-core-foundation")]
305 #[unsafe(method(textRectForBounds:limitedToNumberOfLines:))]
306 #[unsafe(method_family = none)]
307 pub unsafe fn textRectForBounds_limitedToNumberOfLines(
308 &self,
309 bounds: CGRect,
310 number_of_lines: NSInteger,
311 ) -> CGRect;
312
313 #[cfg(feature = "objc2-core-foundation")]
314 #[unsafe(method(drawTextInRect:))]
315 #[unsafe(method_family = none)]
316 pub unsafe fn drawTextInRect(&self, rect: CGRect);
317
318 #[cfg(feature = "objc2-core-foundation")]
319 #[unsafe(method(preferredMaxLayoutWidth))]
320 #[unsafe(method_family = none)]
321 pub unsafe fn preferredMaxLayoutWidth(&self) -> CGFloat;
322
323 #[cfg(feature = "objc2-core-foundation")]
324 #[unsafe(method(setPreferredMaxLayoutWidth:))]
326 #[unsafe(method_family = none)]
327 pub unsafe fn setPreferredMaxLayoutWidth(&self, preferred_max_layout_width: CGFloat);
328
329 #[unsafe(method(enablesMarqueeWhenAncestorFocused))]
330 #[unsafe(method_family = none)]
331 pub unsafe fn enablesMarqueeWhenAncestorFocused(&self) -> bool;
332
333 #[unsafe(method(setEnablesMarqueeWhenAncestorFocused:))]
335 #[unsafe(method_family = none)]
336 pub unsafe fn setEnablesMarqueeWhenAncestorFocused(
337 &self,
338 enables_marquee_when_ancestor_focused: bool,
339 );
340
341 #[unsafe(method(showsExpansionTextWhenTruncated))]
343 #[unsafe(method_family = none)]
344 pub unsafe fn showsExpansionTextWhenTruncated(&self) -> bool;
345
346 #[unsafe(method(setShowsExpansionTextWhenTruncated:))]
348 #[unsafe(method_family = none)]
349 pub unsafe fn setShowsExpansionTextWhenTruncated(
350 &self,
351 shows_expansion_text_when_truncated: bool,
352 );
353
354 #[cfg(feature = "objc2-core-foundation")]
355 #[deprecated]
356 #[unsafe(method(minimumFontSize))]
357 #[unsafe(method_family = none)]
358 pub unsafe fn minimumFontSize(&self) -> CGFloat;
359
360 #[cfg(feature = "objc2-core-foundation")]
361 #[deprecated]
363 #[unsafe(method(setMinimumFontSize:))]
364 #[unsafe(method_family = none)]
365 pub unsafe fn setMinimumFontSize(&self, minimum_font_size: CGFloat);
366
367 #[deprecated]
368 #[unsafe(method(adjustsLetterSpacingToFitWidth))]
369 #[unsafe(method_family = none)]
370 pub unsafe fn adjustsLetterSpacingToFitWidth(&self) -> bool;
371
372 #[deprecated]
374 #[unsafe(method(setAdjustsLetterSpacingToFitWidth:))]
375 #[unsafe(method_family = none)]
376 pub unsafe fn setAdjustsLetterSpacingToFitWidth(
377 &self,
378 adjusts_letter_spacing_to_fit_width: bool,
379 );
380 );
381}
382
383#[cfg(all(feature = "UIResponder", feature = "UIView"))]
385impl UILabel {
386 extern_methods!(
387 #[cfg(feature = "objc2-core-foundation")]
388 #[unsafe(method(initWithFrame:))]
389 #[unsafe(method_family = init)]
390 pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
391
392 #[unsafe(method(initWithCoder:))]
393 #[unsafe(method_family = init)]
394 pub unsafe fn initWithCoder(
395 this: Allocated<Self>,
396 coder: &NSCoder,
397 ) -> Option<Retained<Self>>;
398 );
399}
400
401#[cfg(all(feature = "UIResponder", feature = "UIView"))]
403impl UILabel {
404 extern_methods!(
405 #[unsafe(method(init))]
406 #[unsafe(method_family = init)]
407 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
408
409 #[unsafe(method(new))]
410 #[unsafe(method_family = new)]
411 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
412 );
413}