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::*;
#[cfg(feature = "objc2-core-graphics")]
use objc2_core_graphics::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uibezierpath?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct UIBezierPath;
);

extern_conformance!(
    unsafe impl NSCoding for UIBezierPath {}
);

extern_conformance!(
    unsafe impl NSCopying for UIBezierPath {}
);

unsafe impl CopyingHelper for UIBezierPath {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for UIBezierPath {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for UIBezierPath {}
);

impl UIBezierPath {
    extern_methods!(
        #[unsafe(method(bezierPath))]
        #[unsafe(method_family = none)]
        pub fn bezierPath() -> Retained<Self>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(bezierPathWithRect:))]
        #[unsafe(method_family = none)]
        pub fn bezierPathWithRect(rect: CGRect) -> Retained<Self>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(bezierPathWithOvalInRect:))]
        #[unsafe(method_family = none)]
        pub fn bezierPathWithOvalInRect(rect: CGRect) -> Retained<Self>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(bezierPathWithRoundedRect:cornerRadius:))]
        #[unsafe(method_family = none)]
        pub fn bezierPathWithRoundedRect_cornerRadius(
            rect: CGRect,
            corner_radius: CGFloat,
        ) -> Retained<Self>;

        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
        #[unsafe(method(bezierPathWithRoundedRect:byRoundingCorners:cornerRadii:))]
        #[unsafe(method_family = none)]
        pub fn bezierPathWithRoundedRect_byRoundingCorners_cornerRadii(
            rect: CGRect,
            corners: UIRectCorner,
            corner_radii: CGSize,
        ) -> Retained<Self>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(bezierPathWithArcCenter:radius:startAngle:endAngle:clockwise:))]
        #[unsafe(method_family = none)]
        pub fn bezierPathWithArcCenter_radius_startAngle_endAngle_clockwise(
            center: CGPoint,
            radius: CGFloat,
            start_angle: CGFloat,
            end_angle: CGFloat,
            clockwise: bool,
        ) -> Retained<Self>;

        #[cfg(feature = "objc2-core-graphics")]
        #[unsafe(method(bezierPathWithCGPath:))]
        #[unsafe(method_family = none)]
        pub fn bezierPathWithCGPath(cg_path: &CGPath) -> Retained<Self>;

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;

        /// # Safety
        ///
        /// `coder` possibly has further requirements.
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;

        #[cfg(feature = "objc2-core-graphics")]
        #[unsafe(method(CGPath))]
        #[unsafe(method_family = none)]
        pub fn CGPath(&self) -> Retained<CGPath>;

        #[cfg(feature = "objc2-core-graphics")]
        /// Setter for [`CGPath`][Self::CGPath].
        #[unsafe(method(setCGPath:))]
        #[unsafe(method_family = none)]
        pub fn setCGPath(&self, cg_path: &CGPath);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(moveToPoint:))]
        #[unsafe(method_family = none)]
        pub fn moveToPoint(&self, point: CGPoint);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(addLineToPoint:))]
        #[unsafe(method_family = none)]
        pub fn addLineToPoint(&self, point: CGPoint);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(addCurveToPoint:controlPoint1:controlPoint2:))]
        #[unsafe(method_family = none)]
        pub fn addCurveToPoint_controlPoint1_controlPoint2(
            &self,
            end_point: CGPoint,
            control_point1: CGPoint,
            control_point2: CGPoint,
        );

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(addQuadCurveToPoint:controlPoint:))]
        #[unsafe(method_family = none)]
        pub fn addQuadCurveToPoint_controlPoint(&self, end_point: CGPoint, control_point: CGPoint);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(addArcWithCenter:radius:startAngle:endAngle:clockwise:))]
        #[unsafe(method_family = none)]
        pub fn addArcWithCenter_radius_startAngle_endAngle_clockwise(
            &self,
            center: CGPoint,
            radius: CGFloat,
            start_angle: CGFloat,
            end_angle: CGFloat,
            clockwise: bool,
        );

        #[unsafe(method(closePath))]
        #[unsafe(method_family = none)]
        pub fn closePath(&self);

        #[unsafe(method(removeAllPoints))]
        #[unsafe(method_family = none)]
        pub fn removeAllPoints(&self);

        #[unsafe(method(appendPath:))]
        #[unsafe(method_family = none)]
        pub fn appendPath(&self, bezier_path: &UIBezierPath);

        #[unsafe(method(bezierPathByReversingPath))]
        #[unsafe(method_family = none)]
        pub fn bezierPathByReversingPath(&self) -> Retained<UIBezierPath>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(applyTransform:))]
        #[unsafe(method_family = none)]
        pub fn applyTransform(&self, transform: CGAffineTransform);

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

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

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

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(containsPoint:))]
        #[unsafe(method_family = none)]
        pub fn containsPoint(&self, point: CGPoint) -> bool;

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

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

        #[cfg(feature = "objc2-core-graphics")]
        #[unsafe(method(lineCapStyle))]
        #[unsafe(method_family = none)]
        pub fn lineCapStyle(&self) -> CGLineCap;

        #[cfg(feature = "objc2-core-graphics")]
        /// Setter for [`lineCapStyle`][Self::lineCapStyle].
        #[unsafe(method(setLineCapStyle:))]
        #[unsafe(method_family = none)]
        pub fn setLineCapStyle(&self, line_cap_style: CGLineCap);

        #[cfg(feature = "objc2-core-graphics")]
        #[unsafe(method(lineJoinStyle))]
        #[unsafe(method_family = none)]
        pub fn lineJoinStyle(&self) -> CGLineJoin;

        #[cfg(feature = "objc2-core-graphics")]
        /// Setter for [`lineJoinStyle`][Self::lineJoinStyle].
        #[unsafe(method(setLineJoinStyle:))]
        #[unsafe(method_family = none)]
        pub fn setLineJoinStyle(&self, line_join_style: CGLineJoin);

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

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

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

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

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

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

        #[cfg(feature = "objc2-core-foundation")]
        /// # Safety
        ///
        /// `pattern` must be a valid pointer or null.
        #[unsafe(method(setLineDash:count:phase:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setLineDash_count_phase(
            &self,
            pattern: *const CGFloat,
            count: NSInteger,
            phase: CGFloat,
        );

        #[cfg(feature = "objc2-core-foundation")]
        /// # Safety
        ///
        /// - `pattern` must be a valid pointer or null.
        /// - `count` must be a valid pointer or null.
        /// - `phase` must be a valid pointer or null.
        #[unsafe(method(getLineDash:count:phase:))]
        #[unsafe(method_family = none)]
        pub unsafe fn getLineDash_count_phase(
            &self,
            pattern: *mut CGFloat,
            count: *mut NSInteger,
            phase: *mut CGFloat,
        );

        #[unsafe(method(fill))]
        #[unsafe(method_family = none)]
        pub fn fill(&self);

        #[unsafe(method(stroke))]
        #[unsafe(method_family = none)]
        pub fn stroke(&self);

        #[cfg(all(feature = "objc2-core-foundation", feature = "objc2-core-graphics"))]
        #[unsafe(method(fillWithBlendMode:alpha:))]
        #[unsafe(method_family = none)]
        pub fn fillWithBlendMode_alpha(&self, blend_mode: CGBlendMode, alpha: CGFloat);

        #[cfg(all(feature = "objc2-core-foundation", feature = "objc2-core-graphics"))]
        #[unsafe(method(strokeWithBlendMode:alpha:))]
        #[unsafe(method_family = none)]
        pub fn strokeWithBlendMode_alpha(&self, blend_mode: CGBlendMode, alpha: CGFloat);

        #[unsafe(method(addClip))]
        #[unsafe(method_family = none)]
        pub fn addClip(&self);
    );
}

/// Methods declared on superclass `NSObject`.
impl UIBezierPath {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new() -> Retained<Self>;
    );
}

impl DefaultRetained for UIBezierPath {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}