use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSLayoutAnchor<AnchorType: ?Sized = AnyObject>;
);
impl<AnchorType: ?Sized + Message> NSLayoutAnchor<AnchorType> {
#[inline]
pub unsafe fn cast_unchecked<NewAnchorType: ?Sized + Message>(
&self,
) -> &NSLayoutAnchor<NewAnchorType> {
unsafe { &*((self as *const Self).cast()) }
}
}
extern_conformance!(
unsafe impl<AnchorType: ?Sized + NSCoding> NSCoding for NSLayoutAnchor<AnchorType> {}
);
extern_conformance!(
unsafe impl<AnchorType: ?Sized> NSCopying for NSLayoutAnchor<AnchorType> {}
);
unsafe impl<AnchorType: ?Sized + Message> CopyingHelper for NSLayoutAnchor<AnchorType> {
type Result = Self;
}
extern_conformance!(
unsafe impl<AnchorType: ?Sized> NSObjectProtocol for NSLayoutAnchor<AnchorType> {}
);
impl<AnchorType: Message> NSLayoutAnchor<AnchorType> {
extern_methods!(
#[cfg(feature = "NSLayoutConstraint")]
#[must_use]
#[unsafe(method(constraintEqualToAnchor:))]
#[unsafe(method_family = none)]
pub fn constraintEqualToAnchor(
&self,
anchor: &NSLayoutAnchor<AnchorType>,
) -> Retained<NSLayoutConstraint>;
#[cfg(feature = "NSLayoutConstraint")]
#[must_use]
#[unsafe(method(constraintGreaterThanOrEqualToAnchor:))]
#[unsafe(method_family = none)]
pub fn constraintGreaterThanOrEqualToAnchor(
&self,
anchor: &NSLayoutAnchor<AnchorType>,
) -> Retained<NSLayoutConstraint>;
#[cfg(feature = "NSLayoutConstraint")]
#[must_use]
#[unsafe(method(constraintLessThanOrEqualToAnchor:))]
#[unsafe(method_family = none)]
pub fn constraintLessThanOrEqualToAnchor(
&self,
anchor: &NSLayoutAnchor<AnchorType>,
) -> Retained<NSLayoutConstraint>;
#[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
#[must_use]
#[unsafe(method(constraintEqualToAnchor:constant:))]
#[unsafe(method_family = none)]
pub fn constraintEqualToAnchor_constant(
&self,
anchor: &NSLayoutAnchor<AnchorType>,
c: CGFloat,
) -> Retained<NSLayoutConstraint>;
#[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
#[must_use]
#[unsafe(method(constraintGreaterThanOrEqualToAnchor:constant:))]
#[unsafe(method_family = none)]
pub fn constraintGreaterThanOrEqualToAnchor_constant(
&self,
anchor: &NSLayoutAnchor<AnchorType>,
c: CGFloat,
) -> Retained<NSLayoutConstraint>;
#[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
#[must_use]
#[unsafe(method(constraintLessThanOrEqualToAnchor:constant:))]
#[unsafe(method_family = none)]
pub fn constraintLessThanOrEqualToAnchor_constant(
&self,
anchor: &NSLayoutAnchor<AnchorType>,
c: CGFloat,
) -> Retained<NSLayoutConstraint>;
#[unsafe(method(name))]
#[unsafe(method_family = none)]
pub fn name(&self) -> Retained<NSString>;
#[unsafe(method(item))]
#[unsafe(method_family = none)]
pub fn item(&self) -> Option<Retained<AnyObject>>;
#[unsafe(method(hasAmbiguousLayout))]
#[unsafe(method_family = none)]
pub fn hasAmbiguousLayout(&self) -> bool;
#[cfg(feature = "NSLayoutConstraint")]
#[unsafe(method(constraintsAffectingLayout))]
#[unsafe(method_family = none)]
pub fn constraintsAffectingLayout(&self) -> Retained<NSArray<NSLayoutConstraint>>;
);
}
impl<AnchorType: Message> NSLayoutAnchor<AnchorType> {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl<AnchorType: Message> DefaultRetained for NSLayoutAnchor<AnchorType> {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_class!(
#[unsafe(super(NSLayoutAnchor, NSObject))]
#[derive(Debug)]
pub struct NSLayoutXAxisAnchor;
);
extern_conformance!(
unsafe impl NSCoding for NSLayoutXAxisAnchor {}
);
extern_conformance!(
unsafe impl NSCopying for NSLayoutXAxisAnchor {}
);
unsafe impl CopyingHelper for NSLayoutXAxisAnchor {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for NSLayoutXAxisAnchor {}
);
impl NSLayoutXAxisAnchor {
extern_methods!(
#[unsafe(method(anchorWithOffsetToAnchor:))]
#[unsafe(method_family = none)]
pub fn anchorWithOffsetToAnchor(
&self,
other_anchor: &NSLayoutXAxisAnchor,
) -> Retained<NSLayoutDimension>;
#[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
#[must_use]
#[unsafe(method(constraintEqualToSystemSpacingAfterAnchor:multiplier:))]
#[unsafe(method_family = none)]
pub fn constraintEqualToSystemSpacingAfterAnchor_multiplier(
&self,
anchor: &NSLayoutXAxisAnchor,
multiplier: CGFloat,
) -> Retained<NSLayoutConstraint>;
#[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
#[must_use]
#[unsafe(method(constraintGreaterThanOrEqualToSystemSpacingAfterAnchor:multiplier:))]
#[unsafe(method_family = none)]
pub fn constraintGreaterThanOrEqualToSystemSpacingAfterAnchor_multiplier(
&self,
anchor: &NSLayoutXAxisAnchor,
multiplier: CGFloat,
) -> Retained<NSLayoutConstraint>;
#[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
#[must_use]
#[unsafe(method(constraintLessThanOrEqualToSystemSpacingAfterAnchor:multiplier:))]
#[unsafe(method_family = none)]
pub fn constraintLessThanOrEqualToSystemSpacingAfterAnchor_multiplier(
&self,
anchor: &NSLayoutXAxisAnchor,
multiplier: CGFloat,
) -> Retained<NSLayoutConstraint>;
);
}
impl NSLayoutXAxisAnchor {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for NSLayoutXAxisAnchor {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_class!(
#[unsafe(super(NSLayoutAnchor, NSObject))]
#[derive(Debug)]
pub struct NSLayoutYAxisAnchor;
);
extern_conformance!(
unsafe impl NSCoding for NSLayoutYAxisAnchor {}
);
extern_conformance!(
unsafe impl NSCopying for NSLayoutYAxisAnchor {}
);
unsafe impl CopyingHelper for NSLayoutYAxisAnchor {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for NSLayoutYAxisAnchor {}
);
impl NSLayoutYAxisAnchor {
extern_methods!(
#[unsafe(method(anchorWithOffsetToAnchor:))]
#[unsafe(method_family = none)]
pub fn anchorWithOffsetToAnchor(
&self,
other_anchor: &NSLayoutYAxisAnchor,
) -> Retained<NSLayoutDimension>;
#[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
#[must_use]
#[unsafe(method(constraintEqualToSystemSpacingBelowAnchor:multiplier:))]
#[unsafe(method_family = none)]
pub fn constraintEqualToSystemSpacingBelowAnchor_multiplier(
&self,
anchor: &NSLayoutYAxisAnchor,
multiplier: CGFloat,
) -> Retained<NSLayoutConstraint>;
#[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
#[must_use]
#[unsafe(method(constraintGreaterThanOrEqualToSystemSpacingBelowAnchor:multiplier:))]
#[unsafe(method_family = none)]
pub fn constraintGreaterThanOrEqualToSystemSpacingBelowAnchor_multiplier(
&self,
anchor: &NSLayoutYAxisAnchor,
multiplier: CGFloat,
) -> Retained<NSLayoutConstraint>;
#[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
#[must_use]
#[unsafe(method(constraintLessThanOrEqualToSystemSpacingBelowAnchor:multiplier:))]
#[unsafe(method_family = none)]
pub fn constraintLessThanOrEqualToSystemSpacingBelowAnchor_multiplier(
&self,
anchor: &NSLayoutYAxisAnchor,
multiplier: CGFloat,
) -> Retained<NSLayoutConstraint>;
);
}
impl NSLayoutYAxisAnchor {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for NSLayoutYAxisAnchor {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_class!(
#[unsafe(super(NSLayoutAnchor, NSObject))]
#[derive(Debug)]
pub struct NSLayoutDimension;
);
extern_conformance!(
unsafe impl NSCoding for NSLayoutDimension {}
);
extern_conformance!(
unsafe impl NSCopying for NSLayoutDimension {}
);
unsafe impl CopyingHelper for NSLayoutDimension {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for NSLayoutDimension {}
);
impl NSLayoutDimension {
extern_methods!(
#[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
#[must_use]
#[unsafe(method(constraintEqualToConstant:))]
#[unsafe(method_family = none)]
pub fn constraintEqualToConstant(&self, c: CGFloat) -> Retained<NSLayoutConstraint>;
#[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
#[must_use]
#[unsafe(method(constraintGreaterThanOrEqualToConstant:))]
#[unsafe(method_family = none)]
pub fn constraintGreaterThanOrEqualToConstant(
&self,
c: CGFloat,
) -> Retained<NSLayoutConstraint>;
#[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
#[must_use]
#[unsafe(method(constraintLessThanOrEqualToConstant:))]
#[unsafe(method_family = none)]
pub fn constraintLessThanOrEqualToConstant(
&self,
c: CGFloat,
) -> Retained<NSLayoutConstraint>;
#[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
#[must_use]
#[unsafe(method(constraintEqualToAnchor:multiplier:))]
#[unsafe(method_family = none)]
pub fn constraintEqualToAnchor_multiplier(
&self,
anchor: &NSLayoutDimension,
m: CGFloat,
) -> Retained<NSLayoutConstraint>;
#[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
#[must_use]
#[unsafe(method(constraintGreaterThanOrEqualToAnchor:multiplier:))]
#[unsafe(method_family = none)]
pub fn constraintGreaterThanOrEqualToAnchor_multiplier(
&self,
anchor: &NSLayoutDimension,
m: CGFloat,
) -> Retained<NSLayoutConstraint>;
#[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
#[must_use]
#[unsafe(method(constraintLessThanOrEqualToAnchor:multiplier:))]
#[unsafe(method_family = none)]
pub fn constraintLessThanOrEqualToAnchor_multiplier(
&self,
anchor: &NSLayoutDimension,
m: CGFloat,
) -> Retained<NSLayoutConstraint>;
#[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
#[must_use]
#[unsafe(method(constraintEqualToAnchor:multiplier:constant:))]
#[unsafe(method_family = none)]
pub fn constraintEqualToAnchor_multiplier_constant(
&self,
anchor: &NSLayoutDimension,
m: CGFloat,
c: CGFloat,
) -> Retained<NSLayoutConstraint>;
#[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
#[must_use]
#[unsafe(method(constraintGreaterThanOrEqualToAnchor:multiplier:constant:))]
#[unsafe(method_family = none)]
pub fn constraintGreaterThanOrEqualToAnchor_multiplier_constant(
&self,
anchor: &NSLayoutDimension,
m: CGFloat,
c: CGFloat,
) -> Retained<NSLayoutConstraint>;
#[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
#[must_use]
#[unsafe(method(constraintLessThanOrEqualToAnchor:multiplier:constant:))]
#[unsafe(method_family = none)]
pub fn constraintLessThanOrEqualToAnchor_multiplier_constant(
&self,
anchor: &NSLayoutDimension,
m: CGFloat,
c: CGFloat,
) -> Retained<NSLayoutConstraint>;
);
}
impl NSLayoutDimension {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for NSLayoutDimension {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}