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    #[deprecated]
23    #[doc(alias = "UIBarButtonItemStyleBordered")]
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    #[deprecated]
90    #[doc(alias = "UIBarButtonSystemItemPageCurl")]
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")]
116unsafe impl NSCoding for UIBarButtonItem {}
117
118#[cfg(feature = "UIBarItem")]
119unsafe impl NSObjectProtocol for UIBarButtonItem {}
120
121#[cfg(all(feature = "UIAppearance", feature = "UIBarItem"))]
122unsafe impl UIAppearance for UIBarButtonItem {}
123
124#[cfg(feature = "UIBarItem")]
125impl UIBarButtonItem {
126    extern_methods!(
127        #[unsafe(method(init))]
128        #[unsafe(method_family = init)]
129        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
130
131        #[unsafe(method(initWithCoder:))]
132        #[unsafe(method_family = init)]
133        pub unsafe fn initWithCoder(
134            this: Allocated<Self>,
135            coder: &NSCoder,
136        ) -> Option<Retained<Self>>;
137
138        #[cfg(feature = "UIImage")]
139        #[unsafe(method(initWithImage:style:target:action:))]
140        #[unsafe(method_family = init)]
141        pub unsafe fn initWithImage_style_target_action(
142            this: Allocated<Self>,
143            image: Option<&UIImage>,
144            style: UIBarButtonItemStyle,
145            target: Option<&AnyObject>,
146            action: Option<Sel>,
147        ) -> Retained<Self>;
148
149        #[cfg(feature = "UIImage")]
150        #[unsafe(method(initWithImage:landscapeImagePhone:style:target:action:))]
151        #[unsafe(method_family = init)]
152        pub unsafe fn initWithImage_landscapeImagePhone_style_target_action(
153            this: Allocated<Self>,
154            image: Option<&UIImage>,
155            landscape_image_phone: Option<&UIImage>,
156            style: UIBarButtonItemStyle,
157            target: Option<&AnyObject>,
158            action: Option<Sel>,
159        ) -> Retained<Self>;
160
161        #[unsafe(method(initWithTitle:style:target:action:))]
162        #[unsafe(method_family = init)]
163        pub unsafe fn initWithTitle_style_target_action(
164            this: Allocated<Self>,
165            title: Option<&NSString>,
166            style: UIBarButtonItemStyle,
167            target: Option<&AnyObject>,
168            action: Option<Sel>,
169        ) -> Retained<Self>;
170
171        #[unsafe(method(initWithBarButtonSystemItem:target:action:))]
172        #[unsafe(method_family = init)]
173        pub unsafe fn initWithBarButtonSystemItem_target_action(
174            this: Allocated<Self>,
175            system_item: UIBarButtonSystemItem,
176            target: Option<&AnyObject>,
177            action: Option<Sel>,
178        ) -> Retained<Self>;
179
180        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
181        #[unsafe(method(initWithCustomView:))]
182        #[unsafe(method_family = init)]
183        pub unsafe fn initWithCustomView(
184            this: Allocated<Self>,
185            custom_view: &UIView,
186        ) -> Retained<Self>;
187
188        #[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
189        /// Creates a bar button item for the given systemItem. The primaryAction is copied, and its title
190        /// &
191        /// image are ignored.
192        #[unsafe(method(initWithBarButtonSystemItem:primaryAction:))]
193        #[unsafe(method_family = init)]
194        pub unsafe fn initWithBarButtonSystemItem_primaryAction(
195            this: Allocated<Self>,
196            system_item: UIBarButtonSystemItem,
197            primary_action: Option<&UIAction>,
198        ) -> Retained<Self>;
199
200        #[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
201        /// Creates a plain-style bar button item from the properties of primaryAction. primaryAction is copied.
202        #[unsafe(method(initWithPrimaryAction:))]
203        #[unsafe(method_family = init)]
204        pub unsafe fn initWithPrimaryAction(
205            this: Allocated<Self>,
206            primary_action: Option<&UIAction>,
207        ) -> Retained<Self>;
208
209        #[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
210        /// Creates a bar button item for the given systemItem. The constructed item will present the menu immediately when touched.
211        #[unsafe(method(initWithBarButtonSystemItem:menu:))]
212        #[unsafe(method_family = init)]
213        pub unsafe fn initWithBarButtonSystemItem_menu(
214            this: Allocated<Self>,
215            system_item: UIBarButtonSystemItem,
216            menu: Option<&UIMenu>,
217        ) -> Retained<Self>;
218
219        #[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
220        /// Creates a plain-style bar button item with the given title. The constructed item will present the menu immediately when touched.
221        #[unsafe(method(initWithTitle:menu:))]
222        #[unsafe(method_family = init)]
223        pub unsafe fn initWithTitle_menu(
224            this: Allocated<Self>,
225            title: Option<&NSString>,
226            menu: Option<&UIMenu>,
227        ) -> Retained<Self>;
228
229        #[cfg(all(feature = "UIImage", feature = "UIMenu", feature = "UIMenuElement"))]
230        /// Creates a plain-style bar button item with the given image. The constructed item will present the menu immediately when touched.
231        #[unsafe(method(initWithImage:menu:))]
232        #[unsafe(method_family = init)]
233        pub unsafe fn initWithImage_menu(
234            this: Allocated<Self>,
235            image: Option<&UIImage>,
236            menu: Option<&UIMenu>,
237        ) -> Retained<Self>;
238
239        #[cfg(all(feature = "UIAction", feature = "UIMenu", feature = "UIMenuElement"))]
240        /// Creates a plain-style bar button item from the properties of primaryAction. primaryAction is copied.
241        #[unsafe(method(initWithPrimaryAction:menu:))]
242        #[unsafe(method_family = init)]
243        pub unsafe fn initWithPrimaryAction_menu(
244            this: Allocated<Self>,
245            primary_action: Option<&UIAction>,
246            menu: Option<&UIMenu>,
247        ) -> Retained<Self>;
248
249        #[cfg(all(feature = "UIAction", feature = "UIMenu", feature = "UIMenuElement"))]
250        /// Creates a bar button item for the given systemItem. The primaryAction is copied, and its title
251        /// &
252        /// image are ignored.
253        #[unsafe(method(initWithBarButtonSystemItem:primaryAction:menu:))]
254        #[unsafe(method_family = init)]
255        pub unsafe fn initWithBarButtonSystemItem_primaryAction_menu(
256            this: Allocated<Self>,
257            system_item: UIBarButtonSystemItem,
258            primary_action: Option<&UIAction>,
259            menu: Option<&UIMenu>,
260        ) -> Retained<Self>;
261
262        #[cfg(all(feature = "UIImage", feature = "UIMenu", feature = "UIMenuElement"))]
263        /// Creates a plain-style bar button item with the given title and image.
264        #[unsafe(method(initWithTitle:image:target:action:menu:))]
265        #[unsafe(method_family = init)]
266        pub unsafe fn initWithTitle_image_target_action_menu(
267            this: Allocated<Self>,
268            title: Option<&NSString>,
269            image: Option<&UIImage>,
270            target: Option<&AnyObject>,
271            action: Option<Sel>,
272            menu: Option<&UIMenu>,
273        ) -> Retained<Self>;
274
275        #[cfg(feature = "objc2-core-foundation")]
276        /// Construct a new fixed space item with the given width.
277        #[unsafe(method(fixedSpaceItemOfWidth:))]
278        #[unsafe(method_family = none)]
279        pub unsafe fn fixedSpaceItemOfWidth(
280            width: CGFloat,
281            mtm: MainThreadMarker,
282        ) -> Retained<Self>;
283
284        /// Construct a new flexible space item.
285        #[unsafe(method(flexibleSpaceItem))]
286        #[unsafe(method_family = none)]
287        pub unsafe fn flexibleSpaceItem(mtm: MainThreadMarker) -> Retained<Self>;
288
289        #[unsafe(method(style))]
290        #[unsafe(method_family = none)]
291        pub unsafe fn style(&self) -> UIBarButtonItemStyle;
292
293        /// Setter for [`style`][Self::style].
294        #[unsafe(method(setStyle:))]
295        #[unsafe(method_family = none)]
296        pub unsafe fn setStyle(&self, style: UIBarButtonItemStyle);
297
298        #[cfg(feature = "objc2-core-foundation")]
299        #[unsafe(method(width))]
300        #[unsafe(method_family = none)]
301        pub unsafe fn width(&self) -> CGFloat;
302
303        #[cfg(feature = "objc2-core-foundation")]
304        /// Setter for [`width`][Self::width].
305        #[unsafe(method(setWidth:))]
306        #[unsafe(method_family = none)]
307        pub unsafe fn setWidth(&self, width: CGFloat);
308
309        #[unsafe(method(possibleTitles))]
310        #[unsafe(method_family = none)]
311        pub unsafe fn possibleTitles(&self) -> Option<Retained<NSSet<NSString>>>;
312
313        /// Setter for [`possibleTitles`][Self::possibleTitles].
314        #[unsafe(method(setPossibleTitles:))]
315        #[unsafe(method_family = none)]
316        pub unsafe fn setPossibleTitles(&self, possible_titles: Option<&NSSet<NSString>>);
317
318        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
319        #[unsafe(method(customView))]
320        #[unsafe(method_family = none)]
321        pub unsafe fn customView(&self) -> Option<Retained<UIView>>;
322
323        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
324        /// Setter for [`customView`][Self::customView].
325        #[unsafe(method(setCustomView:))]
326        #[unsafe(method_family = none)]
327        pub unsafe fn setCustomView(&self, custom_view: Option<&UIView>);
328
329        #[unsafe(method(action))]
330        #[unsafe(method_family = none)]
331        pub unsafe fn action(&self) -> Option<Sel>;
332
333        /// Setter for [`action`][Self::action].
334        #[unsafe(method(setAction:))]
335        #[unsafe(method_family = none)]
336        pub unsafe fn setAction(&self, action: Option<Sel>);
337
338        #[unsafe(method(target))]
339        #[unsafe(method_family = none)]
340        pub unsafe fn target(&self) -> Option<Retained<AnyObject>>;
341
342        /// This is a [weak property][objc2::topics::weak_property].
343        /// Setter for [`target`][Self::target].
344        #[unsafe(method(setTarget:))]
345        #[unsafe(method_family = none)]
346        pub unsafe fn setTarget(&self, target: Option<&AnyObject>);
347
348        #[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
349        /// Set the primaryAction on this item, updating the title
350        /// &
351        /// image of the item if appropriate (primaryAction is non-nil, and this is not a system item). When primaryAction is non-nil, the target
352        /// &
353        /// action properties are ignored. If primaryAction is set to nil, the title
354        /// &
355        /// image properties are left unchanged.
356        #[unsafe(method(primaryAction))]
357        #[unsafe(method_family = none)]
358        pub unsafe fn primaryAction(&self) -> Option<Retained<UIAction>>;
359
360        #[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
361        /// Setter for [`primaryAction`][Self::primaryAction].
362        #[unsafe(method(setPrimaryAction:))]
363        #[unsafe(method_family = none)]
364        pub unsafe fn setPrimaryAction(&self, primary_action: Option<&UIAction>);
365
366        #[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
367        /// 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.
368        #[unsafe(method(menu))]
369        #[unsafe(method_family = none)]
370        pub unsafe fn menu(&self) -> Option<Retained<UIMenu>>;
371
372        #[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
373        /// Setter for [`menu`][Self::menu].
374        #[unsafe(method(setMenu:))]
375        #[unsafe(method_family = none)]
376        pub unsafe fn setMenu(&self, menu: Option<&UIMenu>);
377
378        #[cfg(feature = "UIContextMenuConfiguration")]
379        /// Preferred menu element ordering strategy for menus displayed by this button.
380        #[unsafe(method(preferredMenuElementOrder))]
381        #[unsafe(method_family = none)]
382        pub unsafe fn preferredMenuElementOrder(&self) -> UIContextMenuConfigurationElementOrder;
383
384        #[cfg(feature = "UIContextMenuConfiguration")]
385        /// Setter for [`preferredMenuElementOrder`][Self::preferredMenuElementOrder].
386        #[unsafe(method(setPreferredMenuElementOrder:))]
387        #[unsafe(method_family = none)]
388        pub unsafe fn setPreferredMenuElementOrder(
389            &self,
390            preferred_menu_element_order: UIContextMenuConfigurationElementOrder,
391        );
392
393        /// Indicates if the button changes selection as its primary action.
394        /// This shows the menu as options for selection if a menu is populated and no action when tapped is enabled.
395        /// If no menu is provided and no action is enabled when tapped, the item is toggled on and off for the primary action.
396        #[unsafe(method(changesSelectionAsPrimaryAction))]
397        #[unsafe(method_family = none)]
398        pub unsafe fn changesSelectionAsPrimaryAction(&self) -> bool;
399
400        /// Setter for [`changesSelectionAsPrimaryAction`][Self::changesSelectionAsPrimaryAction].
401        #[unsafe(method(setChangesSelectionAsPrimaryAction:))]
402        #[unsafe(method_family = none)]
403        pub unsafe fn setChangesSelectionAsPrimaryAction(
404            &self,
405            changes_selection_as_primary_action: bool,
406        );
407
408        #[unsafe(method(isSelected))]
409        #[unsafe(method_family = none)]
410        pub unsafe fn isSelected(&self) -> bool;
411
412        /// Setter for [`isSelected`][Self::isSelected].
413        #[unsafe(method(setSelected:))]
414        #[unsafe(method_family = none)]
415        pub unsafe fn setSelected(&self, selected: bool);
416
417        /// If the item should be hidden from display.
418        #[unsafe(method(isHidden))]
419        #[unsafe(method_family = none)]
420        pub unsafe fn isHidden(&self) -> bool;
421
422        /// Setter for [`isHidden`][Self::isHidden].
423        #[unsafe(method(setHidden:))]
424        #[unsafe(method_family = none)]
425        pub unsafe fn setHidden(&self, hidden: bool);
426
427        /// Whether or not symbol animations are enabled for this bar button item.
428        #[unsafe(method(isSymbolAnimationEnabled))]
429        #[unsafe(method_family = none)]
430        pub unsafe fn isSymbolAnimationEnabled(&self) -> bool;
431
432        /// Setter for [`isSymbolAnimationEnabled`][Self::isSymbolAnimationEnabled].
433        #[unsafe(method(setSymbolAnimationEnabled:))]
434        #[unsafe(method_family = none)]
435        pub unsafe fn setSymbolAnimationEnabled(&self, symbol_animation_enabled: bool);
436
437        #[cfg(feature = "UIMenuElement")]
438        /// A UIMenuElement that should substitute for the UIBarButtonItem when displayed in a menu.
439        #[unsafe(method(menuRepresentation))]
440        #[unsafe(method_family = none)]
441        pub unsafe fn menuRepresentation(&self) -> Option<Retained<UIMenuElement>>;
442
443        #[cfg(feature = "UIMenuElement")]
444        /// Setter for [`menuRepresentation`][Self::menuRepresentation].
445        #[unsafe(method(setMenuRepresentation:))]
446        #[unsafe(method_family = none)]
447        pub unsafe fn setMenuRepresentation(&self, menu_representation: Option<&UIMenuElement>);
448
449        #[cfg(feature = "UIBarButtonItemGroup")]
450        /// 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.
451        #[unsafe(method(creatingFixedGroup))]
452        #[unsafe(method_family = none)]
453        pub unsafe fn creatingFixedGroup(&self) -> Retained<UIBarButtonItemGroup>;
454
455        #[cfg(feature = "UIBarButtonItemGroup")]
456        /// 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.
457        #[unsafe(method(creatingMovableGroupWithCustomizationIdentifier:))]
458        #[unsafe(method_family = none)]
459        pub unsafe fn creatingMovableGroupWithCustomizationIdentifier(
460            &self,
461            customization_identifier: &NSString,
462        ) -> Retained<UIBarButtonItemGroup>;
463
464        #[cfg(feature = "UIBarButtonItemGroup")]
465        /// 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.
466        #[unsafe(method(creatingOptionalGroupWithCustomizationIdentifier:inDefaultCustomization:))]
467        #[unsafe(method_family = none)]
468        pub unsafe fn creatingOptionalGroupWithCustomizationIdentifier_inDefaultCustomization(
469            &self,
470            customization_identifier: &NSString,
471            in_default_customization: bool,
472        ) -> Retained<UIBarButtonItemGroup>;
473
474        #[cfg(all(feature = "UIBarCommon", feature = "UIControl", feature = "UIImage"))]
475        #[unsafe(method(setBackgroundImage:forState:barMetrics:))]
476        #[unsafe(method_family = none)]
477        pub unsafe fn setBackgroundImage_forState_barMetrics(
478            &self,
479            background_image: Option<&UIImage>,
480            state: UIControlState,
481            bar_metrics: UIBarMetrics,
482        );
483
484        #[cfg(all(feature = "UIBarCommon", feature = "UIControl", feature = "UIImage"))]
485        #[unsafe(method(backgroundImageForState:barMetrics:))]
486        #[unsafe(method_family = none)]
487        pub unsafe fn backgroundImageForState_barMetrics(
488            &self,
489            state: UIControlState,
490            bar_metrics: UIBarMetrics,
491        ) -> Option<Retained<UIImage>>;
492
493        #[cfg(all(feature = "UIBarCommon", feature = "UIControl", feature = "UIImage"))]
494        #[unsafe(method(setBackgroundImage:forState:style:barMetrics:))]
495        #[unsafe(method_family = none)]
496        pub unsafe fn setBackgroundImage_forState_style_barMetrics(
497            &self,
498            background_image: Option<&UIImage>,
499            state: UIControlState,
500            style: UIBarButtonItemStyle,
501            bar_metrics: UIBarMetrics,
502        );
503
504        #[cfg(all(feature = "UIBarCommon", feature = "UIControl", feature = "UIImage"))]
505        #[unsafe(method(backgroundImageForState:style:barMetrics:))]
506        #[unsafe(method_family = none)]
507        pub unsafe fn backgroundImageForState_style_barMetrics(
508            &self,
509            state: UIControlState,
510            style: UIBarButtonItemStyle,
511            bar_metrics: UIBarMetrics,
512        ) -> Option<Retained<UIImage>>;
513
514        #[cfg(feature = "UIColor")]
515        #[unsafe(method(tintColor))]
516        #[unsafe(method_family = none)]
517        pub unsafe fn tintColor(&self) -> Option<Retained<UIColor>>;
518
519        #[cfg(feature = "UIColor")]
520        /// Setter for [`tintColor`][Self::tintColor].
521        #[unsafe(method(setTintColor:))]
522        #[unsafe(method_family = none)]
523        pub unsafe fn setTintColor(&self, tint_color: Option<&UIColor>);
524
525        #[cfg(all(feature = "UIBarCommon", feature = "objc2-core-foundation"))]
526        #[unsafe(method(setBackgroundVerticalPositionAdjustment:forBarMetrics:))]
527        #[unsafe(method_family = none)]
528        pub unsafe fn setBackgroundVerticalPositionAdjustment_forBarMetrics(
529            &self,
530            adjustment: CGFloat,
531            bar_metrics: UIBarMetrics,
532        );
533
534        #[cfg(all(feature = "UIBarCommon", feature = "objc2-core-foundation"))]
535        #[unsafe(method(backgroundVerticalPositionAdjustmentForBarMetrics:))]
536        #[unsafe(method_family = none)]
537        pub unsafe fn backgroundVerticalPositionAdjustmentForBarMetrics(
538            &self,
539            bar_metrics: UIBarMetrics,
540        ) -> CGFloat;
541
542        #[cfg(all(
543            feature = "UIBarCommon",
544            feature = "UIGeometry",
545            feature = "objc2-core-foundation"
546        ))]
547        #[unsafe(method(setTitlePositionAdjustment:forBarMetrics:))]
548        #[unsafe(method_family = none)]
549        pub unsafe fn setTitlePositionAdjustment_forBarMetrics(
550            &self,
551            adjustment: UIOffset,
552            bar_metrics: UIBarMetrics,
553        );
554
555        #[cfg(all(
556            feature = "UIBarCommon",
557            feature = "UIGeometry",
558            feature = "objc2-core-foundation"
559        ))]
560        #[unsafe(method(titlePositionAdjustmentForBarMetrics:))]
561        #[unsafe(method_family = none)]
562        pub unsafe fn titlePositionAdjustmentForBarMetrics(
563            &self,
564            bar_metrics: UIBarMetrics,
565        ) -> UIOffset;
566
567        #[cfg(all(feature = "UIBarCommon", feature = "UIControl", feature = "UIImage"))]
568        #[unsafe(method(setBackButtonBackgroundImage:forState:barMetrics:))]
569        #[unsafe(method_family = none)]
570        pub unsafe fn setBackButtonBackgroundImage_forState_barMetrics(
571            &self,
572            background_image: Option<&UIImage>,
573            state: UIControlState,
574            bar_metrics: UIBarMetrics,
575        );
576
577        #[cfg(all(feature = "UIBarCommon", feature = "UIControl", feature = "UIImage"))]
578        #[unsafe(method(backButtonBackgroundImageForState:barMetrics:))]
579        #[unsafe(method_family = none)]
580        pub unsafe fn backButtonBackgroundImageForState_barMetrics(
581            &self,
582            state: UIControlState,
583            bar_metrics: UIBarMetrics,
584        ) -> Option<Retained<UIImage>>;
585
586        #[cfg(all(
587            feature = "UIBarCommon",
588            feature = "UIGeometry",
589            feature = "objc2-core-foundation"
590        ))]
591        #[unsafe(method(setBackButtonTitlePositionAdjustment:forBarMetrics:))]
592        #[unsafe(method_family = none)]
593        pub unsafe fn setBackButtonTitlePositionAdjustment_forBarMetrics(
594            &self,
595            adjustment: UIOffset,
596            bar_metrics: UIBarMetrics,
597        );
598
599        #[cfg(all(
600            feature = "UIBarCommon",
601            feature = "UIGeometry",
602            feature = "objc2-core-foundation"
603        ))]
604        #[unsafe(method(backButtonTitlePositionAdjustmentForBarMetrics:))]
605        #[unsafe(method_family = none)]
606        pub unsafe fn backButtonTitlePositionAdjustmentForBarMetrics(
607            &self,
608            bar_metrics: UIBarMetrics,
609        ) -> UIOffset;
610
611        #[cfg(all(feature = "UIBarCommon", feature = "objc2-core-foundation"))]
612        #[unsafe(method(setBackButtonBackgroundVerticalPositionAdjustment:forBarMetrics:))]
613        #[unsafe(method_family = none)]
614        pub unsafe fn setBackButtonBackgroundVerticalPositionAdjustment_forBarMetrics(
615            &self,
616            adjustment: CGFloat,
617            bar_metrics: UIBarMetrics,
618        );
619
620        #[cfg(all(feature = "UIBarCommon", feature = "objc2-core-foundation"))]
621        #[unsafe(method(backButtonBackgroundVerticalPositionAdjustmentForBarMetrics:))]
622        #[unsafe(method_family = none)]
623        pub unsafe fn backButtonBackgroundVerticalPositionAdjustmentForBarMetrics(
624            &self,
625            bar_metrics: UIBarMetrics,
626        ) -> CGFloat;
627    );
628}
629
630/// Methods declared on superclass `NSObject`.
631#[cfg(feature = "UIBarItem")]
632impl UIBarButtonItem {
633    extern_methods!(
634        #[unsafe(method(new))]
635        #[unsafe(method_family = new)]
636        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
637    );
638}
639
640/// SpringLoading.
641#[cfg(feature = "UIBarItem")]
642impl UIBarButtonItem {
643    extern_methods!();
644}
645
646#[cfg(all(feature = "UIBarItem", feature = "UISpringLoadedInteractionSupporting"))]
647unsafe impl UISpringLoadedInteractionSupporting for UIBarButtonItem {}
648
649#[cfg(feature = "UIBarItem")]
650impl UIBarButtonItem {
651    extern_methods!(
652        #[cfg(feature = "objc2-symbols")]
653        /// Adds a symbol effect to the bar button item with default options and animation.
654        /// Only a subset of symbol effects are supported; Appear and Disappear effects, for example, are unsupported, and will assert.
655        #[unsafe(method(addSymbolEffect:))]
656        #[unsafe(method_family = none)]
657        pub unsafe fn addSymbolEffect(&self, symbol_effect: &NSSymbolEffect);
658
659        #[cfg(feature = "objc2-symbols")]
660        /// Adds a symbol effect to the bar button item with specified options and default animation.
661        /// Only a subset of symbol effects are supported; Appear and Disappear effects, for example, are unsupported, and will assert.
662        #[unsafe(method(addSymbolEffect:options:))]
663        #[unsafe(method_family = none)]
664        pub unsafe fn addSymbolEffect_options(
665            &self,
666            symbol_effect: &NSSymbolEffect,
667            options: &NSSymbolEffectOptions,
668        );
669
670        #[cfg(feature = "objc2-symbols")]
671        /// Adds a symbol effect to the bar button item with specified options and animation.
672        /// Only a subset of symbol effects are supported; Appear and Disappear effects, for example, are unsupported, and will assert.
673        #[unsafe(method(addSymbolEffect:options:animated:))]
674        #[unsafe(method_family = none)]
675        pub unsafe fn addSymbolEffect_options_animated(
676            &self,
677            symbol_effect: &NSSymbolEffect,
678            options: &NSSymbolEffectOptions,
679            animated: bool,
680        );
681
682        #[cfg(feature = "objc2-symbols")]
683        /// Removes from the bar button item the symbol effect matching the type of effect passed in, with default options and animation.
684        #[unsafe(method(removeSymbolEffectOfType:))]
685        #[unsafe(method_family = none)]
686        pub unsafe fn removeSymbolEffectOfType(&self, symbol_effect: &NSSymbolEffect);
687
688        #[cfg(feature = "objc2-symbols")]
689        /// Removes from the bar button item the symbol effect matching the type of effect passed in, with specified options and default animation.
690        #[unsafe(method(removeSymbolEffectOfType:options:))]
691        #[unsafe(method_family = none)]
692        pub unsafe fn removeSymbolEffectOfType_options(
693            &self,
694            symbol_effect: &NSSymbolEffect,
695            options: &NSSymbolEffectOptions,
696        );
697
698        #[cfg(feature = "objc2-symbols")]
699        /// Removes from the bar button item the symbol effect matching the type of effect passed in, with specified options and animation.
700        #[unsafe(method(removeSymbolEffectOfType:options:animated:))]
701        #[unsafe(method_family = none)]
702        pub unsafe fn removeSymbolEffectOfType_options_animated(
703            &self,
704            symbol_effect: &NSSymbolEffect,
705            options: &NSSymbolEffectOptions,
706            animated: bool,
707        );
708
709        /// Removes all symbol effects from the bar button item with default options and animation.
710        #[unsafe(method(removeAllSymbolEffects))]
711        #[unsafe(method_family = none)]
712        pub unsafe fn removeAllSymbolEffects(&self);
713
714        #[cfg(feature = "objc2-symbols")]
715        /// Removes all symbol effects from the bar button item with specified options and default animation.
716        #[unsafe(method(removeAllSymbolEffectsWithOptions:))]
717        #[unsafe(method_family = none)]
718        pub unsafe fn removeAllSymbolEffectsWithOptions(&self, options: &NSSymbolEffectOptions);
719
720        #[cfg(feature = "objc2-symbols")]
721        /// Removes all symbol effects from the bar button item with specified options and animation.
722        #[unsafe(method(removeAllSymbolEffectsWithOptions:animated:))]
723        #[unsafe(method_family = none)]
724        pub unsafe fn removeAllSymbolEffectsWithOptions_animated(
725            &self,
726            options: &NSSymbolEffectOptions,
727            animated: bool,
728        );
729
730        #[cfg(all(feature = "UIImage", feature = "objc2-symbols"))]
731        /// Sets the symbol image on the bar button item with a symbol content transition and default options.
732        /// Passing in a non-symbol image will result in undefined behavior.
733        #[unsafe(method(setSymbolImage:withContentTransition:))]
734        #[unsafe(method_family = none)]
735        pub unsafe fn setSymbolImage_withContentTransition(
736            &self,
737            symbol_image: &UIImage,
738            transition: &NSSymbolContentTransition,
739        );
740
741        #[cfg(all(feature = "UIImage", feature = "objc2-symbols"))]
742        /// Sets the symbol image on the bar button item with a symbol content transition and specified options.
743        /// Passing in a non-symbol image will result in undefined behavior.
744        #[unsafe(method(setSymbolImage:withContentTransition:options:))]
745        #[unsafe(method_family = none)]
746        pub unsafe fn setSymbolImage_withContentTransition_options(
747            &self,
748            symbol_image: &UIImage,
749            transition: &NSSymbolContentTransition,
750            options: &NSSymbolEffectOptions,
751        );
752    );
753}