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::DynBlock<
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
175extern_conformance!(
176 unsafe impl NSCoding for UIButtonConfiguration {}
177);
178
179extern_conformance!(
180 unsafe impl NSCopying for UIButtonConfiguration {}
181);
182
183unsafe impl CopyingHelper for UIButtonConfiguration {
184 type Result = Self;
185}
186
187extern_conformance!(
188 unsafe impl NSObjectProtocol for UIButtonConfiguration {}
189);
190
191extern_conformance!(
192 unsafe impl NSSecureCoding for UIButtonConfiguration {}
193);
194
195impl UIButtonConfiguration {
196 extern_methods!(
197 #[unsafe(method(plainButtonConfiguration))]
198 #[unsafe(method_family = none)]
199 pub unsafe fn plainButtonConfiguration(mtm: MainThreadMarker) -> Retained<Self>;
200
201 #[unsafe(method(tintedButtonConfiguration))]
202 #[unsafe(method_family = none)]
203 pub unsafe fn tintedButtonConfiguration(mtm: MainThreadMarker) -> Retained<Self>;
204
205 #[unsafe(method(grayButtonConfiguration))]
206 #[unsafe(method_family = none)]
207 pub unsafe fn grayButtonConfiguration(mtm: MainThreadMarker) -> Retained<Self>;
208
209 #[unsafe(method(filledButtonConfiguration))]
210 #[unsafe(method_family = none)]
211 pub unsafe fn filledButtonConfiguration(mtm: MainThreadMarker) -> Retained<Self>;
212
213 #[unsafe(method(borderlessButtonConfiguration))]
214 #[unsafe(method_family = none)]
215 pub unsafe fn borderlessButtonConfiguration(mtm: MainThreadMarker) -> Retained<Self>;
216
217 #[unsafe(method(borderedButtonConfiguration))]
218 #[unsafe(method_family = none)]
219 pub unsafe fn borderedButtonConfiguration(mtm: MainThreadMarker) -> Retained<Self>;
220
221 #[unsafe(method(borderedTintedButtonConfiguration))]
222 #[unsafe(method_family = none)]
223 pub unsafe fn borderedTintedButtonConfiguration(mtm: MainThreadMarker) -> Retained<Self>;
224
225 #[unsafe(method(borderedProminentButtonConfiguration))]
226 #[unsafe(method_family = none)]
227 pub unsafe fn borderedProminentButtonConfiguration(mtm: MainThreadMarker)
228 -> Retained<Self>;
229
230 #[unsafe(method(new))]
231 #[unsafe(method_family = new)]
232 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
233
234 #[unsafe(method(init))]
235 #[unsafe(method_family = init)]
236 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
237
238 #[cfg(all(
239 feature = "UIButton",
240 feature = "UIControl",
241 feature = "UIResponder",
242 feature = "UIView"
243 ))]
244 #[unsafe(method(updatedConfigurationForButton:))]
246 #[unsafe(method_family = none)]
247 pub unsafe fn updatedConfigurationForButton(&self, button: &UIButton) -> Retained<Self>;
248
249 #[cfg(feature = "UIBackgroundConfiguration")]
250 #[unsafe(method(background))]
252 #[unsafe(method_family = none)]
253 pub unsafe fn background(&self) -> Retained<UIBackgroundConfiguration>;
254
255 #[cfg(feature = "UIBackgroundConfiguration")]
256 #[unsafe(method(setBackground:))]
258 #[unsafe(method_family = none)]
259 pub unsafe fn setBackground(&self, background: &UIBackgroundConfiguration);
260
261 #[unsafe(method(cornerStyle))]
263 #[unsafe(method_family = none)]
264 pub unsafe fn cornerStyle(&self) -> UIButtonConfigurationCornerStyle;
265
266 #[unsafe(method(setCornerStyle:))]
268 #[unsafe(method_family = none)]
269 pub unsafe fn setCornerStyle(&self, corner_style: UIButtonConfigurationCornerStyle);
270
271 #[unsafe(method(buttonSize))]
273 #[unsafe(method_family = none)]
274 pub unsafe fn buttonSize(&self) -> UIButtonConfigurationSize;
275
276 #[unsafe(method(setButtonSize:))]
278 #[unsafe(method_family = none)]
279 pub unsafe fn setButtonSize(&self, button_size: UIButtonConfigurationSize);
280
281 #[unsafe(method(macIdiomStyle))]
282 #[unsafe(method_family = none)]
283 pub unsafe fn macIdiomStyle(&self) -> UIButtonConfigurationMacIdiomStyle;
284
285 #[unsafe(method(setMacIdiomStyle:))]
287 #[unsafe(method_family = none)]
288 pub unsafe fn setMacIdiomStyle(&self, mac_idiom_style: UIButtonConfigurationMacIdiomStyle);
289
290 #[cfg(feature = "UIColor")]
291 #[unsafe(method(baseForegroundColor))]
293 #[unsafe(method_family = none)]
294 pub unsafe fn baseForegroundColor(&self) -> Option<Retained<UIColor>>;
295
296 #[cfg(feature = "UIColor")]
297 #[unsafe(method(setBaseForegroundColor:))]
299 #[unsafe(method_family = none)]
300 pub unsafe fn setBaseForegroundColor(&self, base_foreground_color: Option<&UIColor>);
301
302 #[cfg(feature = "UIColor")]
303 #[unsafe(method(baseBackgroundColor))]
305 #[unsafe(method_family = none)]
306 pub unsafe fn baseBackgroundColor(&self) -> Option<Retained<UIColor>>;
307
308 #[cfg(feature = "UIColor")]
309 #[unsafe(method(setBaseBackgroundColor:))]
311 #[unsafe(method_family = none)]
312 pub unsafe fn setBaseBackgroundColor(&self, base_background_color: Option<&UIColor>);
313
314 #[cfg(feature = "UIImage")]
315 #[unsafe(method(image))]
316 #[unsafe(method_family = none)]
317 pub unsafe fn image(&self) -> Option<Retained<UIImage>>;
318
319 #[cfg(feature = "UIImage")]
320 #[unsafe(method(setImage:))]
322 #[unsafe(method_family = none)]
323 pub unsafe fn setImage(&self, image: Option<&UIImage>);
324
325 #[cfg(all(
326 feature = "UIColor",
327 feature = "UIConfigurationColorTransformer",
328 feature = "block2"
329 ))]
330 #[unsafe(method(imageColorTransformer))]
331 #[unsafe(method_family = none)]
332 pub unsafe fn imageColorTransformer(&self) -> UIConfigurationColorTransformer;
333
334 #[cfg(all(
335 feature = "UIColor",
336 feature = "UIConfigurationColorTransformer",
337 feature = "block2"
338 ))]
339 #[unsafe(method(setImageColorTransformer:))]
341 #[unsafe(method_family = none)]
342 pub unsafe fn setImageColorTransformer(
343 &self,
344 image_color_transformer: UIConfigurationColorTransformer,
345 );
346
347 #[cfg(all(
348 feature = "UIImageConfiguration",
349 feature = "UIImageSymbolConfiguration"
350 ))]
351 #[unsafe(method(preferredSymbolConfigurationForImage))]
352 #[unsafe(method_family = none)]
353 pub unsafe fn preferredSymbolConfigurationForImage(
354 &self,
355 ) -> Option<Retained<UIImageSymbolConfiguration>>;
356
357 #[cfg(all(
358 feature = "UIImageConfiguration",
359 feature = "UIImageSymbolConfiguration"
360 ))]
361 #[unsafe(method(setPreferredSymbolConfigurationForImage:))]
363 #[unsafe(method_family = none)]
364 pub unsafe fn setPreferredSymbolConfigurationForImage(
365 &self,
366 preferred_symbol_configuration_for_image: Option<&UIImageSymbolConfiguration>,
367 );
368
369 #[unsafe(method(showsActivityIndicator))]
371 #[unsafe(method_family = none)]
372 pub unsafe fn showsActivityIndicator(&self) -> bool;
373
374 #[unsafe(method(setShowsActivityIndicator:))]
376 #[unsafe(method_family = none)]
377 pub unsafe fn setShowsActivityIndicator(&self, shows_activity_indicator: bool);
378
379 #[cfg(all(
380 feature = "UIColor",
381 feature = "UIConfigurationColorTransformer",
382 feature = "block2"
383 ))]
384 #[unsafe(method(activityIndicatorColorTransformer))]
385 #[unsafe(method_family = none)]
386 pub unsafe fn activityIndicatorColorTransformer(&self) -> UIConfigurationColorTransformer;
387
388 #[cfg(all(
389 feature = "UIColor",
390 feature = "UIConfigurationColorTransformer",
391 feature = "block2"
392 ))]
393 #[unsafe(method(setActivityIndicatorColorTransformer:))]
395 #[unsafe(method_family = none)]
396 pub unsafe fn setActivityIndicatorColorTransformer(
397 &self,
398 activity_indicator_color_transformer: UIConfigurationColorTransformer,
399 );
400
401 #[unsafe(method(title))]
402 #[unsafe(method_family = none)]
403 pub unsafe fn title(&self) -> Option<Retained<NSString>>;
404
405 #[unsafe(method(setTitle:))]
407 #[unsafe(method_family = none)]
408 pub unsafe fn setTitle(&self, title: Option<&NSString>);
409
410 #[unsafe(method(attributedTitle))]
411 #[unsafe(method_family = none)]
412 pub unsafe fn attributedTitle(&self) -> Option<Retained<NSAttributedString>>;
413
414 #[unsafe(method(setAttributedTitle:))]
416 #[unsafe(method_family = none)]
417 pub unsafe fn setAttributedTitle(&self, attributed_title: Option<&NSAttributedString>);
418
419 #[cfg(feature = "block2")]
420 #[unsafe(method(titleTextAttributesTransformer))]
421 #[unsafe(method_family = none)]
422 pub unsafe fn titleTextAttributesTransformer(
423 &self,
424 ) -> UIConfigurationTextAttributesTransformer;
425
426 #[cfg(feature = "block2")]
427 #[unsafe(method(setTitleTextAttributesTransformer:))]
429 #[unsafe(method_family = none)]
430 pub unsafe fn setTitleTextAttributesTransformer(
431 &self,
432 title_text_attributes_transformer: UIConfigurationTextAttributesTransformer,
433 );
434
435 #[cfg(feature = "NSParagraphStyle")]
436 #[unsafe(method(titleLineBreakMode))]
438 #[unsafe(method_family = none)]
439 pub unsafe fn titleLineBreakMode(&self) -> NSLineBreakMode;
440
441 #[cfg(feature = "NSParagraphStyle")]
442 #[unsafe(method(setTitleLineBreakMode:))]
444 #[unsafe(method_family = none)]
445 pub unsafe fn setTitleLineBreakMode(&self, title_line_break_mode: NSLineBreakMode);
446
447 #[unsafe(method(subtitle))]
448 #[unsafe(method_family = none)]
449 pub unsafe fn subtitle(&self) -> Option<Retained<NSString>>;
450
451 #[unsafe(method(setSubtitle:))]
453 #[unsafe(method_family = none)]
454 pub unsafe fn setSubtitle(&self, subtitle: Option<&NSString>);
455
456 #[unsafe(method(attributedSubtitle))]
457 #[unsafe(method_family = none)]
458 pub unsafe fn attributedSubtitle(&self) -> Option<Retained<NSAttributedString>>;
459
460 #[unsafe(method(setAttributedSubtitle:))]
462 #[unsafe(method_family = none)]
463 pub unsafe fn setAttributedSubtitle(
464 &self,
465 attributed_subtitle: Option<&NSAttributedString>,
466 );
467
468 #[cfg(feature = "block2")]
469 #[unsafe(method(subtitleTextAttributesTransformer))]
470 #[unsafe(method_family = none)]
471 pub unsafe fn subtitleTextAttributesTransformer(
472 &self,
473 ) -> UIConfigurationTextAttributesTransformer;
474
475 #[cfg(feature = "block2")]
476 #[unsafe(method(setSubtitleTextAttributesTransformer:))]
478 #[unsafe(method_family = none)]
479 pub unsafe fn setSubtitleTextAttributesTransformer(
480 &self,
481 subtitle_text_attributes_transformer: UIConfigurationTextAttributesTransformer,
482 );
483
484 #[cfg(feature = "NSParagraphStyle")]
485 #[unsafe(method(subtitleLineBreakMode))]
487 #[unsafe(method_family = none)]
488 pub unsafe fn subtitleLineBreakMode(&self) -> NSLineBreakMode;
489
490 #[cfg(feature = "NSParagraphStyle")]
491 #[unsafe(method(setSubtitleLineBreakMode:))]
493 #[unsafe(method_family = none)]
494 pub unsafe fn setSubtitleLineBreakMode(&self, subtitle_line_break_mode: NSLineBreakMode);
495
496 #[unsafe(method(indicator))]
498 #[unsafe(method_family = none)]
499 pub unsafe fn indicator(&self) -> UIButtonConfigurationIndicator;
500
501 #[unsafe(method(setIndicator:))]
503 #[unsafe(method_family = none)]
504 pub unsafe fn setIndicator(&self, indicator: UIButtonConfigurationIndicator);
505
506 #[cfg(all(
507 feature = "UIColor",
508 feature = "UIConfigurationColorTransformer",
509 feature = "block2"
510 ))]
511 #[unsafe(method(indicatorColorTransformer))]
512 #[unsafe(method_family = none)]
513 pub unsafe fn indicatorColorTransformer(&self) -> UIConfigurationColorTransformer;
514
515 #[cfg(all(
516 feature = "UIColor",
517 feature = "UIConfigurationColorTransformer",
518 feature = "block2"
519 ))]
520 #[unsafe(method(setIndicatorColorTransformer:))]
522 #[unsafe(method_family = none)]
523 pub unsafe fn setIndicatorColorTransformer(
524 &self,
525 indicator_color_transformer: UIConfigurationColorTransformer,
526 );
527
528 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
529 #[unsafe(method(contentInsets))]
531 #[unsafe(method_family = none)]
532 pub unsafe fn contentInsets(&self) -> NSDirectionalEdgeInsets;
533
534 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
535 #[unsafe(method(setContentInsets:))]
537 #[unsafe(method_family = none)]
538 pub unsafe fn setContentInsets(&self, content_insets: NSDirectionalEdgeInsets);
539
540 #[unsafe(method(setDefaultContentInsets))]
542 #[unsafe(method_family = none)]
543 pub unsafe fn setDefaultContentInsets(&self);
544
545 #[cfg(feature = "UIGeometry")]
546 #[unsafe(method(imagePlacement))]
548 #[unsafe(method_family = none)]
549 pub unsafe fn imagePlacement(&self) -> NSDirectionalRectEdge;
550
551 #[cfg(feature = "UIGeometry")]
552 #[unsafe(method(setImagePlacement:))]
554 #[unsafe(method_family = none)]
555 pub unsafe fn setImagePlacement(&self, image_placement: NSDirectionalRectEdge);
556
557 #[cfg(feature = "objc2-core-foundation")]
558 #[unsafe(method(imagePadding))]
560 #[unsafe(method_family = none)]
561 pub unsafe fn imagePadding(&self) -> CGFloat;
562
563 #[cfg(feature = "objc2-core-foundation")]
564 #[unsafe(method(setImagePadding:))]
566 #[unsafe(method_family = none)]
567 pub unsafe fn setImagePadding(&self, image_padding: CGFloat);
568
569 #[cfg(feature = "objc2-core-foundation")]
570 #[unsafe(method(titlePadding))]
574 #[unsafe(method_family = none)]
575 pub unsafe fn titlePadding(&self) -> CGFloat;
576
577 #[cfg(feature = "objc2-core-foundation")]
578 #[unsafe(method(setTitlePadding:))]
580 #[unsafe(method_family = none)]
581 pub unsafe fn setTitlePadding(&self, title_padding: CGFloat);
582
583 #[unsafe(method(titleAlignment))]
587 #[unsafe(method_family = none)]
588 pub unsafe fn titleAlignment(&self) -> UIButtonConfigurationTitleAlignment;
589
590 #[unsafe(method(setTitleAlignment:))]
592 #[unsafe(method_family = none)]
593 pub unsafe fn setTitleAlignment(
594 &self,
595 title_alignment: UIButtonConfigurationTitleAlignment,
596 );
597
598 #[unsafe(method(automaticallyUpdateForSelection))]
600 #[unsafe(method_family = none)]
601 pub unsafe fn automaticallyUpdateForSelection(&self) -> bool;
602
603 #[unsafe(method(setAutomaticallyUpdateForSelection:))]
605 #[unsafe(method_family = none)]
606 pub unsafe fn setAutomaticallyUpdateForSelection(
607 &self,
608 automatically_update_for_selection: bool,
609 );
610 );
611}