objc2_ui_kit/generated/
UIStackView.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::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9#[cfg(feature = "objc2-quartz-core")]
10#[cfg(not(target_os = "watchos"))]
11use objc2_quartz_core::*;
12
13use crate::*;
14
15/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uistackviewdistribution?language=objc)
16// NS_ENUM
17#[repr(transparent)]
18#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
19pub struct UIStackViewDistribution(pub NSInteger);
20impl UIStackViewDistribution {
21    #[doc(alias = "UIStackViewDistributionFill")]
22    pub const Fill: Self = Self(0);
23    #[doc(alias = "UIStackViewDistributionFillEqually")]
24    pub const FillEqually: Self = Self(1);
25    #[doc(alias = "UIStackViewDistributionFillProportionally")]
26    pub const FillProportionally: Self = Self(2);
27    #[doc(alias = "UIStackViewDistributionEqualSpacing")]
28    pub const EqualSpacing: Self = Self(3);
29    #[doc(alias = "UIStackViewDistributionEqualCentering")]
30    pub const EqualCentering: Self = Self(4);
31}
32
33unsafe impl Encode for UIStackViewDistribution {
34    const ENCODING: Encoding = NSInteger::ENCODING;
35}
36
37unsafe impl RefEncode for UIStackViewDistribution {
38    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
39}
40
41/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uistackviewalignment?language=objc)
42// NS_ENUM
43#[repr(transparent)]
44#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
45pub struct UIStackViewAlignment(pub NSInteger);
46impl UIStackViewAlignment {
47    #[doc(alias = "UIStackViewAlignmentFill")]
48    pub const Fill: Self = Self(0);
49    #[doc(alias = "UIStackViewAlignmentLeading")]
50    pub const Leading: Self = Self(1);
51    #[doc(alias = "UIStackViewAlignmentTop")]
52    pub const Top: Self = Self(UIStackViewAlignment::Leading.0);
53    #[doc(alias = "UIStackViewAlignmentFirstBaseline")]
54    pub const FirstBaseline: Self = Self(2);
55    #[doc(alias = "UIStackViewAlignmentCenter")]
56    pub const Center: Self = Self(3);
57    #[doc(alias = "UIStackViewAlignmentTrailing")]
58    pub const Trailing: Self = Self(4);
59    #[doc(alias = "UIStackViewAlignmentBottom")]
60    pub const Bottom: Self = Self(UIStackViewAlignment::Trailing.0);
61    #[doc(alias = "UIStackViewAlignmentLastBaseline")]
62    pub const LastBaseline: Self = Self(5);
63}
64
65unsafe impl Encode for UIStackViewAlignment {
66    const ENCODING: Encoding = NSInteger::ENCODING;
67}
68
69unsafe impl RefEncode for UIStackViewAlignment {
70    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
71}
72
73/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uistackviewspacingusedefault?language=objc)
74#[cfg(feature = "objc2-core-foundation")]
75pub static UIStackViewSpacingUseDefault: CGFloat = c_float::MAX as _;
76
77/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uistackviewspacingusesystem?language=objc)
78#[cfg(feature = "objc2-core-foundation")]
79pub static UIStackViewSpacingUseSystem: CGFloat = c_float::MIN as _;
80
81extern_class!(
82    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uistackview?language=objc)
83    #[unsafe(super(UIView, UIResponder, NSObject))]
84    #[thread_kind = MainThreadOnly]
85    #[derive(Debug, PartialEq, Eq, Hash)]
86    #[cfg(all(feature = "UIResponder", feature = "UIView"))]
87    pub struct UIStackView;
88);
89
90#[cfg(all(
91    feature = "UIResponder",
92    feature = "UIView",
93    feature = "objc2-quartz-core"
94))]
95#[cfg(not(target_os = "watchos"))]
96extern_conformance!(
97    unsafe impl CALayerDelegate for UIStackView {}
98);
99
100#[cfg(all(feature = "UIResponder", feature = "UIView"))]
101extern_conformance!(
102    unsafe impl NSCoding for UIStackView {}
103);
104
105#[cfg(all(feature = "UIResponder", feature = "UIView"))]
106extern_conformance!(
107    unsafe impl NSObjectProtocol for UIStackView {}
108);
109
110#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
111extern_conformance!(
112    unsafe impl UIAppearance for UIStackView {}
113);
114
115#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
116extern_conformance!(
117    unsafe impl UIAppearanceContainer for UIStackView {}
118);
119
120#[cfg(all(feature = "UIResponder", feature = "UIView"))]
121extern_conformance!(
122    unsafe impl UICoordinateSpace for UIStackView {}
123);
124
125#[cfg(all(
126    feature = "UIDynamicBehavior",
127    feature = "UIResponder",
128    feature = "UIView"
129))]
130extern_conformance!(
131    unsafe impl UIDynamicItem for UIStackView {}
132);
133
134#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
135extern_conformance!(
136    unsafe impl UIFocusEnvironment for UIStackView {}
137);
138
139#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
140extern_conformance!(
141    unsafe impl UIFocusItem for UIStackView {}
142);
143
144#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
145extern_conformance!(
146    unsafe impl UIFocusItemContainer for UIStackView {}
147);
148
149#[cfg(all(feature = "UIResponder", feature = "UIView"))]
150extern_conformance!(
151    unsafe impl UIResponderStandardEditActions for UIStackView {}
152);
153
154#[cfg(all(
155    feature = "UIResponder",
156    feature = "UITraitCollection",
157    feature = "UIView"
158))]
159extern_conformance!(
160    unsafe impl UITraitEnvironment for UIStackView {}
161);
162
163#[cfg(all(feature = "UIResponder", feature = "UIView"))]
164impl UIStackView {
165    extern_methods!(
166        #[cfg(feature = "objc2-core-foundation")]
167        #[unsafe(method(initWithFrame:))]
168        #[unsafe(method_family = init)]
169        pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
170
171        #[unsafe(method(initWithCoder:))]
172        #[unsafe(method_family = init)]
173        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
174
175        #[unsafe(method(initWithArrangedSubviews:))]
176        #[unsafe(method_family = init)]
177        pub unsafe fn initWithArrangedSubviews(
178            this: Allocated<Self>,
179            views: &NSArray<UIView>,
180        ) -> Retained<Self>;
181
182        #[unsafe(method(arrangedSubviews))]
183        #[unsafe(method_family = none)]
184        pub unsafe fn arrangedSubviews(&self) -> Retained<NSArray<UIView>>;
185
186        #[unsafe(method(addArrangedSubview:))]
187        #[unsafe(method_family = none)]
188        pub unsafe fn addArrangedSubview(&self, view: &UIView);
189
190        #[unsafe(method(removeArrangedSubview:))]
191        #[unsafe(method_family = none)]
192        pub unsafe fn removeArrangedSubview(&self, view: &UIView);
193
194        #[unsafe(method(insertArrangedSubview:atIndex:))]
195        #[unsafe(method_family = none)]
196        pub unsafe fn insertArrangedSubview_atIndex(&self, view: &UIView, stack_index: NSUInteger);
197
198        #[unsafe(method(axis))]
199        #[unsafe(method_family = none)]
200        pub unsafe fn axis(&self) -> UILayoutConstraintAxis;
201
202        /// Setter for [`axis`][Self::axis].
203        #[unsafe(method(setAxis:))]
204        #[unsafe(method_family = none)]
205        pub unsafe fn setAxis(&self, axis: UILayoutConstraintAxis);
206
207        #[unsafe(method(distribution))]
208        #[unsafe(method_family = none)]
209        pub unsafe fn distribution(&self) -> UIStackViewDistribution;
210
211        /// Setter for [`distribution`][Self::distribution].
212        #[unsafe(method(setDistribution:))]
213        #[unsafe(method_family = none)]
214        pub unsafe fn setDistribution(&self, distribution: UIStackViewDistribution);
215
216        #[unsafe(method(alignment))]
217        #[unsafe(method_family = none)]
218        pub unsafe fn alignment(&self) -> UIStackViewAlignment;
219
220        /// Setter for [`alignment`][Self::alignment].
221        #[unsafe(method(setAlignment:))]
222        #[unsafe(method_family = none)]
223        pub unsafe fn setAlignment(&self, alignment: UIStackViewAlignment);
224
225        #[cfg(feature = "objc2-core-foundation")]
226        #[unsafe(method(spacing))]
227        #[unsafe(method_family = none)]
228        pub unsafe fn spacing(&self) -> CGFloat;
229
230        #[cfg(feature = "objc2-core-foundation")]
231        /// Setter for [`spacing`][Self::spacing].
232        #[unsafe(method(setSpacing:))]
233        #[unsafe(method_family = none)]
234        pub unsafe fn setSpacing(&self, spacing: CGFloat);
235
236        #[cfg(feature = "objc2-core-foundation")]
237        #[unsafe(method(setCustomSpacing:afterView:))]
238        #[unsafe(method_family = none)]
239        pub unsafe fn setCustomSpacing_afterView(
240            &self,
241            spacing: CGFloat,
242            arranged_subview: &UIView,
243        );
244
245        #[cfg(feature = "objc2-core-foundation")]
246        #[unsafe(method(customSpacingAfterView:))]
247        #[unsafe(method_family = none)]
248        pub unsafe fn customSpacingAfterView(&self, arranged_subview: &UIView) -> CGFloat;
249
250        #[unsafe(method(isBaselineRelativeArrangement))]
251        #[unsafe(method_family = none)]
252        pub unsafe fn isBaselineRelativeArrangement(&self) -> bool;
253
254        /// Setter for [`isBaselineRelativeArrangement`][Self::isBaselineRelativeArrangement].
255        #[unsafe(method(setBaselineRelativeArrangement:))]
256        #[unsafe(method_family = none)]
257        pub unsafe fn setBaselineRelativeArrangement(&self, baseline_relative_arrangement: bool);
258
259        #[unsafe(method(isLayoutMarginsRelativeArrangement))]
260        #[unsafe(method_family = none)]
261        pub unsafe fn isLayoutMarginsRelativeArrangement(&self) -> bool;
262
263        /// Setter for [`isLayoutMarginsRelativeArrangement`][Self::isLayoutMarginsRelativeArrangement].
264        #[unsafe(method(setLayoutMarginsRelativeArrangement:))]
265        #[unsafe(method_family = none)]
266        pub unsafe fn setLayoutMarginsRelativeArrangement(
267            &self,
268            layout_margins_relative_arrangement: bool,
269        );
270    );
271}
272
273/// Methods declared on superclass `NSObject`.
274#[cfg(all(feature = "UIResponder", feature = "UIView"))]
275impl UIStackView {
276    extern_methods!(
277        #[unsafe(method(init))]
278        #[unsafe(method_family = init)]
279        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
280
281        #[unsafe(method(new))]
282        #[unsafe(method_family = new)]
283        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
284    );
285}