objc2-ui-kit 0.3.2

Bindings to the UIKit framework
Documentation
//! 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::*;
use objc2_foundation::*;

use crate::*;

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

#[cfg(feature = "UIBarAppearance")]
extern_conformance!(
    unsafe impl NSCoding for UINavigationBarAppearance {}
);

#[cfg(feature = "UIBarAppearance")]
extern_conformance!(
    unsafe impl NSCopying for UINavigationBarAppearance {}
);

#[cfg(feature = "UIBarAppearance")]
unsafe impl CopyingHelper for UINavigationBarAppearance {
    type Result = Self;
}

#[cfg(feature = "UIBarAppearance")]
extern_conformance!(
    unsafe impl NSObjectProtocol for UINavigationBarAppearance {}
);

#[cfg(feature = "UIBarAppearance")]
extern_conformance!(
    unsafe impl NSSecureCoding for UINavigationBarAppearance {}
);

#[cfg(feature = "UIBarAppearance")]
impl UINavigationBarAppearance {
    extern_methods!(
        /// Inline Title text attributes. If the font or color are unspecified, appropriate defaults are supplied.
        #[unsafe(method(titleTextAttributes))]
        #[unsafe(method_family = none)]
        pub fn titleTextAttributes(
            &self,
        ) -> 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: &NSDictionary<NSAttributedStringKey, AnyObject>,
        );

        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
        /// An additional adjustment to the inline title's position.
        #[unsafe(method(titlePositionAdjustment))]
        #[unsafe(method_family = none)]
        pub fn titlePositionAdjustment(&self) -> UIOffset;

        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
        /// Setter for [`titlePositionAdjustment`][Self::titlePositionAdjustment].
        #[unsafe(method(setTitlePositionAdjustment:))]
        #[unsafe(method_family = none)]
        pub fn setTitlePositionAdjustment(&self, title_position_adjustment: UIOffset);

        /// The default text attributes to apply to the subtitle rendered in the navigation bar.
        #[unsafe(method(subtitleTextAttributes))]
        #[unsafe(method_family = none)]
        pub fn subtitleTextAttributes(
            &self,
        ) -> Retained<NSDictionary<NSAttributedStringKey, AnyObject>>;

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

