use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSGradientDrawingOptions(pub NSUInteger);
impl NSGradientDrawingOptions {
pub const NSGradientDrawsBeforeStartingLocation: Self = Self(1 << 0);
pub const NSGradientDrawsAfterEndingLocation: Self = Self(1 << 1);
}
unsafe impl Encode for NSGradientDrawingOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSGradientDrawingOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSGradient;
unsafe impl ClassType for NSGradient {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl Send for NSGradient {}
unsafe impl Sync for NSGradient {}
unsafe impl NSCoding for NSGradient {}
unsafe impl NSCopying for NSGradient {}
unsafe impl NSObjectProtocol for NSGradient {}
unsafe impl NSSecureCoding for NSGradient {}
extern_methods!(
unsafe impl NSGradient {
#[cfg(feature = "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(feature = "NSColor")]
#[method_id(@__retain_semantics Init initWithColors:)]
pub unsafe fn initWithColors(
this: Allocated<Self>,
color_array: &NSArray<NSColor>,
) -> Option<Id<Self>>;
#[cfg(all(feature = "NSColor", feature = "NSColorSpace"))]
#[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>>;
#[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 = "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 = "NSBezierPath")]
#[method(drawInBezierPath:relativeCenterPosition:)]
pub unsafe fn drawInBezierPath_relativeCenterPosition(
&self,
path: &NSBezierPath,
relative_center_position: NSPoint,
);
#[cfg(feature = "NSColorSpace")]
#[method_id(@__retain_semantics Other colorSpace)]
pub unsafe fn colorSpace(&self) -> Id<NSColorSpace>;
#[method(numberOfColorStops)]
pub unsafe fn numberOfColorStops(&self) -> NSInteger;
#[cfg(feature = "NSColor")]
#[method(getColor:location:atIndex:)]
pub unsafe fn getColor_location_atIndex(
&self,
color: Option<&mut Id<NSColor>>,
location: *mut CGFloat,
index: NSInteger,
);
#[cfg(feature = "NSColor")]
#[method_id(@__retain_semantics Other interpolatedColorAtLocation:)]
pub unsafe fn interpolatedColorAtLocation(&self, location: CGFloat) -> Id<NSColor>;
}
);
extern_methods!(
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>;
}
);