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::*;
#[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::*;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

#[cfg(all(feature = "UIResponder", feature = "UIView"))]
impl UIToolbar {
    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(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
        #[unsafe(method(items))]
        #[unsafe(method_family = none)]
        pub fn items(&self) -> Option<Retained<NSArray<UIBarButtonItem>>>;

        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
        /// 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<UIBarButtonItem>>);

        #[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(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
        #[unsafe(method(setItems:animated:))]
        #[unsafe(method_family = none)]
        pub fn setItems_animated(&self, items: Option<&NSArray<UIBarButtonItem>>, animated: bool);

        #[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:forToolbarPosition:barMetrics:))]
        #[unsafe(method_family = none)]
        pub fn setBackgroundImage_forToolbarPosition_barMetrics(
            &self,
            background_image: Option<&UIImage>,
            top_or_bottom: UIBarPosition,
            bar_metrics: UIBarMetrics,
        );

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

        #[cfg(all(feature = "UIBarCommon", feature = "UIImage"))]
        #[unsafe(method(setShadowImage:forToolbarPosition:))]
        #[unsafe(method_family = none)]
        pub fn setShadowImage_forToolbarPosition(
            &self,
            shadow_image: Option<&UIImage>,
            top_or_bottom: UIBarPosition,
        );

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

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

        #[cfg(all(feature = "UIBarAppearance", feature = "UIToolbarAppearance"))]
        /// 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: &UIToolbarAppearance);

        #[cfg(all(feature = "UIBarAppearance", feature = "UIToolbarAppearance"))]
        /// Describes the appearance attributes for the toolbar 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<UIToolbarAppearance>>;

        #[cfg(all(feature = "UIBarAppearance", feature = "UIToolbarAppearance"))]
        /// 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<&UIToolbarAppearance>);

        #[cfg(all(feature = "UIBarAppearance", feature = "UIToolbarAppearance"))]
        /// Describes the appearance attributes for the toolbar to use at standard height when an observable scroll view is scrolled to the bottom. If not set, standardAppearance will be used instead.
        #[unsafe(method(scrollEdgeAppearance))]
        #[unsafe(method_family = none)]
        pub fn scrollEdgeAppearance(&self) -> Option<Retained<UIToolbarAppearance>>;

        #[cfg(all(feature = "UIBarAppearance", feature = "UIToolbarAppearance"))]
        /// 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<&UIToolbarAppearance>);

        #[cfg(all(feature = "UIBarAppearance", feature = "UIToolbarAppearance"))]
        /// Describes the appearance attributes for the toolbar to use at compact height when an observable scroll view is scrolled to the bottom. If not set, will fall back to scrollEdgeAppearance followed by compactAppearance and finally standardAppearance.
        #[unsafe(method(compactScrollEdgeAppearance))]
        #[unsafe(method_family = none)]
        pub fn compactScrollEdgeAppearance(&self) -> Option<Retained<UIToolbarAppearance>>;

        #[cfg(all(feature = "UIBarAppearance", feature = "UIToolbarAppearance"))]
        /// 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<&UIToolbarAppearance>,
        );

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

        #[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 UIToolbarDelegate>>);
    );
}

/// Methods declared on superclass `UIView`.
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
impl UIToolbar {
    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 UIToolbar {
    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/uitoolbardelegate?language=objc)
    #[cfg(feature = "UIBarCommon")]
    pub unsafe trait UIToolbarDelegate: UIBarPositioningDelegate + MainThreadOnly {}
);