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::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIDynamicItemCollisionBoundsType(pub NSUInteger);
impl UIDynamicItemCollisionBoundsType {
#[doc(alias = "UIDynamicItemCollisionBoundsTypeRectangle")]
pub const Rectangle: Self = Self(0);
#[doc(alias = "UIDynamicItemCollisionBoundsTypeEllipse")]
pub const Ellipse: Self = Self(1);
#[doc(alias = "UIDynamicItemCollisionBoundsTypePath")]
pub const Path: Self = Self(2);
}
unsafe impl Encode for UIDynamicItemCollisionBoundsType {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for UIDynamicItemCollisionBoundsType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_protocol!(
pub unsafe trait UIDynamicItem: NSObjectProtocol + MainThreadOnly {
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(center))]
#[unsafe(method_family = none)]
fn center(&self) -> CGPoint;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setCenter:))]
#[unsafe(method_family = none)]
fn setCenter(&self, center: CGPoint);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(bounds))]
#[unsafe(method_family = none)]
fn bounds(&self) -> CGRect;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(transform))]
#[unsafe(method_family = none)]
fn transform(&self) -> CGAffineTransform;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setTransform:))]
#[unsafe(method_family = none)]
fn setTransform(&self, transform: CGAffineTransform);
#[optional]
#[unsafe(method(collisionBoundsType))]
#[unsafe(method_family = none)]
fn collisionBoundsType(&self) -> UIDynamicItemCollisionBoundsType;
#[cfg(feature = "UIBezierPath")]
#[optional]
#[unsafe(method(collisionBoundingPath))]
#[unsafe(method_family = none)]
fn collisionBoundingPath(&self) -> Retained<UIBezierPath>;
}
);
extern_class!(
#[unsafe(super(NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct UIDynamicItemGroup;
);
extern_conformance!(
unsafe impl NSObjectProtocol for UIDynamicItemGroup {}
);
extern_conformance!(
unsafe impl UIDynamicItem for UIDynamicItemGroup {}
);
impl UIDynamicItemGroup {
extern_methods!(
#[unsafe(method(initWithItems:))]
#[unsafe(method_family = init)]
pub fn initWithItems(
this: Allocated<Self>,
items: &NSArray<ProtocolObject<dyn UIDynamicItem>>,
) -> Retained<Self>;
#[unsafe(method(items))]
#[unsafe(method_family = none)]
pub fn items(&self) -> Retained<NSArray<ProtocolObject<dyn UIDynamicItem>>>;
);
}
impl UIDynamicItemGroup {
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>;
);
}
extern_class!(
#[unsafe(super(NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct UIDynamicBehavior;
);
extern_conformance!(
unsafe impl NSObjectProtocol for UIDynamicBehavior {}
);
impl UIDynamicBehavior {
extern_methods!(
#[unsafe(method(addChildBehavior:))]
#[unsafe(method_family = none)]
pub fn addChildBehavior(&self, behavior: &UIDynamicBehavior);
#[unsafe(method(removeChildBehavior:))]
#[unsafe(method_family = none)]
pub fn removeChildBehavior(&self, behavior: &UIDynamicBehavior);
#[unsafe(method(childBehaviors))]
#[unsafe(method_family = none)]
pub fn childBehaviors(&self) -> Retained<NSArray<UIDynamicBehavior>>;
#[cfg(feature = "block2")]
#[unsafe(method(action))]
#[unsafe(method_family = none)]
pub fn action(&self) -> *mut block2::DynBlock<dyn Fn()>;
#[cfg(feature = "block2")]
#[unsafe(method(setAction:))]
#[unsafe(method_family = none)]
pub fn setAction(&self, action: Option<&block2::DynBlock<dyn Fn()>>);
#[cfg(feature = "UIDynamicAnimator")]
#[unsafe(method(willMoveToAnimator:))]
#[unsafe(method_family = none)]
pub fn willMoveToAnimator(&self, dynamic_animator: Option<&UIDynamicAnimator>);
#[cfg(feature = "UIDynamicAnimator")]
#[unsafe(method(dynamicAnimator))]
#[unsafe(method_family = none)]
pub fn dynamicAnimator(&self) -> Option<Retained<UIDynamicAnimator>>;
);
}
impl UIDynamicBehavior {
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>;
);
}