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