//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-quartz-core")]
#[cfg(not(target_os = "watchos"))]
use objc2_quartz_core::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uinavigationbarnstoolbarsection?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UINavigationBarNSToolbarSection(pub NSInteger);
impl UINavigationBarNSToolbarSection {
    #[doc(alias = "UINavigationBarNSToolbarSectionNone")]
    pub const None: Self = Self(0);
    #[doc(alias = "UINavigationBarNSToolbarSectionSidebar")]
    pub const Sidebar: Self = Self(1);
    #[doc(alias = "UINavigationBarNSToolbarSectionSupplementary")]
    pub const Supplementary: Self = Self(2);
    #[doc(alias = "UINavigationBarNSToolbarSectionContent")]
    pub const Content: Self = Self(3);
}

unsafe impl Encode for UINavigationBarNSToolbarSection {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for UINavigationBarNSToolbarSection {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uinavigationbar?language=objc)
    #[unsafe(super(UIView, UIResponder, NSObject))]
    #[thread_kind = MainThreadOnly]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "UIResponder", feature = "UIView"))]
    pub struct UINavigationBar;
);

#[cfg(all(
    feature = "UIResponder",
    feature = "UIView",
    feature = "objc2-quartz-core"
))]
#[cfg(not(target_os = "watchos"))]
extern_conformance!(
    unsafe impl CALayerDelegate for UINavigationBar {}
);

#[cfg(all(feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl NSCoding for UINavigationBar {}
);

#[cfg(all(feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl NSObjectProtocol for UINavigationBar {}
);

#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UIAppearance for UINavigationBar {}
);

#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UIAppearanceContainer for UINavigationBar {}
);

#[cfg(all(feature = "UIBarCommon", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UIBarPositioning for UINavigationBar {}
);

#[cfg(all(feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UICoordinateSpace for UINavigationBar {}
);

#[cfg(all(
    feature = "UIDynamicBehavior",
    feature = "UIResponder",
    feature = "UIView"
))]
extern_conformance!(
    unsafe impl UIDynamicItem for UINavigationBar {}
);

#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UIFocusEnvironment for UINavigationBar {}
);

#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UIFocusItem for UINavigationBar {}
);

#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UIFocusItemContainer for UINavigationBar {}
);

#[cfg(all(feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UIResponderStandardEditActions for UINavigationBar {}
);

#[cfg(all(
    feature = "UIResponder",
    feature = "UITraitCollection",
    feature = "UIView"
))]
extern_conformance!(
    unsafe impl UITraitEnvironment for UINavigationBar {}
);

#[cfg(all(feature = "UIResponder", feature = "UIView"))]
impl UINavigationBar {
    extern_methods!(
        #[cfg(feature = "UIInterface")]
        #[unsafe(method(barStyle))]
        #[unsafe(method_family = none)]
        pub fn barStyle(&self) -> UIBarStyle;

        #[cfg(feature = "UIInterface")]
        /// Setter for [`barStyle`][Self::barStyle].
        #[unsafe(method(setBarStyle:))]
        #[unsafe(method_family = none)]
        pub fn setBarStyle(&self, bar_style: UIBarStyle);

        #[cfg(feature = "UIBarCommon")]
        #[unsafe(method(delegate))]
        #[unsafe(method_family = none)]
        pub fn delegate(&self) -> Option<Retained<ProtocolObject<dyn UINavigationBarDelegate>>>;

        #[cfg(feature = "UIBarCommon")]
        /// Setter for [`delegate`][Self::delegate].
        ///
        /// This is a [weak property][objc2::topics::weak_property].
        #[unsafe(method(setDelegate:))]
        #[unsafe(method_family = none)]
        pub fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn UINavigationBarDelegate>>);

        #[unsafe(method(isTranslucent))]
        #[unsafe(method_family = none)]
        pub fn isTranslucent(&self) -> bool;

        /// Setter for [`isTranslucent`][Self::isTranslucent].
        #[unsafe(method(setTranslucent:))]
        #[unsafe(method_family = none)]
        pub fn setTranslucent(&self, translucent: bool);

