objc2_app_kit/generated/
NSLayoutGuide.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nslayoutguide?language=objc)
12    #[unsafe(super(NSObject))]
13    #[derive(Debug, PartialEq, Eq, Hash)]
14    pub struct NSLayoutGuide;
15);
16
17extern_conformance!(
18    unsafe impl NSCoding for NSLayoutGuide {}
19);
20
21extern_conformance!(
22    unsafe impl NSObjectProtocol for NSLayoutGuide {}
23);
24
25#[cfg(feature = "NSUserInterfaceItemIdentification")]
26extern_conformance!(
27    unsafe impl NSUserInterfaceItemIdentification for NSLayoutGuide {}
28);
29
30impl NSLayoutGuide {
31    extern_methods!(
32        #[unsafe(method(frame))]
33        #[unsafe(method_family = none)]
34        pub fn frame(&self) -> NSRect;
35
36        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
37        #[unsafe(method(owningView))]
38        #[unsafe(method_family = none)]
39        pub fn owningView(&self, mtm: MainThreadMarker) -> Option<Retained<NSView>>;
40
41        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
42        /// Setter for [`owningView`][Self::owningView].
43        ///
44        /// This is a [weak property][objc2::topics::weak_property].
45        #[unsafe(method(setOwningView:))]
46        #[unsafe(method_family = none)]
47        pub fn setOwningView(&self, owning_view: Option<&NSView>);
48
49        #[cfg(feature = "NSUserInterfaceItemIdentification")]
50        #[unsafe(method(identifier))]
51        #[unsafe(method_family = none)]
52        pub fn identifier(&self) -> Retained<NSUserInterfaceItemIdentifier>;
53
54        #[cfg(feature = "NSUserInterfaceItemIdentification")]
55        /// Setter for [`identifier`][Self::identifier].
56        ///
57        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
58        #[unsafe(method(setIdentifier:))]
59        #[unsafe(method_family = none)]
60        pub fn setIdentifier(&self, identifier: &NSUserInterfaceItemIdentifier);
61
62        #[cfg(feature = "NSLayoutAnchor")]
63        #[unsafe(method(leadingAnchor))]
64        #[unsafe(method_family = none)]
65        pub fn leadingAnchor(&self) -> Retained<NSLayoutXAxisAnchor>;
66
67        #[cfg(feature = "NSLayoutAnchor")]
68        #[unsafe(method(trailingAnchor))]
69        #[unsafe(method_family = none)]
70        pub fn trailingAnchor(&self) -> Retained<NSLayoutXAxisAnchor>;
71
72        #[cfg(feature = "NSLayoutAnchor")]
73        #[unsafe(method(leftAnchor))]
74        #[unsafe(method_family = none)]
75        pub fn leftAnchor(&self) -> Retained<NSLayoutXAxisAnchor>;
76
77        #[cfg(feature = "NSLayoutAnchor")]
78        #[unsafe(method(rightAnchor))]
79        #[unsafe(method_family = none)]
80        pub fn rightAnchor(&self) -> Retained<NSLayoutXAxisAnchor>;
81
82        #[cfg(feature = "NSLayoutAnchor")]
83        #[unsafe(method(topAnchor))]
84        #[unsafe(method_family = none)]
85        pub fn topAnchor(&self) -> Retained<NSLayoutYAxisAnchor>;
86
87        #[cfg(feature = "NSLayoutAnchor")]
88        #[unsafe(method(bottomAnchor))]
89        #[unsafe(method_family = none)]
90        pub fn bottomAnchor(&self) -> Retained<NSLayoutYAxisAnchor>;
91
92        #[cfg(feature = "NSLayoutAnchor")]
93        #[unsafe(method(widthAnchor))]
94        #[unsafe(method_family = none)]
95        pub fn widthAnchor(&self) -> Retained<NSLayoutDimension>;
96
97        #[cfg(feature = "NSLayoutAnchor")]
98        #[unsafe(method(heightAnchor))]
99        #[unsafe(method_family = none)]
100        pub fn heightAnchor(&self) -> Retained<NSLayoutDimension>;
101
102        #[cfg(feature = "NSLayoutAnchor")]
103        #[unsafe(method(centerXAnchor))]
104        #[unsafe(method_family = none)]
105        pub fn centerXAnchor(&self) -> Retained<NSLayoutXAxisAnchor>;
106
107        #[cfg(feature = "NSLayoutAnchor")]
108        #[unsafe(method(centerYAnchor))]
109        #[unsafe(method_family = none)]
110        pub fn centerYAnchor(&self) -> Retained<NSLayoutYAxisAnchor>;
111
112        #[unsafe(method(hasAmbiguousLayout))]
113        #[unsafe(method_family = none)]
114        pub fn hasAmbiguousLayout(&self) -> bool;
115
116        #[cfg(feature = "NSLayoutConstraint")]
117        #[unsafe(method(constraintsAffectingLayoutForOrientation:))]
118        #[unsafe(method_family = none)]
119        pub fn constraintsAffectingLayoutForOrientation(
120            &self,
121            orientation: NSLayoutConstraintOrientation,
122        ) -> Retained<NSArray<NSLayoutConstraint>>;
123    );
124}
125
126/// Methods declared on superclass `NSObject`.
127impl NSLayoutGuide {
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 DefaultRetained for NSLayoutGuide {
140    #[inline]
141    fn default_retained() -> Retained<Self> {
142        Self::new()
143    }
144}
145
146/// NSLayoutGuideSupport.
147#[cfg(all(feature = "NSResponder", feature = "NSView"))]
148impl NSView {
149    extern_methods!(
150        #[unsafe(method(addLayoutGuide:))]
151        #[unsafe(method_family = none)]
152        pub fn addLayoutGuide(&self, guide: &NSLayoutGuide);
153
154        #[unsafe(method(removeLayoutGuide:))]
155        #[unsafe(method_family = none)]
156        pub fn removeLayoutGuide(&self, guide: &NSLayoutGuide);
157
158        #[unsafe(method(layoutGuides))]
159        #[unsafe(method_family = none)]
160        pub fn layoutGuides(&self) -> Retained<NSArray<NSLayoutGuide>>;
161    );
162}