1use 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#[cfg(feature = "block2")]
14pub type UIConfigurationTextAttributesTransformer = *mut block2::Block<
15 dyn Fn(
16 NonNull<NSDictionary<NSAttributedStringKey, AnyObject>>,
17 ) -> NonNull<NSDictionary<NSAttributedStringKey, AnyObject>>,
18>;
19
20#[repr(transparent)]
23#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
24pub struct UIButtonConfigurationSize(pub NSInteger);
25impl UIButtonConfigurationSize {
26 #[doc(alias = "UIButtonConfigurationSizeMedium")]
27 pub const Medium: Self = Self(0);
28 #[doc(alias = "UIButtonConfigurationSizeSmall")]
29 pub const Small: Self = Self(1);
30 #[doc(alias = "UIButtonConfigurationSizeMini")]
31 pub const Mini: Self = Self(2);
32 #[doc(alias = "UIButtonConfigurationSizeLarge")]
33 pub const Large: Self = Self(3);
34}
35
36unsafe impl Encode for UIButtonConfigurationSize {
37 const ENCODING: Encoding = NSInteger::ENCODING;
38}
39
40unsafe impl RefEncode for UIButtonConfigurationSize {
41 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
42}
43
44#[repr(transparent)]
47#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
48pub struct UIButtonConfigurationTitleAlignment(pub NSInteger);
49impl UIButtonConfigurationTitleAlignment {
50 #[doc(alias = "UIButtonConfigurationTitleAlignmentAutomatic")]
54 pub const Automatic: Self = Self(0);
55 #[doc(alias = "UIButtonConfigurationTitleAlignmentLeading")]
59 pub const Leading: Self = Self(1);
60 #[doc(alias = "UIButtonConfigurationTitleAlignmentCenter")]
64 pub const Center: Self = Self(2);
65 #[doc(alias = "UIButtonConfigurationTitleAlignmentTrailing")]
69 pub const Trailing: Self = Self(3);
70}
71
72unsafe impl Encode for UIButtonConfigurationTitleAlignment {
73 const ENCODING: Encoding = NSInteger::ENCODING;
74}
75
76unsafe impl RefEncode for UIButtonConfigurationTitleAlignment {
77 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
78}
79
80#[repr(transparent)]
83#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
84pub struct UIButtonConfigurationCornerStyle(pub NSInteger);
85impl UIButtonConfigurationCornerStyle {
86 #[doc(alias = "UIButtonConfigurationCornerStyleFixed")]
88 pub const Fixed: Self = Self(-1);
89 #[doc(alias = "UIButtonConfigurationCornerStyleDynamic")]
91 pub const Dynamic: Self = Self(0);
92 #[doc(alias = "UIButtonConfigurationCornerStyleSmall")]
94 pub const Small: Self = Self(1);
95 #[doc(alias = "UIButtonConfigurationCornerStyleMedium")]
97 pub const Medium: Self = Self(2);
98 #[doc(alias = "UIButtonConfigurationCornerStyleLarge")]
100 pub const Large: Self = Self(3);
101 #[doc(alias = "UIButtonConfigurationCornerStyleCapsule")]
103 pub const Capsule: Self = Self(4);
104}
105
106unsafe impl Encode for UIButtonConfigurationCornerStyle {
107 const ENCODING: Encoding = NSInteger::ENCODING;
108}
109
110unsafe impl RefEncode for UIButtonConfigurationCornerStyle {
111 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
112}
113
114#[repr(transparent)]
117#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
118pub struct UIButtonConfigurationMacIdiomStyle(pub NSInteger);
119impl UIButtonConfigurationMacIdiomStyle {
120 #[doc(alias = "UIButtonConfigurationMacIdiomStyleAutomatic")]
122 pub const Automatic: Self = Self(0);
123 #[doc(alias = "UIButtonConfigurationMacIdiomStyleBordered")]
125 pub const Bordered: Self = Self(1);
126 #[doc(alias = "UIButtonConfigurationMacIdiomStyleBorderless")]
128 pub const Borderless: Self = Self(2);
129 #[doc(alias = "UIButtonConfigurationMacIdiomStyleBorderlessTinted")]
131 pub const BorderlessTinted: Self = Self(3);
132}
133
134unsafe impl Encode for UIButtonConfigurationMacIdiomStyle {
135 const ENCODING: Encoding = NSInteger::ENCODING;
136}
137
138unsafe impl RefEncode for UIButtonConfigurationMacIdiomStyle {
139 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
140}
141
142#[repr(transparent)]
145#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
146pub struct UIButtonConfigurationIndicator(pub NSInteger);
147impl UIButtonConfigurationIndicator {
148 #[doc(alias = "UIButtonConfigurationIndicatorAutomatic")]
150 pub const Automatic: Self = Self(0);
151 #[doc(alias = "UIButtonConfigurationIndicatorNone")]
153 pub const None: Self = Self(1);
154 #[doc(alias = "UIButtonConfigurationIndicatorPopup")]
156 pub const Popup: Self = Self(2);
157}
158
159unsafe impl Encode for UIButtonConfigurationIndicator {
160 const ENCODING: Encoding = NSInteger::ENCODING;
161}
162
163unsafe impl RefEncode for UIButtonConfigurationIndicator {
164 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
165}
166
167extern_class!(
168 #[unsafe(super(NSObject))]
170 #[thread_kind = MainThreadOnly]
171 #[derive(Debug, PartialEq, Eq, Hash)]
172 pub struct UIButtonConfiguration;
173);
174
175unsafe impl NSCoding for UIButtonConfiguration {}
176
177unsafe impl NSCopying for UIButtonConfiguration {}
178
179unsafe impl CopyingHelper for UIButtonConfiguration {
180 type Result = Self;
181}
182
183unsafe impl NSObjectProtocol for UIButtonConfiguration {}
184
185unsafe impl NSSecureCoding for UIButtonConfiguration {}
186
187impl UIButtonConfiguration {
188 extern_methods!(
189 #[unsafe(method(plainButtonConfiguration))]
190 #[unsafe(method_family = none)]
191 pub unsafe fn plainButtonConfiguration(mtm: MainThreadMarker) -> Retained<Self>;
192
193 #[unsafe(method(tintedButtonConfiguration))]
194 #[unsafe(method_family = none)]
195 pub unsafe fn tintedButtonConfiguration(mtm: MainThreadMarker) -> Retained<Self>;
196
197 #[unsafe(method(grayButtonConfiguration))]
198 #[unsafe(method_family = none)]
199 pub unsafe fn grayButtonConfiguration(mtm: MainThreadMarker) -> Retained<Self>;
200
201 #[unsafe(method(filledButtonConfiguration))]
202 #[unsafe(method_family = none)]
203 pub unsafe fn filledButtonConfiguration(mtm: MainThreadMarker) -> Retained<Self>;
204
205 #[unsafe(method(borderlessButtonConfiguration))]
206 #[unsafe(method_family = none)]
207 pub unsafe fn borderlessButtonConfiguration(mtm: MainThreadMarker) -> Retained<Self>;
208
209 #[unsafe(method(borderedButtonConfiguration))]
210 #[unsafe(method_family = none)]
211 pub unsafe fn borderedButtonConfiguration(mtm: MainThreadMarker) -> Retained<Self>;
212
213 #[unsafe(method(borderedTintedButtonConfiguration))]
214 #[unsafe(method_family = none)]
215 pub unsafe fn borderedTintedButtonConfiguration(mtm: MainThreadMarker) -> Retained<Self>;
216
217 #[unsafe(method(borderedProminentButtonConfiguration))]
218 #[unsafe(method_family = none)]
219 pub unsafe fn borderedProminentButtonConfiguration(mtm: MainThreadMarker)
220 -> Retained<Self>;
221
222 #[unsafe(method(new))]
223 #[unsafe(method_family = new)]
224 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
225
226 #[unsafe(method(init))]
227 #[unsafe(method_family = init)]
228 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
229
230 #[cfg(all(
231 feature = "UIButton",
232 feature = "UIControl",
233 feature = "UIResponder",
234 feature = "UIView"
235 ))]
236 #[unsafe(method(updatedConfigurationForButton:))]
238 #[unsafe(method_family = none)]
239 pub unsafe fn updatedConfigurationForButton(&self, button: &UIButton) -> Retained<Self>;
240
241 #[cfg(feature = "UIBackgroundConfiguration")]
242 #[unsafe(method(background))]
244 #[unsafe(method_family = none)]
245 pub unsafe fn background(&self) -> Retained<UIBackgroundConfiguration>;
246
247 #[cfg(feature = "UIBackgroundConfiguration")]
248 #[unsafe(method(setBackground:))]
250 #[unsafe(method_family = none)]
251 pub unsafe fn setBackground(&self, background: &UIBackgroundConfiguration);
252
253 #[unsafe(method(cornerStyle))]
255 #[unsafe(method_family = none)]
256 pub unsafe fn cornerStyle(&self) -> UIButtonConfigurationCornerStyle;
257
258 #[unsafe(method(setCornerStyle:))]
260 #[unsafe(method_family = none)]
261 pub unsafe fn setCornerStyle(&self, corner_style: UIButtonConfigurationCornerStyle);
262
263 #[unsafe(method(buttonSize))]
265 #[unsafe(method_family = none)]
266 pub unsafe fn buttonSize(&self) -> UIButtonConfigurationSize;
267
268 #[unsafe(method(setButtonSize:))]
270 #[unsafe(method_family = none)]
271 pub unsafe fn setButtonSize(&self, button_size: UIButtonConfigurationSize);
272
273 #[unsafe(method(macIdiomStyle))]
274 #[unsafe(method_family = none)]
275 pub unsafe fn macIdiomStyle(&self) -> UIButtonConfigurationMacIdiomStyle;
276
277 #[unsafe(method(setMacIdiomStyle:))]
279 #[unsafe(method_family = none)]
280 pub unsafe fn setMacIdiomStyle(&self, mac_idiom_style: UIButtonConfigurationMacIdiomStyle);
281
282 #[cfg(feature = "UIColor")]
283 #[unsafe(method(baseForegroundColor))]
285 #[unsafe(method_family = none)]
286 pub unsafe fn baseForegroundColor(&self) -> Option<Retained<UIColor>>;
287
288 #[cfg(feature = "UIColor")]
289 #[unsafe(method(setBaseForegroundColor:))]
291 #[unsafe(method_family = none)]
292 pub unsafe fn setBaseForegroundColor(&self, base_foreground_color: Option<&UIColor>);
293
294 #[cfg(feature = "UIColor")]
295 #[unsafe(method(baseBackgroundColor))]
297 #[unsafe(method_family = none)]
298 pub unsafe fn baseBackgroundColor(&self) -> Option<Retained<UIColor>>;
299
300 #[cfg(feature = "UIColor")]
301 #[unsafe(method(setBaseBackgroundColor:))]
303 #[unsafe(method_family = none)]
304 pub unsafe fn setBaseBackgroundColor(&self, base_background_color: Option<&UIColor>);
305
306 #[cfg(feature = "UIImage")]
307 #[unsafe(method(image))]
308 #[unsafe(method_family = none)]
309 pub unsafe fn image(&self) -> Option<Retained<UIImage>>;
310
311 #[cfg(feature = "UIImage")]
312 #[unsafe(method(setImage:))]
314 #[unsafe(method_family = none)]
315 pub unsafe fn setImage(&self, image: Option<&UIImage>);
316
317 #[cfg(all(
318 feature = "UIColor",
319 feature = "UIConfigurationColorTransformer",
320 feature = "block2"
321 ))]
322 #[unsafe(method(imageColorTransformer))]
323 #[unsafe(method_family = none)]
324 pub unsafe fn imageColorTransformer(&self) -> UIConfigurationColorTransformer;
325
326 #[cfg(all(
327 feature = "UIColor",
328 feature = "UIConfigurationColorTransformer",
329 feature = "block2"
330 ))]
331 #[unsafe(method(setImageColorTransformer:))]
333 #[unsafe(method_family = none)]
334 pub unsafe fn setImageColorTransformer(
335 &self,
336 image_color_transformer: UIConfigurationColorTransformer,
337 );
338
339 #[cfg(all(
340 feature = "UIImageConfiguration",
341 feature = "UIImageSymbolConfiguration"
342 ))]
343 #[unsafe(method(preferredSymbolConfigurationForImage))]
344 #[unsafe(method_family = none)]
345 pub unsafe fn preferredSymbolConfigurationForImage(
346 &self,
347 ) -> Option<Retained<UIImageSymbolConfiguration>>;
348
349 #[cfg(all(
350 feature = "UIImageConfiguration",
351 feature = "UIImageSymbolConfiguration"
352 ))]
353 #[unsafe(method(setPreferredSymbolConfigurationForImage:))]
355 #[unsafe(method_family = none)]
356 pub unsafe fn setPreferredSymbolConfigurationForImage(
357 &self,
358 preferred_symbol_configuration_for_image: Option<&UIImageSymbolConfiguration>,
359 );
360
361 #[unsafe(method(showsActivityIndicator))]
363 #[unsafe(method_family = none)]
364 pub unsafe fn showsActivityIndicator(&self) -> bool;
365
366 #[unsafe(method(setShowsActivityIndicator:))]
368 #[unsafe(method_family = none)]
369 pub unsafe fn setShowsActivityIndicator(&self, shows_activity_indicator: bool);
370
371 #[cfg(all(
372 feature = "UIColor",
373 feature = "UIConfigurationColorTransformer",
374 feature = "block2"
375 ))]
376 #[unsafe(method(activityIndicatorColorTransformer))]
377 #[unsafe(method_family = none)]
378 pub unsafe fn activityIndicatorColorTransformer(&self) -> UIConfigurationColorTransformer;
379
380 #[cfg(all(
381 feature = "UIColor",
382 feature = "UIConfigurationColorTransformer",
383 feature = "block2"
384 ))]
385 #[unsafe(method(setActivityIndicatorColorTransformer:))]
387 #[unsafe(method_family = none)]
388 pub unsafe fn setActivityIndicatorColorTransformer(
389 &self,
390 activity_indicator_color_transformer: UIConfigurationColorTransformer,
391 );
392
393 #[unsafe(method(title))]
394 #[unsafe(method_family = none)]
395 pub unsafe fn title(&self) -> Option<Retained<NSString>>;
396
397 #[unsafe(method(setTitle:))]
399 #[unsafe(method_family = none)]
400 pub unsafe fn setTitle(&self, title: Option<&NSString>);
401
402 #[unsafe(method(attributedTitle))]
403 #[unsafe(method_family = none)]
404 pub unsafe fn attributedTitle(&self) -> Option<Retained<NSAttributedString>>;
405
406 #[unsafe(method(setAttributedTitle:))]
408 #[unsafe(method_family = none)]
409 pub unsafe fn setAttributedTitle(&self, attributed_title: Option<&NSAttributedString>);
410
411 #[cfg(feature = "block2")]
412 #[unsafe(method(titleTextAttributesTransformer))]
413 #[unsafe(method_family = none)]
414 pub unsafe fn titleTextAttributesTransformer(
415 &self,
416 ) -> UIConfigurationTextAttributesTransformer;
417
418 #[cfg(feature = "block2")]
419 #[unsafe(method(setTitleTextAttributesTransformer:))]
421 #[unsafe(method_family = none)]
422 pub unsafe fn setTitleTextAttributesTransformer(
423 &self,
424 title_text_attributes_transformer: UIConfigurationTextAttributesTransformer,
425 );
426
427 #[cfg(feature = "NSParagraphStyle")]
428 #[unsafe(method(titleLineBreakMode))]
430 #[unsafe(method_family = none)]
431 pub unsafe fn titleLineBreakMode(&self) -> NSLineBreakMode;
432
433 #[cfg(feature = "NSParagraphStyle")]
434 #[unsafe(method(setTitleLineBreakMode:))]
436 #[unsafe(method_family = none)]
437 pub unsafe fn setTitleLineBreakMode(&self, title_line_break_mode: NSLineBreakMode);
438
439 #[unsafe(method(subtitle))]
440 #[unsafe(method_family = none)]
441 pub unsafe fn subtitle(&self) -> Option<Retained<NSString>>;
442
443 #[unsafe(method(setSubtitle:))]
445 #[unsafe(method_family = none)]
446 pub unsafe fn setSubtitle(&self, subtitle: Option<&NSString>);
447
448 #[unsafe(method(attributedSubtitle))]
449 #[unsafe(method_family = none)]
450 pub unsafe fn attributedSubtitle(&self) -> Option<Retained<NSAttributedString>>;
451
452 #[unsafe(method(setAttributedSubtitle:))]
454 #[unsafe(method_family = none)]
455 pub unsafe fn setAttributedSubtitle(
456 &self,
457 attributed_subtitle: Option<&NSAttributedString>,
458 );
459
460 #[cfg(feature = "block2")]
461 #[unsafe(method(subtitleTextAttributesTransformer))]
462 #[unsafe(method_family = none)]
463 pub unsafe fn subtitleTextAttributesTransformer(
464 &self,
465 ) -> UIConfigurationTextAttributesTransformer;
466
467 #[cfg(feature = "block2")]
468 #[unsafe(method(setSubtitleTextAttributesTransformer:))]
470 #[unsafe(method_family = none)]
471 pub unsafe fn setSubtitleTextAttributesTransformer(
472 &self,
473 subtitle_text_attributes_transformer: UIConfigurationTextAttributesTransformer,
474 );
475
476 #[cfg(feature = "NSParagraphStyle")]
477 #[unsafe(method(subtitleLineBreakMode))]
479 #[unsafe(method_family = none)]
480 pub unsafe fn subtitleLineBreakMode(&self) -> NSLineBreakMode;
481
482 #[cfg(feature = "NSParagraphStyle")]
483 #[unsafe(method(setSubtitleLineBreakMode:))]
485 #[unsafe(method_family = none)]
486 pub unsafe fn setSubtitleLineBreakMode(&self, subtitle_line_break_mode: NSLineBreakMode);
487
488 #[unsafe(method(indicator))]
490 #[unsafe(method_family = none)]
491 pub unsafe fn indicator(&self) -> UIButtonConfigurationIndicator;
492
493 #[unsafe(method(setIndicator:))]
495 #[unsafe(method_family = none)]
496 pub unsafe fn setIndicator(&self, indicator: UIButtonConfigurationIndicator);
497
498 #[cfg(all(
499 feature = "UIColor",
500 feature = "UIConfigurationColorTransformer",
501 feature = "block2"
502 ))]
503 #[unsafe(method(indicatorColorTransformer))]
504 #[unsafe(method_family = none)]
505 pub unsafe fn indicatorColorTransformer(&self) -> UIConfigurationColorTransformer;
506
507 #[cfg(all(
508 feature = "UIColor",
509 feature = "UIConfigurationColorTransformer",
510 feature = "block2"
511 ))]
512 #[unsafe(method(setIndicatorColorTransformer:))]
514 #[unsafe(method_family = none)]
515 pub unsafe fn setIndicatorColorTransformer(
516 &self,
517 indicator_color_transformer: UIConfigurationColorTransformer,
518 );
519
520 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
521 #[unsafe(method(contentInsets))]
523 #[unsafe(method_family = none)]
524 pub unsafe fn contentInsets(&self) -> NSDirectionalEdgeInsets;
525
526 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
527 #[unsafe(method(setContentInsets:))]
529 #[unsafe(method_family = none)]
530 pub unsafe fn setContentInsets(&self, content_insets: NSDirectionalEdgeInsets);
531
532 #[unsafe(method(setDefaultContentInsets))]
534 #[unsafe(method_family = none)]
535 pub unsafe fn setDefaultContentInsets(&self);
536
537 #[cfg(feature = "UIGeometry")]
538 #[unsafe(method(imagePlacement))]
540 #[unsafe(method_family = none)]
541 pub unsafe fn imagePlacement(&self) -> NSDirectionalRectEdge;
542
543 #[cfg(feature = "UIGeometry")]
544 #[unsafe(method(setImagePlacement:))]
546 #[unsafe(method_family = none)]
547 pub unsafe fn setImagePlacement(&self, image_placement: NSDirectionalRectEdge);
548
549 #[cfg(feature = "objc2-core-foundation")]
550 #[unsafe(method(imagePadding))]
552 #[unsafe(method_family = none)]
553 pub unsafe fn imagePadding(&self) -> CGFloat;
554
555 #[cfg(feature = "objc2-core-foundation")]
556 #[unsafe(method(setImagePadding:))]
558 #[unsafe(method_family = none)]
559 pub unsafe fn setImagePadding(&self, image_padding: CGFloat);
560
561 #[cfg(feature = "objc2-core-foundation")]
562 #[unsafe(method(titlePadding))]
566 #[unsafe(method_family = none)]
567 pub unsafe fn titlePadding(&self) -> CGFloat;
568
569 #[cfg(feature = "objc2-core-foundation")]
570 #[unsafe(method(setTitlePadding:))]
572 #[unsafe(method_family = none)]
573 pub unsafe fn setTitlePadding(&self, title_padding: CGFloat);
574
575 #[unsafe(method(titleAlignment))]
579 #[unsafe(method_family = none)]
580 pub unsafe fn titleAlignment(&self) -> UIButtonConfigurationTitleAlignment;
581
582 #[unsafe(method(setTitleAlignment:))]
584 #[unsafe(method_family = none)]
585 pub unsafe fn setTitleAlignment(
586 &self,
587 title_alignment: UIButtonConfigurationTitleAlignment,
588 );
589
590 #[unsafe(method(automaticallyUpdateForSelection))]
592 #[unsafe(method_family = none)]
593 pub unsafe fn automaticallyUpdateForSelection(&self) -> bool;
594
595 #[unsafe(method(setAutomaticallyUpdateForSelection:))]
597 #[unsafe(method_family = none)]
598 pub unsafe fn setAutomaticallyUpdateForSelection(
599 &self,
600 automatically_update_for_selection: bool,
601 );
602 );
603}