objc2_ui_kit/generated/
UIListContentTextProperties.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uilistcontenttextalignment?language=objc)
13// NS_ENUM
14#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct UIListContentTextAlignment(pub NSInteger);
17impl UIListContentTextAlignment {
18    #[doc(alias = "UIListContentTextAlignmentNatural")]
19    pub const Natural: Self = Self(0);
20    #[doc(alias = "UIListContentTextAlignmentCenter")]
21    pub const Center: Self = Self(1);
22    #[doc(alias = "UIListContentTextAlignmentJustified")]
23    pub const Justified: Self = Self(2);
24}
25
26unsafe impl Encode for UIListContentTextAlignment {
27    const ENCODING: Encoding = NSInteger::ENCODING;
28}
29
30unsafe impl RefEncode for UIListContentTextAlignment {
31    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
32}
33
34/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uilistcontenttexttransform?language=objc)
35// NS_ENUM
36#[repr(transparent)]
37#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
38pub struct UIListContentTextTransform(pub NSInteger);
39impl UIListContentTextTransform {
40    #[doc(alias = "UIListContentTextTransformNone")]
41    pub const None: Self = Self(0);
42    #[doc(alias = "UIListContentTextTransformUppercase")]
43    pub const Uppercase: Self = Self(1);
44    #[doc(alias = "UIListContentTextTransformLowercase")]
45    pub const Lowercase: Self = Self(2);
46    #[doc(alias = "UIListContentTextTransformCapitalized")]
47    pub const Capitalized: Self = Self(3);
48}
49
50unsafe impl Encode for UIListContentTextTransform {
51    const ENCODING: Encoding = NSInteger::ENCODING;
52}
53
54unsafe impl RefEncode for UIListContentTextTransform {
55    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
56}
57
58extern_class!(
59    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uilistcontenttextproperties?language=objc)
60    #[unsafe(super(NSObject))]
61    #[thread_kind = MainThreadOnly]
62    #[derive(Debug, PartialEq, Eq, Hash)]
63    pub struct UIListContentTextProperties;
64);
65
66extern_conformance!(
67    unsafe impl NSCoding for UIListContentTextProperties {}
68);
69
70extern_conformance!(
71    unsafe impl NSCopying for UIListContentTextProperties {}
72);
73
74unsafe impl CopyingHelper for UIListContentTextProperties {
75    type Result = Self;
76}
77
78extern_conformance!(
79    unsafe impl NSObjectProtocol for UIListContentTextProperties {}
80);
81
82extern_conformance!(
83    unsafe impl NSSecureCoding for UIListContentTextProperties {}
84);
85
86impl UIListContentTextProperties {
87    extern_methods!(
88        #[cfg(feature = "UIFont")]
89        /// The font used for the text.
90        #[unsafe(method(font))]
91        #[unsafe(method_family = none)]
92        pub fn font(&self) -> Retained<UIFont>;
93
94        #[cfg(feature = "UIFont")]
95        /// Setter for [`font`][Self::font].
96        #[unsafe(method(setFont:))]
97        #[unsafe(method_family = none)]
98        pub fn setFont(&self, font: &UIFont);
99
100        #[cfg(feature = "UIColor")]
101        /// The color of the text.
102        #[unsafe(method(color))]
103        #[unsafe(method_family = none)]
104        pub fn color(&self) -> Retained<UIColor>;
105
106        #[cfg(feature = "UIColor")]
107        /// Setter for [`color`][Self::color].
108        #[unsafe(method(setColor:))]
109        #[unsafe(method_family = none)]
110        pub fn setColor(&self, color: &UIColor);
111
112        #[cfg(all(
113            feature = "UIColor",
114            feature = "UIConfigurationColorTransformer",
115            feature = "block2"
116        ))]
117        /// Optional color transformer that is used to resolve the color. A nil value means the `color` is used as-is.
118        ///
119        /// # Safety
120        ///
121        /// The returned block's argument must be a valid pointer.
122        #[unsafe(method(colorTransformer))]
123        #[unsafe(method_family = none)]
124        pub unsafe fn colorTransformer(&self) -> UIConfigurationColorTransformer;
125
126        #[cfg(all(
127            feature = "UIColor",
128            feature = "UIConfigurationColorTransformer",
129            feature = "block2"
130        ))]
131        /// Setter for [`colorTransformer`][Self::colorTransformer].
132        ///
133        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
134        ///
135        /// # Safety
136        ///
137        /// `color_transformer` must be a valid pointer or null.
138        #[unsafe(method(setColorTransformer:))]
139        #[unsafe(method_family = none)]
140        pub unsafe fn setColorTransformer(
141            &self,
142            color_transformer: UIConfigurationColorTransformer,
143        );
144
145        #[cfg(feature = "UIColor")]
146        /// Returns the resolved color, based on the `color` and `colorTransformer`.
147        #[unsafe(method(resolvedColor))]
148        #[unsafe(method_family = none)]
149        pub fn resolvedColor(&self) -> Retained<UIColor>;
150
151        /// The alignment for the text.
152        #[unsafe(method(alignment))]
153        #[unsafe(method_family = none)]
154        pub fn alignment(&self) -> UIListContentTextAlignment;
155
156        /// Setter for [`alignment`][Self::alignment].
157        #[unsafe(method(setAlignment:))]
158        #[unsafe(method_family = none)]
159        pub fn setAlignment(&self, alignment: UIListContentTextAlignment);
160
161        #[cfg(feature = "NSParagraphStyle")]
162        /// The line break mode to use for the text.
163        #[unsafe(method(lineBreakMode))]
164        #[unsafe(method_family = none)]
165        pub fn lineBreakMode(&self) -> NSLineBreakMode;
166
167        #[cfg(feature = "NSParagraphStyle")]
168        /// Setter for [`lineBreakMode`][Self::lineBreakMode].
169        #[unsafe(method(setLineBreakMode:))]
170        #[unsafe(method_family = none)]
171        pub fn setLineBreakMode(&self, line_break_mode: NSLineBreakMode);
172
173        /// The maximum number of lines for the text. 0 indicates the number of lines is unlimited.
174        #[unsafe(method(numberOfLines))]
175        #[unsafe(method_family = none)]
176        pub fn numberOfLines(&self) -> NSInteger;
177
178        /// Setter for [`numberOfLines`][Self::numberOfLines].
179        #[unsafe(method(setNumberOfLines:))]
180        #[unsafe(method_family = none)]
181        pub fn setNumberOfLines(&self, number_of_lines: NSInteger);
182
183        /// Whether the font size of the text is automatically adjusted when necessary to fit in the available width.
184        #[unsafe(method(adjustsFontSizeToFitWidth))]
185        #[unsafe(method_family = none)]
186        pub fn adjustsFontSizeToFitWidth(&self) -> bool;
187
188        /// Setter for [`adjustsFontSizeToFitWidth`][Self::adjustsFontSizeToFitWidth].
189        #[unsafe(method(setAdjustsFontSizeToFitWidth:))]
190        #[unsafe(method_family = none)]
191        pub fn setAdjustsFontSizeToFitWidth(&self, adjusts_font_size_to_fit_width: bool);
192
193        #[cfg(feature = "objc2-core-foundation")]
194        /// When `adjustsFontSizeToFitWidth` is enabled, the smallest multiplier for the font size used to make the text fit.
195        #[unsafe(method(minimumScaleFactor))]
196        #[unsafe(method_family = none)]
197        pub fn minimumScaleFactor(&self) -> CGFloat;
198
199        #[cfg(feature = "objc2-core-foundation")]
200        /// Setter for [`minimumScaleFactor`][Self::minimumScaleFactor].
201        #[unsafe(method(setMinimumScaleFactor:))]
202        #[unsafe(method_family = none)]
203        pub fn setMinimumScaleFactor(&self, minimum_scale_factor: CGFloat);
204
205        /// Whether the text is tightened before truncating.
206        #[unsafe(method(allowsDefaultTighteningForTruncation))]
207        #[unsafe(method_family = none)]
208        pub fn allowsDefaultTighteningForTruncation(&self) -> bool;
209
210        /// Setter for [`allowsDefaultTighteningForTruncation`][Self::allowsDefaultTighteningForTruncation].
211        #[unsafe(method(setAllowsDefaultTighteningForTruncation:))]
212        #[unsafe(method_family = none)]
213        pub fn setAllowsDefaultTighteningForTruncation(
214            &self,
215            allows_default_tightening_for_truncation: bool,
216        );
217
218        /// Whether the font is automatically updated when the content size category changes.
219        #[unsafe(method(adjustsFontForContentSizeCategory))]
220        #[unsafe(method_family = none)]
221        pub fn adjustsFontForContentSizeCategory(&self) -> bool;
222
223        /// Setter for [`adjustsFontForContentSizeCategory`][Self::adjustsFontForContentSizeCategory].
224        #[unsafe(method(setAdjustsFontForContentSizeCategory:))]
225        #[unsafe(method_family = none)]
226        pub fn setAdjustsFontForContentSizeCategory(
227            &self,
228            adjusts_font_for_content_size_category: bool,
229        );
230
231        /// Whether the full text will be shown when a pointer hovers over truncated text.
232        #[unsafe(method(showsExpansionTextWhenTruncated))]
233        #[unsafe(method_family = none)]
234        pub fn showsExpansionTextWhenTruncated(&self) -> bool;
235
236        /// Setter for [`showsExpansionTextWhenTruncated`][Self::showsExpansionTextWhenTruncated].
237        #[unsafe(method(setShowsExpansionTextWhenTruncated:))]
238        #[unsafe(method_family = none)]
239        pub fn setShowsExpansionTextWhenTruncated(&self, shows_expansion_text_when_truncated: bool);
240
241        /// A transform that is applied to the text before it is displayed.
242        #[unsafe(method(transform))]
243        #[unsafe(method_family = none)]
244        pub fn transform(&self) -> UIListContentTextTransform;
245
246        /// Setter for [`transform`][Self::transform].
247        #[unsafe(method(setTransform:))]
248        #[unsafe(method_family = none)]
249        pub fn setTransform(&self, transform: UIListContentTextTransform);
250    );
251}
252
253/// Methods declared on superclass `NSObject`.
254impl UIListContentTextProperties {
255    extern_methods!(
256        #[unsafe(method(init))]
257        #[unsafe(method_family = init)]
258        pub fn init(this: Allocated<Self>) -> Retained<Self>;
259
260        #[unsafe(method(new))]
261        #[unsafe(method_family = new)]
262        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
263    );
264}