objc2-ui-kit 0.2.2

Bindings to the UIKit framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UINavigationControllerOperation(pub NSInteger);
impl UINavigationControllerOperation {
    #[doc(alias = "UINavigationControllerOperationNone")]
    pub const None: Self = Self(0);
    #[doc(alias = "UINavigationControllerOperationPush")]
    pub const Push: Self = Self(1);
    #[doc(alias = "UINavigationControllerOperationPop")]
    pub const Pop: Self = Self(2);
}

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

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

extern "C" {
    pub static UINavigationControllerHideShowBarDuration: CGFloat;
}

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
    pub struct UINavigationController;

    #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
    unsafe impl ClassType for UINavigationController {
        #[inherits(UIResponder, NSObject)]
        type Super = UIViewController;
        type Mutability = MainThreadOnly;
    }
);

#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
unsafe impl NSCoding for UINavigationController {}

#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
unsafe impl NSObjectProtocol for UINavigationController {}

#[cfg(all(
    feature = "UIAppearance",
    feature = "UIResponder",
    feature = "UIViewController"
))]
unsafe impl UIAppearanceContainer for UINavigationController {}

#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
unsafe impl UIContentContainer for UINavigationController {}

#[cfg(all(
    feature = "UIFocus",
    feature = "UIResponder",
    feature = "UIViewController"
))]
unsafe impl UIFocusEnvironment for UINavigationController {}

#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
unsafe impl UIResponderStandardEditActions for UINavigationController {}

#[cfg(all(
    feature = "UIResponder",
    feature = "UITraitCollection",
    feature = "UIViewController"
))]
unsafe impl UITraitEnvironment for UINavigationController {}

