objc2_ui_kit/generated/
UIBarButtonItemGroup.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::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uibarbuttonitemgroup?language=objc)
12    #[unsafe(super(NSObject))]
13    #[thread_kind = MainThreadOnly]
14    #[derive(Debug, PartialEq, Eq, Hash)]
15    pub struct UIBarButtonItemGroup;
16);
17
18extern_conformance!(
19    unsafe impl NSCoding for UIBarButtonItemGroup {}
20);
21
22extern_conformance!(
23    unsafe impl NSObjectProtocol for UIBarButtonItemGroup {}
24);
25
26impl UIBarButtonItemGroup {
27    extern_methods!(
28        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
29        /// Create a new bar button item group with the given items. When bar button item layout is done, either the group's barButtonItems or its representativeItem is displayed (if it exists).
30        #[unsafe(method(initWithBarButtonItems:representativeItem:))]
31        #[unsafe(method_family = init)]
32        pub fn initWithBarButtonItems_representativeItem(
33            this: Allocated<Self>,
34            bar_button_items: &NSArray<UIBarButtonItem>,
35            representative_item: Option<&UIBarButtonItem>,
36        ) -> Retained<Self>;
37
38        /// # Safety
39        ///
40        /// `coder` possibly has further requirements.
41        #[unsafe(method(initWithCoder:))]
42        #[unsafe(method_family = init)]
43        pub unsafe fn initWithCoder(
44            this: Allocated<Self>,
45            coder: &NSCoder,
46        ) -> Option<Retained<Self>>;
47
48        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
49        /// Construct a UIBarButtonItemGroup that cannot be moved or removed under UINavigationBar customization.
50        #[unsafe(method(fixedGroupWithRepresentativeItem:items:))]
51        #[unsafe(method_family = none)]
52        pub fn fixedGroupWithRepresentativeItem_items(
53            representative_item: Option<&UIBarButtonItem>,
54            items: &NSArray<UIBarButtonItem>,
55            mtm: MainThreadMarker,
56        ) -> Retained<UIBarButtonItemGroup>;
57
58        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
59        /// Construct a UIBarButtonItemGroup that can be moved but cannot be removed under UINavigationBar customization.
60        #[unsafe(method(movableGroupWithCustomizationIdentifier:representativeItem:items:))]
61        #[unsafe(method_family = none)]
62        pub fn movableGroupWithCustomizationIdentifier_representativeItem_items(
63            customization_identifier: &NSString,
64            representative_item: Option<&UIBarButtonItem>,
65            items: &NSArray<UIBarButtonItem>,
66            mtm: MainThreadMarker,
67        ) -> Retained<UIBarButtonItemGroup>;
68
69        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
70        /// Construct a UIBarButtonItemGroup that can be moved or added/removed under UINavigationBar customization.
71        #[unsafe(method(optionalGroupWithCustomizationIdentifier:inDefaultCustomization:representativeItem:items:))]
72        #[unsafe(method_family = none)]
73        pub fn optionalGroupWithCustomizationIdentifier_inDefaultCustomization_representativeItem_items(
74            customization_identifier: &NSString,
75            in_default_customization: bool,
76            representative_item: Option<&UIBarButtonItem>,
77            items: &NSArray<UIBarButtonItem>,
78            mtm: MainThreadMarker,
79        ) -> Retained<UIBarButtonItemGroup>;
80
81        /// Returns a new group that contains a single zero-width fixed space item inside it.
82        ///
83        /// If you specify a group with a single zero-width fixed space,
84        /// the navigation bar to visually separate the following groups.
85        #[unsafe(method(groupWithFixedSpace))]
86        #[unsafe(method_family = none)]
87        pub fn groupWithFixedSpace(mtm: MainThreadMarker) -> Retained<UIBarButtonItemGroup>;
88
89        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
90        /// The bar button items associated with this group. Changing these items will affect the bar displaying these items without needing to re-set the groups that are in that bar. Any UIBarButtonItems that are already in group will be removed from that group.
91        #[unsafe(method(barButtonItems))]
92        #[unsafe(method_family = none)]
93        pub fn barButtonItems(&self) -> Retained<NSArray<UIBarButtonItem>>;
94
95        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
96        /// Setter for [`barButtonItems`][Self::barButtonItems].
97        ///
98        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
99        #[unsafe(method(setBarButtonItems:))]
100        #[unsafe(method_family = none)]
101        pub fn setBarButtonItems(&self, bar_button_items: &NSArray<UIBarButtonItem>);
102
103        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
104        /// In order to display as many items as possible, bars that support UIBarButtonItemGroup may choose to collapse items associated with groups to the representativeItem specified by the group.
105        /// A bar will only collapse groups that have a representativeItem set, but may still choose to use an alternate presentation of these items.
106        /// A UIBarButtonItem may only be either the representativeItem or a member of the barButtonItems of a single UIBarButtonItemGroup and may only represent a single group.
107        /// If the representativeItem has an action, then that action will be invoked, otherwise the bar will present a standard UI to allow selection of the barButtonItems in the representedItem's group.
108        #[unsafe(method(representativeItem))]
109        #[unsafe(method_family = none)]
110        pub fn representativeItem(&self) -> Option<Retained<UIBarButtonItem>>;
111
112        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
113        /// Setter for [`representativeItem`][Self::representativeItem].
114        #[unsafe(method(setRepresentativeItem:))]
115        #[unsafe(method_family = none)]
116        pub fn setRepresentativeItem(&self, representative_item: Option<&UIBarButtonItem>);
117
118        /// Returns YES if the representativeItem of this group is currently being displayed, rather than its barButtonItems.
119        #[unsafe(method(isDisplayingRepresentativeItem))]
120        #[unsafe(method_family = none)]
121        pub fn isDisplayingRepresentativeItem(&self) -> bool;
122
123        /// Instructs UIKit to ensure that the functionality in this group is made available to the user regardless of customization status. On iPhone and iPad idioms, UIKit currently places these items in the overflow menu; this property has no effect on macOS idiom.
124        #[unsafe(method(alwaysAvailable))]
125        #[unsafe(method_family = none)]
126        pub fn alwaysAvailable(&self) -> bool;
127
128        /// Setter for [`alwaysAvailable`][Self::alwaysAvailable].
129        #[unsafe(method(setAlwaysAvailable:))]
130        #[unsafe(method_family = none)]
131        pub fn setAlwaysAvailable(&self, always_available: bool);
132
133        #[cfg(feature = "UIMenuElement")]
134        /// A UIMenuElement that should substitute for the UIBarButtonItemGroup when displayed in a menu.
135        #[unsafe(method(menuRepresentation))]
136        #[unsafe(method_family = none)]
137        pub fn menuRepresentation(&self) -> Option<Retained<UIMenuElement>>;
138
139        #[cfg(feature = "UIMenuElement")]
140        /// Setter for [`menuRepresentation`][Self::menuRepresentation].
141        ///
142        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
143        #[unsafe(method(setMenuRepresentation:))]
144        #[unsafe(method_family = none)]
145        pub fn setMenuRepresentation(&self, menu_representation: Option<&UIMenuElement>);
146
147        /// If the group should be hidden from display.
148        #[unsafe(method(isHidden))]
149        #[unsafe(method_family = none)]
150        pub fn isHidden(&self) -> bool;
151
152        /// Setter for [`isHidden`][Self::isHidden].
153        #[unsafe(method(setHidden:))]
154        #[unsafe(method_family = none)]
155        pub fn setHidden(&self, hidden: bool);
156    );
157}
158
159/// Methods declared on superclass `NSObject`.
160impl UIBarButtonItemGroup {
161    extern_methods!(
162        #[unsafe(method(init))]
163        #[unsafe(method_family = init)]
164        pub fn init(this: Allocated<Self>) -> Retained<Self>;
165
166        #[unsafe(method(new))]
167        #[unsafe(method_family = new)]
168        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
169    );
170}
171
172/// UIBarButtonItemGroup.
173#[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
174impl UIBarButtonItem {
175    extern_methods!(
176        /// The group that the UIBarButtonItem is currently associated with, either as a member of the barButtonItems array or as that group's representativeItem.
177        #[unsafe(method(buttonGroup))]
178        #[unsafe(method_family = none)]
179        pub fn buttonGroup(&self) -> Option<Retained<UIBarButtonItemGroup>>;
180    );
181}