use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
pub type CALayerContentsGravity = NSString;
pub type CALayerContentsFormat = NSString;
pub type CALayerContentsFilter = NSString;
pub type CALayerCornerCurve = NSString;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CAAutoresizingMask(pub c_uint);
bitflags::bitflags! {
impl CAAutoresizingMask: c_uint {
const kCALayerNotSizable = 0;
const kCALayerMinXMargin = 1<<0;
const kCALayerWidthSizable = 1<<1;
const kCALayerMaxXMargin = 1<<2;
const kCALayerMinYMargin = 1<<3;
const kCALayerHeightSizable = 1<<4;
const kCALayerMaxYMargin = 1<<5;
}
}
unsafe impl Encode for CAAutoresizingMask {
const ENCODING: Encoding = c_uint::ENCODING;
}
unsafe impl RefEncode for CAAutoresizingMask {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CAEdgeAntialiasingMask(pub c_uint);
bitflags::bitflags! {
impl CAEdgeAntialiasingMask: c_uint {
const kCALayerLeftEdge = 1<<0;
const kCALayerRightEdge = 1<<1;
const kCALayerBottomEdge = 1<<2;
const kCALayerTopEdge = 1<<3;
}
}
unsafe impl Encode for CAEdgeAntialiasingMask {
const ENCODING: Encoding = c_uint::ENCODING;
}
unsafe impl RefEncode for CAEdgeAntialiasingMask {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CACornerMask(pub NSUInteger);
bitflags::bitflags! {
impl CACornerMask: NSUInteger {
const kCALayerMinXMinYCorner = 1<<0;
const kCALayerMaxXMinYCorner = 1<<1;
const kCALayerMinXMaxYCorner = 1<<2;
const kCALayerMaxXMaxYCorner = 1<<3;
}
}
unsafe impl Encode for CACornerMask {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for CACornerMask {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct CALayer;
unsafe impl ClassType for CALayer {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "CAMediaTiming")]
unsafe impl CAMediaTiming for CALayer {}
unsafe impl NSCoding for CALayer {}
unsafe impl NSObjectProtocol for CALayer {}
unsafe impl NSSecureCoding for CALayer {}
extern_methods!(
unsafe impl CALayer {
#[method_id(@__retain_semantics Other layer)]
pub fn layer() -> Retained<Self>;
#[method_id(@__retain_semantics Init init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithLayer:)]
pub unsafe fn initWithLayer(this: Allocated<Self>, layer: &AnyObject) -> Retained<Self>;
#[method_id(@__retain_semantics Other presentationLayer)]
pub unsafe fn presentationLayer(&self) -> Option<Retained<Self>>;
#[method_id(@__retain_semantics Other modelLayer)]
pub unsafe fn modelLayer(&self) -> Retained<Self>;
#[method_id(@__retain_semantics Other defaultValueForKey:)]
pub unsafe fn defaultValueForKey(key: &NSString) -> Option<Retained<AnyObject>>;
#[method(needsDisplayForKey:)]
pub unsafe fn needsDisplayForKey(key: &NSString) -> bool;
#[method(shouldArchiveValueForKey:)]
pub unsafe fn shouldArchiveValueForKey(&self, key: &NSString) -> bool;
#[method(bounds)]
pub fn bounds(&self) -> CGRect;
#[method(setBounds:)]
pub fn setBounds(&self, bounds: CGRect);
#[method(position)]
pub fn position(&self) -> CGPoint;
#[method(setPosition:)]
pub fn setPosition(&self, position: CGPoint);
#[method(zPosition)]
pub fn zPosition(&self) -> CGFloat;
#[method(setZPosition:)]
pub fn setZPosition(&self, z_position: CGFloat);
#[method(anchorPoint)]
pub fn anchorPoint(&self) -> CGPoint;
#[method(setAnchorPoint:)]
pub fn setAnchorPoint(&self, anchor_point: CGPoint);
#[method(anchorPointZ)]
pub fn anchorPointZ(&self) -> CGFloat;
#[method(setAnchorPointZ:)]
pub fn setAnchorPointZ(&self, anchor_point_z: CGFloat);
#[cfg(feature = "CATransform3D")]
#[method(transform)]
pub fn transform(&self) -> CATransform3D;
#[cfg(feature = "CATransform3D")]
#[method(setTransform:)]
pub fn setTransform(&self, transform: CATransform3D);
#[method(frame)]
pub fn frame(&self) -> CGRect;
#[method(setFrame:)]
pub fn setFrame(&self, frame: CGRect);
#[method(isHidden)]
pub fn isHidden(&self) -> bool;
#[method(setHidden:)]
pub fn setHidden(&self, hidden: bool);
#[method(isDoubleSided)]
pub fn isDoubleSided(&self) -> bool;
#[method(setDoubleSided:)]
pub fn setDoubleSided(&self, double_sided: bool);
#[method(isGeometryFlipped)]
pub fn isGeometryFlipped(&self) -> bool;
#[method(setGeometryFlipped:)]
pub fn setGeometryFlipped(&self, geometry_flipped: bool);
#[method(contentsAreFlipped)]
pub fn contentsAreFlipped(&self) -> bool;
#[method_id(@__retain_semantics Other superlayer)]
pub fn superlayer(&self) -> Option<Retained<CALayer>>;
#[method(removeFromSuperlayer)]
pub fn removeFromSuperlayer(&self);
#[method_id(@__retain_semantics Other sublayers)]
pub unsafe fn sublayers(&self) -> Option<Retained<NSArray<CALayer>>>;
#[method(setSublayers:)]
pub unsafe fn setSublayers(&self, sublayers: Option<&NSArray<CALayer>>);
#[method(addSublayer:)]
pub fn addSublayer(&self, layer: &CALayer);
#[method(insertSublayer:atIndex:)]
pub fn insertSublayer_atIndex(&self, layer: &CALayer, idx: c_uint);
#[method(insertSublayer:below:)]
pub fn insertSublayer_below(&self, layer: &CALayer, sibling: Option<&CALayer>);
#[method(insertSublayer:above:)]
pub fn insertSublayer_above(&self, layer: &CALayer, sibling: Option<&CALayer>);
#[method(replaceSublayer:with:)]
pub unsafe fn replaceSublayer_with(&self, old_layer: &CALayer, new_layer: &CALayer);
#[cfg(feature = "CATransform3D")]
#[method(sublayerTransform)]
pub fn sublayerTransform(&self) -> CATransform3D;
#[cfg(feature = "CATransform3D")]
#[method(setSublayerTransform:)]
pub fn setSublayerTransform(&self, sublayer_transform: CATransform3D);
#[method_id(@__retain_semantics Other mask)]
pub fn mask(&self) -> Option<Retained<CALayer>>;
#[method(setMask:)]
pub unsafe fn setMask(&self, mask: Option<&CALayer>);
#[method(masksToBounds)]
pub fn masksToBounds(&self) -> bool;
#[method(setMasksToBounds:)]
pub fn setMasksToBounds(&self, masks_to_bounds: bool);
#[method(convertPoint:fromLayer:)]
pub fn convertPoint_fromLayer(&self, p: CGPoint, l: Option<&CALayer>) -> CGPoint;
#[method(convertPoint:toLayer:)]
pub fn convertPoint_toLayer(&self, p: CGPoint, l: Option<&CALayer>) -> CGPoint;
#[method(convertRect:fromLayer:)]
pub fn convertRect_fromLayer(&self, r: CGRect, l: Option<&CALayer>) -> CGRect;
#[method(convertRect:toLayer:)]
pub fn convertRect_toLayer(&self, r: CGRect, l: Option<&CALayer>) -> CGRect;
#[method(convertTime:fromLayer:)]
pub fn convertTime_fromLayer(
&self,
t: CFTimeInterval,
l: Option<&CALayer>,
) -> CFTimeInterval;
#[method(convertTime:toLayer:)]
pub fn convertTime_toLayer(&self, t: CFTimeInterval, l: Option<&CALayer>)
-> CFTimeInterval;
#[method_id(@__retain_semantics Other hitTest:)]
pub fn hitTest(&self, p: CGPoint) -> Option<Retained<CALayer>>;
#[method(containsPoint:)]
pub fn containsPoint(&self, p: CGPoint) -> bool;
#[method_id(@__retain_semantics Other contents)]
pub unsafe fn contents(&self) -> Option<Retained<AnyObject>>;
#[method(setContents:)]
pub unsafe fn setContents(&self, contents: Option<&AnyObject>);
#[method(contentsRect)]
pub fn contentsRect(&self) -> CGRect;
#[method(setContentsRect:)]
pub fn setContentsRect(&self, contents_rect: CGRect);
#[method_id(@__retain_semantics Other contentsGravity)]
pub fn contentsGravity(&self) -> Retained<CALayerContentsGravity>;
#[method(setContentsGravity:)]
pub fn setContentsGravity(&self, contents_gravity: &CALayerContentsGravity);
#[method(contentsScale)]
pub fn contentsScale(&self) -> CGFloat;
#[method(setContentsScale:)]
pub fn setContentsScale(&self, contents_scale: CGFloat);
#[method(contentsCenter)]
pub fn contentsCenter(&self) -> CGRect;
#[method(setContentsCenter:)]
pub fn setContentsCenter(&self, contents_center: CGRect);
#[method_id(@__retain_semantics Other contentsFormat)]
pub fn contentsFormat(&self) -> Retained<CALayerContentsFormat>;
#[method(setContentsFormat:)]
pub fn setContentsFormat(&self, contents_format: &CALayerContentsFormat);
#[method(wantsExtendedDynamicRangeContent)]
pub unsafe fn wantsExtendedDynamicRangeContent(&self) -> bool;
#[method(setWantsExtendedDynamicRangeContent:)]
pub unsafe fn setWantsExtendedDynamicRangeContent(
&self,
wants_extended_dynamic_range_content: bool,
);
#[method_id(@__retain_semantics Other minificationFilter)]
pub fn minificationFilter(&self) -> Retained<CALayerContentsFilter>;
#[method(setMinificationFilter:)]
pub fn setMinificationFilter(&self, minification_filter: &CALayerContentsFilter);
#[method_id(@__retain_semantics Other magnificationFilter)]
pub fn magnificationFilter(&self) -> Retained<CALayerContentsFilter>;
#[method(setMagnificationFilter:)]
pub fn setMagnificationFilter(&self, magnification_filter: &CALayerContentsFilter);
#[method(minificationFilterBias)]
pub fn minificationFilterBias(&self) -> c_float;
#[method(setMinificationFilterBias:)]
pub fn setMinificationFilterBias(&self, minification_filter_bias: c_float);
#[method(isOpaque)]
pub fn isOpaque(&self) -> bool;
#[method(setOpaque:)]
pub fn setOpaque(&self, opaque: bool);
#[method(display)]
pub fn display(&self);
#[method(setNeedsDisplay)]
pub fn setNeedsDisplay(&self);
#[method(setNeedsDisplayInRect:)]
pub fn setNeedsDisplayInRect(&self, r: CGRect);
#[method(needsDisplay)]
pub fn needsDisplay(&self) -> bool;
#[method(displayIfNeeded)]
pub fn displayIfNeeded(&self);
#[method(needsDisplayOnBoundsChange)]
pub fn needsDisplayOnBoundsChange(&self) -> bool;
#[method(setNeedsDisplayOnBoundsChange:)]
pub fn setNeedsDisplayOnBoundsChange(&self, needs_display_on_bounds_change: bool);
#[method(drawsAsynchronously)]
pub fn drawsAsynchronously(&self) -> bool;
#[method(setDrawsAsynchronously:)]
pub fn setDrawsAsynchronously(&self, draws_asynchronously: bool);
#[method(edgeAntialiasingMask)]
pub fn edgeAntialiasingMask(&self) -> CAEdgeAntialiasingMask;
#[method(setEdgeAntialiasingMask:)]
pub fn setEdgeAntialiasingMask(&self, edge_antialiasing_mask: CAEdgeAntialiasingMask);
#[method(allowsEdgeAntialiasing)]
pub fn allowsEdgeAntialiasing(&self) -> bool;
#[method(setAllowsEdgeAntialiasing:)]
pub fn setAllowsEdgeAntialiasing(&self, allows_edge_antialiasing: bool);
#[method(cornerRadius)]
pub fn cornerRadius(&self) -> CGFloat;
#[method(setCornerRadius:)]
pub fn setCornerRadius(&self, corner_radius: CGFloat);
#[method(maskedCorners)]
pub fn maskedCorners(&self) -> CACornerMask;
#[method(setMaskedCorners:)]
pub fn setMaskedCorners(&self, masked_corners: CACornerMask);
#[method_id(@__retain_semantics Other cornerCurve)]
pub fn cornerCurve(&self) -> Retained<CALayerCornerCurve>;
#[method(setCornerCurve:)]
pub fn setCornerCurve(&self, corner_curve: &CALayerCornerCurve);
#[method(cornerCurveExpansionFactor:)]
pub fn cornerCurveExpansionFactor(curve: &CALayerCornerCurve) -> CGFloat;
#[method(borderWidth)]
pub fn borderWidth(&self) -> CGFloat;
#[method(setBorderWidth:)]
pub fn setBorderWidth(&self, border_width: CGFloat);
#[method(opacity)]
pub fn opacity(&self) -> c_float;
#[method(setOpacity:)]
pub fn setOpacity(&self, opacity: c_float);
#[method(allowsGroupOpacity)]
pub fn allowsGroupOpacity(&self) -> bool;
#[method(setAllowsGroupOpacity:)]
pub fn setAllowsGroupOpacity(&self, allows_group_opacity: bool);
#[method_id(@__retain_semantics Other compositingFilter)]
pub unsafe fn compositingFilter(&self) -> Option<Retained<AnyObject>>;
#[method(setCompositingFilter:)]
pub unsafe fn setCompositingFilter(&self, compositing_filter: Option<&AnyObject>);
#[method_id(@__retain_semantics Other filters)]
pub unsafe fn filters(&self) -> Option<Retained<NSArray>>;
#[method(setFilters:)]
pub unsafe fn setFilters(&self, filters: Option<&NSArray>);
#[method_id(@__retain_semantics Other backgroundFilters)]
pub unsafe fn backgroundFilters(&self) -> Option<Retained<NSArray>>;
#[method(setBackgroundFilters:)]
pub unsafe fn setBackgroundFilters(&self, background_filters: Option<&NSArray>);
#[method(shouldRasterize)]
pub fn shouldRasterize(&self) -> bool;
#[method(setShouldRasterize:)]
pub fn setShouldRasterize(&self, should_rasterize: bool);
#[method(rasterizationScale)]
pub fn rasterizationScale(&self) -> CGFloat;
#[method(setRasterizationScale:)]
pub fn setRasterizationScale(&self, rasterization_scale: CGFloat);
#[method(shadowOpacity)]
pub fn shadowOpacity(&self) -> c_float;
#[method(setShadowOpacity:)]
pub fn setShadowOpacity(&self, shadow_opacity: c_float);
#[method(shadowOffset)]
pub fn shadowOffset(&self) -> CGSize;
#[method(setShadowOffset:)]
pub fn setShadowOffset(&self, shadow_offset: CGSize);
#[method(shadowRadius)]
pub fn shadowRadius(&self) -> CGFloat;
#[method(setShadowRadius:)]
pub fn setShadowRadius(&self, shadow_radius: CGFloat);
#[method(autoresizingMask)]
pub fn autoresizingMask(&self) -> CAAutoresizingMask;
#[method(setAutoresizingMask:)]
pub fn setAutoresizingMask(&self, autoresizing_mask: CAAutoresizingMask);
#[method_id(@__retain_semantics Other layoutManager)]
pub fn layoutManager(&self) -> Option<Retained<ProtocolObject<dyn CALayoutManager>>>;
#[method(setLayoutManager:)]
pub fn setLayoutManager(
&self,
layout_manager: Option<&ProtocolObject<dyn CALayoutManager>>,
);
#[method(preferredFrameSize)]
pub fn preferredFrameSize(&self) -> CGSize;
#[method(setNeedsLayout)]
pub fn setNeedsLayout(&self);
#[method(needsLayout)]
pub fn needsLayout(&self) -> bool;
#[method(layoutIfNeeded)]
pub fn layoutIfNeeded(&self);
#[method(layoutSublayers)]
pub fn layoutSublayers(&self);
#[method(resizeSublayersWithOldSize:)]
pub fn resizeSublayersWithOldSize(&self, size: CGSize);
#[method(resizeWithOldSuperlayerSize:)]
pub fn resizeWithOldSuperlayerSize(&self, size: CGSize);
#[method_id(@__retain_semantics Other defaultActionForKey:)]
pub fn defaultActionForKey(
event: &NSString,
) -> Option<Retained<ProtocolObject<dyn CAAction>>>;
#[method_id(@__retain_semantics Other actionForKey:)]
pub fn actionForKey(
&self,
event: &NSString,
) -> Option<Retained<ProtocolObject<dyn CAAction>>>;
#[method_id(@__retain_semantics Other actions)]
pub fn actions(
&self,
) -> Option<Retained<NSDictionary<NSString, ProtocolObject<dyn CAAction>>>>;
#[method(setActions:)]
pub fn setActions(
&self,
actions: Option<&NSDictionary<NSString, ProtocolObject<dyn CAAction>>>,
);
#[cfg(feature = "CAAnimation")]
#[method(addAnimation:forKey:)]
pub fn addAnimation_forKey(&self, anim: &CAAnimation, key: Option<&NSString>);
#[method(removeAllAnimations)]
pub fn removeAllAnimations(&self);
#[method(removeAnimationForKey:)]
pub fn removeAnimationForKey(&self, key: &NSString);
#[method_id(@__retain_semantics Other animationKeys)]
pub fn animationKeys(&self) -> Option<Retained<NSArray<NSString>>>;
#[cfg(feature = "CAAnimation")]
#[method_id(@__retain_semantics Other animationForKey:)]
pub unsafe fn animationForKey(&self, key: &NSString) -> Option<Retained<CAAnimation>>;
#[method_id(@__retain_semantics Other name)]
pub fn name(&self) -> Option<Retained<NSString>>;
#[method(setName:)]
pub fn setName(&self, name: Option<&NSString>);
#[method_id(@__retain_semantics Other delegate)]
pub fn delegate(&self) -> Option<Retained<ProtocolObject<dyn CALayerDelegate>>>;
#[method(setDelegate:)]
pub fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn CALayerDelegate>>);
#[method_id(@__retain_semantics Other style)]
pub unsafe fn style(&self) -> Option<Retained<NSDictionary>>;
#[method(setStyle:)]
pub unsafe fn setStyle(&self, style: Option<&NSDictionary>);
}
);
extern_methods!(
unsafe impl CALayer {
#[method_id(@__retain_semantics New new)]
pub fn new() -> Retained<Self>;
}
);
impl DefaultRetained for CALayer {
#[inline]
fn default_id() -> Retained<Self> {
Self::new()
}
}
extern_protocol!(
pub unsafe trait CALayoutManager: NSObjectProtocol {
#[optional]
#[method(preferredSizeOfLayer:)]
unsafe fn preferredSizeOfLayer(&self, layer: &CALayer) -> CGSize;
#[optional]
#[method(invalidateLayoutOfLayer:)]
unsafe fn invalidateLayoutOfLayer(&self, layer: &CALayer);
#[optional]
#[method(layoutSublayersOfLayer:)]
unsafe fn layoutSublayersOfLayer(&self, layer: &CALayer);
}
unsafe impl ProtocolType for dyn CALayoutManager {}
);
extern_protocol!(
pub unsafe trait CAAction {
#[method(runActionForKey:object:arguments:)]
unsafe fn runActionForKey_object_arguments(
&self,
event: &NSString,
an_object: &AnyObject,
dict: Option<&NSDictionary>,
);
}
unsafe impl ProtocolType for dyn CAAction {}
);
unsafe impl CAAction for NSNull {}
extern_protocol!(
pub unsafe trait CALayerDelegate: NSObjectProtocol {
#[optional]
#[method(displayLayer:)]
unsafe fn displayLayer(&self, layer: &CALayer);
#[optional]
#[method(layerWillDraw:)]
unsafe fn layerWillDraw(&self, layer: &CALayer);
#[optional]
#[method(layoutSublayersOfLayer:)]
unsafe fn layoutSublayersOfLayer(&self, layer: &CALayer);
#[optional]
#[method_id(@__retain_semantics Other actionForLayer:forKey:)]
unsafe fn actionForLayer_forKey(
&self,
layer: &CALayer,
event: &NSString,
) -> Option<Retained<ProtocolObject<dyn CAAction>>>;
}
unsafe impl ProtocolType for dyn CALayerDelegate {}
);
extern "C" {
pub static kCAGravityCenter: &'static CALayerContentsGravity;
}
extern "C" {
pub static kCAGravityTop: &'static CALayerContentsGravity;
}
extern "C" {
pub static kCAGravityBottom: &'static CALayerContentsGravity;
}
extern "C" {
pub static kCAGravityLeft: &'static CALayerContentsGravity;
}
extern "C" {
pub static kCAGravityRight: &'static CALayerContentsGravity;
}
extern "C" {
pub static kCAGravityTopLeft: &'static CALayerContentsGravity;
}
extern "C" {
pub static kCAGravityTopRight: &'static CALayerContentsGravity;
}
extern "C" {
pub static kCAGravityBottomLeft: &'static CALayerContentsGravity;
}
extern "C" {
pub static kCAGravityBottomRight: &'static CALayerContentsGravity;
}
extern "C" {
pub static kCAGravityResize: &'static CALayerContentsGravity;
}
extern "C" {
pub static kCAGravityResizeAspect: &'static CALayerContentsGravity;
}
extern "C" {
pub static kCAGravityResizeAspectFill: &'static CALayerContentsGravity;
}
extern "C" {
pub static kCAContentsFormatRGBA8Uint: &'static CALayerContentsFormat;
}
extern "C" {
pub static kCAContentsFormatRGBA16Float: &'static CALayerContentsFormat;
}
extern "C" {
pub static kCAContentsFormatGray8Uint: &'static CALayerContentsFormat;
}
extern "C" {
pub static kCAFilterNearest: &'static CALayerContentsFilter;
}
extern "C" {
pub static kCAFilterLinear: &'static CALayerContentsFilter;
}
extern "C" {
pub static kCAFilterTrilinear: &'static CALayerContentsFilter;
}
extern "C" {
pub static kCACornerCurveCircular: &'static CALayerCornerCurve;
}
extern "C" {
pub static kCACornerCurveContinuous: &'static CALayerCornerCurve;
}
extern "C" {
pub static kCAOnOrderIn: &'static NSString;
}
extern "C" {
pub static kCAOnOrderOut: &'static NSString;
}
extern "C" {
pub static kCATransition: &'static NSString;
}