extern_methods!(
    #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
    unsafe impl UINavigationController {
        #[method_id(@__retain_semantics Init initWithNavigationBarClass:toolbarClass:)]
        pub unsafe fn initWithNavigationBarClass_toolbarClass(
            this: Allocated<Self>,
            navigation_bar_class: Option<&AnyClass>,
            toolbar_class: Option<&AnyClass>,
        ) -> Retained<Self>;

        #[method_id(@__retain_semantics Init initWithRootViewController:)]
        pub unsafe fn initWithRootViewController(
            this: Allocated<Self>,
            root_view_controller: &UIViewController,
        ) -> Retained<Self>;

        #[method_id(@__retain_semantics Init initWithNibName:bundle:)]
        pub unsafe fn initWithNibName_bundle(
            this: Allocated<Self>,
            nib_name_or_nil: Option<&NSString>,
            nib_bundle_or_nil: Option<&NSBundle>,
        ) -> Retained<Self>;

        #[method_id(@__retain_semantics Init initWithCoder:)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            a_decoder: &NSCoder,
        ) -> Option<Retained<Self>>;

        #[method(pushViewController:animated:)]
        pub unsafe fn pushViewController_animated(
            &self,
            view_controller: &UIViewController,
            animated: bool,
        );

        #[method_id(@__retain_semantics Other popViewControllerAnimated:)]
        pub unsafe fn popViewControllerAnimated(
            &self,
            animated: bool,
        ) -> Option<Retained<UIViewController>>;

        #[method_id(@__retain_semantics Other popToViewController:animated:)]
        pub unsafe fn popToViewController_animated(
            &self,
            view_controller: &UIViewController,
            animated: bool,
        ) -> Option<Retained<NSArray<UIViewController>>>;

        #[method_id(@__retain_semantics Other popToRootViewControllerAnimated:)]
        pub unsafe fn popToRootViewControllerAnimated(
            &self,
            animated: bool,
        ) -> Option<Retained<NSArray<UIViewController>>>;

        #[method_id(@__retain_semantics Other topViewController)]
        pub unsafe fn topViewController(&self) -> Option<Retained<UIViewController>>;

        #[method_id(@__retain_semantics Other visibleViewController)]
        pub unsafe fn visibleViewController(&self) -> Option<Retained<UIViewController>>;

        #[method_id(@__retain_semantics Other viewControllers)]
        pub unsafe fn viewControllers(&self) -> Retained<NSArray<UIViewController>>;

        #[method(setViewControllers:)]
        pub unsafe fn setViewControllers(&self, view_controllers: &NSArray<UIViewController>);

        #[method(setViewControllers:animated:)]
        pub unsafe fn setViewControllers_animated(
            &self,
            view_controllers: &NSArray<UIViewController>,
            animated: bool,
        );

        #[method(isNavigationBarHidden)]
        pub unsafe fn isNavigationBarHidden(&self) -> bool;

        #[method(setNavigationBarHidden:)]
        pub unsafe fn setNavigationBarHidden(&self, navigation_bar_hidden: bool);

        #[method(setNavigationBarHidden:animated:)]
        pub unsafe fn setNavigationBarHidden_animated(&self, hidden: bool, animated: bool);

        #[cfg(all(feature = "UINavigationBar", feature = "UIView"))]
        #[method_id(@__retain_semantics Other navigationBar)]
        pub unsafe fn navigationBar(&self) -> Retained<UINavigationBar>;

        #[method(isToolbarHidden)]
        pub unsafe fn isToolbarHidden(&self) -> bool;

        #[method(setToolbarHidden:)]
        pub unsafe fn setToolbarHidden(&self, toolbar_hidden: bool);

        #[method(setToolbarHidden:animated:)]
        pub unsafe fn setToolbarHidden_animated(&self, hidden: bool, animated: bool);

        #[cfg(all(feature = "UIToolbar", feature = "UIView"))]
        #[method_id(@__retain_semantics Other toolbar)]
        pub unsafe fn toolbar(&self) -> Option<Retained<UIToolbar>>;

        #[method_id(@__retain_semantics Other delegate)]
        pub unsafe fn delegate(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn UINavigationControllerDelegate>>>;

        #[method(setDelegate:)]
        pub unsafe fn setDelegate(
            &self,
            delegate: Option<&ProtocolObject<dyn UINavigationControllerDelegate>>,
        );

        #[cfg(feature = "UIGestureRecognizer")]
        #[method_id(@__retain_semantics Other interactivePopGestureRecognizer)]
        pub unsafe fn interactivePopGestureRecognizer(
            &self,
        ) -> Option<Retained<UIGestureRecognizer>>;

        #[method(showViewController:sender:)]
        pub unsafe fn showViewController_sender(
            &self,
            vc: &UIViewController,
            sender: Option<&AnyObject>,
        );

        #[method(hidesBarsWhenKeyboardAppears)]
        pub unsafe fn hidesBarsWhenKeyboardAppears(&self) -> bool;

        #[method(setHidesBarsWhenKeyboardAppears:)]
        pub unsafe fn setHidesBarsWhenKeyboardAppears(
            &self,
            hides_bars_when_keyboard_appears: bool,
        );

        #[method(hidesBarsOnSwipe)]
        pub unsafe fn hidesBarsOnSwipe(&self) -> bool;

        #[method(setHidesBarsOnSwipe:)]
        pub unsafe fn setHidesBarsOnSwipe(&self, hides_bars_on_swipe: bool);

        #[cfg(all(feature = "UIGestureRecognizer", feature = "UIPanGestureRecognizer"))]
        #[method_id(@__retain_semantics Other barHideOnSwipeGestureRecognizer)]
        pub unsafe fn barHideOnSwipeGestureRecognizer(&self) -> Retained<UIPanGestureRecognizer>;

        #[method(hidesBarsWhenVerticallyCompact)]
        pub unsafe fn hidesBarsWhenVerticallyCompact(&self) -> bool;

        #[method(setHidesBarsWhenVerticallyCompact:)]
        pub unsafe fn setHidesBarsWhenVerticallyCompact(
            &self,
            hides_bars_when_vertically_compact: bool,
        );

        #[method(hidesBarsOnTap)]
        pub unsafe fn hidesBarsOnTap(&self) -> bool;

        #[method(setHidesBarsOnTap:)]
        pub unsafe fn setHidesBarsOnTap(&self, hides_bars_on_tap: bool);

        #[cfg(all(feature = "UIGestureRecognizer", feature = "UITapGestureRecognizer"))]
        #[method_id(@__retain_semantics Other barHideOnTapGestureRecognizer)]
        pub unsafe fn barHideOnTapGestureRecognizer(&self) -> Retained<UITapGestureRecognizer>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
    unsafe impl UINavigationController {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
    }
);

extern_protocol!(
    pub unsafe trait UINavigationControllerDelegate:
        NSObjectProtocol + IsMainThreadOnly
    {
        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
        #[optional]
        #[method(navigationController:willShowViewController:animated:)]
        unsafe fn navigationController_willShowViewController_animated(
            &self,
            navigation_controller: &UINavigationController,
            view_controller: &UIViewController,
            animated: bool,
        );

        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
        #[optional]
        #[method(navigationController:didShowViewController:animated:)]
        unsafe fn navigationController_didShowViewController_animated(
            &self,
            navigation_controller: &UINavigationController,
            view_controller: &UIViewController,
            animated: bool,
        );

        #[cfg(all(
            feature = "UIOrientation",
            feature = "UIResponder",
            feature = "UIViewController"
        ))]
        #[optional]
        #[method(navigationControllerSupportedInterfaceOrientations:)]
        unsafe fn navigationControllerSupportedInterfaceOrientations(
            &self,
            navigation_controller: &UINavigationController,
        ) -> UIInterfaceOrientationMask;

        #[cfg(all(
            feature = "UIOrientation",
            feature = "UIResponder",
            feature = "UIViewController"
        ))]
        #[optional]
        #[method(navigationControllerPreferredInterfaceOrientationForPresentation:)]
        unsafe fn navigationControllerPreferredInterfaceOrientationForPresentation(
            &self,
            navigation_controller: &UINavigationController,
        ) -> UIInterfaceOrientation;

        #[cfg(all(
            feature = "UIResponder",
            feature = "UIViewController",
            feature = "UIViewControllerTransitioning"
        ))]
        #[optional]
        #[method_id(@__retain_semantics Other navigationController:interactionControllerForAnimationController:)]
        unsafe fn navigationController_interactionControllerForAnimationController(
            &self,
            navigation_controller: &UINavigationController,
            animation_controller: &ProtocolObject<dyn UIViewControllerAnimatedTransitioning>,
        ) -> Option<Retained<ProtocolObject<dyn UIViewControllerInteractiveTransitioning>>>;

        #[cfg(all(
            feature = "UIResponder",
            feature = "UIViewController",
            feature = "UIViewControllerTransitioning"
        ))]
        #[optional]
        #[method_id(@__retain_semantics Other navigationController:animationControllerForOperation:fromViewController:toViewController:)]
        unsafe fn navigationController_animationControllerForOperation_fromViewController_toViewController(
            &self,
            navigation_controller: &UINavigationController,
            operation: UINavigationControllerOperation,
            from_vc: &UIViewController,
            to_vc: &UIViewController,
        ) -> Option<Retained<ProtocolObject<dyn UIViewControllerAnimatedTransitioning>>>;
    }

    unsafe impl ProtocolType for dyn UINavigationControllerDelegate {}
);