        #[cfg(feature = "UINavigationItem")]
        #[unsafe(method(pushNavigationItem:animated:))]
        #[unsafe(method_family = none)]
        pub fn pushNavigationItem_animated(&self, item: &UINavigationItem, animated: bool);

        #[cfg(feature = "UINavigationItem")]
        #[unsafe(method(popNavigationItemAnimated:))]
        #[unsafe(method_family = none)]
        pub fn popNavigationItemAnimated(
            &self,
            animated: bool,
        ) -> Option<Retained<UINavigationItem>>;

        #[cfg(feature = "UINavigationItem")]
        #[unsafe(method(topItem))]
        #[unsafe(method_family = none)]
        pub fn topItem(&self) -> Option<Retained<UINavigationItem>>;

        #[cfg(feature = "UINavigationItem")]
        #[unsafe(method(backItem))]
        #[unsafe(method_family = none)]
        pub fn backItem(&self) -> Option<Retained<UINavigationItem>>;

        #[cfg(feature = "UINavigationItem")]
        #[unsafe(method(items))]
        #[unsafe(method_family = none)]
        pub fn items(&self) -> Option<Retained<NSArray<UINavigationItem>>>;

        #[cfg(feature = "UINavigationItem")]
        /// Setter for [`items`][Self::items].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setItems:))]
        #[unsafe(method_family = none)]
        pub fn setItems(&self, items: Option<&NSArray<UINavigationItem>>);

        #[cfg(feature = "UINavigationItem")]
        #[unsafe(method(setItems:animated:))]
        #[unsafe(method_family = none)]
        pub fn setItems_animated(&self, items: Option<&NSArray<UINavigationItem>>, animated: bool);

        /// When set to YES, the navigation bar will use a larger out-of-line title view when requested by the current navigation item. To specify when the large out-of-line title view appears, see UINavigationItem.largeTitleDisplayMode. Defaults to NO.
        #[unsafe(method(prefersLargeTitles))]
        #[unsafe(method_family = none)]
        pub fn prefersLargeTitles(&self) -> bool;

        /// Setter for [`prefersLargeTitles`][Self::prefersLargeTitles].
        #[unsafe(method(setPrefersLargeTitles:))]
        #[unsafe(method_family = none)]
        pub fn setPrefersLargeTitles(&self, prefers_large_titles: bool);

        /// The toolbar section that this navigation bar is currently using.
        #[unsafe(method(currentNSToolbarSection))]
        #[unsafe(method_family = none)]
        pub fn currentNSToolbarSection(&self) -> UINavigationBarNSToolbarSection;

        #[cfg(feature = "UIBehavioralStyle")]
        /// The concrete behavioral style chosen for the navigation bar. When this resolves to .mac, the navigation bar's contents are placed in the NSToolbar.
        #[unsafe(method(behavioralStyle))]
        #[unsafe(method_family = none)]
        pub fn behavioralStyle(&self) -> UIBehavioralStyle;

        #[cfg(feature = "UIBehavioralStyle")]
        /// The requested behavioral style for the navigation bar.
        #[unsafe(method(preferredBehavioralStyle))]
        #[unsafe(method_family = none)]
        pub fn preferredBehavioralStyle(&self) -> UIBehavioralStyle;

        #[cfg(feature = "UIBehavioralStyle")]
        /// Setter for [`preferredBehavioralStyle`][Self::preferredBehavioralStyle].
        #[unsafe(method(setPreferredBehavioralStyle:))]
        #[unsafe(method_family = none)]
        pub fn setPreferredBehavioralStyle(&self, preferred_behavioral_style: UIBehavioralStyle);

        #[cfg(feature = "UIColor")]
        #[unsafe(method(tintColor))]
        #[unsafe(method_family = none)]
        pub fn tintColor(&self) -> Option<Retained<UIColor>>;

        #[cfg(feature = "UIColor")]
        /// Setter for [`tintColor`][Self::tintColor].
        ///
        /// # Safety
        ///
        /// `tint_color` might not allow `None`.
        #[unsafe(method(setTintColor:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setTintColor(&self, tint_color: Option<&UIColor>);

