objc2_app_kit/generated/
NSLayoutAnchor.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5#[cfg(feature = "objc2-core-foundation")]
6use objc2_core_foundation::*;
7use objc2_foundation::*;
8
9use crate::*;
10
11extern_class!(
12    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nslayoutanchor?language=objc)
13    #[unsafe(super(NSObject))]
14    #[derive(Debug, PartialEq, Eq, Hash)]
15    pub struct NSLayoutAnchor<AnchorType: ?Sized = AnyObject>;
16);
17
18impl<AnchorType: ?Sized + Message> NSLayoutAnchor<AnchorType> {
19    /// Unchecked conversion of the generic parameter.
20    ///
21    /// # Safety
22    ///
23    /// The generic must be valid to reinterpret as the given type.
24    #[inline]
25    pub unsafe fn cast_unchecked<NewAnchorType: ?Sized + Message>(
26        &self,
27    ) -> &NSLayoutAnchor<NewAnchorType> {
28        unsafe { &*((self as *const Self).cast()) }
29    }
30}
31
32extern_conformance!(
33    unsafe impl<AnchorType: ?Sized + NSCoding> NSCoding for NSLayoutAnchor<AnchorType> {}
34);
35
36extern_conformance!(
37    unsafe impl<AnchorType: ?Sized> NSCopying for NSLayoutAnchor<AnchorType> {}
38);
39
40unsafe impl<AnchorType: ?Sized + Message> CopyingHelper for NSLayoutAnchor<AnchorType> {
41    type Result = Self;
42}
43
44extern_conformance!(
45    unsafe impl<AnchorType: ?Sized> NSObjectProtocol for NSLayoutAnchor<AnchorType> {}
46);
47
48impl<AnchorType: Message> NSLayoutAnchor<AnchorType> {
49    extern_methods!(
50        #[cfg(feature = "NSLayoutConstraint")]
51        #[must_use]
52        #[unsafe(method(constraintEqualToAnchor:))]
53        #[unsafe(method_family = none)]
54        pub fn constraintEqualToAnchor(
55            &self,
56            anchor: &NSLayoutAnchor<AnchorType>,
57        ) -> Retained<NSLayoutConstraint>;
58
59        #[cfg(feature = "NSLayoutConstraint")]
60        #[must_use]
61        #[unsafe(method(constraintGreaterThanOrEqualToAnchor:))]
62        #[unsafe(method_family = none)]
63        pub fn constraintGreaterThanOrEqualToAnchor(
64            &self,
65            anchor: &NSLayoutAnchor<AnchorType>,
66        ) -> Retained<NSLayoutConstraint>;
67
68        #[cfg(feature = "NSLayoutConstraint")]
69        #[must_use]
70        #[unsafe(method(constraintLessThanOrEqualToAnchor:))]
71        #[unsafe(method_family = none)]
72        pub fn constraintLessThanOrEqualToAnchor(
73            &self,
74            anchor: &NSLayoutAnchor<AnchorType>,
75        ) -> Retained<NSLayoutConstraint>;
76
77        #[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
78        #[must_use]
79        #[unsafe(method(constraintEqualToAnchor:constant:))]
80        #[unsafe(method_family = none)]
81        pub fn constraintEqualToAnchor_constant(
82            &self,
83            anchor: &NSLayoutAnchor<AnchorType>,
84            c: CGFloat,
85        ) -> Retained<NSLayoutConstraint>;
86
87        #[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
88        #[must_use]
89        #[unsafe(method(constraintGreaterThanOrEqualToAnchor:constant:))]
90        #[unsafe(method_family = none)]
91        pub fn constraintGreaterThanOrEqualToAnchor_constant(
92            &self,
93            anchor: &NSLayoutAnchor<AnchorType>,
94            c: CGFloat,
95        ) -> Retained<NSLayoutConstraint>;
96
97        #[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
98        #[must_use]
99        #[unsafe(method(constraintLessThanOrEqualToAnchor:constant:))]
100        #[unsafe(method_family = none)]
101        pub fn constraintLessThanOrEqualToAnchor_constant(
102            &self,
103            anchor: &NSLayoutAnchor<AnchorType>,
104            c: CGFloat,
105        ) -> Retained<NSLayoutConstraint>;
106
107        #[unsafe(method(name))]
108        #[unsafe(method_family = none)]
109        pub fn name(&self) -> Retained<NSString>;
110
111        #[unsafe(method(item))]
112        #[unsafe(method_family = none)]
113        pub fn item(&self) -> Option<Retained<AnyObject>>;
114
115        #[unsafe(method(hasAmbiguousLayout))]
116        #[unsafe(method_family = none)]
117        pub fn hasAmbiguousLayout(&self) -> bool;
118
119        #[cfg(feature = "NSLayoutConstraint")]
120        #[unsafe(method(constraintsAffectingLayout))]
121        #[unsafe(method_family = none)]
122        pub fn constraintsAffectingLayout(&self) -> Retained<NSArray<NSLayoutConstraint>>;
123    );
124}
125
126/// Methods declared on superclass `NSObject`.
127impl<AnchorType: Message> NSLayoutAnchor<AnchorType> {
128    extern_methods!(
129        #[unsafe(method(init))]
130        #[unsafe(method_family = init)]
131        pub fn init(this: Allocated<Self>) -> Retained<Self>;
132
133        #[unsafe(method(new))]
134        #[unsafe(method_family = new)]
135        pub fn new() -> Retained<Self>;
136    );
137}
138
139impl<AnchorType: Message> DefaultRetained for NSLayoutAnchor<AnchorType> {
140    #[inline]
141    fn default_retained() -> Retained<Self> {
142        Self::new()
143    }
144}
145
146extern_class!(
147    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nslayoutxaxisanchor?language=objc)
148    #[unsafe(super(NSLayoutAnchor, NSObject))]
149    #[derive(Debug)]
150    pub struct NSLayoutXAxisAnchor;
151);
152
153extern_conformance!(
154    unsafe impl NSCoding for NSLayoutXAxisAnchor {}
155);
156
157extern_conformance!(
158    unsafe impl NSCopying for NSLayoutXAxisAnchor {}
159);
160
161unsafe impl CopyingHelper for NSLayoutXAxisAnchor {
162    type Result = Self;
163}
164
165extern_conformance!(
166    unsafe impl NSObjectProtocol for NSLayoutXAxisAnchor {}
167);
168
169impl NSLayoutXAxisAnchor {
170    extern_methods!(
171        #[unsafe(method(anchorWithOffsetToAnchor:))]
172        #[unsafe(method_family = none)]
173        pub fn anchorWithOffsetToAnchor(
174            &self,
175            other_anchor: &NSLayoutXAxisAnchor,
176        ) -> Retained<NSLayoutDimension>;
177
178        #[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
179        #[must_use]
180        #[unsafe(method(constraintEqualToSystemSpacingAfterAnchor:multiplier:))]
181        #[unsafe(method_family = none)]
182        pub fn constraintEqualToSystemSpacingAfterAnchor_multiplier(
183            &self,
184            anchor: &NSLayoutXAxisAnchor,
185            multiplier: CGFloat,
186        ) -> Retained<NSLayoutConstraint>;
187
188        #[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
189        #[must_use]
190        #[unsafe(method(constraintGreaterThanOrEqualToSystemSpacingAfterAnchor:multiplier:))]
191        #[unsafe(method_family = none)]
192        pub fn constraintGreaterThanOrEqualToSystemSpacingAfterAnchor_multiplier(
193            &self,
194            anchor: &NSLayoutXAxisAnchor,
195            multiplier: CGFloat,
196        ) -> Retained<NSLayoutConstraint>;
197
198        #[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
199        #[must_use]
200        #[unsafe(method(constraintLessThanOrEqualToSystemSpacingAfterAnchor:multiplier:))]
201        #[unsafe(method_family = none)]
202        pub fn constraintLessThanOrEqualToSystemSpacingAfterAnchor_multiplier(
203            &self,
204            anchor: &NSLayoutXAxisAnchor,
205            multiplier: CGFloat,
206        ) -> Retained<NSLayoutConstraint>;
207    );
208}
209
210/// Methods declared on superclass `NSObject`.
211impl NSLayoutXAxisAnchor {
212    extern_methods!(
213        #[unsafe(method(init))]
214        #[unsafe(method_family = init)]
215        pub fn init(this: Allocated<Self>) -> Retained<Self>;
216
217        #[unsafe(method(new))]
218        #[unsafe(method_family = new)]
219        pub fn new() -> Retained<Self>;
220    );
221}
222
223impl DefaultRetained for NSLayoutXAxisAnchor {
224    #[inline]
225    fn default_retained() -> Retained<Self> {
226        Self::new()
227    }
228}
229
230extern_class!(
231    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nslayoutyaxisanchor?language=objc)
232    #[unsafe(super(NSLayoutAnchor, NSObject))]
233    #[derive(Debug)]
234    pub struct NSLayoutYAxisAnchor;
235);
236
237extern_conformance!(
238    unsafe impl NSCoding for NSLayoutYAxisAnchor {}
239);
240
241extern_conformance!(
242    unsafe impl NSCopying for NSLayoutYAxisAnchor {}
243);
244
245unsafe impl CopyingHelper for NSLayoutYAxisAnchor {
246    type Result = Self;
247}
248
249extern_conformance!(
250    unsafe impl NSObjectProtocol for NSLayoutYAxisAnchor {}
251);
252
253impl NSLayoutYAxisAnchor {
254    extern_methods!(
255        #[unsafe(method(anchorWithOffsetToAnchor:))]
256        #[unsafe(method_family = none)]
257        pub fn anchorWithOffsetToAnchor(
258            &self,
259            other_anchor: &NSLayoutYAxisAnchor,
260        ) -> Retained<NSLayoutDimension>;
261
262        #[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
263        #[must_use]
264        #[unsafe(method(constraintEqualToSystemSpacingBelowAnchor:multiplier:))]
265        #[unsafe(method_family = none)]
266        pub fn constraintEqualToSystemSpacingBelowAnchor_multiplier(
267            &self,
268            anchor: &NSLayoutYAxisAnchor,
269            multiplier: CGFloat,
270        ) -> Retained<NSLayoutConstraint>;
271
272        #[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
273        #[must_use]
274        #[unsafe(method(constraintGreaterThanOrEqualToSystemSpacingBelowAnchor:multiplier:))]
275        #[unsafe(method_family = none)]
276        pub fn constraintGreaterThanOrEqualToSystemSpacingBelowAnchor_multiplier(
277            &self,
278            anchor: &NSLayoutYAxisAnchor,
279            multiplier: CGFloat,
280        ) -> Retained<NSLayoutConstraint>;
281
282        #[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
283        #[must_use]
284        #[unsafe(method(constraintLessThanOrEqualToSystemSpacingBelowAnchor:multiplier:))]
285        #[unsafe(method_family = none)]
286        pub fn constraintLessThanOrEqualToSystemSpacingBelowAnchor_multiplier(
287            &self,
288            anchor: &NSLayoutYAxisAnchor,
289            multiplier: CGFloat,
290        ) -> Retained<NSLayoutConstraint>;
291    );
292}
293
294/// Methods declared on superclass `NSObject`.
295impl NSLayoutYAxisAnchor {
296    extern_methods!(
297        #[unsafe(method(init))]
298        #[unsafe(method_family = init)]
299        pub fn init(this: Allocated<Self>) -> Retained<Self>;
300
301        #[unsafe(method(new))]
302        #[unsafe(method_family = new)]
303        pub fn new() -> Retained<Self>;
304    );
305}
306
307impl DefaultRetained for NSLayoutYAxisAnchor {
308    #[inline]
309    fn default_retained() -> Retained<Self> {
310        Self::new()
311    }
312}
313
314extern_class!(
315    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nslayoutdimension?language=objc)
316    #[unsafe(super(NSLayoutAnchor, NSObject))]
317    #[derive(Debug)]
318    pub struct NSLayoutDimension;
319);
320
321extern_conformance!(
322    unsafe impl NSCoding for NSLayoutDimension {}
323);
324
325extern_conformance!(
326    unsafe impl NSCopying for NSLayoutDimension {}
327);
328
329unsafe impl CopyingHelper for NSLayoutDimension {
330    type Result = Self;
331}
332
333extern_conformance!(
334    unsafe impl NSObjectProtocol for NSLayoutDimension {}
335);
336
337impl NSLayoutDimension {
338    extern_methods!(
339        #[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
340        #[must_use]
341        #[unsafe(method(constraintEqualToConstant:))]
342        #[unsafe(method_family = none)]
343        pub fn constraintEqualToConstant(&self, c: CGFloat) -> Retained<NSLayoutConstraint>;
344
345        #[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
346        #[must_use]
347        #[unsafe(method(constraintGreaterThanOrEqualToConstant:))]
348        #[unsafe(method_family = none)]
349        pub fn constraintGreaterThanOrEqualToConstant(
350            &self,
351            c: CGFloat,
352        ) -> Retained<NSLayoutConstraint>;
353
354        #[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
355        #[must_use]
356        #[unsafe(method(constraintLessThanOrEqualToConstant:))]
357        #[unsafe(method_family = none)]
358        pub fn constraintLessThanOrEqualToConstant(
359            &self,
360            c: CGFloat,
361        ) -> Retained<NSLayoutConstraint>;
362
363        #[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
364        #[must_use]
365        #[unsafe(method(constraintEqualToAnchor:multiplier:))]
366        #[unsafe(method_family = none)]
367        pub fn constraintEqualToAnchor_multiplier(
368            &self,
369            anchor: &NSLayoutDimension,
370            m: CGFloat,
371        ) -> Retained<NSLayoutConstraint>;
372
373        #[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
374        #[must_use]
375        #[unsafe(method(constraintGreaterThanOrEqualToAnchor:multiplier:))]
376        #[unsafe(method_family = none)]
377        pub fn constraintGreaterThanOrEqualToAnchor_multiplier(
378            &self,
379            anchor: &NSLayoutDimension,
380            m: CGFloat,
381        ) -> Retained<NSLayoutConstraint>;
382
383        #[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
384        #[must_use]
385        #[unsafe(method(constraintLessThanOrEqualToAnchor:multiplier:))]
386        #[unsafe(method_family = none)]
387        pub fn constraintLessThanOrEqualToAnchor_multiplier(
388            &self,
389            anchor: &NSLayoutDimension,
390            m: CGFloat,
391        ) -> Retained<NSLayoutConstraint>;
392
393        #[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
394        #[must_use]
395        #[unsafe(method(constraintEqualToAnchor:multiplier:constant:))]
396        #[unsafe(method_family = none)]
397        pub fn constraintEqualToAnchor_multiplier_constant(
398            &self,
399            anchor: &NSLayoutDimension,
400            m: CGFloat,
401            c: CGFloat,
402        ) -> Retained<NSLayoutConstraint>;
403
404        #[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
405        #[must_use]
406        #[unsafe(method(constraintGreaterThanOrEqualToAnchor:multiplier:constant:))]
407        #[unsafe(method_family = none)]
408        pub fn constraintGreaterThanOrEqualToAnchor_multiplier_constant(
409            &self,
410            anchor: &NSLayoutDimension,
411            m: CGFloat,
412            c: CGFloat,
413        ) -> Retained<NSLayoutConstraint>;
414
415        #[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
416        #[must_use]
417        #[unsafe(method(constraintLessThanOrEqualToAnchor:multiplier:constant:))]
418        #[unsafe(method_family = none)]
419        pub fn constraintLessThanOrEqualToAnchor_multiplier_constant(
420            &self,
421            anchor: &NSLayoutDimension,
422            m: CGFloat,
423            c: CGFloat,
424        ) -> Retained<NSLayoutConstraint>;
425    );
426}
427
428/// Methods declared on superclass `NSObject`.
429impl NSLayoutDimension {
430    extern_methods!(
431        #[unsafe(method(init))]
432        #[unsafe(method_family = init)]
433        pub fn init(this: Allocated<Self>) -> Retained<Self>;
434
435        #[unsafe(method(new))]
436        #[unsafe(method_family = new)]
437        pub fn new() -> Retained<Self>;
438    );
439}
440
441impl DefaultRetained for NSLayoutDimension {
442    #[inline]
443    fn default_retained() -> Retained<Self> {
444        Self::new()
445    }
446}