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 fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
170
171        /// # Safety
172        ///
173        /// `coder` possibly has further requirements.
174        #[unsafe(method(initWithCoder:))]
175        #[unsafe(method_family = init)]
176        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
177
178        #[unsafe(method(initWithArrangedSubviews:))]
179        #[unsafe(method_family = init)]
180        pub fn initWithArrangedSubviews(
181            this: Allocated<Self>,
182            views: &NSArray<UIView>,
183        ) -> Retained<Self>;
184
185        #[unsafe(method(arrangedSubviews))]
186        #[unsafe(method_family = none)]
187        pub fn arrangedSubviews(&self) -> Retained<NSArray<UIView>>;
188
189        #[unsafe(method(addArrangedSubview:))]
190        #[unsafe(method_family = none)]
191        pub fn addArrangedSubview(&self, view: &UIView);
192
193        #[unsafe(method(removeArrangedSubview:))]
194        #[unsafe(method_family = none)]
195        pub fn removeArrangedSubview(&self, view: &UIView);
196
197        #[unsafe(method(insertArrangedSubview:atIndex:))]
198        #[unsafe(method_family = none)]
199        pub fn insertArrangedSubview_atIndex(&self, view: &UIView, stack_index: NSUInteger);
200
201        #[unsafe(method(axis))]
202        #[unsafe(method_family = none)]
203        pub fn axis(&self) -> UILayoutConstraintAxis;
204
205        /// Setter for [`axis`][Self::axis].
206        #[unsafe(method(setAxis:))]
207        #[unsafe(method_family = none)]
208        pub fn setAxis(&self, axis: UILayoutConstraintAxis);
209
210        #[unsafe(method(distribution))]
211        #[unsafe(method_family = none)]
212        pub fn distribution(&self) -> UIStackViewDistribution;
213
214        /// Setter for [`distribution`][Self::distribution].
215        #[unsafe(method(setDistribution:))]
216        #[unsafe(method_family = none)]
217        pub fn setDistribution(&self, distribution: UIStackViewDistribution);
218
219        #[unsafe(method(alignment))]
220        #[unsafe(method_family = none)]
221        pub fn alignment(&self) -> UIStackViewAlignment;
222
223        /// Setter for [`alignment`][Self::alignment].
224        #[unsafe(method(setAlignment:))]
225        #[unsafe(method_family = none)]
226        pub fn setAlignment(&self, alignment: UIStackViewAlignment);
227
228        #[cfg(feature = "objc2-core-foundation")]
229        #[unsafe(method(spacing))]
230        #[unsafe(method_family = none)]
231        pub fn spacing(&self) -> CGFloat;
232
233        #[cfg(feature = "objc2-core-foundation")]
234        /// Setter for [`spacing`][Self::spacing].
235        #[unsafe(method(setSpacing:))]
236        #[unsafe(method_family = none)]
237        pub fn setSpacing(&self, spacing: CGFloat);
238
239        #[cfg(feature = "objc2-core-foundation")]
240        #[unsafe(method(setCustomSpacing:afterView:))]
241        #[unsafe(method_family = none)]
242        pub fn setCustomSpacing_afterView(&self, spacing: CGFloat, arranged_subview: &UIView);
243
244        #[cfg(feature = "objc2-core-foundation")]
245        #[unsafe(method(customSpacingAfterView:))]
246        #[unsafe(method_family = none)]
247        pub fn customSpacingAfterView(&self, arranged_subview: &UIView) -> CGFloat;
248
249        #[unsafe(method(isBaselineRelativeArrangement))]
250        #[unsafe(method_family = none)]
251        pub fn isBaselineRelativeArrangement(&self) -> bool;
252
253        /// Setter for [`isBaselineRelativeArrangement`][Self::isBaselineRelativeArrangement].
254        #[unsafe(method(setBaselineRelativeArrangement:))]
255        #[unsafe(method_family = none)]
256        pub fn setBaselineRelativeArrangement(&self, baseline_relative_arrangement: bool);
257
258        #[unsafe(method(isLayoutMarginsRelativeArrangement))]
259        #[unsafe(method_family = none)]
260        pub fn isLayoutMarginsRelativeArrangement(&self) -> bool;
261
262        /// Setter for [`isLayoutMarginsRelativeArrangement`][Self::isLayoutMarginsRelativeArrangement].
263        #[unsafe(method(setLayoutMarginsRelativeArrangement:))]
264        #[unsafe(method_family = none)]
265        pub fn setLayoutMarginsRelativeArrangement(
266            &self,
267            layout_margins_relative_arrangement: bool,
268        );
269    );
270}
271
272/// Methods declared on superclass `UIView`.
273#[cfg(all(feature = "UIResponder", feature = "UIView"))]
274impl UIStackView {
275    extern_methods!(
276        #[unsafe(method(init))]
277        #[unsafe(method_family = init)]
278        pub fn init(this: Allocated<Self>) -> Retained<Self>;
279    );
280}
281
282/// Methods declared on superclass `NSObject`.
283#[cfg(all(feature = "UIResponder", feature = "UIView"))]
284impl UIStackView {
285    extern_methods!(
286        #[unsafe(method(new))]
287        #[unsafe(method_family = new)]
288        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
289    );
290}