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 fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
216
217 #[unsafe(method(initWithCoder:))]
221 #[unsafe(method_family = init)]
222 pub unsafe fn initWithCoder(
223 this: Allocated<Self>,
224 coder: &NSCoder,
225 ) -> Option<Retained<Self>>;
226
227 #[cfg(all(
228 feature = "UIAction",
229 feature = "UIMenuElement",
230 feature = "objc2-core-foundation"
231 ))]
232 #[unsafe(method(initWithFrame:primaryAction:))]
238 #[unsafe(method_family = init)]
239 pub fn initWithFrame_primaryAction(
240 this: Allocated<Self>,
241 frame: CGRect,
242 primary_action: Option<&UIAction>,
243 ) -> Retained<Self>;
244
245 #[unsafe(method(buttonWithType:))]
246 #[unsafe(method_family = none)]
247 pub fn buttonWithType(button_type: UIButtonType, mtm: MainThreadMarker) -> Retained<Self>;
248
249 #[cfg(feature = "UIImage")]
250 #[unsafe(method(systemButtonWithImage:target:action:))]
255 #[unsafe(method_family = none)]
256 pub unsafe fn systemButtonWithImage_target_action(
257 image: &UIImage,
258 target: Option<&AnyObject>,
259 action: Option<Sel>,
260 mtm: MainThreadMarker,
261 ) -> Retained<Self>;
262
263 #[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
264 #[unsafe(method(systemButtonWithPrimaryAction:))]
270 #[unsafe(method_family = none)]
271 pub fn systemButtonWithPrimaryAction(
272 primary_action: Option<&UIAction>,
273 mtm: MainThreadMarker,
274 ) -> Retained<Self>;
275
276 #[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
277 #[unsafe(method(buttonWithType:primaryAction:))]
283 #[unsafe(method_family = none)]
284 pub fn buttonWithType_primaryAction(
285 button_type: UIButtonType,
286 primary_action: Option<&UIAction>,
287 mtm: MainThreadMarker,
288 ) -> Retained<Self>;
289
290 #[cfg(all(
291 feature = "UIAction",
292 feature = "UIButtonConfiguration",
293 feature = "UIMenuElement"
294 ))]
295 #[unsafe(method(buttonWithConfiguration:primaryAction:))]
297 #[unsafe(method_family = none)]
298 pub fn buttonWithConfiguration_primaryAction(
299 configuration: &UIButtonConfiguration,
300 primary_action: Option<&UIAction>,
301 ) -> Retained<Self>;
302
303 #[cfg(feature = "UIButtonConfiguration")]
304 #[unsafe(method(configuration))]
306 #[unsafe(method_family = none)]
307 pub fn configuration(&self) -> Option<Retained<UIButtonConfiguration>>;
308
309 #[cfg(feature = "UIButtonConfiguration")]
310 #[unsafe(method(setConfiguration:))]
314 #[unsafe(method_family = none)]
315 pub fn setConfiguration(&self, configuration: Option<&UIButtonConfiguration>);
316
317 #[unsafe(method(setNeedsUpdateConfiguration))]
319 #[unsafe(method_family = none)]
320 pub fn setNeedsUpdateConfiguration(&self);
321
322 #[unsafe(method(updateConfiguration))]
324 #[unsafe(method_family = none)]
325 pub fn updateConfiguration(&self);
326
327 #[cfg(feature = "block2")]
328 #[unsafe(method(configurationUpdateHandler))]
334 #[unsafe(method_family = none)]
335 pub unsafe fn configurationUpdateHandler(&self) -> UIButtonConfigurationUpdateHandler;
336
337 #[cfg(feature = "block2")]
338 #[unsafe(method(setConfigurationUpdateHandler:))]
346 #[unsafe(method_family = none)]
347 pub unsafe fn setConfigurationUpdateHandler(
348 &self,
349 configuration_update_handler: UIButtonConfigurationUpdateHandler,
350 );
351
352 #[unsafe(method(automaticallyUpdatesConfiguration))]
354 #[unsafe(method_family = none)]
355 pub fn automaticallyUpdatesConfiguration(&self) -> bool;
356
357 #[unsafe(method(setAutomaticallyUpdatesConfiguration:))]
359 #[unsafe(method_family = none)]
360 pub fn setAutomaticallyUpdatesConfiguration(
361 &self,
362 automatically_updates_configuration: bool,
363 );
364
365 #[cfg(feature = "UIColor")]
366 #[unsafe(method(tintColor))]
367 #[unsafe(method_family = none)]
368 pub fn tintColor(&self) -> Option<Retained<UIColor>>;
369
370 #[cfg(feature = "UIColor")]
371 #[unsafe(method(setTintColor:))]
377 #[unsafe(method_family = none)]
378 pub unsafe fn setTintColor(&self, tint_color: Option<&UIColor>);
379
380 #[unsafe(method(buttonType))]
381 #[unsafe(method_family = none)]
382 pub fn buttonType(&self) -> UIButtonType;
383
384 #[unsafe(method(isHovered))]
386 #[unsafe(method_family = none)]
387 pub fn isHovered(&self) -> bool;
388
389 #[unsafe(method(isHeld))]
391 #[unsafe(method_family = none)]
392 pub fn isHeld(&self) -> bool;
393
394 #[unsafe(method(role))]
395 #[unsafe(method_family = none)]
396 pub fn role(&self) -> UIButtonRole;
397
398 #[unsafe(method(setRole:))]
400 #[unsafe(method_family = none)]
401 pub fn setRole(&self, role: UIButtonRole);
402
403 #[unsafe(method(isPointerInteractionEnabled))]
405 #[unsafe(method_family = none)]
406 pub fn isPointerInteractionEnabled(&self) -> bool;
407
408 #[unsafe(method(setPointerInteractionEnabled:))]
410 #[unsafe(method_family = none)]
411 pub fn setPointerInteractionEnabled(&self, pointer_interaction_enabled: bool);
412
413 #[cfg(all(
414 feature = "UIHoverStyle",
415 feature = "UIPointerStyle",
416 feature = "block2"
417 ))]
418 #[unsafe(method(pointerStyleProvider))]
430 #[unsafe(method_family = none)]
431 pub unsafe fn pointerStyleProvider(&self) -> UIButtonPointerStyleProvider;
432
433 #[cfg(all(
434 feature = "UIHoverStyle",
435 feature = "UIPointerStyle",
436 feature = "block2"
437 ))]
438 #[unsafe(method(setPointerStyleProvider:))]
446 #[unsafe(method_family = none)]
447 pub unsafe fn setPointerStyleProvider(
448 &self,
449 pointer_style_provider: UIButtonPointerStyleProvider,
450 );
451
452 #[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
453 #[unsafe(method(menu))]
455 #[unsafe(method_family = none)]
456 pub fn menu(&self) -> Option<Retained<UIMenu>>;
457
458 #[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
459 #[unsafe(method(setMenu:))]
463 #[unsafe(method_family = none)]
464 pub fn setMenu(&self, menu: Option<&UIMenu>);
465
466 #[cfg(feature = "UIContextMenuConfiguration")]
467 #[unsafe(method(preferredMenuElementOrder))]
469 #[unsafe(method_family = none)]
470 pub fn preferredMenuElementOrder(&self) -> UIContextMenuConfigurationElementOrder;
471
472 #[cfg(feature = "UIContextMenuConfiguration")]
473 #[unsafe(method(setPreferredMenuElementOrder:))]
475 #[unsafe(method_family = none)]
476 pub fn setPreferredMenuElementOrder(
477 &self,
478 preferred_menu_element_order: UIContextMenuConfigurationElementOrder,
479 );
480
481 #[unsafe(method(changesSelectionAsPrimaryAction))]
485 #[unsafe(method_family = none)]
486 pub fn changesSelectionAsPrimaryAction(&self) -> bool;
487
488 #[unsafe(method(setChangesSelectionAsPrimaryAction:))]
490 #[unsafe(method_family = none)]
491 pub fn setChangesSelectionAsPrimaryAction(&self, changes_selection_as_primary_action: bool);
492
493 #[unsafe(method(setTitle:forState:))]
494 #[unsafe(method_family = none)]
495 pub fn setTitle_forState(&self, title: Option<&NSString>, state: UIControlState);
496
497 #[cfg(feature = "UIColor")]
498 #[unsafe(method(setTitleColor:forState:))]
499 #[unsafe(method_family = none)]
500 pub fn setTitleColor_forState(&self, color: Option<&UIColor>, state: UIControlState);
501
502 #[cfg(feature = "UIColor")]
503 #[unsafe(method(setTitleShadowColor:forState:))]
504 #[unsafe(method_family = none)]
505 pub fn setTitleShadowColor_forState(&self, color: Option<&UIColor>, state: UIControlState);
506
507 #[cfg(feature = "UIImage")]
508 #[unsafe(method(setImage:forState:))]
509 #[unsafe(method_family = none)]
510 pub fn setImage_forState(&self, image: Option<&UIImage>, state: UIControlState);
511
512 #[cfg(feature = "UIImage")]
513 #[unsafe(method(setBackgroundImage:forState:))]
514 #[unsafe(method_family = none)]
515 pub fn setBackgroundImage_forState(&self, image: Option<&UIImage>, state: UIControlState);
516
517 #[cfg(all(
518 feature = "UIImageConfiguration",
519 feature = "UIImageSymbolConfiguration"
520 ))]
521 #[unsafe(method(setPreferredSymbolConfiguration:forImageInState:))]
522 #[unsafe(method_family = none)]
523 pub fn setPreferredSymbolConfiguration_forImageInState(
524 &self,
525 configuration: Option<&UIImageSymbolConfiguration>,
526 state: UIControlState,
527 );
528
529 #[unsafe(method(setAttributedTitle:forState:))]
530 #[unsafe(method_family = none)]
531 pub fn setAttributedTitle_forState(
532 &self,
533 title: Option<&NSAttributedString>,
534 state: UIControlState,
535 );
536
537 #[unsafe(method(titleForState:))]
538 #[unsafe(method_family = none)]
539 pub fn titleForState(&self, state: UIControlState) -> Option<Retained<NSString>>;
540
541 #[cfg(feature = "UIColor")]
542 #[unsafe(method(titleColorForState:))]
543 #[unsafe(method_family = none)]
544 pub fn titleColorForState(&self, state: UIControlState) -> Option<Retained<UIColor>>;
545
546 #[cfg(feature = "UIColor")]
547 #[unsafe(method(titleShadowColorForState:))]
548 #[unsafe(method_family = none)]
549 pub fn titleShadowColorForState(&self, state: UIControlState) -> Option<Retained<UIColor>>;
550
551 #[cfg(feature = "UIImage")]
552 #[unsafe(method(imageForState:))]
553 #[unsafe(method_family = none)]
554 pub fn imageForState(&self, state: UIControlState) -> Option<Retained<UIImage>>;
555
556 #[cfg(feature = "UIImage")]
557 #[unsafe(method(backgroundImageForState:))]
558 #[unsafe(method_family = none)]
559 pub fn backgroundImageForState(&self, state: UIControlState) -> Option<Retained<UIImage>>;
560
561 #[cfg(all(
562 feature = "UIImageConfiguration",
563 feature = "UIImageSymbolConfiguration"
564 ))]
565 #[unsafe(method(preferredSymbolConfigurationForImageInState:))]
566 #[unsafe(method_family = none)]
567 pub fn preferredSymbolConfigurationForImageInState(
568 &self,
569 state: UIControlState,
570 ) -> Option<Retained<UIImageSymbolConfiguration>>;
571
572 #[unsafe(method(attributedTitleForState:))]
573 #[unsafe(method_family = none)]
574 pub fn attributedTitleForState(
575 &self,
576 state: UIControlState,
577 ) -> Option<Retained<NSAttributedString>>;
578
579 #[unsafe(method(currentTitle))]
580 #[unsafe(method_family = none)]
581 pub fn currentTitle(&self) -> Option<Retained<NSString>>;
582
583 #[cfg(feature = "UIColor")]
584 #[unsafe(method(currentTitleColor))]
585 #[unsafe(method_family = none)]
586 pub fn currentTitleColor(&self) -> Retained<UIColor>;
587
588 #[cfg(feature = "UIColor")]
589 #[unsafe(method(currentTitleShadowColor))]
590 #[unsafe(method_family = none)]
591 pub fn currentTitleShadowColor(&self) -> Option<Retained<UIColor>>;
592
593 #[cfg(feature = "UIImage")]
594 #[unsafe(method(currentImage))]
595 #[unsafe(method_family = none)]
596 pub fn currentImage(&self) -> Option<Retained<UIImage>>;
597
598 #[cfg(feature = "UIImage")]
599 #[unsafe(method(currentBackgroundImage))]
600 #[unsafe(method_family = none)]
601 pub fn currentBackgroundImage(&self) -> Option<Retained<UIImage>>;
602
603 #[cfg(all(
604 feature = "UIImageConfiguration",
605 feature = "UIImageSymbolConfiguration"
606 ))]
607 #[unsafe(method(currentPreferredSymbolConfiguration))]
608 #[unsafe(method_family = none)]
609 pub fn currentPreferredSymbolConfiguration(
610 &self,
611 ) -> Option<Retained<UIImageSymbolConfiguration>>;
612
613 #[unsafe(method(currentAttributedTitle))]
614 #[unsafe(method_family = none)]
615 pub fn currentAttributedTitle(&self) -> Option<Retained<NSAttributedString>>;
616
617 #[cfg(feature = "UILabel")]
618 #[unsafe(method(titleLabel))]
619 #[unsafe(method_family = none)]
620 pub fn titleLabel(&self) -> Option<Retained<UILabel>>;
621
622 #[cfg(feature = "UIImageView")]
623 #[unsafe(method(imageView))]
624 #[unsafe(method_family = none)]
625 pub fn imageView(&self) -> Option<Retained<UIImageView>>;
626
627 #[cfg(feature = "UILabel")]
628 #[unsafe(method(subtitleLabel))]
630 #[unsafe(method_family = none)]
631 pub fn subtitleLabel(&self) -> Option<Retained<UILabel>>;
632 );
633}
634
635#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
637impl UIButton {
638 extern_methods!(
639 #[unsafe(method(init))]
640 #[unsafe(method_family = init)]
641 pub fn init(this: Allocated<Self>) -> Retained<Self>;
642 );
643}
644
645#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
647impl UIButton {
648 extern_methods!(
649 #[unsafe(method(new))]
650 #[unsafe(method_family = new)]
651 pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
652 );
653}
654
655#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
656impl UIButton {
657 extern_methods!(
658 #[cfg(feature = "UIFont")]
659 #[deprecated = "Specify an attributed title with a custom font"]
660 #[unsafe(method(font))]
661 #[unsafe(method_family = none)]
662 pub fn font(&self) -> Retained<UIFont>;
663
664 #[cfg(feature = "UIFont")]
665 #[deprecated = "Specify an attributed title with a custom font"]
667 #[unsafe(method(setFont:))]
668 #[unsafe(method_family = none)]
669 pub fn setFont(&self, font: &UIFont);
670
671 #[cfg(feature = "NSParagraphStyle")]
672 #[deprecated = "Specify an attributed title with a customized paragraph style"]
673 #[unsafe(method(lineBreakMode))]
674 #[unsafe(method_family = none)]
675 pub fn lineBreakMode(&self) -> NSLineBreakMode;
676
677 #[cfg(feature = "NSParagraphStyle")]
678 #[deprecated = "Specify an attributed title with a customized paragraph style"]
680 #[unsafe(method(setLineBreakMode:))]
681 #[unsafe(method_family = none)]
682 pub fn setLineBreakMode(&self, line_break_mode: NSLineBreakMode);
683
684 #[cfg(feature = "objc2-core-foundation")]
685 #[deprecated = "Specify an attributed title with a customized shadow style"]
686 #[unsafe(method(titleShadowOffset))]
687 #[unsafe(method_family = none)]
688 pub fn titleShadowOffset(&self) -> CGSize;
689
690 #[cfg(feature = "objc2-core-foundation")]
691 #[deprecated = "Specify an attributed title with a customized shadow style"]
693 #[unsafe(method(setTitleShadowOffset:))]
694 #[unsafe(method_family = none)]
695 pub fn setTitleShadowOffset(&self, title_shadow_offset: CGSize);
696
697 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
698 #[deprecated = "This property is ignored when using UIButtonConfiguration"]
699 #[unsafe(method(contentEdgeInsets))]
700 #[unsafe(method_family = none)]
701 pub fn contentEdgeInsets(&self) -> UIEdgeInsets;
702
703 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
704 #[deprecated = "This property is ignored when using UIButtonConfiguration"]
706 #[unsafe(method(setContentEdgeInsets:))]
707 #[unsafe(method_family = none)]
708 pub fn setContentEdgeInsets(&self, content_edge_insets: UIEdgeInsets);
709
710 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
711 #[deprecated = "This property is ignored when using UIButtonConfiguration"]
712 #[unsafe(method(titleEdgeInsets))]
713 #[unsafe(method_family = none)]
714 pub fn titleEdgeInsets(&self) -> UIEdgeInsets;
715
716 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
717 #[deprecated = "This property is ignored when using UIButtonConfiguration"]
719 #[unsafe(method(setTitleEdgeInsets:))]
720 #[unsafe(method_family = none)]
721 pub fn setTitleEdgeInsets(&self, title_edge_insets: UIEdgeInsets);
722
723 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
724 #[deprecated = "This property is ignored when using UIButtonConfiguration"]
725 #[unsafe(method(imageEdgeInsets))]
726 #[unsafe(method_family = none)]
727 pub fn imageEdgeInsets(&self) -> UIEdgeInsets;
728
729 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
730 #[deprecated = "This property is ignored when using UIButtonConfiguration"]
732 #[unsafe(method(setImageEdgeInsets:))]
733 #[unsafe(method_family = none)]
734 pub fn setImageEdgeInsets(&self, image_edge_insets: UIEdgeInsets);
735
736 #[deprecated = "This property is ignored when using UIButtonConfiguration, you may customize to replicate this behavior via a configurationUpdateHandler"]
737 #[unsafe(method(reversesTitleShadowWhenHighlighted))]
738 #[unsafe(method_family = none)]
739 pub fn reversesTitleShadowWhenHighlighted(&self) -> bool;
740
741 #[deprecated = "This property is ignored when using UIButtonConfiguration, you may customize to replicate this behavior via a configurationUpdateHandler"]
743 #[unsafe(method(setReversesTitleShadowWhenHighlighted:))]
744 #[unsafe(method_family = none)]
745 pub fn setReversesTitleShadowWhenHighlighted(
746 &self,
747 reverses_title_shadow_when_highlighted: bool,
748 );
749
750 #[deprecated = "This property is ignored when using UIButtonConfiguration, you may customize to replicate this behavior via a configurationUpdateHandler"]
751 #[unsafe(method(adjustsImageWhenHighlighted))]
752 #[unsafe(method_family = none)]
753 pub fn adjustsImageWhenHighlighted(&self) -> bool;
754
755 #[deprecated = "This property is ignored when using UIButtonConfiguration, you may customize to replicate this behavior via a configurationUpdateHandler"]
757 #[unsafe(method(setAdjustsImageWhenHighlighted:))]
758 #[unsafe(method_family = none)]
759 pub fn setAdjustsImageWhenHighlighted(&self, adjusts_image_when_highlighted: bool);
760
761 #[deprecated = "This property is ignored when using UIButtonConfiguration, you may customize to replicate this behavior via a configurationUpdateHandler"]
762 #[unsafe(method(adjustsImageWhenDisabled))]
763 #[unsafe(method_family = none)]
764 pub fn adjustsImageWhenDisabled(&self) -> bool;
765
766 #[deprecated = "This property is ignored when using UIButtonConfiguration, you may customize to replicate this behavior via a configurationUpdateHandler"]
768 #[unsafe(method(setAdjustsImageWhenDisabled:))]
769 #[unsafe(method_family = none)]
770 pub fn setAdjustsImageWhenDisabled(&self, adjusts_image_when_disabled: bool);
771
772 #[deprecated = "This property is ignored when using UIButtonConfiguration"]
773 #[unsafe(method(showsTouchWhenHighlighted))]
774 #[unsafe(method_family = none)]
775 pub fn showsTouchWhenHighlighted(&self) -> bool;
776
777 #[deprecated = "This property is ignored when using UIButtonConfiguration"]
779 #[unsafe(method(setShowsTouchWhenHighlighted:))]
780 #[unsafe(method_family = none)]
781 pub fn setShowsTouchWhenHighlighted(&self, shows_touch_when_highlighted: bool);
782
783 #[cfg(feature = "objc2-core-foundation")]
784 #[deprecated = "Override layoutSubviews, call super, and position views as you desire."]
785 #[unsafe(method(backgroundRectForBounds:))]
786 #[unsafe(method_family = none)]
787 pub fn backgroundRectForBounds(&self, bounds: CGRect) -> CGRect;
788
789 #[cfg(feature = "objc2-core-foundation")]
790 #[deprecated = "Override layoutSubviews, call super, and position views as you desire."]
791 #[unsafe(method(contentRectForBounds:))]
792 #[unsafe(method_family = none)]
793 pub fn contentRectForBounds(&self, bounds: CGRect) -> CGRect;
794
795 #[cfg(feature = "objc2-core-foundation")]
796 #[deprecated = "Override layoutSubviews, call super, and position views as you desire."]
797 #[unsafe(method(titleRectForContentRect:))]
798 #[unsafe(method_family = none)]
799 pub fn titleRectForContentRect(&self, content_rect: CGRect) -> CGRect;
800
801 #[cfg(feature = "objc2-core-foundation")]
802 #[deprecated = "Override layoutSubviews, call super, and position views as you desire."]
803 #[unsafe(method(imageRectForContentRect:))]
804 #[unsafe(method_family = none)]
805 pub fn imageRectForContentRect(&self, content_rect: CGRect) -> CGRect;
806 );
807}
808
809#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
811impl UIButton {
812 extern_methods!();
813}
814
815#[cfg(all(
816 feature = "UIControl",
817 feature = "UIResponder",
818 feature = "UISpringLoadedInteractionSupporting",
819 feature = "UIView"
820))]
821extern_conformance!(
822 unsafe impl UISpringLoadedInteractionSupporting for UIButton {}
823);