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
66unsafe impl NSCoding for UIListContentTextProperties {}
67
68unsafe impl NSCopying for UIListContentTextProperties {}
69
70unsafe impl CopyingHelper for UIListContentTextProperties {
71    type Result = Self;
72}
73
74unsafe impl NSObjectProtocol for UIListContentTextProperties {}
75
76unsafe impl NSSecureCoding for UIListContentTextProperties {}
77
78impl UIListContentTextProperties {
79    extern_methods!(
80        #[cfg(feature = "UIFont")]
81        /// The font used for the text.
82        #[unsafe(method(font))]
83        #[unsafe(method_family = none)]
84        pub unsafe fn font(&self) -> Retained<UIFont>;
85
86        #[cfg(feature = "UIFont")]
87        /// Setter for [`font`][Self::font].
88        #[unsafe(method(setFont:))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn setFont(&self, font: &UIFont);
91
92        #[cfg(feature = "UIColor")]
93        /// The color of the text.
94        #[unsafe(method(color))]
95        #[unsafe(method_family = none)]
96        pub unsafe fn color(&self) -> Retained<UIColor>;
97
98        #[cfg(feature = "UIColor")]
99        /// Setter for [`color`][Self::color].
100        #[unsafe(method(setColor:))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn setColor(&self, color: &UIColor);
103
104        #[cfg(all(
105            feature = "UIColor",
106            feature = "UIConfigurationColorTransformer",
107            feature = "block2"
108        ))]
109        /// Optional color transformer that is used to resolve the color. A nil value means the `color` is used as-is.
110        #[unsafe(method(colorTransformer))]
111        #[unsafe(method_family = none)]
112        pub unsafe fn colorTransformer(&self) -> UIConfigurationColorTransformer;
113
114        #[cfg(all(
115            feature = "UIColor",
116            feature = "UIConfigurationColorTransformer",
117            feature = "block2"
118        ))]
119        /// Setter for [`colorTransformer`][Self::colorTransformer].
120        #[unsafe(method(setColorTransformer:))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn setColorTransformer(
123            &self,
124            color_transformer: UIConfigurationColorTransformer,
125        );
126
127        #[cfg(feature = "UIColor")]
128        /// Returns the resolved color, based on the `color` and `colorTransformer`.
129        #[unsafe(method(resolvedColor))]
130        #[unsafe(method_family = none)]
131        pub unsafe fn resolvedColor(&self) -> Retained<UIColor>;
132
133        /// The alignment for the text.
134        #[unsafe(method(alignment))]
135        #[unsafe(method_family = none)]
136        pub unsafe fn alignment(&self) -> UIListContentTextAlignment;
137
138        /// Setter for [`alignment`][Self::alignment].
139        #[unsafe(method(setAlignment:))]
140        #[unsafe(method_family = none)]
141        pub unsafe fn setAlignment(&self, alignment: UIListContentTextAlignment);
142
143        #[cfg(feature = "NSParagraphStyle")]
144        /// The line break mode to use for the text.
145        #[unsafe(method(lineBreakMode))]
146        #[unsafe(method_family = none)]
147        pub unsafe fn lineBreakMode(&self) -> NSLineBreakMode;
148
149        #[cfg(feature = "NSParagraphStyle")]
150        /// Setter for [`lineBreakMode`][Self::lineBreakMode].
151        #[unsafe(method(setLineBreakMode:))]
152        #[unsafe(method_family = none)]
153        pub unsafe fn setLineBreakMode(&self, line_break_mode: NSLineBreakMode);
154
155        /// The maximum number of lines for the text. 0 indicates the number of lines is unlimited.
156        #[unsafe(method(numberOfLines))]
157        #[unsafe(method_family = none)]
158        pub unsafe fn numberOfLines(&self) -> NSInteger;
159
160        /// Setter for [`numberOfLines`][Self::numberOfLines].
161        #[unsafe(method(setNumberOfLines:))]
162        #[unsafe(method_family = none)]
163        pub unsafe fn setNumberOfLines(&self, number_of_lines: NSInteger);
164
165        /// Whether the font size of the text is automatically adjusted when necessary to fit in the available width.
166        #[unsafe(method(adjustsFontSizeToFitWidth))]
167        #[unsafe(method_family = none)]
168        pub unsafe fn adjustsFontSizeToFitWidth(&self) -> bool;
169
170        /// Setter for [`adjustsFontSizeToFitWidth`][Self::adjustsFontSizeToFitWidth].
171        #[unsafe(method(setAdjustsFontSizeToFitWidth:))]
172        #[unsafe(method_family = none)]
173        pub unsafe fn setAdjustsFontSizeToFitWidth(&self, adjusts_font_size_to_fit_width: bool);
174
175        #[cfg(feature = "objc2-core-foundation")]
176        /// When `adjustsFontSizeToFitWidth` is enabled, the smallest multiplier for the font size used to make the text fit.
177        #[unsafe(method(minimumScaleFactor))]
178        #[unsafe(method_family = none)]
179        pub unsafe fn minimumScaleFactor(&self) -> CGFloat;
180
181        #[cfg(feature = "objc2-core-foundation")]
182        /// Setter for [`minimumScaleFactor`][Self::minimumScaleFactor].
183        #[unsafe(method(setMinimumScaleFactor:))]
184        #[unsafe(method_family = none)]
185        pub unsafe fn setMinimumScaleFactor(&self, minimum_scale_factor: CGFloat);
186
187        /// Whether the text is tightened before truncating.
188        #[unsafe(method(allowsDefaultTighteningForTruncation))]
189        #[unsafe(method_family = none)]
190        pub unsafe fn allowsDefaultTighteningForTruncation(&self) -> bool;
191
192        /// Setter for [`allowsDefaultTighteningForTruncation`][Self::allowsDefaultTighteningForTruncation].
193        #[unsafe(method(setAllowsDefaultTighteningForTruncation:))]
194        #[unsafe(method_family = none)]
195        pub unsafe fn setAllowsDefaultTighteningForTruncation(
196            &self,
197            allows_default_tightening_for_truncation: bool,
198        );
199
200        /// Whether the font is automatically updated when the content size category changes.
201        #[unsafe(method(adjustsFontForContentSizeCategory))]
202        #[unsafe(method_family = none)]
203        pub unsafe fn adjustsFontForContentSizeCategory(&self) -> bool;
204
205        /// Setter for [`adjustsFontForContentSizeCategory`][Self::adjustsFontForContentSizeCategory].
206        #[unsafe(method(setAdjustsFontForContentSizeCategory:))]
207        #[unsafe(method_family = none)]
208        pub unsafe fn setAdjustsFontForContentSizeCategory(
209            &self,
210            adjusts_font_for_content_size_category: bool,
211        );
212
213        /// Whether the full text will be shown when a pointer hovers over truncated text.
214        #[unsafe(method(showsExpansionTextWhenTruncated))]
215        #[unsafe(method_family = none)]
216        pub unsafe fn showsExpansionTextWhenTruncated(&self) -> bool;
217
218        /// Setter for [`showsExpansionTextWhenTruncated`][Self::showsExpansionTextWhenTruncated].
219        #[unsafe(method(setShowsExpansionTextWhenTruncated:))]
220        #[unsafe(method_family = none)]
221        pub unsafe fn setShowsExpansionTextWhenTruncated(
222            &self,
223            shows_expansion_text_when_truncated: bool,
224        );
225
226        /// A transform that is applied to the text before it is displayed.
227        #[unsafe(method(transform))]
228        #[unsafe(method_family = none)]
229        pub unsafe fn transform(&self) -> UIListContentTextTransform;
230
231        /// Setter for [`transform`][Self::transform].
232        #[unsafe(method(setTransform:))]
233        #[unsafe(method_family = none)]
234        pub unsafe fn setTransform(&self, transform: UIListContentTextTransform);
235    );
236}
237
238/// Methods declared on superclass `NSObject`.
239impl UIListContentTextProperties {
240    extern_methods!(
241        #[unsafe(method(init))]
242        #[unsafe(method_family = init)]
243        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
244
245        #[unsafe(method(new))]
246        #[unsafe(method_family = new)]
247        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
248    );
249}