        #[cfg(feature = "UIColor")]
        #[unsafe(method(barTintColor))]
        #[unsafe(method_family = none)]
        pub fn barTintColor(&self) -> Option<Retained<UIColor>>;

        #[cfg(feature = "UIColor")]
        /// Setter for [`barTintColor`][Self::barTintColor].
        #[unsafe(method(setBarTintColor:))]
        #[unsafe(method_family = none)]
        pub fn setBarTintColor(&self, bar_tint_color: Option<&UIColor>);

        #[cfg(all(feature = "UIBarCommon", feature = "UIImage"))]
        #[unsafe(method(setBackgroundImage:forBarPosition:barMetrics:))]
        #[unsafe(method_family = none)]
        pub fn setBackgroundImage_forBarPosition_barMetrics(
            &self,
            background_image: Option<&UIImage>,
            bar_position: UIBarPosition,
            bar_metrics: UIBarMetrics,
        );

        #[cfg(all(feature = "UIBarCommon", feature = "UIImage"))]
        #[unsafe(method(backgroundImageForBarPosition:barMetrics:))]
        #[unsafe(method_family = none)]
        pub fn backgroundImageForBarPosition_barMetrics(
            &self,
            bar_position: UIBarPosition,
            bar_metrics: UIBarMetrics,
        ) -> Option<Retained<UIImage>>;

        #[cfg(all(feature = "UIBarCommon", feature = "UIImage"))]
        #[unsafe(method(setBackgroundImage:forBarMetrics:))]
        #[unsafe(method_family = none)]
        pub fn setBackgroundImage_forBarMetrics(
            &self,
            background_image: Option<&UIImage>,
            bar_metrics: UIBarMetrics,
        );

        #[cfg(all(feature = "UIBarCommon", feature = "UIImage"))]
        #[unsafe(method(backgroundImageForBarMetrics:))]
        #[unsafe(method_family = none)]
        pub fn backgroundImageForBarMetrics(
            &self,
            bar_metrics: UIBarMetrics,
        ) -> Option<Retained<UIImage>>;

        #[cfg(feature = "UIImage")]
        #[unsafe(method(shadowImage))]
        #[unsafe(method_family = none)]
        pub fn shadowImage(&self) -> Option<Retained<UIImage>>;

        #[cfg(feature = "UIImage")]
        /// Setter for [`shadowImage`][Self::shadowImage].
        #[unsafe(method(setShadowImage:))]
        #[unsafe(method_family = none)]
        pub fn setShadowImage(&self, shadow_image: Option<&UIImage>);

        #[unsafe(method(titleTextAttributes))]
        #[unsafe(method_family = none)]
        pub fn titleTextAttributes(
            &self,
        ) -> Option<Retained<NSDictionary<NSAttributedStringKey, AnyObject>>>;

