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 unsafe 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 unsafe 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 unsafe 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 unsafe 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        #[unsafe(method(colorTransformer))]
119        #[unsafe(method_family = none)]
120        pub unsafe fn colorTransformer(&self) -> UIConfigurationColorTransformer;
121
122        #[cfg(all(
123            feature = "UIColor",
124            feature = "UIConfigurationColorTransformer",
125            feature = "block2"
126        ))]
127        /// Setter for [`colorTransformer`][Self::colorTransformer].
128        #[unsafe(method(setColorTransformer:))]
129        #[unsafe(method_family = none)]
130        pub unsafe fn setColorTransformer(
131            &self,
132            color_transformer: UIConfigurationColorTransformer,
133        );
134
135        #[cfg(feature = "UIColor")]
136        /// Returns the resolved color, based on the `color` and `colorTransformer`.
137        #[unsafe(method(resolvedColor))]
138        #[unsafe(method_family = none)]
139        pub unsafe fn resolvedColor(&self) -> Retained<UIColor>;
140
141        /// The alignment for the text.
142        #[unsafe(method(alignment))]
143        #[unsafe(method_family = none)]
144        pub unsafe fn alignment(&self) -> UIListContentTextAlignment;
145
146        /// Setter for [`alignment`][Self::alignment].
147        #[unsafe(method(setAlignment:))]
148        #[unsafe(method_family = none)]
149        pub unsafe fn setAlignment(&self, alignment: UIListContentTextAlignment);
150
151        #[cfg(feature = "NSParagraphStyle")]
152        /// The line break mode to use for the text.
153        #[unsafe(method(lineBreakMode))]
154        #[unsafe(method_family = none)]
155        pub unsafe fn lineBreakMode(&self) -> NSLineBreakMode;
156
157        #[cfg(feature = "NSParagraphStyle")]
158        /// Setter for [`lineBreakMode`][Self::lineBreakMode].
159        #[unsafe(method(setLineBreakMode:))]
160        #[unsafe(method_family = none)]
161        pub unsafe fn setLineBreakMode(&self, line_break_mode: NSLineBreakMode);
162
163        /// The maximum number of lines for the text. 0 indicates the number of lines is unlimited.
164        #[unsafe(method(numberOfLines))]
165        #[unsafe(method_family = none)]
166        pub unsafe fn numberOfLines(&self) -> NSInteger;
167
168        /// Setter for [`numberOfLines`][Self::numberOfLines].
169        #[unsafe(method(setNumberOfLines:))]
170        #[unsafe(method_family = none)]
171        pub unsafe fn setNumberOfLines(&self, number_of_lines: NSInteger);
172
173        /// Whether the font size of the text is automatically adjusted when necessary to fit in the available width.
174        #[unsafe(method(adjustsFontSizeToFitWidth))]
175        #[unsafe(method_family = none)]
176        pub unsafe fn adjustsFontSizeToFitWidth(&self) -> bool;
177
178        /// Setter for [`adjustsFontSizeToFitWidth`][Self::adjustsFontSizeToFitWidth].
179        #[unsafe(method(setAdjustsFontSizeToFitWidth:))]
180        #[unsafe(method_family = none)]
181        pub unsafe fn setAdjustsFontSizeToFitWidth(&self, adjusts_font_size_to_fit_width: bool);
182
183        #[cfg(feature = "objc2-core-foundation")]
184        /// When `adjustsFontSizeToFitWidth` is enabled, the smallest multiplier for the font size used to make the text fit.
185        #[unsafe(method(minimumScaleFactor))]
186        #[unsafe(method_family = none)]
187        pub unsafe fn minimumScaleFactor(&self) -> CGFloat;
188
189        #[cfg(feature = "objc2-core-foundation")]
190        /// Setter for [`minimumScaleFactor`][Self::minimumScaleFactor].
191        #[unsafe(method(setMinimumScaleFactor:))]
192        #[unsafe(method_family = none)]
193        pub unsafe fn setMinimumScaleFactor(&self, minimum_scale_factor: CGFloat);
194
195        /// Whether the text is tightened before truncating.
196        #[unsafe(method(allowsDefaultTighteningForTruncation))]
197        #[unsafe(method_family = none)]
198        pub unsafe fn allowsDefaultTighteningForTruncation(&self) -> bool;
199
200        /// Setter for [`allowsDefaultTighteningForTruncation`][Self::allowsDefaultTighteningForTruncation].
201        #[unsafe(method(setAllowsDefaultTighteningForTruncation:))]
202        #[unsafe(method_family = none)]
203        pub unsafe fn setAllowsDefaultTighteningForTruncation(
204            &self,
205            allows_default_tightening_for_truncation: bool,
206        );
207
208        /// Whether the font is automatically updated when the content size category changes.
209        #[unsafe(method(adjustsFontForContentSizeCategory))]
210        #[unsafe(method_family = none)]
211        pub unsafe fn adjustsFontForContentSizeCategory(&self) -> bool;
212
213        /// Setter for [`adjustsFontForContentSizeCategory`][Self::adjustsFontForContentSizeCategory].
214        #[unsafe(method(setAdjustsFontForContentSizeCategory:))]
215        #[unsafe(method_family = none)]
216        pub unsafe fn setAdjustsFontForContentSizeCategory(
217            &self,
218            adjusts_font_for_content_size_category: bool,
219        );
220
221        /// Whether the full text will be shown when a pointer hovers over truncated text.
222        #[unsafe(method(showsExpansionTextWhenTruncated))]
223        #[unsafe(method_family = none)]
224        pub unsafe fn showsExpansionTextWhenTruncated(&self) -> bool;
225
226        /// Setter for [`showsExpansionTextWhenTruncated`][Self::showsExpansionTextWhenTruncated].
227        #[unsafe(method(setShowsExpansionTextWhenTruncated:))]
228        #[unsafe(method_family = none)]
229        pub unsafe fn setShowsExpansionTextWhenTruncated(
230            &self,
231            shows_expansion_text_when_truncated: bool,
232        );
233
234        /// A transform that is applied to the text before it is displayed.
235        #[unsafe(method(transform))]
236        #[unsafe(method_family = none)]
237        pub unsafe fn transform(&self) -> UIListContentTextTransform;
238
239        /// Setter for [`transform`][Self::transform].
240        #[unsafe(method(setTransform:))]
241        #[unsafe(method_family = none)]
242        pub unsafe fn setTransform(&self, transform: UIListContentTextTransform);
243    );
244}
245
246/// Methods declared on superclass `NSObject`.
247impl UIListContentTextProperties {
248    extern_methods!(
249        #[unsafe(method(init))]
250        #[unsafe(method_family = init)]
251        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
252
253        #[unsafe(method(new))]
254        #[unsafe(method_family = new)]
255        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
256    );
257}