objc2_ui_kit/generated/
UIBarButtonItem.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#[cfg(feature = "objc2-symbols")]
10use objc2_symbols::*;
11
12use crate::*;
13
14/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uibarbuttonitemstyle?language=objc)
15// NS_ENUM
16#[repr(transparent)]
17#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
18pub struct UIBarButtonItemStyle(pub NSInteger);
19impl UIBarButtonItemStyle {
20    #[doc(alias = "UIBarButtonItemStylePlain")]
21    pub const Plain: Self = Self(0);
22    #[doc(alias = "UIBarButtonItemStyleBordered")]
23    #[deprecated]
24    pub const Bordered: Self = Self(1);
25    #[doc(alias = "UIBarButtonItemStyleDone")]
26    pub const Done: Self = Self(2);
27}
28
29unsafe impl Encode for UIBarButtonItemStyle {
30    const ENCODING: Encoding = NSInteger::ENCODING;
31}
32
33unsafe impl RefEncode for UIBarButtonItemStyle {
34    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
35}
36
37/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uibarbuttonsystemitem?language=objc)
38// NS_ENUM
39#[repr(transparent)]
40#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
41pub struct UIBarButtonSystemItem(pub NSInteger);
42impl UIBarButtonSystemItem {
43    #[doc(alias = "UIBarButtonSystemItemDone")]
44    pub const Done: Self = Self(0);
45    #[doc(alias = "UIBarButtonSystemItemCancel")]
46    pub const Cancel: Self = Self(1);
47    #[doc(alias = "UIBarButtonSystemItemEdit")]
48    pub const Edit: Self = Self(2);
49    #[doc(alias = "UIBarButtonSystemItemSave")]
50    pub const Save: Self = Self(3);
51    #[doc(alias = "UIBarButtonSystemItemAdd")]
52    pub const Add: Self = Self(4);
53    #[doc(alias = "UIBarButtonSystemItemFlexibleSpace")]
54    pub const FlexibleSpace: Self = Self(5);
55    #[doc(alias = "UIBarButtonSystemItemFixedSpace")]
56    pub const FixedSpace: Self = Self(6);
57    #[doc(alias = "UIBarButtonSystemItemCompose")]
58    pub const Compose: Self = Self(7);
59    #[doc(alias = "UIBarButtonSystemItemReply")]
60    pub const Reply: Self = Self(8);
61    #[doc(alias = "UIBarButtonSystemItemAction")]
62    pub const Action: Self = Self(9);
63    #[doc(alias = "UIBarButtonSystemItemOrganize")]
64    pub const Organize: Self = Self(10);
65    #[doc(alias = "UIBarButtonSystemItemBookmarks")]
66    pub const Bookmarks: Self = Self(11);
67    #[doc(alias = "UIBarButtonSystemItemSearch")]
68    pub const Search: Self = Self(12);
69    #[doc(alias = "UIBarButtonSystemItemRefresh")]
70    pub const Refresh: Self = Self(13);
71    #[doc(alias = "UIBarButtonSystemItemStop")]
72    pub const Stop: Self = Self(14);
73    #[doc(alias = "UIBarButtonSystemItemCamera")]
74    pub const Camera: Self = Self(15);
75    #[doc(alias = "UIBarButtonSystemItemTrash")]
76    pub const Trash: Self = Self(16);
77    #[doc(alias = "UIBarButtonSystemItemPlay")]
78    pub const Play: Self = Self(17);
79    #[doc(alias = "UIBarButtonSystemItemPause")]
80    pub const Pause: Self = Self(18);
81    #[doc(alias = "UIBarButtonSystemItemRewind")]
82    pub const Rewind: Self = Self(19);
83    #[doc(alias = "UIBarButtonSystemItemFastForward")]
84    pub const FastForward: Self = Self(20);
85    #[doc(alias = "UIBarButtonSystemItemUndo")]
86    pub const Undo: Self = Self(21);
87    #[doc(alias = "UIBarButtonSystemItemRedo")]
88    pub const Redo: Self = Self(22);
89    #[doc(alias = "UIBarButtonSystemItemPageCurl")]
90    #[deprecated]
91    pub const PageCurl: Self = Self(23);
92    #[doc(alias = "UIBarButtonSystemItemClose")]
93    pub const Close: Self = Self(24);
94    #[doc(alias = "UIBarButtonSystemItemWritingTools")]
95    pub const WritingTools: Self = Self(25);
96}
97
98unsafe impl Encode for UIBarButtonSystemItem {
99    const ENCODING: Encoding = NSInteger::ENCODING;
100}
101
102unsafe impl RefEncode for UIBarButtonSystemItem {
103    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
104}
105
106extern_class!(
107    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uibarbuttonitem?language=objc)
108    #[unsafe(super(UIBarItem, NSObject))]
109    #[thread_kind = MainThreadOnly]
110    #[derive(Debug, PartialEq, Eq, Hash)]
111    #[cfg(feature = "UIBarItem")]
112    pub struct UIBarButtonItem;
113);
114
115#[cfg(feature = "UIBarItem")]
116extern_conformance!(
117    unsafe impl NSCoding for UIBarButtonItem {}
118);
119
120#[cfg(feature = "UIBarItem")]
121extern_conformance!(
122    unsafe impl NSObjectProtocol for UIBarButtonItem {}
123);
124
125#[cfg(all(feature = "UIAppearance", feature = "UIBarItem"))]
126extern_conformance!(
127    unsafe impl UIAppearance for UIBarButtonItem {}
128);
129
130#[cfg(feature = "UIBarItem")]
131impl UIBarButtonItem {
132    extern_methods!(
133        #[unsafe(method(init))]
134        #[unsafe(method_family = init)]
135        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
136
137        #[unsafe(method(initWithCoder:))]
138        #[unsafe(method_family = init)]
139        pub unsafe fn initWithCoder(
140            this: Allocated<Self>,
141            coder: &NSCoder,
142        ) -> Option<Retained<Self>>;
143
144        #[cfg(feature = "UIImage")]
145        #[unsafe(method(initWithImage:style:target:action:))]
146        #[unsafe(method_family = init)]
147        pub unsafe fn initWithImage_style_target_action(
148            this: Allocated<Self>,
149            image: Option<&UIImage>,
150            style: UIBarButtonItemStyle,
151            target: Option<&AnyObject>,
152            action: Option<Sel>,
153        ) -> Retained<Self>;
154
155        #[cfg(feature = "UIImage")]
156        #[unsafe(method(initWithImage:landscapeImagePhone:style:target:action:))]
157        #[unsafe(method_family = init)]
158        pub unsafe fn initWithImage_landscapeImagePhone_style_target_action(
159            this: Allocated<Self>,
160            image: Option<&UIImage>,
161            landscape_image_phone: Option<&UIImage>,
162            style: UIBarButtonItemStyle,
163            target: Option<&AnyObject>,
164            action: Option<Sel>,
165        ) -> Retained<Self>;
166
167        #[unsafe(method(initWithTitle:style:target:action:))]
168        #[unsafe(method_family = init)]
169        pub unsafe fn initWithTitle_style_target_action(
170            this: Allocated<Self>,
171            title: Option<&NSString>,
172            style: UIBarButtonItemStyle,
173            target: Option<&AnyObject>,
174            action: Option<Sel>,
175        ) -> Retained<Self>;
176
177        #[unsafe(method(initWithBarButtonSystemItem:target:action:))]
178        #[unsafe(method_family = init)]
179        pub unsafe fn initWithBarButtonSystemItem_target_action(
180            this: Allocated<Self>,
181            system_item: UIBarButtonSystemItem,
182            target: Option<&AnyObject>,
183            action: Option<Sel>,
184        ) -> Retained<Self>;
185
186        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
187        #[unsafe(method(initWithCustomView:))]
188        #[unsafe(method_family = init)]
189        pub unsafe fn initWithCustomView(
190            this: Allocated<Self>,
191            custom_view: &UIView,
192        ) -> Retained<Self>;
193
194        #[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
195        /// Creates a bar button item for the given systemItem. The primaryAction is copied, and its title
196        /// &
197        /// image are ignored.
198        #[unsafe(method(initWithBarButtonSystemItem:primaryAction:))]
199        #[unsafe(method_family = init)]
200        pub unsafe fn initWithBarButtonSystemItem_primaryAction(
201            this: Allocated<Self>,
202            system_item: UIBarButtonSystemItem,
203            primary_action: Option<&UIAction>,
204        ) -> Retained<Self>;
205
206        #[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
207        /// Creates a plain-style bar button item from the properties of primaryAction. primaryAction is copied.
208        #[unsafe(method(initWithPrimaryAction:))]
209        #[unsafe(method_family = init)]
210        pub unsafe fn initWithPrimaryAction(
211            this: Allocated<Self>,
212            primary_action: Option<&UIAction>,
213        ) -> Retained<Self>;
214
215        #[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
216        /// Creates a bar button item for the given systemItem. The constructed item will present the menu immediately when touched.
217        #[unsafe(method(initWithBarButtonSystemItem:menu:))]
218        #[unsafe(method_family = init)]
219        pub unsafe fn initWithBarButtonSystemItem_menu(
220            this: Allocated<Self>,
221            system_item: UIBarButtonSystemItem,
222            menu: Option<&UIMenu>,
223        ) -> Retained<Self>;
224
225        #[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
226        /// Creates a plain-style bar button item with the given title. The constructed item will present the menu immediately when touched.
227        #[unsafe(method(initWithTitle:menu:))]
228        #[unsafe(method_family = init)]
229        pub unsafe fn initWithTitle_menu(
230            this: Allocated<Self>,
231            title: Option<&NSString>,
232            menu: Option<&UIMenu>,
233        ) -> Retained<Self>;
234
235        #[cfg(all(feature = "UIImage", feature = "UIMenu", feature = "UIMenuElement"))]
236        /// Creates a plain-style bar button item with the given image. The constructed item will present the menu immediately when touched.
237        #[unsafe(method(initWithImage:menu:))]
238        #[unsafe(method_family = init)]
239        pub unsafe fn initWithImage_menu(
240            this: Allocated<Self>,
241            image: Option<&UIImage>,
242            menu: Option<&UIMenu>,
243        ) -> Retained<Self>;
244
245        #[cfg(all(feature = "UIAction", feature = "UIMenu", feature = "UIMenuElement"))]
246        /// Creates a plain-style bar button item from the properties of primaryAction. primaryAction is copied.
247        #[unsafe(method(initWithPrimaryAction:menu:))]
248        #[unsafe(method_family = init)]
249        pub unsafe fn initWithPrimaryAction_menu(
250            this: Allocated<Self>,
251            primary_action: Option<&UIAction>,
252            menu: Option<&UIMenu>,
253        ) -> Retained<Self>;
254
255        #[cfg(all(feature = "UIAction", feature = "UIMenu", feature = "UIMenuElement"))]
256        /// Creates a bar button item for the given systemItem. The primaryAction is copied, and its title
257        /// &
258        /// image are ignored.
259        #[unsafe(method(initWithBarButtonSystemItem:primaryAction:menu:))]
260        #[unsafe(method_family = init)]
261        pub unsafe fn initWithBarButtonSystemItem_primaryAction_menu(
262            this: Allocated<Self>,
263            system_item: UIBarButtonSystemItem,
264            primary_action: Option<&UIAction>,
265            menu: Option<&UIMenu>,
266        ) -> Retained<Self>;
267
268        #[cfg(all(feature = "UIImage", feature = "UIMenu", feature = "UIMenuElement"))]
269        /// Creates a plain-style bar button item with the given title and image.
270        #[unsafe(method(initWithTitle:image:target:action:menu:))]
271        #[unsafe(method_family = init)]
272        pub unsafe fn initWithTitle_image_target_action_menu(
273            this: Allocated<Self>,
274            title: Option<&NSString>,
275            image: Option<&UIImage>,
276            target: Option<&AnyObject>,
277            action: Option<Sel>,
278            menu: Option<&UIMenu>,
279        ) -> Retained<Self>;
280
281        #[cfg(feature = "objc2-core-foundation")]
282        /// Construct a new fixed space item with the given width.
283        #[unsafe(method(fixedSpaceItemOfWidth:))]
284        #[unsafe(method_family = none)]
285        pub unsafe fn fixedSpaceItemOfWidth(
286            width: CGFloat,
287            mtm: MainThreadMarker,
288        ) -> Retained<Self>;
289
290        /// Construct a new flexible space item.
291        #[unsafe(method(flexibleSpaceItem))]
292        #[unsafe(method_family = none)]
293        pub unsafe fn flexibleSpaceItem(mtm: MainThreadMarker) -> Retained<Self>;
294
295        #[unsafe(method(style))]
296        #[unsafe(method_family = none)]
297        pub unsafe fn style(&self) -> UIBarButtonItemStyle;
298
299        /// Setter for [`style`][Self::style].
300        #[unsafe(method(setStyle:))]
301        #[unsafe(method_family = none)]
302        pub unsafe fn setStyle(&self, style: UIBarButtonItemStyle);
303
304        #[cfg(feature = "objc2-core-foundation")]
305        #[unsafe(method(width))]
306        #[unsafe(method_family = none)]
307        pub unsafe fn width(&self) -> CGFloat;
308
309        #[cfg(feature = "objc2-core-foundation")]
310        /// Setter for [`width`][Self::width].
311        #[unsafe(method(setWidth:))]
312        #[unsafe(method_family = none)]
313        pub unsafe fn setWidth(&self, width: CGFloat);
314
315        #[unsafe(method(possibleTitles))]
316        #[unsafe(method_family = none)]
317        pub unsafe fn possibleTitles(&self) -> Option<Retained<NSSet<NSString>>>;
318
319        /// Setter for [`possibleTitles`][Self::possibleTitles].
320        #[unsafe(method(setPossibleTitles:))]
321        #[unsafe(method_family = none)]
322        pub unsafe fn setPossibleTitles(&self, possible_titles: Option<&NSSet<NSString>>);
323
324        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
325        #[unsafe(method(customView))]
326        #[unsafe(method_family = none)]
327        pub unsafe fn customView(&self) -> Option<Retained<UIView>>;
328
329        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
330        /// Setter for [`customView`][Self::customView].
331        #[unsafe(method(setCustomView:))]
332        #[unsafe(method_family = none)]
333        pub unsafe fn setCustomView(&self, custom_view: Option<&UIView>);
334
335        #[unsafe(method(action))]
336        #[unsafe(method_family = none)]
337        pub unsafe fn action(&self) -> Option<Sel>;
338
339        /// Setter for [`action`][Self::action].
340        #[unsafe(method(setAction:))]
341        #[unsafe(method_family = none)]
342        pub unsafe fn setAction(&self, action: Option<Sel>);
343
344        #[unsafe(method(target))]
345        #[unsafe(method_family = none)]
346        pub unsafe fn target(&self) -> Option<Retained<AnyObject>>;
347
348        /// This is a [weak property][objc2::topics::weak_property].
349        /// Setter for [`target`][Self::target].
350        #[unsafe(method(setTarget:))]
351        #[unsafe(method_family = none)]
352        pub unsafe fn setTarget(&self, target: Option<&AnyObject>);
353
354        #[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
355        /// Set the primaryAction on this item, updating the title
356        /// &
357        /// image of the item if appropriate (primaryAction is non-nil, and this is not a system item). When primaryAction is non-nil, the target
358        /// &
359        /// action properties are ignored. If primaryAction is set to nil, the title
360        /// &
361        /// image properties are left unchanged.
362        #[unsafe(method(primaryAction))]
363        #[unsafe(method_family = none)]
364        pub unsafe fn primaryAction(&self) -> Option<Retained<UIAction>>;
365
366        #[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
367        /// Setter for [`primaryAction`][Self::primaryAction].
368        #[unsafe(method(setPrimaryAction:))]
369        #[unsafe(method_family = none)]
370        pub unsafe fn setPrimaryAction(&self, primary_action: Option<&UIAction>);
371
372        #[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
373        /// When non-nil the menu is presented, the gesture used to trigger the menu is based on if the bar button item would normally trigger an action when tapped.
374        #[unsafe(method(menu))]
375        #[unsafe(method_family = none)]
376        pub unsafe fn menu(&self) -> Option<Retained<UIMenu>>;
377
378        #[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
379        /// Setter for [`menu`][Self::menu].
380        #[unsafe(method(setMenu:))]
381        #[unsafe(method_family = none)]
382        pub unsafe fn setMenu(&self, menu: Option<&UIMenu>);
383
384        #[cfg(feature = "UIContextMenuConfiguration")]
385        /// Preferred menu element ordering strategy for menus displayed by this button.
386        #[unsafe(method(preferredMenuElementOrder))]
387        #[unsafe(method_family = none)]
388        pub unsafe fn preferredMenuElementOrder(&self) -> UIContextMenuConfigurationElementOrder;
389
390        #[cfg(feature = "UIContextMenuConfiguration")]
391        /// Setter for [`preferredMenuElementOrder`][Self::preferredMenuElementOrder].
392        #[unsafe(method(setPreferredMenuElementOrder:))]
393        #[unsafe(method_family = none)]
394        pub unsafe fn setPreferredMenuElementOrder(
395            &self,
396            preferred_menu_element_order: UIContextMenuConfigurationElementOrder,
397        );
398
399        /// Indicates if the button changes selection as its primary action.
400        /// This shows the menu as options for selection if a menu is populated and no action when tapped is enabled.
401        /// If no menu is provided and no action is enabled when tapped, the item is toggled on and off for the primary action.
402        #[unsafe(method(changesSelectionAsPrimaryAction))]
403        #[unsafe(method_family = none)]
404        pub unsafe fn changesSelectionAsPrimaryAction(&self) -> bool;
405
406        /// Setter for [`changesSelectionAsPrimaryAction`][Self::changesSelectionAsPrimaryAction].
407        #[unsafe(method(setChangesSelectionAsPrimaryAction:))]
408        #[unsafe(method_family = none)]
409        pub unsafe fn setChangesSelectionAsPrimaryAction(
410            &self,
411            changes_selection_as_primary_action: bool,
412        );
413
414        #[unsafe(method(isSelected))]
415        #[unsafe(method_family = none)]
416        pub unsafe fn isSelected(&self) -> bool;
417
418        /// Setter for [`isSelected`][Self::isSelected].
419        #[unsafe(method(setSelected:))]
420        #[unsafe(method_family = none)]
421        pub unsafe fn setSelected(&self, selected: bool);
422
423        /// If the item should be hidden from display.
424        #[unsafe(method(isHidden))]
425        #[unsafe(method_family = none)]
426        pub unsafe fn isHidden(&self) -> bool;
427
428        /// Setter for [`isHidden`][Self::isHidden].
429        #[unsafe(method(setHidden:))]
430        #[unsafe(method_family = none)]
431        pub unsafe fn setHidden(&self, hidden: bool);
432
433        /// Whether or not symbol animations are enabled for this bar button item.
434        #[unsafe(method(isSymbolAnimationEnabled))]
435        #[unsafe(method_family = none)]
436        pub unsafe fn isSymbolAnimationEnabled(&self) -> bool;
437
438        /// Setter for [`isSymbolAnimationEnabled`][Self::isSymbolAnimationEnabled].
439        #[unsafe(method(setSymbolAnimationEnabled:))]
440        #[unsafe(method_family = none)]
441        pub unsafe fn setSymbolAnimationEnabled(&self, symbol_animation_enabled: bool);
442
443        #[cfg(feature = "UIMenuElement")]
444        /// A UIMenuElement that should substitute for the UIBarButtonItem when displayed in a menu.
445        #[unsafe(method(menuRepresentation))]
446        #[unsafe(method_family = none)]
447        pub unsafe fn menuRepresentation(&self) -> Option<Retained<UIMenuElement>>;
448
449        #[cfg(feature = "UIMenuElement")]
450        /// Setter for [`menuRepresentation`][Self::menuRepresentation].
451        #[unsafe(method(setMenuRepresentation:))]
452        #[unsafe(method_family = none)]
453        pub unsafe fn setMenuRepresentation(&self, menu_representation: Option<&UIMenuElement>);
454
455        #[cfg(feature = "UIBarButtonItemGroup")]
456        /// Create a fixed group containing this bar button item. UIBarButtonItems may only be in a single UIBarButtonItemGroup at a time, adding a bar button item to a group removes it from any previous group.
457        #[unsafe(method(creatingFixedGroup))]
458        #[unsafe(method_family = none)]
459        pub unsafe fn creatingFixedGroup(&self) -> Retained<UIBarButtonItemGroup>;
460
461        #[cfg(feature = "UIBarButtonItemGroup")]
462        /// Create a movable group containing this bar button item. UIBarButtonItems may only be in a single UIBarButtonItemGroup at a time, adding a bar button item to a group removes it from any previous group.
463        #[unsafe(method(creatingMovableGroupWithCustomizationIdentifier:))]
464        #[unsafe(method_family = none)]
465        pub unsafe fn creatingMovableGroupWithCustomizationIdentifier(
466            &self,
467            customization_identifier: &NSString,
468        ) -> Retained<UIBarButtonItemGroup>;
469
470        #[cfg(feature = "UIBarButtonItemGroup")]
471        /// Create an optional group containing this bar button item. UIBarButtonItems may only be in a single UIBarButtonItemGroup at a time, adding a bar button item to a group removes it from any previous group.
472        #[unsafe(method(creatingOptionalGroupWithCustomizationIdentifier:inDefaultCustomization:))]
473        #[unsafe(method_family = none)]
474        pub unsafe fn creatingOptionalGroupWithCustomizationIdentifier_inDefaultCustomization(
475            &self,
476            customization_identifier: &NSString,
477            in_default_customization: bool,
478        ) -> Retained<UIBarButtonItemGroup>;
479
480        #[cfg(all(feature = "UIBarCommon", feature = "UIControl", feature = "UIImage"))]
481        #[unsafe(method(setBackgroundImage:forState:barMetrics:))]
482        #[unsafe(method_family = none)]
483        pub unsafe fn setBackgroundImage_forState_barMetrics(
484            &self,
485            background_image: Option<&UIImage>,
486            state: UIControlState,
487            bar_metrics: UIBarMetrics,
488        );
489
490        #[cfg(all(feature = "UIBarCommon", feature = "UIControl", feature = "UIImage"))]
491        #[unsafe(method(backgroundImageForState:barMetrics:))]
492        #[unsafe(method_family = none)]
493        pub unsafe fn backgroundImageForState_barMetrics(
494            &self,
495            state: UIControlState,
496            bar_metrics: UIBarMetrics,
497        ) -> Option<Retained<UIImage>>;
498
499        #[cfg(all(feature = "UIBarCommon", feature = "UIControl", feature = "UIImage"))]
500        #[unsafe(method(setBackgroundImage:forState:style:barMetrics:))]
501        #[unsafe(method_family = none)]
502        pub unsafe fn setBackgroundImage_forState_style_barMetrics(
503            &self,
504            background_image: Option<&UIImage>,
505            state: UIControlState,
506            style: UIBarButtonItemStyle,
507            bar_metrics: UIBarMetrics,
508        );
509
510        #[cfg(all(feature = "UIBarCommon", feature = "UIControl", feature = "UIImage"))]
511        #[unsafe(method(backgroundImageForState:style:barMetrics:))]
512        #[unsafe(method_family = none)]
513        pub unsafe fn backgroundImageForState_style_barMetrics(
514            &self,
515            state: UIControlState,
516            style: UIBarButtonItemStyle,
517            bar_metrics: UIBarMetrics,
518        ) -> Option<Retained<UIImage>>;
519
520        #[cfg(feature = "UIColor")]
521        #[unsafe(method(tintColor))]
522        #[unsafe(method_family = none)]
523        pub unsafe fn tintColor(&self) -> Option<Retained<UIColor>>;
524
525        #[cfg(feature = "UIColor")]
526        /// Setter for [`tintColor`][Self::tintColor].
527        #[unsafe(method(setTintColor:))]
528        #[unsafe(method_family = none)]
529        pub unsafe fn setTintColor(&self, tint_color: Option<&UIColor>);
530
531        #[cfg(all(feature = "UIBarCommon", feature = "objc2-core-foundation"))]
532        #[unsafe(method(setBackgroundVerticalPositionAdjustment:forBarMetrics:))]
533        #[unsafe(method_family = none)]
534        pub unsafe fn setBackgroundVerticalPositionAdjustment_forBarMetrics(
535            &self,
536            adjustment: CGFloat,
537            bar_metrics: UIBarMetrics,
538        );
539
540        #[cfg(all(feature = "UIBarCommon", feature = "objc2-core-foundation"))]
541        #[unsafe(method(backgroundVerticalPositionAdjustmentForBarMetrics:))]
542        #[unsafe(method_family = none)]
543        pub unsafe fn backgroundVerticalPositionAdjustmentForBarMetrics(
544            &self,
545            bar_metrics: UIBarMetrics,
546        ) -> CGFloat;
547
548        #[cfg(all(
549            feature = "UIBarCommon",
550            feature = "UIGeometry",
551            feature = "objc2-core-foundation"
552        ))]
553        #[unsafe(method(setTitlePositionAdjustment:forBarMetrics:))]
554        #[unsafe(method_family = none)]
555        pub unsafe fn setTitlePositionAdjustment_forBarMetrics(
556            &self,
557            adjustment: UIOffset,
558            bar_metrics: UIBarMetrics,
559        );
560
561        #[cfg(all(
562            feature = "UIBarCommon",
563            feature = "UIGeometry",
564            feature = "objc2-core-foundation"
565        ))]
566        #[unsafe(method(titlePositionAdjustmentForBarMetrics:))]
567        #[unsafe(method_family = none)]
568        pub unsafe fn titlePositionAdjustmentForBarMetrics(
569            &self,
570            bar_metrics: UIBarMetrics,
571        ) -> UIOffset;
572
573        #[cfg(all(feature = "UIBarCommon", feature = "UIControl", feature = "UIImage"))]
574        #[unsafe(method(setBackButtonBackgroundImage:forState:barMetrics:))]
575        #[unsafe(method_family = none)]
576        pub unsafe fn setBackButtonBackgroundImage_forState_barMetrics(
577            &self,
578            background_image: Option<&UIImage>,
579            state: UIControlState,
580            bar_metrics: UIBarMetrics,
581        );
582
583        #[cfg(all(feature = "UIBarCommon", feature = "UIControl", feature = "UIImage"))]
584        #[unsafe(method(backButtonBackgroundImageForState:barMetrics:))]
585        #[unsafe(method_family = none)]
586        pub unsafe fn backButtonBackgroundImageForState_barMetrics(
587            &self,
588            state: UIControlState,
589            bar_metrics: UIBarMetrics,
590        ) -> Option<Retained<UIImage>>;
591
592        #[cfg(all(
593            feature = "UIBarCommon",
594            feature = "UIGeometry",
595            feature = "objc2-core-foundation"
596        ))]
597        #[unsafe(method(setBackButtonTitlePositionAdjustment:forBarMetrics:))]
598        #[unsafe(method_family = none)]
599        pub unsafe fn setBackButtonTitlePositionAdjustment_forBarMetrics(
600            &self,
601            adjustment: UIOffset,
602            bar_metrics: UIBarMetrics,
603        );
604
605        #[cfg(all(
606            feature = "UIBarCommon",
607            feature = "UIGeometry",
608            feature = "objc2-core-foundation"
609        ))]
610        #[unsafe(method(backButtonTitlePositionAdjustmentForBarMetrics:))]
611        #[unsafe(method_family = none)]
612        pub unsafe fn backButtonTitlePositionAdjustmentForBarMetrics(
613            &self,
614            bar_metrics: UIBarMetrics,
615        ) -> UIOffset;
616
617        #[cfg(all(feature = "UIBarCommon", feature = "objc2-core-foundation"))]
618        #[unsafe(method(setBackButtonBackgroundVerticalPositionAdjustment:forBarMetrics:))]
619        #[unsafe(method_family = none)]
620        pub unsafe fn setBackButtonBackgroundVerticalPositionAdjustment_forBarMetrics(
621            &self,
622            adjustment: CGFloat,
623            bar_metrics: UIBarMetrics,
624        );
625
626        #[cfg(all(feature = "UIBarCommon", feature = "objc2-core-foundation"))]
627        #[unsafe(method(backButtonBackgroundVerticalPositionAdjustmentForBarMetrics:))]
628        #[unsafe(method_family = none)]
629        pub unsafe fn backButtonBackgroundVerticalPositionAdjustmentForBarMetrics(
630            &self,
631            bar_metrics: UIBarMetrics,
632        ) -> CGFloat;
633    );
634}
635
636/// Methods declared on superclass `NSObject`.
637#[cfg(feature = "UIBarItem")]
638impl UIBarButtonItem {
639    extern_methods!(
640        #[unsafe(method(new))]
641        #[unsafe(method_family = new)]
642        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
643    );
644}
645
646/// SpringLoading.
647#[cfg(feature = "UIBarItem")]
648impl UIBarButtonItem {
649    extern_methods!();
650}
651
652#[cfg(all(feature = "UIBarItem", feature = "UISpringLoadedInteractionSupporting"))]
653extern_conformance!(
654    unsafe impl UISpringLoadedInteractionSupporting for UIBarButtonItem {}
655);
656
657#[cfg(feature = "UIBarItem")]
658impl UIBarButtonItem {
659    extern_methods!(
660        #[cfg(feature = "objc2-symbols")]
661        /// Adds a symbol effect to the bar button item with default options and animation.
662        /// Only a subset of symbol effects are supported; Appear and Disappear effects, for example, are unsupported, and will assert.
663        #[unsafe(method(addSymbolEffect:))]
664        #[unsafe(method_family = none)]
665        pub unsafe fn addSymbolEffect(&self, symbol_effect: &NSSymbolEffect);
666
667        #[cfg(feature = "objc2-symbols")]
668        /// Adds a symbol effect to the bar button item with specified options and default animation.
669        /// Only a subset of symbol effects are supported; Appear and Disappear effects, for example, are unsupported, and will assert.
670        #[unsafe(method(addSymbolEffect:options:))]
671        #[unsafe(method_family = none)]
672        pub unsafe fn addSymbolEffect_options(
673            &self,
674            symbol_effect: &NSSymbolEffect,
675            options: &NSSymbolEffectOptions,
676        );
677
678        #[cfg(feature = "objc2-symbols")]
679        /// Adds a symbol effect to the bar button item with specified options and animation.
680        /// Only a subset of symbol effects are supported; Appear and Disappear effects, for example, are unsupported, and will assert.
681        #[unsafe(method(addSymbolEffect:options:animated:))]
682        #[unsafe(method_family = none)]
683        pub unsafe fn addSymbolEffect_options_animated(
684            &self,
685            symbol_effect: &NSSymbolEffect,
686            options: &NSSymbolEffectOptions,
687            animated: bool,
688        );
689
690        #[cfg(feature = "objc2-symbols")]
691        /// Removes from the bar button item the symbol effect matching the type of effect passed in, with default options and animation.
692        #[unsafe(method(removeSymbolEffectOfType:))]
693        #[unsafe(method_family = none)]
694        pub unsafe fn removeSymbolEffectOfType(&self, symbol_effect: &NSSymbolEffect);
695
696        #[cfg(feature = "objc2-symbols")]
697        /// Removes from the bar button item the symbol effect matching the type of effect passed in, with specified options and default animation.
698        #[unsafe(method(removeSymbolEffectOfType:options:))]
699        #[unsafe(method_family = none)]
700        pub unsafe fn removeSymbolEffectOfType_options(
701            &self,
702            symbol_effect: &NSSymbolEffect,
703            options: &NSSymbolEffectOptions,
704        );
705
706        #[cfg(feature = "objc2-symbols")]
707        /// Removes from the bar button item the symbol effect matching the type of effect passed in, with specified options and animation.
708        #[unsafe(method(removeSymbolEffectOfType:options:animated:))]
709        #[unsafe(method_family = none)]
710        pub unsafe fn removeSymbolEffectOfType_options_animated(
711            &self,
712            symbol_effect: &NSSymbolEffect,
713            options: &NSSymbolEffectOptions,
714            animated: bool,
715        );
716
717        /// Removes all symbol effects from the bar button item with default options and animation.
718        #[unsafe(method(removeAllSymbolEffects))]
719        #[unsafe(method_family = none)]
720        pub unsafe fn removeAllSymbolEffects(&self);
721
722        #[cfg(feature = "objc2-symbols")]
723        /// Removes all symbol effects from the bar button item with specified options and default animation.
724        #[unsafe(method(removeAllSymbolEffectsWithOptions:))]
725        #[unsafe(method_family = none)]
726        pub unsafe fn removeAllSymbolEffectsWithOptions(&self, options: &NSSymbolEffectOptions);
727
728        #[cfg(feature = "objc2-symbols")]
729        /// Removes all symbol effects from the bar button item with specified options and animation.
730        #[unsafe(method(removeAllSymbolEffectsWithOptions:animated:))]
731        #[unsafe(method_family = none)]
732        pub unsafe fn removeAllSymbolEffectsWithOptions_animated(
733            &self,
734            options: &NSSymbolEffectOptions,
735            animated: bool,
736        );
737
738        #[cfg(all(feature = "UIImage", feature = "objc2-symbols"))]
739        /// Sets the symbol image on the bar button item with a symbol content transition and default options.
740        /// Passing in a non-symbol image will result in undefined behavior.
741        #[unsafe(method(setSymbolImage:withContentTransition:))]
742        #[unsafe(method_family = none)]
743        pub unsafe fn setSymbolImage_withContentTransition(
744            &self,
745            symbol_image: &UIImage,
746            transition: &NSSymbolContentTransition,
747        );
748
749        #[cfg(all(feature = "UIImage", feature = "objc2-symbols"))]
750        /// Sets the symbol image on the bar button item with a symbol content transition and specified options.
751        /// Passing in a non-symbol image will result in undefined behavior.
752        #[unsafe(method(setSymbolImage:withContentTransition:options:))]
753        #[unsafe(method_family = none)]
754        pub unsafe fn setSymbolImage_withContentTransition_options(
755            &self,
756            symbol_image: &UIImage,
757            transition: &NSSymbolContentTransition,
758            options: &NSSymbolEffectOptions,
759        );
760    );
761}