objc2_ui_kit/generated/
UINavigationItem.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
10/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uinavigationitemlargetitledisplaymode?language=objc)
11// NS_ENUM
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct UINavigationItemLargeTitleDisplayMode(pub NSInteger);
15impl UINavigationItemLargeTitleDisplayMode {
16    /// Automatically use the large out-of-line title based on the state of the previous item in the navigation bar. An item with largeTitleDisplayMode=Automatic will show or hide the large title based on the request of the previous navigation item. If the first item pushed is set to Automatic, then it will show the large title if the navigation bar has prefersLargeTitles=YES.
17    #[doc(alias = "UINavigationItemLargeTitleDisplayModeAutomatic")]
18    pub const Automatic: Self = Self(0);
19    /// Always use a larger title when this item is topmost.
20    #[doc(alias = "UINavigationItemLargeTitleDisplayModeAlways")]
21    pub const Always: Self = Self(1);
22    /// Never use a larger title when this item is topmost.
23    #[doc(alias = "UINavigationItemLargeTitleDisplayModeNever")]
24    pub const Never: Self = Self(2);
25    /// Always use a large title when this item is topmost. If there is a back button present, this will revert to `Always`. Leading
26    /// &
27    /// center items will move to the overflow menu if present.
28    #[doc(alias = "UINavigationItemLargeTitleDisplayModeInline")]
29    pub const Inline: Self = Self(3);
30}
31
32unsafe impl Encode for UINavigationItemLargeTitleDisplayMode {
33    const ENCODING: Encoding = NSInteger::ENCODING;
34}
35
36unsafe impl RefEncode for UINavigationItemLargeTitleDisplayMode {
37    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
38}
39
40/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uinavigationitembackbuttondisplaymode?language=objc)
41// NS_ENUM
42#[repr(transparent)]
43#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
44pub struct UINavigationItemBackButtonDisplayMode(pub NSInteger);
45impl UINavigationItemBackButtonDisplayMode {
46    /// Default mode, uses an appropriate title, followed by a generic title (typically 'Back'), then no title.
47    #[doc(alias = "UINavigationItemBackButtonDisplayModeDefault")]
48    pub const Default: Self = Self(0);
49    /// Generic titles only. Ignores .title and .backButtonTitle (but *not* .backBarButtonItem.title).
50    #[doc(alias = "UINavigationItemBackButtonDisplayModeGeneric")]
51    pub const Generic: Self = Self(1);
52    /// Don't use a title, just the back button indicator image.
53    #[doc(alias = "UINavigationItemBackButtonDisplayModeMinimal")]
54    pub const Minimal: Self = Self(2);
55}
56
57unsafe impl Encode for UINavigationItemBackButtonDisplayMode {
58    const ENCODING: Encoding = NSInteger::ENCODING;
59}
60
61unsafe impl RefEncode for UINavigationItemBackButtonDisplayMode {
62    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
63}
64
65/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uinavigationitemsearchbarplacement?language=objc)
66// NS_ENUM
67#[repr(transparent)]
68#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
69pub struct UINavigationItemSearchBarPlacement(pub NSInteger);
70impl UINavigationItemSearchBarPlacement {
71    /// The navigation bar will choose a placement for the search bar that is appropriate for the current layout
72    #[doc(alias = "UINavigationItemSearchBarPlacementAutomatic")]
73    pub const Automatic: Self = Self(0);
74    /// The navigation bar will place the search bar inline with other content, on the trailing edge.
75    /// On iPhone, when the navigation bar belongs to a UINavigationController, the search bar may be integrated into the toolbar.
76    #[doc(alias = "UINavigationItemSearchBarPlacementIntegrated")]
77    pub const Integrated: Self = Self(1);
78    /// The navigation bar will place the search bar vertically stacked with other content.
79    #[doc(alias = "UINavigationItemSearchBarPlacementStacked")]
80    pub const Stacked: Self = Self(2);
81    /// Placement is the same as Integrated, except that in regular width on iPad, the search bar is centered in the navigation bar.
82    /// Only respected when used in a view controller that is a descendant of a tab bar controller or when using a navigation item style that requires a leading aligned title
83    #[doc(alias = "UINavigationItemSearchBarPlacementIntegratedCentered")]
84    pub const IntegratedCentered: Self = Self(3);
85    /// Placement is the same as Integrated, except that the inactive search bar is always shown as a button even when space permits a search field.
86    #[doc(alias = "UINavigationItemSearchBarPlacementIntegratedButton")]
87    pub const IntegratedButton: Self = Self(4);
88    /// Placement is the same as Integrated, except that the inactive search bar is always shown as a button even when space permits a search field.
89    #[doc(alias = "UINavigationItemSearchBarPlacementInline")]
90    #[deprecated]
91    pub const Inline: Self = Self(UINavigationItemSearchBarPlacement::Integrated.0);
92}
93
94unsafe impl Encode for UINavigationItemSearchBarPlacement {
95    const ENCODING: Encoding = NSInteger::ENCODING;
96}
97
98unsafe impl RefEncode for UINavigationItemSearchBarPlacement {
99    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
100}
101
102/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uinavigationitemstyle?language=objc)
103// NS_ENUM
104#[repr(transparent)]
105#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
106pub struct UINavigationItemStyle(pub NSInteger);
107impl UINavigationItemStyle {
108    /// Traditional navigation bar behavior. Center items are placed in the overflow menu.
109    #[doc(alias = "UINavigationItemStyleNavigator")]
110    pub const Navigator: Self = Self(0);
111    /// A style designed for use as a browser. Title is leading aligned, center items are displayed. Typically used with history-based navigation.
112    #[doc(alias = "UINavigationItemStyleBrowser")]
113    pub const Browser: Self = Self(1);
114    /// A style designed for use as an editor. The back button will always present as chevron-only, title is leading aligned, center items are displayed. Typically used without navigation.
115    #[doc(alias = "UINavigationItemStyleEditor")]
116    pub const Editor: Self = Self(2);
117}
118
119unsafe impl Encode for UINavigationItemStyle {
120    const ENCODING: Encoding = NSInteger::ENCODING;
121}
122
123unsafe impl RefEncode for UINavigationItemStyle {
124    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
125}
126
127extern_protocol!(
128    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uinavigationitemrenamedelegate?language=objc)
129    pub unsafe trait UINavigationItemRenameDelegate:
130        NSObjectProtocol + MainThreadOnly
131    {
132        /// This method is called when renaming has ended. The title on the navigation item has already been changed when this method is called but
133        /// clients can make further adjustments to it when necessary.
134        #[unsafe(method(navigationItem:didEndRenamingWithTitle:))]
135        #[unsafe(method_family = none)]
136        fn navigationItem_didEndRenamingWithTitle(
137            &self,
138            navigation_item: &UINavigationItem,
139            title: &NSString,
140        );
141
142        /// Controls whether the rename action is supported for the given navigation item. For example this method is called when the navigation bar's
143        /// document menu is shown to validate if the rename action should be part of that menu.
144        #[optional]
145        #[unsafe(method(navigationItemShouldBeginRenaming:))]
146        #[unsafe(method_family = none)]
147        fn navigationItemShouldBeginRenaming(&self, navigation_item: &UINavigationItem) -> bool;
148
149        /// Called when we begin renaming. Implementing this method allows for customizing the initial text that will show up in the text field as well as the
150        /// selected range of that text.
151        ///
152        /// # Safety
153        ///
154        /// `selected_range` must be a valid pointer.
155        #[optional]
156        #[unsafe(method(navigationItem:willBeginRenamingWithSuggestedTitle:selectedRange:))]
157        #[unsafe(method_family = none)]
158        unsafe fn navigationItem_willBeginRenamingWithSuggestedTitle_selectedRange(
159            &self,
160            navigation_item: &UINavigationItem,
161            title: &NSString,
162            selected_range: NonNull<NSRange>,
163        ) -> Retained<NSString>;
164
165        /// This method can be used to prevent renaming from happening. However there are cases (e.g. when a new navigation item is pushed on the navigation
166        /// bar) where this method will not be called and instead navigationItem:didEndRenamingWithTitle: is called right away. Clients are therefore expected to
167        /// handle titles in navigationItem:didEndRenamingWithTitle: for which they would return NO from navigationItem:shouldEndRenamingWithTitle:.
168        #[optional]
169        #[unsafe(method(navigationItem:shouldEndRenamingWithTitle:))]
170        #[unsafe(method_family = none)]
171        fn navigationItem_shouldEndRenamingWithTitle(
172            &self,
173            navigation_item: &UINavigationItem,
174            title: &NSString,
175        ) -> bool;
176    }
177);
178
179extern_class!(
180    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uinavigationitem?language=objc)
181    #[unsafe(super(NSObject))]
182    #[thread_kind = MainThreadOnly]
183    #[derive(Debug, PartialEq, Eq, Hash)]
184    pub struct UINavigationItem;
185);
186
187extern_conformance!(
188    unsafe impl NSCoding for UINavigationItem {}
189);
190
191extern_conformance!(
192    unsafe impl NSObjectProtocol for UINavigationItem {}
193);
194
195impl UINavigationItem {
196    extern_methods!(
197        #[unsafe(method(initWithTitle:))]
198        #[unsafe(method_family = init)]
199        pub fn initWithTitle(this: Allocated<Self>, title: &NSString) -> Retained<Self>;
200
201        /// # Safety
202        ///
203        /// `coder` possibly has further requirements.
204        #[unsafe(method(initWithCoder:))]
205        #[unsafe(method_family = init)]
206        pub unsafe fn initWithCoder(
207            this: Allocated<Self>,
208            coder: &NSCoder,
209        ) -> Option<Retained<Self>>;
210
211        /// Title when topmost on the stack. default is nil
212        #[unsafe(method(title))]
213        #[unsafe(method_family = none)]
214        pub fn title(&self) -> Option<Retained<NSString>>;
215
216        /// Setter for [`title`][Self::title].
217        ///
218        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
219        #[unsafe(method(setTitle:))]
220        #[unsafe(method_family = none)]
221        pub fn setTitle(&self, title: Option<&NSString>);
222
223        /// An attributed string that is rendered as the title in the navigation bar.
224        ///
225        /// If `titleView` is non-nil, this property is ignored.
226        #[unsafe(method(attributedTitle))]
227        #[unsafe(method_family = none)]
228        pub fn attributedTitle(&self) -> Option<Retained<NSAttributedString>>;
229
230        /// Setter for [`attributedTitle`][Self::attributedTitle].
231        ///
232        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
233        #[unsafe(method(setAttributedTitle:))]
234        #[unsafe(method_family = none)]
235        pub fn setAttributedTitle(&self, attributed_title: Option<&NSAttributedString>);
236
237        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
238        /// Custom view to use in lieu of a title. May be sized horizontally. Only used when item is topmost on the stack.
239        #[unsafe(method(titleView))]
240        #[unsafe(method_family = none)]
241        pub fn titleView(&self) -> Option<Retained<UIView>>;
242
243        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
244        /// Setter for [`titleView`][Self::titleView].
245        #[unsafe(method(setTitleView:))]
246        #[unsafe(method_family = none)]
247        pub fn setTitleView(&self, title_view: Option<&UIView>);
248
249        /// A string to display as the subtitle in the navigation bar.
250        ///
251        /// If `attributedSubtitle` is `non-nil`, this property just returns the `String`
252        /// representation of the `attributedString`.
253        /// If `subtitleView` is non-nil, this property is ignored.
254        #[unsafe(method(subtitle))]
255        #[unsafe(method_family = none)]
256        pub fn subtitle(&self) -> Option<Retained<NSString>>;
257
258        /// Setter for [`subtitle`][Self::subtitle].
259        ///
260        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
261        #[unsafe(method(setSubtitle:))]
262        #[unsafe(method_family = none)]
263        pub fn setSubtitle(&self, subtitle: Option<&NSString>);
264
265        /// An attributed string to display as the subtitle in the navigation bar.
266        ///
267        /// If non-nil, this property takes precedence over the `subtitle` property.
268        /// If `subtitleView` is non-nil, this property is ignored.
269        /// If `titleView` is non-nil, this property is ignored.
270        #[unsafe(method(attributedSubtitle))]
271        #[unsafe(method_family = none)]
272        pub fn attributedSubtitle(&self) -> Option<Retained<NSAttributedString>>;
273
274        /// Setter for [`attributedSubtitle`][Self::attributedSubtitle].
275        ///
276        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
277        #[unsafe(method(setAttributedSubtitle:))]
278        #[unsafe(method_family = none)]
279        pub fn setAttributedSubtitle(&self, attributed_subtitle: Option<&NSAttributedString>);
280
281        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
282        /// A custom view to display below the title in the navigation bar.
283        ///
284        /// If non-nil, this property takes precedence over the `subtitle` and `attributedSubtitle` properties.
285        /// The view's layout constraints will determine its size, or the view may override `sizeThatFits(_:)`
286        /// to return its desired size.
287        #[unsafe(method(subtitleView))]
288        #[unsafe(method_family = none)]
289        pub fn subtitleView(&self) -> Option<Retained<UIView>>;
290
291        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
292        /// Setter for [`subtitleView`][Self::subtitleView].
293        ///
294        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
295        #[unsafe(method(setSubtitleView:))]
296        #[unsafe(method_family = none)]
297        pub fn setSubtitleView(&self, subtitle_view: Option<&UIView>);
298
299        /// String to be used as the large title.
300        ///
301        /// When `nil`, the navigation bar will use the navigation item's current title.
302        #[unsafe(method(largeTitle))]
303        #[unsafe(method_family = none)]
304        pub fn largeTitle(&self) -> Option<Retained<NSString>>;
305
306        /// Setter for [`largeTitle`][Self::largeTitle].
307        ///
308        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
309        #[unsafe(method(setLargeTitle:))]
310        #[unsafe(method_family = none)]
311        pub fn setLargeTitle(&self, large_title: Option<&NSString>);
312
313        /// String to be rendered below the large title.
314        ///
315        /// When `nil`, the navigation bar will fall back to the `subtitle`.
316        #[unsafe(method(largeSubtitle))]
317        #[unsafe(method_family = none)]
318        pub fn largeSubtitle(&self) -> Option<Retained<NSString>>;
319
320        /// Setter for [`largeSubtitle`][Self::largeSubtitle].
321        ///
322        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
323        #[unsafe(method(setLargeSubtitle:))]
324        #[unsafe(method_family = none)]
325        pub fn setLargeSubtitle(&self, large_subtitle: Option<&NSString>);
326
327        /// An attributed string to be rendered below the large title.
328        ///
329        /// When `nil`, the navigation bar will fall back to the `largeSubtitle`.
330        /// If a `largeSubtitleView` is set, this property is ignored.
331        #[unsafe(method(largeAttributedSubtitle))]
332        #[unsafe(method_family = none)]
333        pub fn largeAttributedSubtitle(&self) -> Option<Retained<NSAttributedString>>;
334
335        /// Setter for [`largeAttributedSubtitle`][Self::largeAttributedSubtitle].
336        ///
337        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
338        #[unsafe(method(setLargeAttributedSubtitle:))]
339        #[unsafe(method_family = none)]
340        pub fn setLargeAttributedSubtitle(
341            &self,
342            large_attributed_subtitle: Option<&NSAttributedString>,
343        );
344
345        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
346        /// A custom view to display below the large title.
347        ///
348        /// When non-nil, this takes precedence over any other subtitle.
349        /// The view's layout constraints will determine its size, or the view may override `sizeThatFits(_:)`
350        /// to return its desired size.
351        #[unsafe(method(largeSubtitleView))]
352        #[unsafe(method_family = none)]
353        pub fn largeSubtitleView(&self) -> Option<Retained<UIView>>;
354
355        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
356        /// Setter for [`largeSubtitleView`][Self::largeSubtitleView].
357        #[unsafe(method(setLargeSubtitleView:))]
358        #[unsafe(method_family = none)]
359        pub fn setLargeSubtitleView(&self, large_subtitle_view: Option<&UIView>);
360
361        /// Explanatory text to display above the navigation bar buttons.
362        #[unsafe(method(prompt))]
363        #[unsafe(method_family = none)]
364        pub fn prompt(&self) -> Option<Retained<NSString>>;
365
366        /// Setter for [`prompt`][Self::prompt].
367        ///
368        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
369        #[unsafe(method(setPrompt:))]
370        #[unsafe(method_family = none)]
371        pub fn setPrompt(&self, prompt: Option<&NSString>);
372
373        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
374        /// Bar button item to use for the back button when this item is the navigation bar's backItem.
375        #[unsafe(method(backBarButtonItem))]
376        #[unsafe(method_family = none)]
377        pub fn backBarButtonItem(&self) -> Option<Retained<UIBarButtonItem>>;
378
379        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
380        /// Setter for [`backBarButtonItem`][Self::backBarButtonItem].
381        #[unsafe(method(setBackBarButtonItem:))]
382        #[unsafe(method_family = none)]
383        pub fn setBackBarButtonItem(&self, back_bar_button_item: Option<&UIBarButtonItem>);
384
385        /// Title to use when this item is the navigation bar's backItem. Default is nil. backBarButtonItem takes precedence if both are specified.
386        #[unsafe(method(backButtonTitle))]
387        #[unsafe(method_family = none)]
388        pub fn backButtonTitle(&self) -> Option<Retained<NSString>>;
389
390        /// Setter for [`backButtonTitle`][Self::backButtonTitle].
391        ///
392        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
393        #[unsafe(method(setBackButtonTitle:))]
394        #[unsafe(method_family = none)]
395        pub fn setBackButtonTitle(&self, back_button_title: Option<&NSString>);
396
397        /// If YES, this navigation item will hide the back button when it's on top of the stack.
398        #[unsafe(method(hidesBackButton))]
399        #[unsafe(method_family = none)]
400        pub fn hidesBackButton(&self) -> bool;
401
402        /// Setter for [`hidesBackButton`][Self::hidesBackButton].
403        #[unsafe(method(setHidesBackButton:))]
404        #[unsafe(method_family = none)]
405        pub fn setHidesBackButton(&self, hides_back_button: bool);
406
407        #[unsafe(method(setHidesBackButton:animated:))]
408        #[unsafe(method_family = none)]
409        pub fn setHidesBackButton_animated(&self, hides_back_button: bool, animated: bool);
410
411        /// Controls how the back button sources its title.
412        #[unsafe(method(backButtonDisplayMode))]
413        #[unsafe(method_family = none)]
414        pub fn backButtonDisplayMode(&self) -> UINavigationItemBackButtonDisplayMode;
415
416        /// Setter for [`backButtonDisplayMode`][Self::backButtonDisplayMode].
417        #[unsafe(method(setBackButtonDisplayMode:))]
418        #[unsafe(method_family = none)]
419        pub fn setBackButtonDisplayMode(
420            &self,
421            back_button_display_mode: UINavigationItemBackButtonDisplayMode,
422        );
423
424        #[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
425        /// Replaces the back action for the navigation bar. if a back button is naturally present, this replaces only its action, otherwise a back button will be synthesized with the image or title from the action.
426        #[unsafe(method(backAction))]
427        #[unsafe(method_family = none)]
428        pub fn backAction(&self) -> Option<Retained<UIAction>>;
429
430        #[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
431        /// Setter for [`backAction`][Self::backAction].
432        ///
433        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
434        #[unsafe(method(setBackAction:))]
435        #[unsafe(method_family = none)]
436        pub fn setBackAction(&self, back_action: Option<&UIAction>);
437
438        #[cfg(all(feature = "UIMenu", feature = "UIMenuElement", feature = "block2"))]
439        /// When non-nil, UIKit will generate suggestedActions and call this block to generate a menu that is displayed from the title.
440        ///
441        /// # Safety
442        ///
443        /// The returned block's argument must be a valid pointer.
444        #[unsafe(method(titleMenuProvider))]
445        #[unsafe(method_family = none)]
446        pub unsafe fn titleMenuProvider(
447            &self,
448        ) -> *mut block2::DynBlock<dyn Fn(NonNull<NSArray<UIMenuElement>>) -> *mut UIMenu>;
449
450        #[cfg(all(feature = "UIMenu", feature = "UIMenuElement", feature = "block2"))]
451        /// Setter for [`titleMenuProvider`][Self::titleMenuProvider].
452        ///
453        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
454        ///
455        /// # Safety
456        ///
457        /// `title_menu_provider` block's return must be a valid pointer or null.
458        #[unsafe(method(setTitleMenuProvider:))]
459        #[unsafe(method_family = none)]
460        pub unsafe fn setTitleMenuProvider(
461            &self,
462            title_menu_provider: Option<
463                &block2::DynBlock<dyn Fn(NonNull<NSArray<UIMenuElement>>) -> *mut UIMenu>,
464            >,
465        );
466
467        /// When non-nil, enables the UINavigationBar to respond to the rename: action by providing an inline UI.
468        /// Setting this property to nil while a rename operation is in progress will cancel the operation immediately.
469        #[unsafe(method(renameDelegate))]
470        #[unsafe(method_family = none)]
471        pub fn renameDelegate(
472            &self,
473        ) -> Option<Retained<ProtocolObject<dyn UINavigationItemRenameDelegate>>>;
474
475        /// Setter for [`renameDelegate`][Self::renameDelegate].
476        ///
477        /// This is a [weak property][objc2::topics::weak_property].
478        #[unsafe(method(setRenameDelegate:))]
479        #[unsafe(method_family = none)]
480        pub fn setRenameDelegate(
481            &self,
482            rename_delegate: Option<&ProtocolObject<dyn UINavigationItemRenameDelegate>>,
483        );
484
485        #[cfg(feature = "UIDocumentProperties")]
486        /// When non-nil, UIKit will use the metadata provided to generate additional controls displayed from the title.
487        #[unsafe(method(documentProperties))]
488        #[unsafe(method_family = none)]
489        pub fn documentProperties(&self) -> Option<Retained<UIDocumentProperties>>;
490
491        #[cfg(feature = "UIDocumentProperties")]
492        /// Setter for [`documentProperties`][Self::documentProperties].
493        #[unsafe(method(setDocumentProperties:))]
494        #[unsafe(method_family = none)]
495        pub fn setDocumentProperties(&self, document_properties: Option<&UIDocumentProperties>);
496
497        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
498        #[unsafe(method(leftBarButtonItems))]
499        #[unsafe(method_family = none)]
500        pub fn leftBarButtonItems(&self) -> Option<Retained<NSArray<UIBarButtonItem>>>;
501
502        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
503        /// Setter for [`leftBarButtonItems`][Self::leftBarButtonItems].
504        ///
505        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
506        #[unsafe(method(setLeftBarButtonItems:))]
507        #[unsafe(method_family = none)]
508        pub fn setLeftBarButtonItems(
509            &self,
510            left_bar_button_items: Option<&NSArray<UIBarButtonItem>>,
511        );
512
513        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
514        #[unsafe(method(rightBarButtonItems))]
515        #[unsafe(method_family = none)]
516        pub fn rightBarButtonItems(&self) -> Option<Retained<NSArray<UIBarButtonItem>>>;
517
518        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
519        /// Setter for [`rightBarButtonItems`][Self::rightBarButtonItems].
520        ///
521        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
522        #[unsafe(method(setRightBarButtonItems:))]
523        #[unsafe(method_family = none)]
524        pub fn setRightBarButtonItems(
525            &self,
526            right_bar_button_items: Option<&NSArray<UIBarButtonItem>>,
527        );
528
529        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
530        #[unsafe(method(setLeftBarButtonItems:animated:))]
531        #[unsafe(method_family = none)]
532        pub fn setLeftBarButtonItems_animated(
533            &self,
534            items: Option<&NSArray<UIBarButtonItem>>,
535            animated: bool,
536        );
537
538        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
539        #[unsafe(method(setRightBarButtonItems:animated:))]
540        #[unsafe(method_family = none)]
541        pub fn setRightBarButtonItems_animated(
542            &self,
543            items: Option<&NSArray<UIBarButtonItem>>,
544            animated: bool,
545        );
546
547        #[unsafe(method(leftItemsSupplementBackButton))]
548        #[unsafe(method_family = none)]
549        pub fn leftItemsSupplementBackButton(&self) -> bool;
550
551        /// Setter for [`leftItemsSupplementBackButton`][Self::leftItemsSupplementBackButton].
552        #[unsafe(method(setLeftItemsSupplementBackButton:))]
553        #[unsafe(method_family = none)]
554        pub fn setLeftItemsSupplementBackButton(&self, left_items_supplement_back_button: bool);
555
556        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
557        /// Some navigation items want to display a custom left or right item when they're on top of the stack. A custom left item replaces the regular back button unless you set leftItemsSupplementBackButton to YES
558        #[unsafe(method(leftBarButtonItem))]
559        #[unsafe(method_family = none)]
560        pub fn leftBarButtonItem(&self) -> Option<Retained<UIBarButtonItem>>;
561
562        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
563        /// Setter for [`leftBarButtonItem`][Self::leftBarButtonItem].
564        #[unsafe(method(setLeftBarButtonItem:))]
565        #[unsafe(method_family = none)]
566        pub fn setLeftBarButtonItem(&self, left_bar_button_item: Option<&UIBarButtonItem>);
567
568        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
569        #[unsafe(method(rightBarButtonItem))]
570        #[unsafe(method_family = none)]
571        pub fn rightBarButtonItem(&self) -> Option<Retained<UIBarButtonItem>>;
572
573        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
574        /// Setter for [`rightBarButtonItem`][Self::rightBarButtonItem].
575        #[unsafe(method(setRightBarButtonItem:))]
576        #[unsafe(method_family = none)]
577        pub fn setRightBarButtonItem(&self, right_bar_button_item: Option<&UIBarButtonItem>);
578
579        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
580        #[unsafe(method(setLeftBarButtonItem:animated:))]
581        #[unsafe(method_family = none)]
582        pub fn setLeftBarButtonItem_animated(&self, item: Option<&UIBarButtonItem>, animated: bool);
583
584        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
585        #[unsafe(method(setRightBarButtonItem:animated:))]
586        #[unsafe(method_family = none)]
587        pub fn setRightBarButtonItem_animated(
588            &self,
589            item: Option<&UIBarButtonItem>,
590            animated: bool,
591        );
592
593        /// Setting a non-nil customizationIdentifier enables customization and UIKit will automatically save
594        /// &
595        /// restore customizations based on this identifier. The identifier must be unique within the scope of the application.
596        #[unsafe(method(customizationIdentifier))]
597        #[unsafe(method_family = none)]
598        pub fn customizationIdentifier(&self) -> Option<Retained<NSString>>;
599
600        /// Setter for [`customizationIdentifier`][Self::customizationIdentifier].
601        ///
602        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
603        #[unsafe(method(setCustomizationIdentifier:))]
604        #[unsafe(method_family = none)]
605        pub fn setCustomizationIdentifier(&self, customization_identifier: Option<&NSString>);
606
607        #[cfg(feature = "UIBarButtonItemGroup")]
608        /// UIBarButtonItemGroups to be displayed in the leading section of the navigation bar. Items set via this method will replace items set via .leftBarButtonItem or .leftBarButtonItems.
609        #[unsafe(method(leadingItemGroups))]
610        #[unsafe(method_family = none)]
611        pub fn leadingItemGroups(&self) -> Retained<NSArray<UIBarButtonItemGroup>>;
612
613        #[cfg(feature = "UIBarButtonItemGroup")]
614        /// Setter for [`leadingItemGroups`][Self::leadingItemGroups].
615        ///
616        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
617        #[unsafe(method(setLeadingItemGroups:))]
618        #[unsafe(method_family = none)]
619        pub fn setLeadingItemGroups(&self, leading_item_groups: &NSArray<UIBarButtonItemGroup>);
620
621        #[cfg(feature = "UIBarButtonItemGroup")]
622        /// Customizable UIBarButtonItemGroups that will be placed in the center region when the navigation bar is the browser or editor modes. In navigation mode, these items will be placed in the overflow.
623        #[unsafe(method(centerItemGroups))]
624        #[unsafe(method_family = none)]
625        pub fn centerItemGroups(&self) -> Retained<NSArray<UIBarButtonItemGroup>>;
626
627        #[cfg(feature = "UIBarButtonItemGroup")]
628        /// Setter for [`centerItemGroups`][Self::centerItemGroups].
629        ///
630        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
631        #[unsafe(method(setCenterItemGroups:))]
632        #[unsafe(method_family = none)]
633        pub fn setCenterItemGroups(&self, center_item_groups: &NSArray<UIBarButtonItemGroup>);
634
635        #[cfg(feature = "UIBarButtonItemGroup")]
636        /// UIBarButtonItemGroups to be displayed in the trailing section of the navigation bar. Items set via this method will replace items set via .rightBarButtonItem or .rightBarButtonItems.
637        #[unsafe(method(trailingItemGroups))]
638        #[unsafe(method_family = none)]
639        pub fn trailingItemGroups(&self) -> Retained<NSArray<UIBarButtonItemGroup>>;
640
641        #[cfg(feature = "UIBarButtonItemGroup")]
642        /// Setter for [`trailingItemGroups`][Self::trailingItemGroups].
643        ///
644        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
645        #[unsafe(method(setTrailingItemGroups:))]
646        #[unsafe(method_family = none)]
647        pub fn setTrailingItemGroups(&self, trailing_item_groups: &NSArray<UIBarButtonItemGroup>);
648
649        #[cfg(feature = "UIBarButtonItemGroup")]
650        /// Set a group of items to be placed on the trailing edge of the bar, past the overflow
651        /// &
652        /// search items (if present). If you wish to have more than 1 item, it is HIGHLY recommended to assign a representative item to the group to avoid overflowing the bar as this group cannot move to the overflow.
653        #[unsafe(method(pinnedTrailingGroup))]
654        #[unsafe(method_family = none)]
655        pub fn pinnedTrailingGroup(&self) -> Option<Retained<UIBarButtonItemGroup>>;
656
657        #[cfg(feature = "UIBarButtonItemGroup")]
658        /// Setter for [`pinnedTrailingGroup`][Self::pinnedTrailingGroup].
659        #[unsafe(method(setPinnedTrailingGroup:))]
660        #[unsafe(method_family = none)]
661        pub fn setPinnedTrailingGroup(&self, pinned_trailing_group: Option<&UIBarButtonItemGroup>);
662
663        #[cfg(all(feature = "UIDeferredMenuElement", feature = "UIMenuElement"))]
664        /// Additional items to add to the overflow menu. Setting this property to a non-nil value will force the overflow button to appear, regardless of if you provide any content in the element's callback. Items returned are displayed directly in the presented menu.
665        #[unsafe(method(additionalOverflowItems))]
666        #[unsafe(method_family = none)]
667        pub fn additionalOverflowItems(&self) -> Option<Retained<UIDeferredMenuElement>>;
668
669        #[cfg(all(feature = "UIDeferredMenuElement", feature = "UIMenuElement"))]
670        /// Setter for [`additionalOverflowItems`][Self::additionalOverflowItems].
671        #[unsafe(method(setAdditionalOverflowItems:))]
672        #[unsafe(method_family = none)]
673        pub fn setAdditionalOverflowItems(
674            &self,
675            additional_overflow_items: Option<&UIDeferredMenuElement>,
676        );
677
678        #[cfg(feature = "UIPopoverPresentationControllerSourceItem")]
679        /// If the overflow button for this item is currently present, then this will return a non-nil item that can be used as a presentation source (e.g. for popovers). Otherwise it will return nil.
680        #[unsafe(method(overflowPresentationSource))]
681        #[unsafe(method_family = none)]
682        pub fn overflowPresentationSource(
683            &self,
684        ) -> Option<Retained<ProtocolObject<dyn UIPopoverPresentationControllerSourceItem>>>;
685
686        /// When UINavigationBar.prefersLargeTitles=YES, this property controls when the larger out-of-line title is displayed. If prefersLargeTitles=NO, this property has no effect. The default value is Automatic.
687        #[unsafe(method(largeTitleDisplayMode))]
688        #[unsafe(method_family = none)]
689        pub fn largeTitleDisplayMode(&self) -> UINavigationItemLargeTitleDisplayMode;
690
691        /// Setter for [`largeTitleDisplayMode`][Self::largeTitleDisplayMode].
692        #[unsafe(method(setLargeTitleDisplayMode:))]
693        #[unsafe(method_family = none)]
694        pub fn setLargeTitleDisplayMode(
695            &self,
696            large_title_display_mode: UINavigationItemLargeTitleDisplayMode,
697        );
698
699        /// Controls how content defined by this item is laid out in the navigation bar.
700        #[unsafe(method(style))]
701        #[unsafe(method_family = none)]
702        pub fn style(&self) -> UINavigationItemStyle;
703
704        /// Setter for [`style`][Self::style].
705        #[unsafe(method(setStyle:))]
706        #[unsafe(method_family = none)]
707        pub fn setStyle(&self, style: UINavigationItemStyle);
708
709        #[cfg(all(
710            feature = "UIResponder",
711            feature = "UISearchController",
712            feature = "UIViewController"
713        ))]
714        /// A view controller that will be shown inside of a navigation controller can assign a UISearchController to this property to display the search controller’s search bar in its containing navigation controller’s navigation bar.
715        #[unsafe(method(searchController))]
716        #[unsafe(method_family = none)]
717        pub fn searchController(&self) -> Option<Retained<UISearchController>>;
718
719        #[cfg(all(
720            feature = "UIResponder",
721            feature = "UISearchController",
722            feature = "UIViewController"
723        ))]
724        /// Setter for [`searchController`][Self::searchController].
725        #[unsafe(method(setSearchController:))]
726        #[unsafe(method_family = none)]
727        pub fn setSearchController(&self, search_controller: Option<&UISearchController>);
728
729        /// If this property is true (the default), the searchController’s search bar will hide as the user scrolls in the top view controller’s scroll view. If false, the search bar will remain visible and pinned underneath the navigation bar.
730        /// Not applicable and ignored for `UINavigationItemSearchBarPlacementIntegrated`
731        #[unsafe(method(hidesSearchBarWhenScrolling))]
732        #[unsafe(method_family = none)]
733        pub fn hidesSearchBarWhenScrolling(&self) -> bool;
734
735        /// Setter for [`hidesSearchBarWhenScrolling`][Self::hidesSearchBarWhenScrolling].
736        #[unsafe(method(setHidesSearchBarWhenScrolling:))]
737        #[unsafe(method_family = none)]
738        pub fn setHidesSearchBarWhenScrolling(&self, hides_search_bar_when_scrolling: bool);
739
740        /// The preferred search bar placement, when a search controller is assigned to this item.
741        #[unsafe(method(preferredSearchBarPlacement))]
742        #[unsafe(method_family = none)]
743        pub fn preferredSearchBarPlacement(&self) -> UINavigationItemSearchBarPlacement;
744
745        /// Setter for [`preferredSearchBarPlacement`][Self::preferredSearchBarPlacement].
746        #[unsafe(method(setPreferredSearchBarPlacement:))]
747        #[unsafe(method_family = none)]
748        pub fn setPreferredSearchBarPlacement(
749            &self,
750            preferred_search_bar_placement: UINavigationItemSearchBarPlacement,
751        );
752
753        /// The realized placement. Only valid if a search controller has been assigned to this item.
754        #[unsafe(method(searchBarPlacement))]
755        #[unsafe(method_family = none)]
756        pub fn searchBarPlacement(&self) -> UINavigationItemSearchBarPlacement;
757
758        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
759        /// When `searchBarPlacement` is `.integrated` or `.integratedButton` and a search controller is present, use this bar button item in the view controller's `toolbarItems` to control the placement of the search bar among them when the search bar is appearing in the UIToolbar on iPhone.
760        /// Without this bar button item, the positioning for the search bar defaults to trailingmost for the UIToolbar case.
761        /// This bar button item will be ignored during toolbar layout if `searchController` is `nil`.
762        /// UIBarButtonItemGroup will throw an NSInvalidArgumentException when this bar button item is included in its initialization.
763        /// UINavigationItem will throw an NSInvalidArgumentException when this bar button item is included in leftBarButtonItems or rightBarButtonItems.
764        #[unsafe(method(searchBarPlacementBarButtonItem))]
765        #[unsafe(method_family = none)]
766        pub fn searchBarPlacementBarButtonItem(&self) -> Retained<UIBarButtonItem>;
767
768        /// Defaults to `YES`
769        /// Set to `NO` to prevent the search bar from being placed among other UIToolbar items on iPhone
770        #[unsafe(method(searchBarPlacementAllowsToolbarIntegration))]
771        #[unsafe(method_family = none)]
772        pub fn searchBarPlacementAllowsToolbarIntegration(&self) -> bool;
773
774        /// Setter for [`searchBarPlacementAllowsToolbarIntegration`][Self::searchBarPlacementAllowsToolbarIntegration].
775        #[unsafe(method(setSearchBarPlacementAllowsToolbarIntegration:))]
776        #[unsafe(method_family = none)]
777        pub fn setSearchBarPlacementAllowsToolbarIntegration(
778            &self,
779            search_bar_placement_allows_toolbar_integration: bool,
780        );
781
782        /// `AllowsExternalIntegration` means that something at a higher scope may take the search bar and integrate it somewhere other than the navigation bar (or toolbar) directly associated with this navigation item.
783        /// On iOS 26, UISplitViewController uses this to allow Mac-like placement of the search bar on iPad.
784        /// Defaults to `NO`
785        /// Set to `YES` to allow the containing UISplitViewController to place the search bar in the navigation bar for the trailingmost column independent of the column used for this view controller.
786        /// Ignored when `searchController` is `nil`, when `searchBarPlacement` is `.stacked`, or when not contained in a UISplitViewController.
787        /// When the top view controller's navigation item has this property set to `YES` in more than one column at the same time, only one will be respected; the columns are checked in order of `.inspector`, `.secondary`, `.supplementary`, `.primary`
788        /// If the search bar has a scope bar, the scope bar will not be moved into a different column.
789        #[unsafe(method(searchBarPlacementAllowsExternalIntegration))]
790        #[unsafe(method_family = none)]
791        pub fn searchBarPlacementAllowsExternalIntegration(&self) -> bool;
792
793        /// Setter for [`searchBarPlacementAllowsExternalIntegration`][Self::searchBarPlacementAllowsExternalIntegration].
794        #[unsafe(method(setSearchBarPlacementAllowsExternalIntegration:))]
795        #[unsafe(method_family = none)]
796        pub fn setSearchBarPlacementAllowsExternalIntegration(
797            &self,
798            search_bar_placement_allows_external_integration: bool,
799        );
800
801        #[cfg(all(feature = "UIBarAppearance", feature = "UINavigationBarAppearance"))]
802        /// When set and this item is topmost, overrides the hosting navigation bar's standardAppearance. See UINavigationBar.standardAppearance for further details.
803        #[unsafe(method(standardAppearance))]
804        #[unsafe(method_family = none)]
805        pub fn standardAppearance(&self) -> Option<Retained<UINavigationBarAppearance>>;
806
807        #[cfg(all(feature = "UIBarAppearance", feature = "UINavigationBarAppearance"))]
808        /// Setter for [`standardAppearance`][Self::standardAppearance].
809        ///
810        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
811        #[unsafe(method(setStandardAppearance:))]
812        #[unsafe(method_family = none)]
813        pub fn setStandardAppearance(
814            &self,
815            standard_appearance: Option<&UINavigationBarAppearance>,
816        );
817
818        #[cfg(all(feature = "UIBarAppearance", feature = "UINavigationBarAppearance"))]
819        /// When set and this item is topmost, overrides the hosting navigation bar's compactAppearance. See UINavigationBar.compactAppearance for further details.
820        #[unsafe(method(compactAppearance))]
821        #[unsafe(method_family = none)]
822        pub fn compactAppearance(&self) -> Option<Retained<UINavigationBarAppearance>>;
823
824        #[cfg(all(feature = "UIBarAppearance", feature = "UINavigationBarAppearance"))]
825        /// Setter for [`compactAppearance`][Self::compactAppearance].
826        ///
827        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
828        #[unsafe(method(setCompactAppearance:))]
829        #[unsafe(method_family = none)]
830        pub fn setCompactAppearance(&self, compact_appearance: Option<&UINavigationBarAppearance>);
831
832        #[cfg(all(feature = "UIBarAppearance", feature = "UINavigationBarAppearance"))]
833        /// When set and this item is topmost, overrides the hosting navigation bar's scrollEdgeAppearance. See UINavigationBar.scrollEdgeAppearance for further details.
834        #[unsafe(method(scrollEdgeAppearance))]
835        #[unsafe(method_family = none)]
836        pub fn scrollEdgeAppearance(&self) -> Option<Retained<UINavigationBarAppearance>>;
837
838        #[cfg(all(feature = "UIBarAppearance", feature = "UINavigationBarAppearance"))]
839        /// Setter for [`scrollEdgeAppearance`][Self::scrollEdgeAppearance].
840        ///
841        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
842        #[unsafe(method(setScrollEdgeAppearance:))]
843        #[unsafe(method_family = none)]
844        pub fn setScrollEdgeAppearance(
845            &self,
846            scroll_edge_appearance: Option<&UINavigationBarAppearance>,
847        );
848
849        #[cfg(all(feature = "UIBarAppearance", feature = "UINavigationBarAppearance"))]
850        /// When set and this item is topmost, overrides the hosting navigation bar's compactScrollEdgeAppearance. See UINavigationBar.h for further details.
851        #[unsafe(method(compactScrollEdgeAppearance))]
852        #[unsafe(method_family = none)]
853        pub fn compactScrollEdgeAppearance(&self) -> Option<Retained<UINavigationBarAppearance>>;
854
855        #[cfg(all(feature = "UIBarAppearance", feature = "UINavigationBarAppearance"))]
856        /// Setter for [`compactScrollEdgeAppearance`][Self::compactScrollEdgeAppearance].
857        ///
858        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
859        #[unsafe(method(setCompactScrollEdgeAppearance:))]
860        #[unsafe(method_family = none)]
861        pub fn setCompactScrollEdgeAppearance(
862            &self,
863            compact_scroll_edge_appearance: Option<&UINavigationBarAppearance>,
864        );
865    );
866}
867
868/// Methods declared on superclass `NSObject`.
869impl UINavigationItem {
870    extern_methods!(
871        #[unsafe(method(init))]
872        #[unsafe(method_family = init)]
873        pub fn init(this: Allocated<Self>) -> Retained<Self>;
874
875        #[unsafe(method(new))]
876        #[unsafe(method_family = new)]
877        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
878    );
879}