objc2_app_kit/generated/
NSComboBoxCell.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
10use crate::*;
11
12extern_class!(
13    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscomboboxcell?language=objc)
14    #[unsafe(super(NSTextFieldCell, NSActionCell, NSCell, NSObject))]
15    #[derive(Debug, PartialEq, Eq, Hash)]
16    #[cfg(all(
17        feature = "NSActionCell",
18        feature = "NSCell",
19        feature = "NSTextFieldCell"
20    ))]
21    pub struct NSComboBoxCell;
22);
23
24#[cfg(all(
25    feature = "NSAccessibilityProtocols",
26    feature = "NSActionCell",
27    feature = "NSCell",
28    feature = "NSTextFieldCell"
29))]
30extern_conformance!(
31    unsafe impl NSAccessibility for NSComboBoxCell {}
32);
33
34#[cfg(all(
35    feature = "NSAccessibilityProtocols",
36    feature = "NSActionCell",
37    feature = "NSCell",
38    feature = "NSTextFieldCell"
39))]
40extern_conformance!(
41    unsafe impl NSAccessibilityElementProtocol for NSComboBoxCell {}
42);
43
44#[cfg(all(
45    feature = "NSActionCell",
46    feature = "NSCell",
47    feature = "NSTextFieldCell"
48))]
49extern_conformance!(
50    unsafe impl NSCoding for NSComboBoxCell {}
51);
52
53#[cfg(all(
54    feature = "NSActionCell",
55    feature = "NSCell",
56    feature = "NSTextFieldCell"
57))]
58extern_conformance!(
59    unsafe impl NSCopying for NSComboBoxCell {}
60);
61
62#[cfg(all(
63    feature = "NSActionCell",
64    feature = "NSCell",
65    feature = "NSTextFieldCell"
66))]
67unsafe impl CopyingHelper for NSComboBoxCell {
68    type Result = Self;
69}
70
71#[cfg(all(
72    feature = "NSActionCell",
73    feature = "NSCell",
74    feature = "NSTextFieldCell"
75))]
76extern_conformance!(
77    unsafe impl NSObjectProtocol for NSComboBoxCell {}
78);
79
80#[cfg(all(
81    feature = "NSActionCell",
82    feature = "NSCell",
83    feature = "NSTextFieldCell",
84    feature = "NSUserInterfaceItemIdentification"
85))]
86extern_conformance!(
87    unsafe impl NSUserInterfaceItemIdentification for NSComboBoxCell {}
88);
89
90#[cfg(all(
91    feature = "NSActionCell",
92    feature = "NSCell",
93    feature = "NSTextFieldCell"
94))]
95impl NSComboBoxCell {
96    extern_methods!(
97        #[unsafe(method(hasVerticalScroller))]
98        #[unsafe(method_family = none)]
99        pub fn hasVerticalScroller(&self) -> bool;
100
101        /// Setter for [`hasVerticalScroller`][Self::hasVerticalScroller].
102        #[unsafe(method(setHasVerticalScroller:))]
103        #[unsafe(method_family = none)]
104        pub fn setHasVerticalScroller(&self, has_vertical_scroller: bool);
105
106        #[unsafe(method(intercellSpacing))]
107        #[unsafe(method_family = none)]
108        pub fn intercellSpacing(&self) -> NSSize;
109
110        /// Setter for [`intercellSpacing`][Self::intercellSpacing].
111        #[unsafe(method(setIntercellSpacing:))]
112        #[unsafe(method_family = none)]
113        pub fn setIntercellSpacing(&self, intercell_spacing: NSSize);
114
115        #[cfg(feature = "objc2-core-foundation")]
116        #[unsafe(method(itemHeight))]
117        #[unsafe(method_family = none)]
118        pub fn itemHeight(&self) -> CGFloat;
119
120        #[cfg(feature = "objc2-core-foundation")]
121        /// Setter for [`itemHeight`][Self::itemHeight].
122        #[unsafe(method(setItemHeight:))]
123        #[unsafe(method_family = none)]
124        pub fn setItemHeight(&self, item_height: CGFloat);
125
126        #[unsafe(method(numberOfVisibleItems))]
127        #[unsafe(method_family = none)]
128        pub fn numberOfVisibleItems(&self) -> NSInteger;
129
130        /// Setter for [`numberOfVisibleItems`][Self::numberOfVisibleItems].
131        #[unsafe(method(setNumberOfVisibleItems:))]
132        #[unsafe(method_family = none)]
133        pub fn setNumberOfVisibleItems(&self, number_of_visible_items: NSInteger);
134
135        #[unsafe(method(isButtonBordered))]
136        #[unsafe(method_family = none)]
137        pub fn isButtonBordered(&self) -> bool;
138
139        /// Setter for [`isButtonBordered`][Self::isButtonBordered].
140        #[unsafe(method(setButtonBordered:))]
141        #[unsafe(method_family = none)]
142        pub fn setButtonBordered(&self, button_bordered: bool);
143
144        #[unsafe(method(reloadData))]
145        #[unsafe(method_family = none)]
146        pub fn reloadData(&self);
147
148        #[unsafe(method(noteNumberOfItemsChanged))]
149        #[unsafe(method_family = none)]
150        pub fn noteNumberOfItemsChanged(&self);
151
152        #[unsafe(method(usesDataSource))]
153        #[unsafe(method_family = none)]
154        pub fn usesDataSource(&self) -> bool;
155
156        /// Setter for [`usesDataSource`][Self::usesDataSource].
157        #[unsafe(method(setUsesDataSource:))]
158        #[unsafe(method_family = none)]
159        pub fn setUsesDataSource(&self, uses_data_source: bool);
160
161        #[unsafe(method(scrollItemAtIndexToTop:))]
162        #[unsafe(method_family = none)]
163        pub fn scrollItemAtIndexToTop(&self, index: NSInteger);
164
165        #[unsafe(method(scrollItemAtIndexToVisible:))]
166        #[unsafe(method_family = none)]
167        pub fn scrollItemAtIndexToVisible(&self, index: NSInteger);
168
169        #[unsafe(method(selectItemAtIndex:))]
170        #[unsafe(method_family = none)]
171        pub fn selectItemAtIndex(&self, index: NSInteger);
172
173        #[unsafe(method(deselectItemAtIndex:))]
174        #[unsafe(method_family = none)]
175        pub fn deselectItemAtIndex(&self, index: NSInteger);
176
177        #[unsafe(method(indexOfSelectedItem))]
178        #[unsafe(method_family = none)]
179        pub fn indexOfSelectedItem(&self) -> NSInteger;
180
181        #[unsafe(method(numberOfItems))]
182        #[unsafe(method_family = none)]
183        pub fn numberOfItems(&self) -> NSInteger;
184
185        #[unsafe(method(completes))]
186        #[unsafe(method_family = none)]
187        pub fn completes(&self) -> bool;
188
189        /// Setter for [`completes`][Self::completes].
190        #[unsafe(method(setCompletes:))]
191        #[unsafe(method_family = none)]
192        pub fn setCompletes(&self, completes: bool);
193
194        #[unsafe(method(completedString:))]
195        #[unsafe(method_family = none)]
196        pub fn completedString(&self, string: &NSString) -> Option<Retained<NSString>>;
197
198        /// # Safety
199        ///
200        /// This is not retained internally, you must ensure the object is still alive.
201        #[unsafe(method(dataSource))]
202        #[unsafe(method_family = none)]
203        pub unsafe fn dataSource(
204            &self,
205        ) -> Option<Retained<ProtocolObject<dyn NSComboBoxCellDataSource>>>;
206
207        /// Setter for [`dataSource`][Self::dataSource].
208        ///
209        /// # Safety
210        ///
211        /// This is unretained, you must ensure the object is kept alive while in use.
212        #[unsafe(method(setDataSource:))]
213        #[unsafe(method_family = none)]
214        pub unsafe fn setDataSource(
215            &self,
216            data_source: Option<&ProtocolObject<dyn NSComboBoxCellDataSource>>,
217        );
218
219        /// # Safety
220        ///
221        /// `object` should be of the correct type.
222        #[unsafe(method(addItemWithObjectValue:))]
223        #[unsafe(method_family = none)]
224        pub unsafe fn addItemWithObjectValue(&self, object: &AnyObject);
225
226        /// # Safety
227        ///
228        /// `objects` generic should be of the correct type.
229        #[unsafe(method(addItemsWithObjectValues:))]
230        #[unsafe(method_family = none)]
231        pub unsafe fn addItemsWithObjectValues(&self, objects: &NSArray);
232
233        /// # Safety
234        ///
235        /// `object` should be of the correct type.
236        #[unsafe(method(insertItemWithObjectValue:atIndex:))]
237        #[unsafe(method_family = none)]
238        pub unsafe fn insertItemWithObjectValue_atIndex(
239            &self,
240            object: &AnyObject,
241            index: NSInteger,
242        );
243
244        /// # Safety
245        ///
246        /// `object` should be of the correct type.
247        #[unsafe(method(removeItemWithObjectValue:))]
248        #[unsafe(method_family = none)]
249        pub unsafe fn removeItemWithObjectValue(&self, object: &AnyObject);
250
251        #[unsafe(method(removeItemAtIndex:))]
252        #[unsafe(method_family = none)]
253        pub fn removeItemAtIndex(&self, index: NSInteger);
254
255        #[unsafe(method(removeAllItems))]
256        #[unsafe(method_family = none)]
257        pub fn removeAllItems(&self);
258
259        /// # Safety
260        ///
261        /// `object` should be of the correct type.
262        #[unsafe(method(selectItemWithObjectValue:))]
263        #[unsafe(method_family = none)]
264        pub unsafe fn selectItemWithObjectValue(&self, object: Option<&AnyObject>);
265
266        #[unsafe(method(itemObjectValueAtIndex:))]
267        #[unsafe(method_family = none)]
268        pub fn itemObjectValueAtIndex(&self, index: NSInteger) -> Retained<AnyObject>;
269
270        #[unsafe(method(objectValueOfSelectedItem))]
271        #[unsafe(method_family = none)]
272        pub fn objectValueOfSelectedItem(&self) -> Option<Retained<AnyObject>>;
273
274        /// # Safety
275        ///
276        /// `object` should be of the correct type.
277        #[unsafe(method(indexOfItemWithObjectValue:))]
278        #[unsafe(method_family = none)]
279        pub unsafe fn indexOfItemWithObjectValue(&self, object: &AnyObject) -> NSInteger;
280
281        #[unsafe(method(objectValues))]
282        #[unsafe(method_family = none)]
283        pub fn objectValues(&self) -> Retained<NSArray>;
284    );
285}
286
287/// Methods declared on superclass `NSTextFieldCell`.
288#[cfg(all(
289    feature = "NSActionCell",
290    feature = "NSCell",
291    feature = "NSTextFieldCell"
292))]
293impl NSComboBoxCell {
294    extern_methods!(
295        #[unsafe(method(initTextCell:))]
296        #[unsafe(method_family = init)]
297        pub fn initTextCell(this: Allocated<Self>, string: &NSString) -> Retained<Self>;
298
299        /// # Safety
300        ///
301        /// `coder` possibly has further requirements.
302        #[unsafe(method(initWithCoder:))]
303        #[unsafe(method_family = init)]
304        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
305
306        #[cfg(feature = "NSImage")]
307        #[unsafe(method(initImageCell:))]
308        #[unsafe(method_family = init)]
309        pub unsafe fn initImageCell(
310            this: Allocated<Self>,
311            image: Option<&NSImage>,
312        ) -> Retained<Self>;
313    );
314}
315
316/// Methods declared on superclass `NSCell`.
317#[cfg(all(
318    feature = "NSActionCell",
319    feature = "NSCell",
320    feature = "NSTextFieldCell"
321))]
322impl NSComboBoxCell {
323    extern_methods!(
324        #[unsafe(method(init))]
325        #[unsafe(method_family = init)]
326        pub fn init(this: Allocated<Self>) -> Retained<Self>;
327    );
328}
329
330/// Methods declared on superclass `NSObject`.
331#[cfg(all(
332    feature = "NSActionCell",
333    feature = "NSCell",
334    feature = "NSTextFieldCell"
335))]
336impl NSComboBoxCell {
337    extern_methods!(
338        #[unsafe(method(new))]
339        #[unsafe(method_family = new)]
340        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
341    );
342}
343
344extern_protocol!(
345    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscomboboxcelldatasource?language=objc)
346    pub unsafe trait NSComboBoxCellDataSource: NSObjectProtocol {
347        #[cfg(all(
348            feature = "NSActionCell",
349            feature = "NSCell",
350            feature = "NSTextFieldCell"
351        ))]
352        #[optional]
353        #[unsafe(method(numberOfItemsInComboBoxCell:))]
354        #[unsafe(method_family = none)]
355        fn numberOfItemsInComboBoxCell(&self, combo_box_cell: &NSComboBoxCell) -> NSInteger;
356
357        #[cfg(all(
358            feature = "NSActionCell",
359            feature = "NSCell",
360            feature = "NSTextFieldCell"
361        ))]
362        #[optional]
363        #[unsafe(method(comboBoxCell:objectValueForItemAtIndex:))]
364        #[unsafe(method_family = none)]
365        fn comboBoxCell_objectValueForItemAtIndex(
366            &self,
367            combo_box_cell: &NSComboBoxCell,
368            index: NSInteger,
369        ) -> Retained<AnyObject>;
370
371        #[cfg(all(
372            feature = "NSActionCell",
373            feature = "NSCell",
374            feature = "NSTextFieldCell"
375        ))]
376        #[optional]
377        #[unsafe(method(comboBoxCell:indexOfItemWithStringValue:))]
378        #[unsafe(method_family = none)]
379        fn comboBoxCell_indexOfItemWithStringValue(
380            &self,
381            combo_box_cell: &NSComboBoxCell,
382            string: &NSString,
383        ) -> NSUInteger;
384
385        #[cfg(all(
386            feature = "NSActionCell",
387            feature = "NSCell",
388            feature = "NSTextFieldCell"
389        ))]
390        #[optional]
391        #[unsafe(method(comboBoxCell:completedString:))]
392        #[unsafe(method_family = none)]
393        fn comboBoxCell_completedString(
394            &self,
395            combo_box_cell: &NSComboBoxCell,
396            uncompleted_string: &NSString,
397        ) -> Option<Retained<NSString>>;
398    }
399);