extern_methods!(
    /// UINavigationControllerItem
    #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
    unsafe impl UIViewController {
        #[cfg(feature = "UINavigationItem")]
        #[method_id(@__retain_semantics Other navigationItem)]
        pub unsafe fn navigationItem(&self) -> Retained<UINavigationItem>;

        #[method(hidesBottomBarWhenPushed)]
        pub unsafe fn hidesBottomBarWhenPushed(&self) -> bool;

        #[method(setHidesBottomBarWhenPushed:)]
        pub unsafe fn setHidesBottomBarWhenPushed(&self, hides_bottom_bar_when_pushed: bool);

        #[method_id(@__retain_semantics Other navigationController)]
        pub unsafe fn navigationController(&self) -> Option<Retained<UINavigationController>>;
    }
);

extern_methods!(
    /// UINavigationControllerContextualToolbarItems
    #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
    unsafe impl UIViewController {
        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
        #[method_id(@__retain_semantics Other toolbarItems)]
        pub unsafe fn toolbarItems(&self) -> Option<Retained<NSArray<UIBarButtonItem>>>;

        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
        #[method(setToolbarItems:)]
        pub unsafe fn setToolbarItems(&self, toolbar_items: Option<&NSArray<UIBarButtonItem>>);

        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
        #[method(setToolbarItems:animated:)]
        pub unsafe fn setToolbarItems_animated(
            &self,
            toolbar_items: Option<&NSArray<UIBarButtonItem>>,
            animated: bool,
        );
    }
);