        /// Large Title text attributes. If the font or color are unspecified, appropriate defaults are supplied.
        #[unsafe(method(largeTitleTextAttributes))]
        #[unsafe(method_family = none)]
        pub fn largeTitleTextAttributes(
            &self,
        ) -> 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: &NSDictionary<NSAttributedStringKey, AnyObject>,
        );

        /// The default text attributes to apply to the subtitle when it’s rendered under
        /// the large title.
        #[unsafe(method(largeSubtitleTextAttributes))]
        #[unsafe(method_family = none)]
        pub fn largeSubtitleTextAttributes(
            &self,
        ) -> Retained<NSDictionary<NSAttributedStringKey, AnyObject>>;

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

        #[cfg(feature = "UIBarButtonItemAppearance")]
        /// The appearance for plain-style bar button items
        #[unsafe(method(buttonAppearance))]
        #[unsafe(method_family = none)]
        pub fn buttonAppearance(&self) -> Retained<UIBarButtonItemAppearance>;

        #[cfg(feature = "UIBarButtonItemAppearance")]
        /// Setter for [`buttonAppearance`][Self::buttonAppearance].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setButtonAppearance:))]
        #[unsafe(method_family = none)]
        pub fn setButtonAppearance(&self, button_appearance: &UIBarButtonItemAppearance);

        #[cfg(feature = "UIBarButtonItemAppearance")]
        /// The appearance attributes for Prominent buttons.
        ///
        /// Use this property to configure the appearance of bar button items that use `UIBarButtonItemStyleProminent`.
        /// If the navigation bar doesn't have any buttons using this style, this property has no effect.
        #[unsafe(method(prominentButtonAppearance))]
        #[unsafe(method_family = none)]
        pub fn prominentButtonAppearance(&self) -> Retained<UIBarButtonItemAppearance>;

        #[cfg(feature = "UIBarButtonItemAppearance")]
        /// Setter for [`prominentButtonAppearance`][Self::prominentButtonAppearance].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setProminentButtonAppearance:))]
        #[unsafe(method_family = none)]
        pub fn setProminentButtonAppearance(
            &self,
            prominent_button_appearance: &UIBarButtonItemAppearance,
        );

        #[cfg(feature = "UIBarButtonItemAppearance")]
        /// The appearance for back buttons. Defaults are drawn from buttonAppearance when appropriate.
        #[unsafe(method(backButtonAppearance))]
        #[unsafe(method_family = none)]
        pub fn backButtonAppearance(&self) -> Retained<UIBarButtonItemAppearance>;

        #[cfg(feature = "UIBarButtonItemAppearance")]
        /// Setter for [`backButtonAppearance`][Self::backButtonAppearance].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setBackButtonAppearance:))]
        #[unsafe(method_family = none)]
        pub fn setBackButtonAppearance(&self, back_button_appearance: &UIBarButtonItemAppearance);

        #[cfg(feature = "UIImage")]
        /// The image shown on the leading edge of the back button.
        #[unsafe(method(backIndicatorImage))]
        #[unsafe(method_family = none)]
        pub fn backIndicatorImage(&self) -> Retained<UIImage>;

        #[cfg(feature = "UIImage")]
        /// This image is used to mask content flowing underneath the backIndicatorImage during push
        /// &
        /// pop transitions
        #[unsafe(method(backIndicatorTransitionMaskImage))]
        #[unsafe(method_family = none)]
        pub fn backIndicatorTransitionMaskImage(&self) -> Retained<UIImage>;

        #[cfg(feature = "UIImage")]
        /// Set the backIndicatorImage
        /// &
        /// backIndicatorTransitionMaskImage images. If either image is nil, then both images will be reset to their default.
        #[unsafe(method(setBackIndicatorImage:transitionMaskImage:))]
        #[unsafe(method_family = none)]
        pub fn setBackIndicatorImage_transitionMaskImage(
            &self,
            back_indicator_image: Option<&UIImage>,
            back_indicator_transition_mask_image: Option<&UIImage>,
        );

        #[cfg(feature = "UIBarButtonItemAppearance")]
        /// The appearance for done-style bar button items
        #[deprecated]
        #[unsafe(method(doneButtonAppearance))]
        #[unsafe(method_family = none)]
        pub fn doneButtonAppearance(&self) -> Retained<UIBarButtonItemAppearance>;

        #[cfg(feature = "UIBarButtonItemAppearance")]
        /// Setter for [`doneButtonAppearance`][Self::doneButtonAppearance].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[deprecated]
        #[unsafe(method(setDoneButtonAppearance:))]
        #[unsafe(method_family = none)]
        pub fn setDoneButtonAppearance(&self, done_button_appearance: &UIBarButtonItemAppearance);
    );
}

/// Methods declared on superclass `UIBarAppearance`.
#[cfg(feature = "UIBarAppearance")]
impl UINavigationBarAppearance {
    extern_methods!(
        /// Constructs a new bar appearance, configured with default values and targeting the device idiom.
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;

        #[cfg(feature = "UIDevice")]
        /// Constructs a new bar appearance, targeting the passed-in idiom as a hint. Not all platforms support all available idioms. See the idiom property to determine the resolved idiom.
        #[unsafe(method(initWithIdiom:))]
        #[unsafe(method_family = init)]
        pub fn initWithIdiom(this: Allocated<Self>, idiom: UIUserInterfaceIdiom) -> Retained<Self>;

        /// Constructs a new bar appearance, copying all relevant properties from the given appearance object. This initializer is useful for migrating configuration between UIBarAppearance subclasses. For example, you can initialize a UINavigationBarAppearance with a UIToolbarAppearance instance, and shared attributes will be identical between the two.
        #[unsafe(method(initWithBarAppearance:))]
        #[unsafe(method_family = init)]
        pub fn initWithBarAppearance(
            this: Allocated<Self>,
            bar_appearance: &UIBarAppearance,
        ) -> Retained<Self>;

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

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