objc2_ui_kit/generated/
UIPickerView.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
15extern_class!(
16    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipickerview?language=objc)
17    #[unsafe(super(UIView, UIResponder, NSObject))]
18    #[thread_kind = MainThreadOnly]
19    #[derive(Debug, PartialEq, Eq, Hash)]
20    #[cfg(all(feature = "UIResponder", feature = "UIView"))]
21    pub struct UIPickerView;
22);
23
24#[cfg(all(
25    feature = "UIResponder",
26    feature = "UIView",
27    feature = "objc2-quartz-core"
28))]
29#[cfg(not(target_os = "watchos"))]
30extern_conformance!(
31    unsafe impl CALayerDelegate for UIPickerView {}
32);
33
34#[cfg(all(feature = "UIResponder", feature = "UIView"))]
35extern_conformance!(
36    unsafe impl NSCoding for UIPickerView {}
37);
38
39#[cfg(all(feature = "UIResponder", feature = "UIView"))]
40extern_conformance!(
41    unsafe impl NSObjectProtocol for UIPickerView {}
42);
43
44#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
45extern_conformance!(
46    unsafe impl UIAppearance for UIPickerView {}
47);
48
49#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
50extern_conformance!(
51    unsafe impl UIAppearanceContainer for UIPickerView {}
52);
53
54#[cfg(all(feature = "UIResponder", feature = "UIView"))]
55extern_conformance!(
56    unsafe impl UICoordinateSpace for UIPickerView {}
57);
58
59#[cfg(all(
60    feature = "UIDynamicBehavior",
61    feature = "UIResponder",
62    feature = "UIView"
63))]
64extern_conformance!(
65    unsafe impl UIDynamicItem for UIPickerView {}
66);
67
68#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
69extern_conformance!(
70    unsafe impl UIFocusEnvironment for UIPickerView {}
71);
72
73#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
74extern_conformance!(
75    unsafe impl UIFocusItem for UIPickerView {}
76);
77
78#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
79extern_conformance!(
80    unsafe impl UIFocusItemContainer for UIPickerView {}
81);
82
83#[cfg(all(feature = "UIResponder", feature = "UIView"))]
84extern_conformance!(
85    unsafe impl UIResponderStandardEditActions for UIPickerView {}
86);
87
88#[cfg(all(
89    feature = "UIResponder",
90    feature = "UITraitCollection",
91    feature = "UIView"
92))]
93extern_conformance!(
94    unsafe impl UITraitEnvironment for UIPickerView {}
95);
96
97#[cfg(all(feature = "UIResponder", feature = "UIView"))]
98impl UIPickerView {
99    extern_methods!(
100        #[unsafe(method(dataSource))]
101        #[unsafe(method_family = none)]
102        pub fn dataSource(&self) -> Option<Retained<ProtocolObject<dyn UIPickerViewDataSource>>>;
103
104        /// Setter for [`dataSource`][Self::dataSource].
105        ///
106        /// This is a [weak property][objc2::topics::weak_property].
107        #[unsafe(method(setDataSource:))]
108        #[unsafe(method_family = none)]
109        pub fn setDataSource(
110            &self,
111            data_source: Option<&ProtocolObject<dyn UIPickerViewDataSource>>,
112        );
113
114        #[unsafe(method(delegate))]
115        #[unsafe(method_family = none)]
116        pub fn delegate(&self) -> Option<Retained<ProtocolObject<dyn UIPickerViewDelegate>>>;
117
118        /// Setter for [`delegate`][Self::delegate].
119        ///
120        /// This is a [weak property][objc2::topics::weak_property].
121        #[unsafe(method(setDelegate:))]
122        #[unsafe(method_family = none)]
123        pub fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn UIPickerViewDelegate>>);
124
125        #[deprecated = "This property has no effect on iOS 7 and later."]
126        #[unsafe(method(showsSelectionIndicator))]
127        #[unsafe(method_family = none)]
128        pub fn showsSelectionIndicator(&self) -> bool;
129
130        /// Setter for [`showsSelectionIndicator`][Self::showsSelectionIndicator].
131        #[deprecated = "This property has no effect on iOS 7 and later."]
132        #[unsafe(method(setShowsSelectionIndicator:))]
133        #[unsafe(method_family = none)]
134        pub fn setShowsSelectionIndicator(&self, shows_selection_indicator: bool);
135
136        #[unsafe(method(numberOfComponents))]
137        #[unsafe(method_family = none)]
138        pub fn numberOfComponents(&self) -> NSInteger;
139
140        #[unsafe(method(numberOfRowsInComponent:))]
141        #[unsafe(method_family = none)]
142        pub fn numberOfRowsInComponent(&self, component: NSInteger) -> NSInteger;
143
144        #[cfg(feature = "objc2-core-foundation")]
145        #[unsafe(method(rowSizeForComponent:))]
146        #[unsafe(method_family = none)]
147        pub fn rowSizeForComponent(&self, component: NSInteger) -> CGSize;
148
149        #[unsafe(method(viewForRow:forComponent:))]
150        #[unsafe(method_family = none)]
151        pub fn viewForRow_forComponent(
152            &self,
153            row: NSInteger,
154            component: NSInteger,
155        ) -> Option<Retained<UIView>>;
156
157        #[unsafe(method(reloadAllComponents))]
158        #[unsafe(method_family = none)]
159        pub fn reloadAllComponents(&self);
160
161        #[unsafe(method(reloadComponent:))]
162        #[unsafe(method_family = none)]
163        pub fn reloadComponent(&self, component: NSInteger);
164
165        #[unsafe(method(selectRow:inComponent:animated:))]
166        #[unsafe(method_family = none)]
167        pub fn selectRow_inComponent_animated(
168            &self,
169            row: NSInteger,
170            component: NSInteger,
171            animated: bool,
172        );
173
174        #[unsafe(method(selectedRowInComponent:))]
175        #[unsafe(method_family = none)]
176        pub fn selectedRowInComponent(&self, component: NSInteger) -> NSInteger;
177    );
178}
179
180/// Methods declared on superclass `UIView`.
181#[cfg(all(feature = "UIResponder", feature = "UIView"))]
182impl UIPickerView {
183    extern_methods!(
184        #[cfg(feature = "objc2-core-foundation")]
185        #[unsafe(method(initWithFrame:))]
186        #[unsafe(method_family = init)]
187        pub fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
188
189        /// # Safety
190        ///
191        /// `coder` possibly has further requirements.
192        #[unsafe(method(initWithCoder:))]
193        #[unsafe(method_family = init)]
194        pub unsafe fn initWithCoder(
195            this: Allocated<Self>,
196            coder: &NSCoder,
197        ) -> Option<Retained<Self>>;
198
199        #[unsafe(method(init))]
200        #[unsafe(method_family = init)]
201        pub fn init(this: Allocated<Self>) -> Retained<Self>;
202    );
203}
204
205/// Methods declared on superclass `NSObject`.
206#[cfg(all(feature = "UIResponder", feature = "UIView"))]
207impl UIPickerView {
208    extern_methods!(
209        #[unsafe(method(new))]
210        #[unsafe(method_family = new)]
211        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
212    );
213}
214
215extern_protocol!(
216    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipickerviewdatasource?language=objc)
217    pub unsafe trait UIPickerViewDataSource: NSObjectProtocol + MainThreadOnly {
218        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
219        #[unsafe(method(numberOfComponentsInPickerView:))]
220        #[unsafe(method_family = none)]
221        fn numberOfComponentsInPickerView(&self, picker_view: &UIPickerView) -> NSInteger;
222
223        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
224        #[unsafe(method(pickerView:numberOfRowsInComponent:))]
225        #[unsafe(method_family = none)]
226        fn pickerView_numberOfRowsInComponent(
227            &self,
228            picker_view: &UIPickerView,
229            component: NSInteger,
230        ) -> NSInteger;
231    }
232);
233
234extern_protocol!(
235    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipickerviewdelegate?language=objc)
236    pub unsafe trait UIPickerViewDelegate: NSObjectProtocol + MainThreadOnly {
237        #[cfg(all(
238            feature = "UIResponder",
239            feature = "UIView",
240            feature = "objc2-core-foundation"
241        ))]
242        #[optional]
243        #[unsafe(method(pickerView:widthForComponent:))]
244        #[unsafe(method_family = none)]
245        fn pickerView_widthForComponent(
246            &self,
247            picker_view: &UIPickerView,
248            component: NSInteger,
249        ) -> CGFloat;
250
251        #[cfg(all(
252            feature = "UIResponder",
253            feature = "UIView",
254            feature = "objc2-core-foundation"
255        ))]
256        #[optional]
257        #[unsafe(method(pickerView:rowHeightForComponent:))]
258        #[unsafe(method_family = none)]
259        fn pickerView_rowHeightForComponent(
260            &self,
261            picker_view: &UIPickerView,
262            component: NSInteger,
263        ) -> CGFloat;
264
265        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
266        #[optional]
267        #[unsafe(method(pickerView:titleForRow:forComponent:))]
268        #[unsafe(method_family = none)]
269        fn pickerView_titleForRow_forComponent(
270            &self,
271            picker_view: &UIPickerView,
272            row: NSInteger,
273            component: NSInteger,
274        ) -> Option<Retained<NSString>>;
275
276        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
277        #[optional]
278        #[unsafe(method(pickerView:attributedTitleForRow:forComponent:))]
279        #[unsafe(method_family = none)]
280        fn pickerView_attributedTitleForRow_forComponent(
281            &self,
282            picker_view: &UIPickerView,
283            row: NSInteger,
284            component: NSInteger,
285        ) -> Option<Retained<NSAttributedString>>;
286
287        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
288        #[optional]
289        #[unsafe(method(pickerView:viewForRow:forComponent:reusingView:))]
290        #[unsafe(method_family = none)]
291        fn pickerView_viewForRow_forComponent_reusingView(
292            &self,
293            picker_view: &UIPickerView,
294            row: NSInteger,
295            component: NSInteger,
296            view: Option<&UIView>,
297        ) -> Retained<UIView>;
298
299        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
300        #[optional]
301        #[unsafe(method(pickerView:didSelectRow:inComponent:))]
302        #[unsafe(method_family = none)]
303        fn pickerView_didSelectRow_inComponent(
304            &self,
305            picker_view: &UIPickerView,
306            row: NSInteger,
307            component: NSInteger,
308        );
309    }
310);