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"))]
96unsafe impl CALayerDelegate for UIStackView {}
97
98#[cfg(all(feature = "UIResponder", feature = "UIView"))]
99unsafe impl NSCoding for UIStackView {}
100
101#[cfg(all(feature = "UIResponder", feature = "UIView"))]
102unsafe impl NSObjectProtocol for UIStackView {}
103
104#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
105unsafe impl UIAppearance for UIStackView {}
106
107#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
108unsafe impl UIAppearanceContainer for UIStackView {}
109
110#[cfg(all(feature = "UIResponder", feature = "UIView"))]
111unsafe impl UICoordinateSpace for UIStackView {}
112
113#[cfg(all(
114    feature = "UIDynamicBehavior",
115    feature = "UIResponder",
116    feature = "UIView"
117))]
118unsafe impl UIDynamicItem for UIStackView {}
119
120#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
121unsafe impl UIFocusEnvironment for UIStackView {}
122
123#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
124unsafe impl UIFocusItem for UIStackView {}
125
126#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
127unsafe impl UIFocusItemContainer for UIStackView {}
128
129#[cfg(all(feature = "UIResponder", feature = "UIView"))]
130unsafe impl UIResponderStandardEditActions for UIStackView {}
131
132#[cfg(all(
133    feature = "UIResponder",
134    feature = "UITraitCollection",
135    feature = "UIView"
136))]
137unsafe impl UITraitEnvironment for UIStackView {}
138
139#[cfg(all(feature = "UIResponder", feature = "UIView"))]
140impl UIStackView {
141    extern_methods!(
142        #[cfg(feature = "objc2-core-foundation")]
143        #[unsafe(method(initWithFrame:))]
144        #[unsafe(method_family = init)]
145        pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
146
147        #[unsafe(method(initWithCoder:))]
148        #[unsafe(method_family = init)]
149        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
150
151        #[unsafe(method(initWithArrangedSubviews:))]
152        #[unsafe(method_family = init)]
153        pub unsafe fn initWithArrangedSubviews(
154            this: Allocated<Self>,
155            views: &NSArray<UIView>,
156        ) -> Retained<Self>;
157
158        #[unsafe(method(arrangedSubviews))]
159        #[unsafe(method_family = none)]
160        pub unsafe fn arrangedSubviews(&self) -> Retained<NSArray<UIView>>;
161
162        #[unsafe(method(addArrangedSubview:))]
163        #[unsafe(method_family = none)]
164        pub unsafe fn addArrangedSubview(&self, view: &UIView);
165
166        #[unsafe(method(removeArrangedSubview:))]
167        #[unsafe(method_family = none)]
168        pub unsafe fn removeArrangedSubview(&self, view: &UIView);
169
170        #[unsafe(method(insertArrangedSubview:atIndex:))]
171        #[unsafe(method_family = none)]
172        pub unsafe fn insertArrangedSubview_atIndex(&self, view: &UIView, stack_index: NSUInteger);
173
174        #[unsafe(method(axis))]
175        #[unsafe(method_family = none)]
176        pub unsafe fn axis(&self) -> UILayoutConstraintAxis;
177
178        /// Setter for [`axis`][Self::axis].
179        #[unsafe(method(setAxis:))]
180        #[unsafe(method_family = none)]
181        pub unsafe fn setAxis(&self, axis: UILayoutConstraintAxis);
182
183        #[unsafe(method(distribution))]
184        #[unsafe(method_family = none)]
185        pub unsafe fn distribution(&self) -> UIStackViewDistribution;
186
187        /// Setter for [`distribution`][Self::distribution].
188        #[unsafe(method(setDistribution:))]
189        #[unsafe(method_family = none)]
190        pub unsafe fn setDistribution(&self, distribution: UIStackViewDistribution);
191
192        #[unsafe(method(alignment))]
193        #[unsafe(method_family = none)]
194        pub unsafe fn alignment(&self) -> UIStackViewAlignment;
195
196        /// Setter for [`alignment`][Self::alignment].
197        #[unsafe(method(setAlignment:))]
198        #[unsafe(method_family = none)]
199        pub unsafe fn setAlignment(&self, alignment: UIStackViewAlignment);
200
201        #[cfg(feature = "objc2-core-foundation")]
202        #[unsafe(method(spacing))]
203        #[unsafe(method_family = none)]
204        pub unsafe fn spacing(&self) -> CGFloat;
205
206        #[cfg(feature = "objc2-core-foundation")]
207        /// Setter for [`spacing`][Self::spacing].
208        #[unsafe(method(setSpacing:))]
209        #[unsafe(method_family = none)]
210        pub unsafe fn setSpacing(&self, spacing: CGFloat);
211
212        #[cfg(feature = "objc2-core-foundation")]
213        #[unsafe(method(setCustomSpacing:afterView:))]
214        #[unsafe(method_family = none)]
215        pub unsafe fn setCustomSpacing_afterView(
216            &self,
217            spacing: CGFloat,
218            arranged_subview: &UIView,
219        );
220
221        #[cfg(feature = "objc2-core-foundation")]
222        #[unsafe(method(customSpacingAfterView:))]
223        #[unsafe(method_family = none)]
224        pub unsafe fn customSpacingAfterView(&self, arranged_subview: &UIView) -> CGFloat;
225
226        #[unsafe(method(isBaselineRelativeArrangement))]
227        #[unsafe(method_family = none)]
228        pub unsafe fn isBaselineRelativeArrangement(&self) -> bool;
229
230        /// Setter for [`isBaselineRelativeArrangement`][Self::isBaselineRelativeArrangement].
231        #[unsafe(method(setBaselineRelativeArrangement:))]
232        #[unsafe(method_family = none)]
233        pub unsafe fn setBaselineRelativeArrangement(&self, baseline_relative_arrangement: bool);
234
235        #[unsafe(method(isLayoutMarginsRelativeArrangement))]
236        #[unsafe(method_family = none)]
237        pub unsafe fn isLayoutMarginsRelativeArrangement(&self) -> bool;
238
239        /// Setter for [`isLayoutMarginsRelativeArrangement`][Self::isLayoutMarginsRelativeArrangement].
240        #[unsafe(method(setLayoutMarginsRelativeArrangement:))]
241        #[unsafe(method_family = none)]
242        pub unsafe fn setLayoutMarginsRelativeArrangement(
243            &self,
244            layout_margins_relative_arrangement: bool,
245        );
246    );
247}
248
249/// Methods declared on superclass `NSObject`.
250#[cfg(all(feature = "UIResponder", feature = "UIView"))]
251impl UIStackView {
252    extern_methods!(
253        #[unsafe(method(init))]
254        #[unsafe(method_family = init)]
255        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
256
257        #[unsafe(method(new))]
258        #[unsafe(method_family = new)]
259        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
260    );
261}