        /// Setter for [`titleTextAttributes`][Self::titleTextAttributes].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        ///
        /// # Safety
        ///
        /// `title_text_attributes` generic should be of the correct type.
        #[unsafe(method(setTitleTextAttributes:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setTitleTextAttributes(
            &self,
            title_text_attributes: Option<&NSDictionary<NSAttributedStringKey, AnyObject>>,
        );

        #[unsafe(method(largeTitleTextAttributes))]
        #[unsafe(method_family = none)]
        pub fn largeTitleTextAttributes(
            &self,
        ) -> Option<Retained<NSDictionary<NSAttributedStringKey, AnyObject>>>;

        /// Setter for [`largeTitleTextAttributes`][Self::largeTitleTextAttributes].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        ///
        /// # Safety
        ///
        /// `large_title_text_attributes` generic should be of the correct type.
        #[unsafe(method(setLargeTitleTextAttributes:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setLargeTitleTextAttributes(
            &self,
            large_title_text_attributes: Option<&NSDictionary<NSAttributedStringKey, AnyObject>>,
        );

        #[cfg(all(feature = "UIBarCommon", feature = "objc2-core-foundation"))]
        #[unsafe(method(setTitleVerticalPositionAdjustment:forBarMetrics:))]
        #[unsafe(method_family = none)]
        pub fn setTitleVerticalPositionAdjustment_forBarMetrics(
            &self,
            adjustment: CGFloat,
            bar_metrics: UIBarMetrics,
        );

        #[cfg(all(feature = "UIBarCommon", feature = "objc2-core-foundation"))]
        #[unsafe(method(titleVerticalPositionAdjustmentForBarMetrics:))]
        #[unsafe(method_family = none)]
        pub fn titleVerticalPositionAdjustmentForBarMetrics(
            &self,
            bar_metrics: UIBarMetrics,
        ) -> CGFloat;

        #[cfg(feature = "UIImage")]
        #[unsafe(method(backIndicatorImage))]
        #[unsafe(method_family = none)]
        pub fn backIndicatorImage(&self) -> Option<Retained<UIImage>>;

        #[cfg(feature = "UIImage")]
        /// Setter for [`backIndicatorImage`][Self::backIndicatorImage].
        #[unsafe(method(setBackIndicatorImage:))]
        #[unsafe(method_family = none)]
        pub fn setBackIndicatorImage(&self, back_indicator_image: Option<&UIImage>);

        #[cfg(feature = "UIImage")]
        #[unsafe(method(backIndicatorTransitionMaskImage))]
        #[unsafe(method_family = none)]
        pub fn backIndicatorTransitionMaskImage(&self) -> Option<Retained<UIImage>>;

        #[cfg(feature = "UIImage")]
        /// Setter for [`backIndicatorTransitionMaskImage`][Self::backIndicatorTransitionMaskImage].
        #[unsafe(method(setBackIndicatorTransitionMaskImage:))]
        #[unsafe(method_family = none)]
        pub fn setBackIndicatorTransitionMaskImage(
            &self,
            back_indicator_transition_mask_image: Option<&UIImage>,
        );

        #[cfg(all(feature = "UIBarAppearance", feature = "UINavigationBarAppearance"))]
        /// Describes the appearance attributes for the navigation bar to use when it is displayed with its standard height.
        #[unsafe(method(standardAppearance))]
        #[unsafe(method_family = none)]
        pub fn standardAppearance(&self) -> Retained<UINavigationBarAppearance>;

        #[cfg(all(feature = "UIBarAppearance", feature = "UINavigationBarAppearance"))]
        /// Setter for [`standardAppearance`][Self::standardAppearance].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setStandardAppearance:))]
        #[unsafe(method_family = none)]
        pub fn setStandardAppearance(&self, standard_appearance: &UINavigationBarAppearance);

        #[cfg(all(feature = "UIBarAppearance", feature = "UINavigationBarAppearance"))]
        /// Describes the appearance attributes for the navigation bar to use when it is displayed with its compact height. If not set, the standardAppearance will be used instead.
        #[unsafe(method(compactAppearance))]
        #[unsafe(method_family = none)]
        pub fn compactAppearance(&self) -> Option<Retained<UINavigationBarAppearance>>;

        #[cfg(all(feature = "UIBarAppearance", feature = "UINavigationBarAppearance"))]
        /// Setter for [`compactAppearance`][Self::compactAppearance].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setCompactAppearance:))]
        #[unsafe(method_family = none)]
        pub fn setCompactAppearance(&self, compact_appearance: Option<&UINavigationBarAppearance>);

        #[cfg(all(feature = "UIBarAppearance", feature = "UINavigationBarAppearance"))]
        /// Describes the appearance attributes for the navigation bar to use when an associated UIScrollView has reached the edge abutting the bar (the top edge for the navigation bar). If not set, a modified standardAppearance will be used instead.
        #[unsafe(method(scrollEdgeAppearance))]
        #[unsafe(method_family = none)]
        pub fn scrollEdgeAppearance(&self) -> Option<Retained<UINavigationBarAppearance>>;

        #[cfg(all(feature = "UIBarAppearance", feature = "UINavigationBarAppearance"))]
        /// Setter for [`scrollEdgeAppearance`][Self::scrollEdgeAppearance].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setScrollEdgeAppearance:))]
        #[unsafe(method_family = none)]
        pub fn setScrollEdgeAppearance(
            &self,
            scroll_edge_appearance: Option<&UINavigationBarAppearance>,
        );

        #[cfg(all(feature = "UIBarAppearance", feature = "UINavigationBarAppearance"))]
        /// Describes the appearance attributes for the navigation bar to use when it is displayed with its compact heights, and an associated UIScrollView has reached the edge abutting the bar. If not set, first the scrollEdgeAppearance will be tried, and if that is nil then compactAppearance followed by a modified standardAppearance.
        #[unsafe(method(compactScrollEdgeAppearance))]
        #[unsafe(method_family = none)]
        pub fn compactScrollEdgeAppearance(&self) -> Option<Retained<UINavigationBarAppearance>>;

        #[cfg(all(feature = "UIBarAppearance", feature = "UINavigationBarAppearance"))]
        /// Setter for [`compactScrollEdgeAppearance`][Self::compactScrollEdgeAppearance].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setCompactScrollEdgeAppearance:))]
        #[unsafe(method_family = none)]
        pub fn setCompactScrollEdgeAppearance(
            &self,
            compact_scroll_edge_appearance: Option<&UINavigationBarAppearance>,
        );
    );
}

