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#[cfg(feature = "objc2-quartz-core")]
10#[cfg(not(target_os = "watchos"))]
11use objc2_quartz_core::*;
12
13use crate::*;
14
15#[repr(transparent)]
18#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
19pub struct UIButtonType(pub NSInteger);
20impl UIButtonType {
21 #[doc(alias = "UIButtonTypeCustom")]
22 pub const Custom: Self = Self(0);
23 #[doc(alias = "UIButtonTypeSystem")]
24 pub const System: Self = Self(1);
25 #[doc(alias = "UIButtonTypeDetailDisclosure")]
26 pub const DetailDisclosure: Self = Self(2);
27 #[doc(alias = "UIButtonTypeInfoLight")]
28 pub const InfoLight: Self = Self(3);
29 #[doc(alias = "UIButtonTypeInfoDark")]
30 pub const InfoDark: Self = Self(4);
31 #[doc(alias = "UIButtonTypeContactAdd")]
32 pub const ContactAdd: Self = Self(5);
33 #[doc(alias = "UIButtonTypePlain")]
34 pub const Plain: Self = Self(6);
35 #[doc(alias = "UIButtonTypeClose")]
36 pub const Close: Self = Self(7);
37 #[doc(alias = "UIButtonTypeRoundedRect")]
38 pub const RoundedRect: Self = Self(UIButtonType::System.0);
39}
40
41unsafe impl Encode for UIButtonType {
42 const ENCODING: Encoding = NSInteger::ENCODING;
43}
44
45unsafe impl RefEncode for UIButtonType {
46 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
47}
48
49#[repr(transparent)]
52#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
53pub struct UIButtonRole(pub NSInteger);
54impl UIButtonRole {
55 #[doc(alias = "UIButtonRoleNormal")]
56 pub const Normal: Self = Self(0);
57 #[doc(alias = "UIButtonRolePrimary")]
58 pub const Primary: Self = Self(1);
59 #[doc(alias = "UIButtonRoleCancel")]
60 pub const Cancel: Self = Self(2);
61 #[doc(alias = "UIButtonRoleDestructive")]
62 pub const Destructive: Self = Self(3);
63}
64
65unsafe impl Encode for UIButtonRole {
66 const ENCODING: Encoding = NSInteger::ENCODING;
67}
68
69unsafe impl RefEncode for UIButtonRole {
70 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
71}
72
73#[cfg(all(
75 feature = "UIControl",
76 feature = "UIHoverStyle",
77 feature = "UIPointerStyle",
78 feature = "UIResponder",
79 feature = "UIView",
80 feature = "block2"
81))]
82pub type UIButtonPointerStyleProvider = *mut block2::DynBlock<
83 dyn Fn(
84 NonNull<UIButton>,
85 NonNull<UIPointerEffect>,
86 NonNull<UIPointerShape>,
87 ) -> *mut UIPointerStyle,
88>;
89
90#[cfg(all(
92 feature = "UIControl",
93 feature = "UIResponder",
94 feature = "UIView",
95 feature = "block2"
96))]
97pub type UIButtonConfigurationUpdateHandler = *mut block2::DynBlock<dyn Fn(NonNull<UIButton>)>;
98
99extern_class!(
100 #[unsafe(super(UIControl, UIView, UIResponder, NSObject))]
102 #[thread_kind = MainThreadOnly]
103 #[derive(Debug, PartialEq, Eq, Hash)]
104 #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
105 pub struct UIButton;
106);
107
108#[cfg(all(
109 feature = "UIControl",
110 feature = "UIResponder",
111 feature = "UIView",
112 feature = "objc2-quartz-core"
113))]
114#[cfg(not(target_os = "watchos"))]
115extern_conformance!(
116 unsafe impl CALayerDelegate for UIButton {}
117);
118
119#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
120extern_conformance!(
121 unsafe impl NSCoding for UIButton {}
122);
123
124#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
125extern_conformance!(
126 unsafe impl NSObjectProtocol for UIButton {}
127);
128
129#[cfg(all(
130 feature = "UIAppearance",
131 feature = "UIControl",
132 feature = "UIResponder",
133 feature = "UIView"
134))]
135extern_conformance!(
136 unsafe impl UIAppearance for UIButton {}
137);
138
139#[cfg(all(
140 feature = "UIAppearance",
141 feature = "UIControl",
142 feature = "UIResponder",
143 feature = "UIView"
144))]
145extern_conformance!(
146 unsafe impl UIAppearanceContainer for UIButton {}
147);
148
149#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
150extern_conformance!(
151 unsafe impl UICoordinateSpace for UIButton {}
152);
153
154#[cfg(all(
155 feature = "UIControl",
156 feature = "UIDynamicBehavior",
157 feature = "UIResponder",
158 feature = "UIView"
159))]
160extern_conformance!(
161 unsafe impl UIDynamicItem for UIButton {}
162);
163
164#[cfg(all(
165 feature = "UIControl",
166 feature = "UIFocus",
167 feature = "UIResponder",
168 feature = "UIView"
169))]
170extern_conformance!(
171 unsafe impl UIFocusEnvironment for UIButton {}
172);
173
174#[cfg(all(
175 feature = "UIControl",
176 feature = "UIFocus",
177 feature = "UIResponder",
178 feature = "UIView"
179))]
180extern_conformance!(
181 unsafe impl UIFocusItem for UIButton {}
182);
183
184#[cfg(all(
185 feature = "UIControl",
186 feature = "UIFocus",
187 feature = "UIResponder",
188 feature = "UIView"
189))]
190extern_conformance!(
191 unsafe impl UIFocusItemContainer for UIButton {}
192);
193
194#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
195extern_conformance!(
196 unsafe impl UIResponderStandardEditActions for UIButton {}
197);
198
199#[cfg(all(
200 feature = "UIControl",
201 feature = "UIResponder",
202 feature = "UITraitCollection",
203 feature = "UIView"
204))]
205extern_conformance!(
206 unsafe impl UITraitEnvironment for UIButton {}
207);
208
209#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
210impl UIButton {
211 extern_methods!(
212 #[cfg(feature = "objc2-core-foundation")]
213 #[unsafe(method(initWithFrame:))]
214 #[unsafe(method_family = init)]
215 pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
216
217 #[unsafe(method(initWithCoder:))]
218 #[unsafe(method_family = init)]
219 pub unsafe fn initWithCoder(
220 this: Allocated<Self>,
221 coder: &NSCoder,
222 ) -> Option<Retained<Self>>;
223
224 #[cfg(all(
225 feature = "UIAction",
226 feature = "UIMenuElement",
227 feature = "objc2-core-foundation"
228 ))]
229 #[unsafe(method(initWithFrame:primaryAction:))]
235 #[unsafe(method_family = init)]
236 pub unsafe fn initWithFrame_primaryAction(
237 this: Allocated<Self>,
238 frame: CGRect,
239 primary_action: Option<&UIAction>,
240 ) -> Retained<Self>;
241
242 #[unsafe(method(buttonWithType:))]
243 #[unsafe(method_family = none)]
244 pub unsafe fn buttonWithType(
245 button_type: UIButtonType,
246 mtm: MainThreadMarker,
247 ) -> Retained<Self>;
248
249 #[cfg(feature = "UIImage")]
250 #[unsafe(method(systemButtonWithImage:target:action:))]
251 #[unsafe(method_family = none)]
252 pub unsafe fn systemButtonWithImage_target_action(
253 image: &UIImage,
254 target: Option<&AnyObject>,
255 action: Option<Sel>,
256 mtm: MainThreadMarker,
257 ) -> Retained<Self>;
258
259 #[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
260 #[unsafe(method(systemButtonWithPrimaryAction:))]
266 #[unsafe(method_family = none)]
267 pub unsafe fn systemButtonWithPrimaryAction(
268 primary_action: Option<&UIAction>,
269 mtm: MainThreadMarker,
270 ) -> Retained<Self>;
271
272 #[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
273 #[unsafe(method(buttonWithType:primaryAction:))]
279 #[unsafe(method_family = none)]
280 pub unsafe fn buttonWithType_primaryAction(
281 button_type: UIButtonType,
282 primary_action: Option<&UIAction>,
283 mtm: MainThreadMarker,
284 ) -> Retained<Self>;
285
286 #[cfg(all(
287 feature = "UIAction",
288 feature = "UIButtonConfiguration",
289 feature = "UIMenuElement"
290 ))]
291 #[unsafe(method(buttonWithConfiguration:primaryAction:))]
293 #[unsafe(method_family = none)]
294 pub unsafe fn buttonWithConfiguration_primaryAction(
295 configuration: &UIButtonConfiguration,
296 primary_action: Option<&UIAction>,
297 ) -> Retained<Self>;
298
299 #[cfg(feature = "UIButtonConfiguration")]
300 #[unsafe(method(configuration))]
302 #[unsafe(method_family = none)]
303 pub unsafe fn configuration(&self) -> Option<Retained<UIButtonConfiguration>>;
304
305 #[cfg(feature = "UIButtonConfiguration")]
306 #[unsafe(method(setConfiguration:))]
308 #[unsafe(method_family = none)]
309 pub unsafe fn setConfiguration(&self, configuration: Option<&UIButtonConfiguration>);
310
311 #[unsafe(method(setNeedsUpdateConfiguration))]
313 #[unsafe(method_family = none)]
314 pub unsafe fn setNeedsUpdateConfiguration(&self);
315
316 #[unsafe(method(updateConfiguration))]
318 #[unsafe(method_family = none)]
319 pub unsafe fn updateConfiguration(&self);
320
321 #[cfg(feature = "block2")]
322 #[unsafe(method(configurationUpdateHandler))]
324 #[unsafe(method_family = none)]
325 pub unsafe fn configurationUpdateHandler(&self) -> UIButtonConfigurationUpdateHandler;
326
327 #[cfg(feature = "block2")]
328 #[unsafe(method(setConfigurationUpdateHandler:))]
330 #[unsafe(method_family = none)]
331 pub unsafe fn setConfigurationUpdateHandler(
332 &self,
333 configuration_update_handler: UIButtonConfigurationUpdateHandler,
334 );
335
336 #[unsafe(method(automaticallyUpdatesConfiguration))]
338 #[unsafe(method_family = none)]
339 pub unsafe fn automaticallyUpdatesConfiguration(&self) -> bool;
340
341 #[unsafe(method(setAutomaticallyUpdatesConfiguration:))]
343 #[unsafe(method_family = none)]
344 pub unsafe fn setAutomaticallyUpdatesConfiguration(
345 &self,
346 automatically_updates_configuration: bool,
347 );
348
349 #[cfg(feature = "UIColor")]
350 #[unsafe(method(tintColor))]
351 #[unsafe(method_family = none)]
352 pub unsafe fn tintColor(&self) -> Option<Retained<UIColor>>;
353
354 #[cfg(feature = "UIColor")]
355 #[unsafe(method(setTintColor:))]
357 #[unsafe(method_family = none)]
358 pub unsafe fn setTintColor(&self, tint_color: Option<&UIColor>);
359
360 #[unsafe(method(buttonType))]
361 #[unsafe(method_family = none)]
362 pub unsafe fn buttonType(&self) -> UIButtonType;
363
364 #[unsafe(method(isHovered))]
366 #[unsafe(method_family = none)]
367 pub unsafe fn isHovered(&self) -> bool;
368
369 #[unsafe(method(isHeld))]
371 #[unsafe(method_family = none)]
372 pub unsafe fn isHeld(&self) -> bool;
373
374 #[unsafe(method(role))]
375 #[unsafe(method_family = none)]
376 pub unsafe fn role(&self) -> UIButtonRole;
377
378 #[unsafe(method(setRole:))]
380 #[unsafe(method_family = none)]
381 pub unsafe fn setRole(&self, role: UIButtonRole);
382
383 #[unsafe(method(isPointerInteractionEnabled))]
385 #[unsafe(method_family = none)]
386 pub unsafe fn isPointerInteractionEnabled(&self) -> bool;
387
388 #[unsafe(method(setPointerInteractionEnabled:))]
390 #[unsafe(method_family = none)]
391 pub unsafe fn setPointerInteractionEnabled(&self, pointer_interaction_enabled: bool);
392
393 #[cfg(all(
394 feature = "UIHoverStyle",
395 feature = "UIPointerStyle",
396 feature = "block2"
397 ))]
398 #[unsafe(method(pointerStyleProvider))]
404 #[unsafe(method_family = none)]
405 pub unsafe fn pointerStyleProvider(&self) -> UIButtonPointerStyleProvider;
406
407 #[cfg(all(
408 feature = "UIHoverStyle",
409 feature = "UIPointerStyle",
410 feature = "block2"
411 ))]
412 #[unsafe(method(setPointerStyleProvider:))]
414 #[unsafe(method_family = none)]
415 pub unsafe fn setPointerStyleProvider(
416 &self,
417 pointer_style_provider: UIButtonPointerStyleProvider,
418 );
419
420 #[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
421 #[unsafe(method(menu))]
423 #[unsafe(method_family = none)]
424 pub unsafe fn menu(&self) -> Option<Retained<UIMenu>>;
425
426 #[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
427 #[unsafe(method(setMenu:))]
429 #[unsafe(method_family = none)]
430 pub unsafe fn setMenu(&self, menu: Option<&UIMenu>);
431
432 #[cfg(feature = "UIContextMenuConfiguration")]
433 #[unsafe(method(preferredMenuElementOrder))]
435 #[unsafe(method_family = none)]
436 pub unsafe fn preferredMenuElementOrder(&self) -> UIContextMenuConfigurationElementOrder;
437
438 #[cfg(feature = "UIContextMenuConfiguration")]
439 #[unsafe(method(setPreferredMenuElementOrder:))]
441 #[unsafe(method_family = none)]
442 pub unsafe fn setPreferredMenuElementOrder(
443 &self,
444 preferred_menu_element_order: UIContextMenuConfigurationElementOrder,
445 );
446
447 #[unsafe(method(changesSelectionAsPrimaryAction))]
451 #[unsafe(method_family = none)]
452 pub unsafe fn changesSelectionAsPrimaryAction(&self) -> bool;
453
454 #[unsafe(method(setChangesSelectionAsPrimaryAction:))]
456 #[unsafe(method_family = none)]
457 pub unsafe fn setChangesSelectionAsPrimaryAction(
458 &self,
459 changes_selection_as_primary_action: bool,
460 );
461
462 #[unsafe(method(setTitle:forState:))]
463 #[unsafe(method_family = none)]
464 pub unsafe fn setTitle_forState(&self, title: Option<&NSString>, state: UIControlState);
465
466 #[cfg(feature = "UIColor")]
467 #[unsafe(method(setTitleColor:forState:))]
468 #[unsafe(method_family = none)]
469 pub unsafe fn setTitleColor_forState(&self, color: Option<&UIColor>, state: UIControlState);
470
471 #[cfg(feature = "UIColor")]
472 #[unsafe(method(setTitleShadowColor:forState:))]
473 #[unsafe(method_family = none)]
474 pub unsafe fn setTitleShadowColor_forState(
475 &self,
476 color: Option<&UIColor>,
477 state: UIControlState,
478 );
479
480 #[cfg(feature = "UIImage")]
481 #[unsafe(method(setImage:forState:))]
482 #[unsafe(method_family = none)]
483 pub unsafe fn setImage_forState(&self, image: Option<&UIImage>, state: UIControlState);
484
485 #[cfg(feature = "UIImage")]
486 #[unsafe(method(setBackgroundImage:forState:))]
487 #[unsafe(method_family = none)]
488 pub unsafe fn setBackgroundImage_forState(
489 &self,
490 image: Option<&UIImage>,
491 state: UIControlState,
492 );
493
494 #[cfg(all(
495 feature = "UIImageConfiguration",
496 feature = "UIImageSymbolConfiguration"
497 ))]
498 #[unsafe(method(setPreferredSymbolConfiguration:forImageInState:))]
499 #[unsafe(method_family = none)]
500 pub unsafe fn setPreferredSymbolConfiguration_forImageInState(
501 &self,
502 configuration: Option<&UIImageSymbolConfiguration>,
503 state: UIControlState,
504 );
505
506 #[unsafe(method(setAttributedTitle:forState:))]
507 #[unsafe(method_family = none)]
508 pub unsafe fn setAttributedTitle_forState(
509 &self,
510 title: Option<&NSAttributedString>,
511 state: UIControlState,
512 );
513
514 #[unsafe(method(titleForState:))]
515 #[unsafe(method_family = none)]
516 pub unsafe fn titleForState(&self, state: UIControlState) -> Option<Retained<NSString>>;
517
518 #[cfg(feature = "UIColor")]
519 #[unsafe(method(titleColorForState:))]
520 #[unsafe(method_family = none)]
521 pub unsafe fn titleColorForState(&self, state: UIControlState)
522 -> Option<Retained<UIColor>>;
523
524 #[cfg(feature = "UIColor")]
525 #[unsafe(method(titleShadowColorForState:))]
526 #[unsafe(method_family = none)]
527 pub unsafe fn titleShadowColorForState(
528 &self,
529 state: UIControlState,
530 ) -> Option<Retained<UIColor>>;
531
532 #[cfg(feature = "UIImage")]
533 #[unsafe(method(imageForState:))]
534 #[unsafe(method_family = none)]
535 pub unsafe fn imageForState(&self, state: UIControlState) -> Option<Retained<UIImage>>;
536
537 #[cfg(feature = "UIImage")]
538 #[unsafe(method(backgroundImageForState:))]
539 #[unsafe(method_family = none)]
540 pub unsafe fn backgroundImageForState(
541 &self,
542 state: UIControlState,
543 ) -> Option<Retained<UIImage>>;
544
545 #[cfg(all(
546 feature = "UIImageConfiguration",
547 feature = "UIImageSymbolConfiguration"
548 ))]
549 #[unsafe(method(preferredSymbolConfigurationForImageInState:))]
550 #[unsafe(method_family = none)]
551 pub unsafe fn preferredSymbolConfigurationForImageInState(
552 &self,
553 state: UIControlState,
554 ) -> Option<Retained<UIImageSymbolConfiguration>>;
555
556 #[unsafe(method(attributedTitleForState:))]
557 #[unsafe(method_family = none)]
558 pub unsafe fn attributedTitleForState(
559 &self,
560 state: UIControlState,
561 ) -> Option<Retained<NSAttributedString>>;
562
563 #[unsafe(method(currentTitle))]
564 #[unsafe(method_family = none)]
565 pub unsafe fn currentTitle(&self) -> Option<Retained<NSString>>;
566
567 #[cfg(feature = "UIColor")]
568 #[unsafe(method(currentTitleColor))]
569 #[unsafe(method_family = none)]
570 pub unsafe fn currentTitleColor(&self) -> Retained<UIColor>;
571
572 #[cfg(feature = "UIColor")]
573 #[unsafe(method(currentTitleShadowColor))]
574 #[unsafe(method_family = none)]
575 pub unsafe fn currentTitleShadowColor(&self) -> Option<Retained<UIColor>>;
576
577 #[cfg(feature = "UIImage")]
578 #[unsafe(method(currentImage))]
579 #[unsafe(method_family = none)]
580 pub unsafe fn currentImage(&self) -> Option<Retained<UIImage>>;
581
582 #[cfg(feature = "UIImage")]
583 #[unsafe(method(currentBackgroundImage))]
584 #[unsafe(method_family = none)]
585 pub unsafe fn currentBackgroundImage(&self) -> Option<Retained<UIImage>>;
586
587 #[cfg(all(
588 feature = "UIImageConfiguration",
589 feature = "UIImageSymbolConfiguration"
590 ))]
591 #[unsafe(method(currentPreferredSymbolConfiguration))]
592 #[unsafe(method_family = none)]
593 pub unsafe fn currentPreferredSymbolConfiguration(
594 &self,
595 ) -> Option<Retained<UIImageSymbolConfiguration>>;
596
597 #[unsafe(method(currentAttributedTitle))]
598 #[unsafe(method_family = none)]
599 pub unsafe fn currentAttributedTitle(&self) -> Option<Retained<NSAttributedString>>;
600
601 #[cfg(feature = "UILabel")]
602 #[unsafe(method(titleLabel))]
603 #[unsafe(method_family = none)]
604 pub unsafe fn titleLabel(&self) -> Option<Retained<UILabel>>;
605
606 #[cfg(feature = "UIImageView")]
607 #[unsafe(method(imageView))]
608 #[unsafe(method_family = none)]
609 pub unsafe fn imageView(&self) -> Option<Retained<UIImageView>>;
610
611 #[cfg(feature = "UILabel")]
612 #[unsafe(method(subtitleLabel))]
614 #[unsafe(method_family = none)]
615 pub unsafe fn subtitleLabel(&self) -> Option<Retained<UILabel>>;
616 );
617}
618
619#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
621impl UIButton {
622 extern_methods!(
623 #[unsafe(method(init))]
624 #[unsafe(method_family = init)]
625 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
626
627 #[unsafe(method(new))]
628 #[unsafe(method_family = new)]
629 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
630 );
631}
632
633#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
634impl UIButton {
635 extern_methods!(
636 #[cfg(feature = "UIFont")]
637 #[deprecated = "Specify an attributed title with a custom font"]
638 #[unsafe(method(font))]
639 #[unsafe(method_family = none)]
640 pub unsafe fn font(&self) -> Retained<UIFont>;
641
642 #[cfg(feature = "UIFont")]
643 #[deprecated = "Specify an attributed title with a custom font"]
645 #[unsafe(method(setFont:))]
646 #[unsafe(method_family = none)]
647 pub unsafe fn setFont(&self, font: &UIFont);
648
649 #[cfg(feature = "NSParagraphStyle")]
650 #[deprecated = "Specify an attributed title with a customized paragraph style"]
651 #[unsafe(method(lineBreakMode))]
652 #[unsafe(method_family = none)]
653 pub unsafe fn lineBreakMode(&self) -> NSLineBreakMode;
654
655 #[cfg(feature = "NSParagraphStyle")]
656 #[deprecated = "Specify an attributed title with a customized paragraph style"]
658 #[unsafe(method(setLineBreakMode:))]
659 #[unsafe(method_family = none)]
660 pub unsafe fn setLineBreakMode(&self, line_break_mode: NSLineBreakMode);
661
662 #[cfg(feature = "objc2-core-foundation")]
663 #[deprecated = "Specify an attributed title with a customized shadow style"]
664 #[unsafe(method(titleShadowOffset))]
665 #[unsafe(method_family = none)]
666 pub unsafe fn titleShadowOffset(&self) -> CGSize;
667
668 #[cfg(feature = "objc2-core-foundation")]
669 #[deprecated = "Specify an attributed title with a customized shadow style"]
671 #[unsafe(method(setTitleShadowOffset:))]
672 #[unsafe(method_family = none)]
673 pub unsafe fn setTitleShadowOffset(&self, title_shadow_offset: CGSize);
674
675 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
676 #[deprecated = "This property is ignored when using UIButtonConfiguration"]
677 #[unsafe(method(contentEdgeInsets))]
678 #[unsafe(method_family = none)]
679 pub unsafe fn contentEdgeInsets(&self) -> UIEdgeInsets;
680
681 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
682 #[deprecated = "This property is ignored when using UIButtonConfiguration"]
684 #[unsafe(method(setContentEdgeInsets:))]
685 #[unsafe(method_family = none)]
686 pub unsafe fn setContentEdgeInsets(&self, content_edge_insets: UIEdgeInsets);
687
688 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
689 #[deprecated = "This property is ignored when using UIButtonConfiguration"]
690 #[unsafe(method(titleEdgeInsets))]
691 #[unsafe(method_family = none)]
692 pub unsafe fn titleEdgeInsets(&self) -> UIEdgeInsets;
693
694 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
695 #[deprecated = "This property is ignored when using UIButtonConfiguration"]
697 #[unsafe(method(setTitleEdgeInsets:))]
698 #[unsafe(method_family = none)]
699 pub unsafe fn setTitleEdgeInsets(&self, title_edge_insets: UIEdgeInsets);
700
701 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
702 #[deprecated = "This property is ignored when using UIButtonConfiguration"]
703 #[unsafe(method(imageEdgeInsets))]
704 #[unsafe(method_family = none)]
705 pub unsafe fn imageEdgeInsets(&self) -> UIEdgeInsets;
706
707 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
708 #[deprecated = "This property is ignored when using UIButtonConfiguration"]
710 #[unsafe(method(setImageEdgeInsets:))]
711 #[unsafe(method_family = none)]
712 pub unsafe fn setImageEdgeInsets(&self, image_edge_insets: UIEdgeInsets);
713
714 #[deprecated = "This property is ignored when using UIButtonConfiguration, you may customize to replicate this behavior via a configurationUpdateHandler"]
715 #[unsafe(method(reversesTitleShadowWhenHighlighted))]
716 #[unsafe(method_family = none)]
717 pub unsafe fn reversesTitleShadowWhenHighlighted(&self) -> bool;
718
719 #[deprecated = "This property is ignored when using UIButtonConfiguration, you may customize to replicate this behavior via a configurationUpdateHandler"]
721 #[unsafe(method(setReversesTitleShadowWhenHighlighted:))]
722 #[unsafe(method_family = none)]
723 pub unsafe fn setReversesTitleShadowWhenHighlighted(
724 &self,
725 reverses_title_shadow_when_highlighted: bool,
726 );
727
728 #[deprecated = "This property is ignored when using UIButtonConfiguration, you may customize to replicate this behavior via a configurationUpdateHandler"]
729 #[unsafe(method(adjustsImageWhenHighlighted))]
730 #[unsafe(method_family = none)]
731 pub unsafe fn adjustsImageWhenHighlighted(&self) -> bool;
732
733 #[deprecated = "This property is ignored when using UIButtonConfiguration, you may customize to replicate this behavior via a configurationUpdateHandler"]
735 #[unsafe(method(setAdjustsImageWhenHighlighted:))]
736 #[unsafe(method_family = none)]
737 pub unsafe fn setAdjustsImageWhenHighlighted(&self, adjusts_image_when_highlighted: bool);
738
739 #[deprecated = "This property is ignored when using UIButtonConfiguration, you may customize to replicate this behavior via a configurationUpdateHandler"]
740 #[unsafe(method(adjustsImageWhenDisabled))]
741 #[unsafe(method_family = none)]
742 pub unsafe fn adjustsImageWhenDisabled(&self) -> bool;
743
744 #[deprecated = "This property is ignored when using UIButtonConfiguration, you may customize to replicate this behavior via a configurationUpdateHandler"]
746 #[unsafe(method(setAdjustsImageWhenDisabled:))]
747 #[unsafe(method_family = none)]
748 pub unsafe fn setAdjustsImageWhenDisabled(&self, adjusts_image_when_disabled: bool);
749
750 #[deprecated = "This property is ignored when using UIButtonConfiguration"]
751 #[unsafe(method(showsTouchWhenHighlighted))]
752 #[unsafe(method_family = none)]
753 pub unsafe fn showsTouchWhenHighlighted(&self) -> bool;
754
755 #[deprecated = "This property is ignored when using UIButtonConfiguration"]
757 #[unsafe(method(setShowsTouchWhenHighlighted:))]
758 #[unsafe(method_family = none)]
759 pub unsafe fn setShowsTouchWhenHighlighted(&self, shows_touch_when_highlighted: bool);
760
761 #[cfg(feature = "objc2-core-foundation")]
762 #[deprecated = "Override layoutSubviews, call super, and position views as you desire."]
763 #[unsafe(method(backgroundRectForBounds:))]
764 #[unsafe(method_family = none)]
765 pub unsafe fn backgroundRectForBounds(&self, bounds: CGRect) -> CGRect;
766
767 #[cfg(feature = "objc2-core-foundation")]
768 #[deprecated = "Override layoutSubviews, call super, and position views as you desire."]
769 #[unsafe(method(contentRectForBounds:))]
770 #[unsafe(method_family = none)]
771 pub unsafe fn contentRectForBounds(&self, bounds: CGRect) -> CGRect;
772
773 #[cfg(feature = "objc2-core-foundation")]
774 #[deprecated = "Override layoutSubviews, call super, and position views as you desire."]
775 #[unsafe(method(titleRectForContentRect:))]
776 #[unsafe(method_family = none)]
777 pub unsafe fn titleRectForContentRect(&self, content_rect: CGRect) -> CGRect;
778
779 #[cfg(feature = "objc2-core-foundation")]
780 #[deprecated = "Override layoutSubviews, call super, and position views as you desire."]
781 #[unsafe(method(imageRectForContentRect:))]
782 #[unsafe(method_family = none)]
783 pub unsafe fn imageRectForContentRect(&self, content_rect: CGRect) -> CGRect;
784 );
785}
786
787#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
789impl UIButton {
790 extern_methods!();
791}
792
793#[cfg(all(
794 feature = "UIControl",
795 feature = "UIResponder",
796 feature = "UISpringLoadedInteractionSupporting",
797 feature = "UIView"
798))]
799extern_conformance!(
800 unsafe impl UISpringLoadedInteractionSupporting for UIButton {}
801);