use objc2::__framework_prelude::*;
use crate::*;
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;
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct NSEdgeInsets {
pub top: CGFloat,
pub left: CGFloat,
pub bottom: CGFloat,
pub right: CGFloat,
}
unsafe impl Encode for NSEdgeInsets {
const ENCODING: Encoding = Encoding::Struct(
"NSEdgeInsets",
&[
<CGFloat>::ENCODING,
<CGFloat>::ENCODING,
<CGFloat>::ENCODING,
<CGFloat>::ENCODING,
],
);
}
unsafe impl RefEncode for NSEdgeInsets {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
unsafe impl Send for NSEdgeInsets {}
unsafe impl Sync for NSEdgeInsets {}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSAlignmentOptions(pub c_ulonglong);
bitflags::bitflags! {
impl NSAlignmentOptions: c_ulonglong {
const NSAlignMinXInward = 1<<0;
const NSAlignMinYInward = 1<<1;
const NSAlignMaxXInward = 1<<2;
const NSAlignMaxYInward = 1<<3;
const NSAlignWidthInward = 1<<4;
const NSAlignHeightInward = 1<<5;
const NSAlignMinXOutward = 1<<8;
const NSAlignMinYOutward = 1<<9;
const NSAlignMaxXOutward = 1<<10;
const NSAlignMaxYOutward = 1<<11;
const NSAlignWidthOutward = 1<<12;
const NSAlignHeightOutward = 1<<13;
const NSAlignMinXNearest = 1<<16;
const NSAlignMinYNearest = 1<<17;
const NSAlignMaxXNearest = 1<<18;
const NSAlignMaxYNearest = 1<<19;
const NSAlignWidthNearest = 1<<20;
const NSAlignHeightNearest = 1<<21;
const NSAlignRectFlipped = 1<<63;
const NSAlignAllEdgesInward = NSAlignmentOptions::NSAlignMinXInward.0|NSAlignmentOptions::NSAlignMaxXInward.0|NSAlignmentOptions::NSAlignMinYInward.0|NSAlignmentOptions::NSAlignMaxYInward.0;
const NSAlignAllEdgesOutward = NSAlignmentOptions::NSAlignMinXOutward.0|NSAlignmentOptions::NSAlignMaxXOutward.0|NSAlignmentOptions::NSAlignMinYOutward.0|NSAlignmentOptions::NSAlignMaxYOutward.0;
const NSAlignAllEdgesNearest = NSAlignmentOptions::NSAlignMinXNearest.0|NSAlignmentOptions::NSAlignMaxXNearest.0|NSAlignmentOptions::NSAlignMinYNearest.0|NSAlignmentOptions::NSAlignMaxYNearest.0;
}
}
unsafe impl Encode for NSAlignmentOptions {
const ENCODING: Encoding = c_ulonglong::ENCODING;
}
unsafe impl RefEncode for NSAlignmentOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern "C" {
pub static NSZeroPoint: NSPoint;
}
extern "C" {
pub static NSZeroSize: NSSize;
}
extern "C" {
pub static NSZeroRect: NSRect;
}
extern "C" {
pub static NSEdgeInsetsZero: NSEdgeInsets;
}
extern "C" {
pub fn NSEqualPoints(a_point: NSPoint, b_point: NSPoint) -> Bool;
}
extern "C" {
pub fn NSEqualSizes(a_size: NSSize, b_size: NSSize) -> Bool;
}
extern "C" {
pub fn NSEqualRects(a_rect: NSRect, b_rect: NSRect) -> Bool;
}
extern "C" {
pub fn NSIsEmptyRect(a_rect: NSRect) -> Bool;
}
extern "C" {
pub fn NSEdgeInsetsEqual(a_insets: NSEdgeInsets, b_insets: NSEdgeInsets) -> Bool;
}
extern "C" {
pub fn NSInsetRect(a_rect: NSRect, d_x: CGFloat, d_y: CGFloat) -> NSRect;
}
extern "C" {
pub fn NSIntegralRect(a_rect: NSRect) -> NSRect;
}
extern "C" {
pub fn NSIntegralRectWithOptions(a_rect: NSRect, opts: NSAlignmentOptions) -> NSRect;
}
extern "C" {
pub fn NSUnionRect(a_rect: NSRect, b_rect: NSRect) -> NSRect;
}
extern "C" {
pub fn NSIntersectionRect(a_rect: NSRect, b_rect: NSRect) -> NSRect;
}
extern "C" {
pub fn NSOffsetRect(a_rect: NSRect, d_x: CGFloat, d_y: CGFloat) -> NSRect;
}
extern "C" {
pub fn NSDivideRect(
in_rect: NSRect,
slice: NonNull<NSRect>,
rem: NonNull<NSRect>,
amount: CGFloat,
edge: NSRectEdge,
);
}
extern "C" {
pub fn NSPointInRect(a_point: NSPoint, a_rect: NSRect) -> Bool;
}
extern "C" {
pub fn NSMouseInRect(a_point: NSPoint, a_rect: NSRect, flipped: Bool) -> Bool;
}
extern "C" {
pub fn NSContainsRect(a_rect: NSRect, b_rect: NSRect) -> Bool;
}
extern "C" {
pub fn NSIntersectsRect(a_rect: NSRect, b_rect: NSRect) -> Bool;
}
extern "C" {
#[cfg(feature = "NSString")]
pub fn NSStringFromPoint(a_point: NSPoint) -> NonNull<NSString>;
}
extern "C" {
#[cfg(feature = "NSString")]
pub fn NSStringFromSize(a_size: NSSize) -> NonNull<NSString>;
}
extern "C" {
#[cfg(feature = "NSString")]
pub fn NSStringFromRect(a_rect: NSRect) -> NonNull<NSString>;
}
extern "C" {
#[cfg(feature = "NSString")]
pub fn NSPointFromString(a_string: &NSString) -> NSPoint;
}
extern "C" {
#[cfg(feature = "NSString")]
pub fn NSSizeFromString(a_string: &NSString) -> NSSize;
}
extern "C" {
#[cfg(feature = "NSString")]
pub fn NSRectFromString(a_string: &NSString) -> NSRect;
}
extern_methods!(
#[cfg(feature = "NSValue")]
unsafe impl NSValue {
#[method_id(@__retain_semantics Other valueWithPoint:)]
pub unsafe fn valueWithPoint(point: NSPoint) -> Retained<NSValue>;
#[method_id(@__retain_semantics Other valueWithSize:)]
pub unsafe fn valueWithSize(size: NSSize) -> Retained<NSValue>;
#[method_id(@__retain_semantics Other valueWithRect:)]
pub unsafe fn valueWithRect(rect: NSRect) -> Retained<NSValue>;
#[method_id(@__retain_semantics Other valueWithEdgeInsets:)]
pub unsafe fn valueWithEdgeInsets(insets: NSEdgeInsets) -> Retained<NSValue>;
#[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!(
#[cfg(feature = "NSCoder")]
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!(
#[cfg(feature = "NSCoder")]
unsafe impl NSCoder {
#[cfg(feature = "NSString")]
#[method(encodePoint:forKey:)]
pub unsafe fn encodePoint_forKey(&self, point: NSPoint, key: &NSString);
#[cfg(feature = "NSString")]
#[method(encodeSize:forKey:)]
pub unsafe fn encodeSize_forKey(&self, size: NSSize, key: &NSString);
#[cfg(feature = "NSString")]
#[method(encodeRect:forKey:)]
pub unsafe fn encodeRect_forKey(&self, rect: NSRect, key: &NSString);
#[cfg(feature = "NSString")]
#[method(decodePointForKey:)]
pub unsafe fn decodePointForKey(&self, key: &NSString) -> NSPoint;
#[cfg(feature = "NSString")]
#[method(decodeSizeForKey:)]
pub unsafe fn decodeSizeForKey(&self, key: &NSString) -> NSSize;
#[cfg(feature = "NSString")]
#[method(decodeRectForKey:)]
pub unsafe fn decodeRectForKey(&self, key: &NSString) -> NSRect;
}
);