/// Methods declared on superclass `UIView`.
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
impl UINavigationBar {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(initWithFrame:))]
        #[unsafe(method_family = init)]
        pub fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;

        /// # Safety
        ///
        /// `coder` possibly has further requirements.
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
impl UINavigationBar {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uinavigationbardelegate?language=objc)
    #[cfg(feature = "UIBarCommon")]
    pub unsafe trait UINavigationBarDelegate:
        UIBarPositioningDelegate + MainThreadOnly
    {
        #[cfg(all(
            feature = "UINavigationItem",
            feature = "UIResponder",
            feature = "UIView"
        ))]
        #[optional]
        #[unsafe(method(navigationBar:shouldPushItem:))]
        #[unsafe(method_family = none)]
        fn navigationBar_shouldPushItem(
            &self,
            navigation_bar: &UINavigationBar,
            item: &UINavigationItem,
        ) -> bool;

        #[cfg(all(
            feature = "UINavigationItem",
            feature = "UIResponder",
            feature = "UIView"
        ))]
        #[optional]
        #[unsafe(method(navigationBar:didPushItem:))]
        #[unsafe(method_family = none)]
        fn navigationBar_didPushItem(
            &self,
            navigation_bar: &UINavigationBar,
            item: &UINavigationItem,
        );

        #[cfg(all(
            feature = "UINavigationItem",
            feature = "UIResponder",
            feature = "UIView"
        ))]
        #[optional]
        #[unsafe(method(navigationBar:shouldPopItem:))]
        #[unsafe(method_family = none)]
        fn navigationBar_shouldPopItem(
            &self,
            navigation_bar: &UINavigationBar,
            item: &UINavigationItem,
        ) -> bool;

        #[cfg(all(
            feature = "UINavigationItem",
            feature = "UIResponder",
            feature = "UIView"
        ))]
        #[optional]
        #[unsafe(method(navigationBar:didPopItem:))]
        #[unsafe(method_family = none)]
        fn navigationBar_didPopItem(
            &self,
            navigation_bar: &UINavigationBar,
            item: &UINavigationItem,
        );

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        /// Which section of the NSToolbar this navigation bar should use when attempting to host in an NSToolbar. Returning 'None' will disable NSToolbar hosting as if preferredBehavioralStyle were set to 'Pad' The specific section returned will also affect how the navigation bar presents in that section.
        #[optional]
        #[unsafe(method(navigationBarNSToolbarSection:))]
        #[unsafe(method_family = none)]
        fn navigationBarNSToolbarSection(
            &self,
            navigation_bar: &UINavigationBar,
        ) -> UINavigationBarNSToolbarSection;
    }
);
