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

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipushbehaviormode?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIPushBehaviorMode(pub NSInteger);
impl UIPushBehaviorMode {
    #[doc(alias = "UIPushBehaviorModeContinuous")]
    pub const Continuous: Self = Self(0);
    #[doc(alias = "UIPushBehaviorModeInstantaneous")]
    pub const Instantaneous: Self = Self(1);
}

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

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

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

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

#[cfg(feature = "UIDynamicBehavior")]
impl UIPushBehavior {
    extern_methods!(
        #[unsafe(method(initWithItems:mode:))]
        #[unsafe(method_family = init)]
        pub fn initWithItems_mode(
            this: Allocated<Self>,
            items: &NSArray<ProtocolObject<dyn UIDynamicItem>>,
            mode: UIPushBehaviorMode,
        ) -> Retained<Self>;

        #[unsafe(method(addItem:))]
        #[unsafe(method_family = none)]
        pub fn addItem(&self, item: &ProtocolObject<dyn UIDynamicItem>);

        #[unsafe(method(removeItem:))]
        #[unsafe(method_family = none)]
        pub fn removeItem(&self, item: &ProtocolObject<dyn UIDynamicItem>);

        #[unsafe(method(items))]
        #[unsafe(method_family = none)]
        pub fn items(&self) -> Retained<NSArray<ProtocolObject<dyn UIDynamicItem>>>;

        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
        #[unsafe(method(targetOffsetFromCenterForItem:))]
        #[unsafe(method_family = none)]
        pub fn targetOffsetFromCenterForItem(
            &self,
            item: &ProtocolObject<dyn UIDynamicItem>,
        ) -> UIOffset;

        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
        #[unsafe(method(setTargetOffsetFromCenter:forItem:))]
        #[unsafe(method_family = none)]
        pub fn setTargetOffsetFromCenter_forItem(
            &self,
            o: UIOffset,
            item: &ProtocolObject<dyn UIDynamicItem>,
        );

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

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

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

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(angle))]
        #[unsafe(method_family = none)]
        pub fn angle(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`angle`][Self::angle].
        #[unsafe(method(setAngle:))]
        #[unsafe(method_family = none)]
        pub fn setAngle(&self, angle: CGFloat);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(magnitude))]
        #[unsafe(method_family = none)]
        pub fn magnitude(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`magnitude`][Self::magnitude].
        #[unsafe(method(setMagnitude:))]
        #[unsafe(method_family = none)]
        pub fn setMagnitude(&self, magnitude: CGFloat);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(pushDirection))]
        #[unsafe(method_family = none)]
        pub fn pushDirection(&self) -> CGVector;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`pushDirection`][Self::pushDirection].
        #[unsafe(method(setPushDirection:))]
        #[unsafe(method_family = none)]
        pub fn setPushDirection(&self, push_direction: CGVector);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(setAngle:magnitude:))]
        #[unsafe(method_family = none)]
        pub fn setAngle_magnitude(&self, angle: CGFloat, magnitude: CGFloat);
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "UIDynamicBehavior")]
impl UIPushBehavior {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}