use crate::common::*;
use crate::Foundation::*;
pub type NSPointPointer = *mut NSPoint;
pub type NSPointArray = *mut NSPoint;
pub type NSSizePointer = *mut NSSize;
pub type NSSizeArray = *mut NSSize;
pub type NSRectPointer = *mut NSRect;
pub type NSRectArray = *mut NSRect;
extern_struct!(
pub struct NSEdgeInsets {
pub top: CGFloat,
pub left: CGFloat,
pub bottom: CGFloat,
pub right: CGFloat,
}
);
ns_options!(
#[underlying(c_ulonglong)]
pub enum NSAlignmentOptions {
NSAlignMinXInward = 1 << 0,
NSAlignMinYInward = 1 << 1,
NSAlignMaxXInward = 1 << 2,
NSAlignMaxYInward = 1 << 3,
NSAlignWidthInward = 1 << 4,
NSAlignHeightInward = 1 << 5,
NSAlignMinXOutward = 1 << 8,
NSAlignMinYOutward = 1 << 9,
NSAlignMaxXOutward = 1 << 10,
NSAlignMaxYOutward = 1 << 11,
NSAlignWidthOutward = 1 << 12,
NSAlignHeightOutward = 1 << 13,
NSAlignMinXNearest = 1 << 16,
NSAlignMinYNearest = 1 << 17,
NSAlignMaxXNearest = 1 << 18,
NSAlignMaxYNearest = 1 << 19,
NSAlignWidthNearest = 1 << 20,
NSAlignHeightNearest = 1 << 21,
NSAlignRectFlipped = 1 << 63,
NSAlignAllEdgesInward =
NSAlignMinXInward | NSAlignMaxXInward | NSAlignMinYInward | NSAlignMaxYInward,
NSAlignAllEdgesOutward =
NSAlignMinXOutward | NSAlignMaxXOutward | NSAlignMinYOutward | NSAlignMaxYOutward,
NSAlignAllEdgesNearest =
NSAlignMinXNearest | NSAlignMaxXNearest | NSAlignMinYNearest | NSAlignMaxYNearest,
}
);
extern_static!(NSZeroPoint: NSPoint);
extern_static!(NSZeroSize: NSSize);
extern_static!(NSZeroRect: NSRect);
extern_static!(NSEdgeInsetsZero: NSEdgeInsets);
inline_fn!(
pub unsafe fn NSMakePoint(x: CGFloat, y: CGFloat) -> NSPoint {
todo!()
}
);
inline_fn!(
pub unsafe fn NSMakeSize(w: CGFloat, h: CGFloat) -> NSSize {
todo!()
}
);
inline_fn!(
pub unsafe fn NSMakeRect(x: CGFloat, y: CGFloat, w: CGFloat, h: CGFloat) -> NSRect {
todo!()
}
);
inline_fn!(
pub unsafe fn NSMaxX(aRect: NSRect) -> CGFloat {
todo!()
}
);
inline_fn!(
pub unsafe fn NSMaxY(aRect: NSRect) -> CGFloat {
todo!()
}
);
inline_fn!(
pub unsafe fn NSMidX(aRect: NSRect) -> CGFloat {
todo!()
}
);
inline_fn!(
pub unsafe fn NSMidY(aRect: NSRect) -> CGFloat {
todo!()
}
);
inline_fn!(
pub unsafe fn NSMinX(aRect: NSRect) -> CGFloat {
todo!()
}
);
inline_fn!(
pub unsafe fn NSMinY(aRect: NSRect) -> CGFloat {
todo!()
}
);
inline_fn!(
pub unsafe fn NSWidth(aRect: NSRect) -> CGFloat {
todo!()
}
);
inline_fn!(
pub unsafe fn NSHeight(aRect: NSRect) -> CGFloat {
todo!()
}
);
inline_fn!(
pub unsafe fn NSRectFromCGRect(cgrect: CGRect) -> NSRect {
todo!()
}
);
inline_fn!(
pub unsafe fn NSRectToCGRect(nsrect: NSRect) -> CGRect {
todo!()
}
);
inline_fn!(
pub unsafe fn NSPointFromCGPoint(cgpoint: CGPoint) -> NSPoint {
todo!()
}
);
inline_fn!(
pub unsafe fn NSPointToCGPoint(nspoint: NSPoint) -> CGPoint {
todo!()
}
);
inline_fn!(
pub unsafe fn NSSizeFromCGSize(cgsize: CGSize) -> NSSize {
todo!()
}
);
inline_fn!(
pub unsafe fn NSSizeToCGSize(nssize: NSSize) -> CGSize {
todo!()
}
);
inline_fn!(
pub unsafe fn NSEdgeInsetsMake(
top: CGFloat,
left: CGFloat,
bottom: CGFloat,
right: CGFloat,
) -> NSEdgeInsets {
todo!()
}
);
extern_fn!(
pub unsafe fn NSEqualPoints(aPoint: NSPoint, bPoint: NSPoint) -> Bool;
);
extern_fn!(
pub unsafe fn NSEqualSizes(aSize: NSSize, bSize: NSSize) -> Bool;
);
extern_fn!(
pub unsafe fn NSEqualRects(aRect: NSRect, bRect: NSRect) -> Bool;
);
extern_fn!(
pub unsafe fn NSIsEmptyRect(aRect: NSRect) -> Bool;
);
extern_fn!(
pub unsafe fn NSEdgeInsetsEqual(aInsets: NSEdgeInsets, bInsets: NSEdgeInsets) -> Bool;
);
extern_fn!(
pub unsafe fn NSInsetRect(aRect: NSRect, dX: CGFloat, dY: CGFloat) -> NSRect;
);
extern_fn!(
pub unsafe fn NSIntegralRect(aRect: NSRect) -> NSRect;
);
extern_fn!(
pub unsafe fn NSIntegralRectWithOptions(aRect: NSRect, opts: NSAlignmentOptions) -> NSRect;
);
extern_fn!(
pub unsafe fn NSUnionRect(aRect: NSRect, bRect: NSRect) -> NSRect;
);
extern_fn!(
pub unsafe fn NSIntersectionRect(aRect: NSRect, bRect: NSRect) -> NSRect;
);
extern_fn!(
pub unsafe fn NSOffsetRect(aRect: NSRect, dX: CGFloat, dY: CGFloat) -> NSRect;
);
extern_fn!(
pub unsafe fn NSDivideRect(
inRect: NSRect,
slice: NonNull<NSRect>,
rem: NonNull<NSRect>,
amount: CGFloat,
edge: NSRectEdge,
);
);
extern_fn!(
pub unsafe fn NSPointInRect(aPoint: NSPoint, aRect: NSRect) -> Bool;
);
extern_fn!(
pub unsafe fn NSMouseInRect(aPoint: NSPoint, aRect: NSRect, flipped: Bool) -> Bool;
);
extern_fn!(
pub unsafe fn NSContainsRect(aRect: NSRect, bRect: NSRect) -> Bool;
);
extern_fn!(
pub unsafe fn NSIntersectsRect(aRect: NSRect, bRect: NSRect) -> Bool;
);
extern_fn!(
pub unsafe fn NSStringFromPoint(aPoint: NSPoint) -> NonNull<NSString>;
);
extern_fn!(
pub unsafe fn NSStringFromSize(aSize: NSSize) -> NonNull<NSString>;
);
extern_fn!(
pub unsafe fn NSStringFromRect(aRect: NSRect) -> NonNull<NSString>;
);
extern_fn!(
pub unsafe fn NSPointFromString(aString: &NSString) -> NSPoint;
);
extern_fn!(
pub unsafe fn NSSizeFromString(aString: &NSString) -> NSSize;
);
extern_fn!(
pub unsafe fn NSRectFromString(aString: &NSString) -> NSRect;
);
extern_methods!(
unsafe impl NSValue {
#[method_id(@__retain_semantics Other valueWithPoint:)]
pub unsafe fn valueWithPoint(point: NSPoint) -> Id<NSValue, Shared>;
#[method_id(@__retain_semantics Other valueWithSize:)]
pub unsafe fn valueWithSize(size: NSSize) -> Id<NSValue, Shared>;
#[method_id(@__retain_semantics Other valueWithRect:)]
pub unsafe fn valueWithRect(rect: NSRect) -> Id<NSValue, Shared>;
#[method_id(@__retain_semantics Other valueWithEdgeInsets:)]
pub unsafe fn valueWithEdgeInsets(insets: NSEdgeInsets) -> Id<NSValue, Shared>;
#[method(pointValue)]
pub unsafe fn pointValue(&self) -> NSPoint;
#[method(sizeValue)]
pub unsafe fn sizeValue(&self) -> NSSize;
#[method(rectValue)]
pub unsafe fn rectValue(&self) -> NSRect;
#[method(edgeInsetsValue)]
pub unsafe fn edgeInsetsValue(&self) -> NSEdgeInsets;
}
);
extern_methods!(
unsafe impl NSCoder {
#[method(encodePoint:)]
pub unsafe fn encodePoint(&self, point: NSPoint);
#[method(decodePoint)]
pub unsafe fn decodePoint(&self) -> NSPoint;
#[method(encodeSize:)]
pub unsafe fn encodeSize(&self, size: NSSize);
#[method(decodeSize)]
pub unsafe fn decodeSize(&self) -> NSSize;
#[method(encodeRect:)]
pub unsafe fn encodeRect(&self, rect: NSRect);
#[method(decodeRect)]
pub unsafe fn decodeRect(&self) -> NSRect;
}
);
extern_methods!(
unsafe impl NSCoder {
#[method(encodePoint:forKey:)]
pub unsafe fn encodePoint_forKey(&self, point: NSPoint, key: &NSString);
#[method(encodeSize:forKey:)]
pub unsafe fn encodeSize_forKey(&self, size: NSSize, key: &NSString);
#[method(encodeRect:forKey:)]
pub unsafe fn encodeRect_forKey(&self, rect: NSRect, key: &NSString);
#[method(decodePointForKey:)]
pub unsafe fn decodePointForKey(&self, key: &NSString) -> NSPoint;
#[method(decodeSizeForKey:)]
pub unsafe fn decodeSizeForKey(&self, key: &NSString) -> NSSize;
#[method(decodeRectForKey:)]
pub unsafe fn decodeRectForKey(&self, key: &NSString) -> NSRect;
}
);