use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UICornerCurve(pub NSInteger);
impl UICornerCurve {
#[doc(alias = "UICornerCurveAutomatic")]
pub const Automatic: Self = Self(0);
#[doc(alias = "UICornerCurveCircular")]
pub const Circular: Self = Self(1);
#[doc(alias = "UICornerCurveContinuous")]
pub const Continuous: Self = Self(2);
}
unsafe impl Encode for UICornerCurve {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for UICornerCurve {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_protocol!(
pub unsafe trait UIShapeProvider: NSObjectProtocol {
#[method_id(@__retain_semantics Other resolvedShapeInContext:)]
unsafe fn resolvedShapeInContext(
&self,
context: &UIShapeResolutionContext,
) -> Retained<UIResolvedShape>;
}
unsafe impl ProtocolType for dyn UIShapeProvider {}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct UIShape;
unsafe impl ClassType for UIShape {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for UIShape {}
unsafe impl NSObjectProtocol for UIShape {}
unsafe impl UIShapeProvider for UIShape {}
extern_methods!(
unsafe impl UIShape {
#[method_id(@__retain_semantics Other rectShape)]
pub unsafe fn rectShape() -> Retained<UIShape>;
#[method_id(@__retain_semantics Other capsuleShape)]
pub unsafe fn capsuleShape() -> Retained<UIShape>;
#[method_id(@__retain_semantics Other circleShape)]
pub unsafe fn circleShape() -> Retained<UIShape>;
#[method_id(@__retain_semantics Other rectShapeWithCornerRadius:)]
pub unsafe fn rectShapeWithCornerRadius(corner_radius: CGFloat) -> Retained<Self>;
#[method_id(@__retain_semantics Other rectShapeWithCornerRadius:cornerCurve:)]
pub unsafe fn rectShapeWithCornerRadius_cornerCurve(
corner_radius: CGFloat,
corner_curve: UICornerCurve,
) -> Retained<Self>;
#[cfg(feature = "UIGeometry")]
#[method_id(@__retain_semantics Other rectShapeWithCornerRadius:cornerCurve:maskedCorners:)]
pub unsafe fn rectShapeWithCornerRadius_cornerCurve_maskedCorners(
corner_radius: CGFloat,
corner_curve: UICornerCurve,
masked_corners: UIRectCorner,
) -> Retained<Self>;
#[method_id(@__retain_semantics Other fixedRectShapeWithRect:)]
pub unsafe fn fixedRectShapeWithRect(rect: CGRect) -> Retained<Self>;
#[method_id(@__retain_semantics Other fixedRectShapeWithRect:cornerRadius:)]
pub unsafe fn fixedRectShapeWithRect_cornerRadius(
rect: CGRect,
corner_radius: CGFloat,
) -> Retained<Self>;
#[cfg(feature = "UIGeometry")]
#[method_id(@__retain_semantics Other fixedRectShapeWithRect:cornerRadius:cornerCurve:maskedCorners:)]
pub unsafe fn fixedRectShapeWithRect_cornerRadius_cornerCurve_maskedCorners(
rect: CGRect,
corner_radius: CGFloat,
corner_curve: UICornerCurve,
masked_corners: UIRectCorner,
) -> Retained<Self>;
#[cfg(feature = "UIBezierPath")]
#[method_id(@__retain_semantics Other shapeWithBezierPath:)]
pub unsafe fn shapeWithBezierPath(path: &UIBezierPath) -> Retained<Self>;
#[method_id(@__retain_semantics Other shapeWithProvider:)]
pub unsafe fn shapeWithProvider(
provider: &ProtocolObject<dyn UIShapeProvider>,
) -> Retained<Self>;
#[cfg(feature = "UIGeometry")]
#[method_id(@__retain_semantics Other shapeByApplyingInsets:)]
pub unsafe fn shapeByApplyingInsets(&self, insets: UIEdgeInsets) -> Retained<UIShape>;
#[method_id(@__retain_semantics Other shapeByApplyingInset:)]
pub unsafe fn shapeByApplyingInset(&self, inset: CGFloat) -> Retained<UIShape>;
#[method_id(@__retain_semantics Other resolvedShapeInContext:)]
pub unsafe fn resolvedShapeInContext(
&self,
context: &UIShapeResolutionContext,
) -> Retained<UIResolvedShape>;
#[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() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct UIResolvedShape;
unsafe impl ClassType for UIResolvedShape {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for UIResolvedShape {}
unsafe impl NSObjectProtocol for UIResolvedShape {}
extern_methods!(
unsafe impl UIResolvedShape {
#[method_id(@__retain_semantics Other shape)]
pub unsafe fn shape(&self) -> Retained<UIShape>;
#[method(boundingRect)]
pub unsafe fn boundingRect(&self) -> CGRect;
#[cfg(feature = "UIBezierPath")]
#[method_id(@__retain_semantics Other path)]
pub unsafe fn path(&self) -> Retained<UIBezierPath>;
#[cfg(feature = "UIGeometry")]
#[method_id(@__retain_semantics Other shapeByApplyingInsets:)]
pub unsafe fn shapeByApplyingInsets(
&self,
insets: UIEdgeInsets,
) -> Retained<UIResolvedShape>;
#[method_id(@__retain_semantics Other shapeByApplyingInset:)]
pub unsafe fn shapeByApplyingInset(&self, inset: CGFloat) -> Retained<UIResolvedShape>;
#[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() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct UIShapeResolutionContext;
unsafe impl ClassType for UIShapeResolutionContext {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for UIShapeResolutionContext {}
extern_methods!(
unsafe impl UIShapeResolutionContext {
#[method_id(@__retain_semantics Other contentShape)]
pub unsafe fn contentShape(&self) -> Retained<UIResolvedShape>;
#[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() -> Retained<Self>;
}
);