icrate 0.1.2

Bindings to Apple's frameworks
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use crate::common::*;
use crate::AppKit::*;
use crate::CoreData::*;
use crate::Foundation::*;

ns_options!(
    #[underlying(NSUInteger)]
    pub enum NSGradientDrawingOptions {
        NSGradientDrawsBeforeStartingLocation = 1 << 0,
        NSGradientDrawsAfterEndingLocation = 1 << 1,
    }
);

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "AppKit_NSGradient")]
    pub struct NSGradient;

    #[cfg(feature = "AppKit_NSGradient")]
    unsafe impl ClassType for NSGradient {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

#[cfg(feature = "AppKit_NSGradient")]
unsafe impl Send for NSGradient {}

#[cfg(feature = "AppKit_NSGradient")]
unsafe impl Sync for NSGradient {}

#[cfg(feature = "AppKit_NSGradient")]
unsafe impl NSCoding for NSGradient {}

#[cfg(feature = "AppKit_NSGradient")]
unsafe impl NSCopying for NSGradient {}

#[cfg(feature = "AppKit_NSGradient")]
unsafe impl NSObjectProtocol for NSGradient {}

#[cfg(feature = "AppKit_NSGradient")]
unsafe impl NSSecureCoding for NSGradient {}

extern_methods!(
    #[cfg(feature = "AppKit_NSGradient")]
    unsafe impl NSGradient {
        #[cfg(feature = "AppKit_NSColor")]
        #[method_id(@__retain_semantics Init initWithStartingColor:endingColor:)]
        pub unsafe fn initWithStartingColor_endingColor(
            this: Allocated<Self>,
            starting_color: &NSColor,
            ending_color: &NSColor,
        ) -> Option<Id<Self>>;

        #[cfg(all(feature = "AppKit_NSColor", feature = "Foundation_NSArray"))]
        #[method_id(@__retain_semantics Init initWithColors:)]
        pub unsafe fn initWithColors(
            this: Allocated<Self>,
            color_array: &NSArray<NSColor>,
        ) -> Option<Id<Self>>;

        #[cfg(all(
            feature = "AppKit_NSColor",
            feature = "AppKit_NSColorSpace",
            feature = "Foundation_NSArray"
        ))]
        #[method_id(@__retain_semantics Init initWithColors:atLocations:colorSpace:)]
        pub unsafe fn initWithColors_atLocations_colorSpace(
            this: Allocated<Self>,
            color_array: &NSArray<NSColor>,
            locations: *mut CGFloat,
            color_space: &NSColorSpace,
        ) -> Option<Id<Self>>;

        #[cfg(feature = "Foundation_NSCoder")]
        #[method_id(@__retain_semantics Init initWithCoder:)]
        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Option<Id<Self>>;

        #[method(drawFromPoint:toPoint:options:)]
        pub unsafe fn drawFromPoint_toPoint_options(
            &self,
            starting_point: NSPoint,
            ending_point: NSPoint,
            options: NSGradientDrawingOptions,
        );

        #[method(drawInRect:angle:)]
        pub unsafe fn drawInRect_angle(&self, rect: NSRect, angle: CGFloat);

        #[cfg(feature = "AppKit_NSBezierPath")]
        #[method(drawInBezierPath:angle:)]
        pub unsafe fn drawInBezierPath_angle(&self, path: &NSBezierPath, angle: CGFloat);

        #[method(drawFromCenter:radius:toCenter:radius:options:)]
        pub unsafe fn drawFromCenter_radius_toCenter_radius_options(
            &self,
            start_center: NSPoint,
            start_radius: CGFloat,
            end_center: NSPoint,
            end_radius: CGFloat,
            options: NSGradientDrawingOptions,
        );

        #[method(drawInRect:relativeCenterPosition:)]
        pub unsafe fn drawInRect_relativeCenterPosition(
            &self,
            rect: NSRect,
            relative_center_position: NSPoint,
        );

        #[cfg(feature = "AppKit_NSBezierPath")]
        #[method(drawInBezierPath:relativeCenterPosition:)]
        pub unsafe fn drawInBezierPath_relativeCenterPosition(
            &self,
            path: &NSBezierPath,
            relative_center_position: NSPoint,
        );

        #[cfg(feature = "AppKit_NSColorSpace")]
        #[method_id(@__retain_semantics Other colorSpace)]
        pub unsafe fn colorSpace(&self) -> Id<NSColorSpace>;

        #[method(numberOfColorStops)]
        pub unsafe fn numberOfColorStops(&self) -> NSInteger;

        #[cfg(feature = "AppKit_NSColor")]
        #[method(getColor:location:atIndex:)]
        pub unsafe fn getColor_location_atIndex(
            &self,
            color: Option<&mut Id<NSColor>>,
            location: *mut CGFloat,
            index: NSInteger,
        );

        #[cfg(feature = "AppKit_NSColor")]
        #[method_id(@__retain_semantics Other interpolatedColorAtLocation:)]
        pub unsafe fn interpolatedColorAtLocation(&self, location: CGFloat) -> Id<NSColor>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    #[cfg(feature = "AppKit_NSGradient")]
    unsafe impl NSGradient {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Id<Self>;
    }
);