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
#[deprecated = "UIMenuController is deprecated. Use UIEditMenuInteraction instead."]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIMenuControllerArrowDirection(pub NSInteger);
impl UIMenuControllerArrowDirection {
    #[deprecated = "UIMenuController is deprecated. Use UIEditMenuInteraction instead."]
    pub const UIMenuControllerArrowDefault: Self = Self(0);
    pub const UIMenuControllerArrowUp: Self = Self(1);
    pub const UIMenuControllerArrowDown: Self = Self(2);
    pub const UIMenuControllerArrowLeft: Self = Self(3);
    pub const UIMenuControllerArrowRight: Self = Self(4);
}

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

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

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[deprecated = "UIMenuController is deprecated. Use UIEditMenuInteraction instead."]
    pub struct UIMenuController;

    unsafe impl ClassType for UIMenuController {
        type Super = NSObject;
        type Mutability = MainThreadOnly;
    }
);

unsafe impl NSObjectProtocol for UIMenuController {}

extern_methods!(
    unsafe impl UIMenuController {
        #[deprecated = "UIMenuController is deprecated. Use UIEditMenuInteraction instead."]
        #[method_id(@__retain_semantics Other sharedMenuController)]
        pub unsafe fn sharedMenuController(mtm: MainThreadMarker) -> Retained<UIMenuController>;

        #[deprecated = "UIMenuController is deprecated. Use UIEditMenuInteraction instead."]
        #[method(isMenuVisible)]
        pub unsafe fn isMenuVisible(&self) -> bool;

        #[deprecated = "UIMenuController is deprecated. Use UIEditMenuInteraction instead."]
        #[method(setMenuVisible:)]
        pub unsafe fn setMenuVisible(&self, menu_visible: bool);

        #[deprecated = "Use showMenuFromView:rect: or hideMenuFromView: instead."]
        #[method(setMenuVisible:animated:)]
        pub unsafe fn setMenuVisible_animated(&self, menu_visible: bool, animated: bool);

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[deprecated = "Use showMenuFromView:rect: instead."]
        #[method(setTargetRect:inView:)]
        pub unsafe fn setTargetRect_inView(&self, target_rect: CGRect, target_view: &UIView);

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[method(showMenuFromView:rect:)]
        pub unsafe fn showMenuFromView_rect(&self, target_view: &UIView, target_rect: CGRect);

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[method(hideMenuFromView:)]
        pub unsafe fn hideMenuFromView(&self, target_view: &UIView);

        #[method(hideMenu)]
        pub unsafe fn hideMenu(&self);

        #[method(arrowDirection)]
        pub unsafe fn arrowDirection(&self) -> UIMenuControllerArrowDirection;

        #[method(setArrowDirection:)]
        pub unsafe fn setArrowDirection(&self, arrow_direction: UIMenuControllerArrowDirection);

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

        #[method(setMenuItems:)]
        pub unsafe fn setMenuItems(&self, menu_items: Option<&NSArray<UIMenuItem>>);

        #[deprecated = "UIMenuController is deprecated. Use UIEditMenuInteraction instead."]
        #[method(update)]
        pub unsafe fn update(&self);

        #[deprecated = "UIMenuController is deprecated. Use UIEditMenuInteraction instead."]
        #[method(menuFrame)]
        pub unsafe fn menuFrame(&self) -> CGRect;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl UIMenuController {
        #[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 "C" {
    pub static UIMenuControllerWillShowMenuNotification: &'static NSNotificationName;
}

extern "C" {
    pub static UIMenuControllerDidShowMenuNotification: &'static NSNotificationName;
}

extern "C" {
    pub static UIMenuControllerWillHideMenuNotification: &'static NSNotificationName;
}

extern "C" {
    pub static UIMenuControllerDidHideMenuNotification: &'static NSNotificationName;
}

extern "C" {
    pub static UIMenuControllerMenuFrameDidChangeNotification: &'static NSNotificationName;
}

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[deprecated = "UIMenuItem is deprecated. Use UIEditMenuInteraction instead."]
    pub struct UIMenuItem;

    unsafe impl ClassType for UIMenuItem {
        type Super = NSObject;
        type Mutability = MainThreadOnly;
    }
);

unsafe impl NSObjectProtocol for UIMenuItem {}

extern_methods!(
    unsafe impl UIMenuItem {
        #[deprecated = "UIMenuItem is deprecated. Use UIEditMenuInteraction instead."]
        #[method_id(@__retain_semantics Init initWithTitle:action:)]
        pub unsafe fn initWithTitle_action(
            this: Allocated<Self>,
            title: &NSString,
            action: Sel,
        ) -> Retained<Self>;

        #[deprecated = "UIMenuItem is deprecated. Use UIEditMenuInteraction instead."]
        #[method_id(@__retain_semantics Other title)]
        pub unsafe fn title(&self) -> Retained<NSString>;

        #[deprecated = "UIMenuItem is deprecated. Use UIEditMenuInteraction instead."]
        #[method(setTitle:)]
        pub unsafe fn setTitle(&self, title: &NSString);

        #[deprecated = "UIMenuItem is deprecated. Use UIEditMenuInteraction instead."]
        #[method(action)]
        pub unsafe fn action(&self) -> Sel;

        #[deprecated = "UIMenuItem is deprecated. Use UIEditMenuInteraction instead."]
        #[method(setAction:)]
        pub unsafe fn setAction(&self, action: Sel);
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl UIMenuItem {
        #[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>;
    }
);