objc2_app_kit/generated/
NSTokenFieldCell.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::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstokenstyle?language=objc)
11// NS_ENUM
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct NSTokenStyle(pub NSUInteger);
15impl NSTokenStyle {
16    #[doc(alias = "NSTokenStyleDefault")]
17    pub const Default: Self = Self(0);
18    #[doc(alias = "NSTokenStyleNone")]
19    pub const None: Self = Self(1);
20    #[doc(alias = "NSTokenStyleRounded")]
21    pub const Rounded: Self = Self(2);
22    #[doc(alias = "NSTokenStyleSquared")]
23    pub const Squared: Self = Self(3);
24    #[doc(alias = "NSTokenStylePlainSquared")]
25    pub const PlainSquared: Self = Self(4);
26}
27
28unsafe impl Encode for NSTokenStyle {
29    const ENCODING: Encoding = NSUInteger::ENCODING;
30}
31
32unsafe impl RefEncode for NSTokenStyle {
33    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
34}
35
36extern_class!(
37    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstokenfieldcell?language=objc)
38    #[unsafe(super(NSTextFieldCell, NSActionCell, NSCell, NSObject))]
39    #[derive(Debug, PartialEq, Eq, Hash)]
40    #[cfg(all(
41        feature = "NSActionCell",
42        feature = "NSCell",
43        feature = "NSTextFieldCell"
44    ))]
45    pub struct NSTokenFieldCell;
46);
47
48#[cfg(all(
49    feature = "NSAccessibilityProtocols",
50    feature = "NSActionCell",
51    feature = "NSCell",
52    feature = "NSTextFieldCell"
53))]
54unsafe impl NSAccessibility for NSTokenFieldCell {}
55
56#[cfg(all(
57    feature = "NSAccessibilityProtocols",
58    feature = "NSActionCell",
59    feature = "NSCell",
60    feature = "NSTextFieldCell"
61))]
62unsafe impl NSAccessibilityElementProtocol for NSTokenFieldCell {}
63
64#[cfg(all(
65    feature = "NSActionCell",
66    feature = "NSCell",
67    feature = "NSTextFieldCell"
68))]
69unsafe impl NSCoding for NSTokenFieldCell {}
70
71#[cfg(all(
72    feature = "NSActionCell",
73    feature = "NSCell",
74    feature = "NSTextFieldCell"
75))]
76unsafe impl NSCopying for NSTokenFieldCell {}
77
78#[cfg(all(
79    feature = "NSActionCell",
80    feature = "NSCell",
81    feature = "NSTextFieldCell"
82))]
83unsafe impl CopyingHelper for NSTokenFieldCell {
84    type Result = Self;
85}
86
87#[cfg(all(
88    feature = "NSActionCell",
89    feature = "NSCell",
90    feature = "NSTextFieldCell"
91))]
92unsafe impl NSObjectProtocol for NSTokenFieldCell {}
93
94#[cfg(all(
95    feature = "NSActionCell",
96    feature = "NSCell",
97    feature = "NSTextFieldCell",
98    feature = "NSUserInterfaceItemIdentification"
99))]
100unsafe impl NSUserInterfaceItemIdentification for NSTokenFieldCell {}
101
102#[cfg(all(
103    feature = "NSActionCell",
104    feature = "NSCell",
105    feature = "NSTextFieldCell"
106))]
107impl NSTokenFieldCell {
108    extern_methods!(
109        #[unsafe(method(tokenStyle))]
110        #[unsafe(method_family = none)]
111        pub unsafe fn tokenStyle(&self) -> NSTokenStyle;
112
113        /// Setter for [`tokenStyle`][Self::tokenStyle].
114        #[unsafe(method(setTokenStyle:))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn setTokenStyle(&self, token_style: NSTokenStyle);
117
118        #[unsafe(method(completionDelay))]
119        #[unsafe(method_family = none)]
120        pub unsafe fn completionDelay(&self) -> NSTimeInterval;
121
122        /// Setter for [`completionDelay`][Self::completionDelay].
123        #[unsafe(method(setCompletionDelay:))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn setCompletionDelay(&self, completion_delay: NSTimeInterval);
126
127        #[unsafe(method(defaultCompletionDelay))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn defaultCompletionDelay(mtm: MainThreadMarker) -> NSTimeInterval;
130
131        #[unsafe(method(tokenizingCharacterSet))]
132        #[unsafe(method_family = none)]
133        pub unsafe fn tokenizingCharacterSet(&self) -> Retained<NSCharacterSet>;
134
135        /// Setter for [`tokenizingCharacterSet`][Self::tokenizingCharacterSet].
136        #[unsafe(method(setTokenizingCharacterSet:))]
137        #[unsafe(method_family = none)]
138        pub unsafe fn setTokenizingCharacterSet(
139            &self,
140            tokenizing_character_set: Option<&NSCharacterSet>,
141        );
142
143        #[unsafe(method(defaultTokenizingCharacterSet))]
144        #[unsafe(method_family = none)]
145        pub unsafe fn defaultTokenizingCharacterSet(
146            mtm: MainThreadMarker,
147        ) -> Retained<NSCharacterSet>;
148
149        #[unsafe(method(delegate))]
150        #[unsafe(method_family = none)]
151        pub unsafe fn delegate(
152            &self,
153        ) -> Option<Retained<ProtocolObject<dyn NSTokenFieldCellDelegate>>>;
154
155        /// This is a [weak property][objc2::topics::weak_property].
156        /// Setter for [`delegate`][Self::delegate].
157        #[unsafe(method(setDelegate:))]
158        #[unsafe(method_family = none)]
159        pub unsafe fn setDelegate(
160            &self,
161            delegate: Option<&ProtocolObject<dyn NSTokenFieldCellDelegate>>,
162        );
163    );
164}
165
166/// Methods declared on superclass `NSTextFieldCell`.
167#[cfg(all(
168    feature = "NSActionCell",
169    feature = "NSCell",
170    feature = "NSTextFieldCell"
171))]
172impl NSTokenFieldCell {
173    extern_methods!(
174        #[unsafe(method(initTextCell:))]
175        #[unsafe(method_family = init)]
176        pub unsafe fn initTextCell(this: Allocated<Self>, string: &NSString) -> Retained<Self>;
177
178        #[unsafe(method(initWithCoder:))]
179        #[unsafe(method_family = init)]
180        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
181
182        #[cfg(feature = "NSImage")]
183        #[unsafe(method(initImageCell:))]
184        #[unsafe(method_family = init)]
185        pub unsafe fn initImageCell(
186            this: Allocated<Self>,
187            image: Option<&NSImage>,
188        ) -> Retained<Self>;
189    );
190}
191
192/// Methods declared on superclass `NSCell`.
193#[cfg(all(
194    feature = "NSActionCell",
195    feature = "NSCell",
196    feature = "NSTextFieldCell"
197))]
198impl NSTokenFieldCell {
199    extern_methods!(
200        #[unsafe(method(init))]
201        #[unsafe(method_family = init)]
202        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
203    );
204}
205
206/// Methods declared on superclass `NSObject`.
207#[cfg(all(
208    feature = "NSActionCell",
209    feature = "NSCell",
210    feature = "NSTextFieldCell"
211))]
212impl NSTokenFieldCell {
213    extern_methods!(
214        #[unsafe(method(new))]
215        #[unsafe(method_family = new)]
216        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
217    );
218}
219
220extern_protocol!(
221    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstokenfieldcelldelegate?language=objc)
222    pub unsafe trait NSTokenFieldCellDelegate: NSObjectProtocol + MainThreadOnly {
223        #[cfg(all(
224            feature = "NSActionCell",
225            feature = "NSCell",
226            feature = "NSTextFieldCell"
227        ))]
228        /// Allows the delegate to provide an array of appropriate completions for the contents of the receiver
229        ///
230        /// Parameter `tokenFieldCell`: The token field cell where editing is occurring
231        ///
232        /// Parameter `substring`: The partial string that is being completed
233        ///
234        /// Parameter `tokenIndex`: The index of the token being completed
235        ///
236        /// Parameter `selectedIndex`: Optionally, you can return by reference an index into the returned array that specifies which of the completions should be initially selected. If none are to be selected, return by reference `-1`.
237        ///
238        /// Returns: An array of strings (`NSString`) that are possible completions
239        ///
240        /// If the delegate does not implement this method, no completions are provided
241        #[optional]
242        #[unsafe(method(tokenFieldCell:completionsForSubstring:indexOfToken:indexOfSelectedItem:))]
243        #[unsafe(method_family = none)]
244        unsafe fn tokenFieldCell_completionsForSubstring_indexOfToken_indexOfSelectedItem(
245            &self,
246            token_field_cell: &NSTokenFieldCell,
247            substring: &NSString,
248            token_index: NSInteger,
249            selected_index: NonNull<NSInteger>,
250        ) -> Retained<NSArray>;
251
252        #[cfg(all(
253            feature = "NSActionCell",
254            feature = "NSCell",
255            feature = "NSTextFieldCell"
256        ))]
257        #[optional]
258        #[unsafe(method(tokenFieldCell:shouldAddObjects:atIndex:))]
259        #[unsafe(method_family = none)]
260        unsafe fn tokenFieldCell_shouldAddObjects_atIndex(
261            &self,
262            token_field_cell: &NSTokenFieldCell,
263            tokens: &NSArray,
264            index: NSUInteger,
265        ) -> Retained<NSArray>;
266
267        #[cfg(all(
268            feature = "NSActionCell",
269            feature = "NSCell",
270            feature = "NSTextFieldCell"
271        ))]
272        #[optional]
273        #[unsafe(method(tokenFieldCell:displayStringForRepresentedObject:))]
274        #[unsafe(method_family = none)]
275        unsafe fn tokenFieldCell_displayStringForRepresentedObject(
276            &self,
277            token_field_cell: &NSTokenFieldCell,
278            represented_object: &AnyObject,
279        ) -> Option<Retained<NSString>>;
280
281        #[cfg(all(
282            feature = "NSActionCell",
283            feature = "NSCell",
284            feature = "NSTextFieldCell"
285        ))]
286        #[optional]
287        #[unsafe(method(tokenFieldCell:editingStringForRepresentedObject:))]
288        #[unsafe(method_family = none)]
289        unsafe fn tokenFieldCell_editingStringForRepresentedObject(
290            &self,
291            token_field_cell: &NSTokenFieldCell,
292            represented_object: &AnyObject,
293        ) -> Option<Retained<NSString>>;
294
295        #[cfg(all(
296            feature = "NSActionCell",
297            feature = "NSCell",
298            feature = "NSTextFieldCell"
299        ))]
300        #[optional]
301        #[unsafe(method(tokenFieldCell:representedObjectForEditingString:))]
302        #[unsafe(method_family = none)]
303        unsafe fn tokenFieldCell_representedObjectForEditingString(
304            &self,
305            token_field_cell: &NSTokenFieldCell,
306            editing_string: &NSString,
307        ) -> Option<Retained<AnyObject>>;
308
309        #[cfg(all(
310            feature = "NSActionCell",
311            feature = "NSCell",
312            feature = "NSPasteboard",
313            feature = "NSTextFieldCell"
314        ))]
315        #[optional]
316        #[unsafe(method(tokenFieldCell:writeRepresentedObjects:toPasteboard:))]
317        #[unsafe(method_family = none)]
318        unsafe fn tokenFieldCell_writeRepresentedObjects_toPasteboard(
319            &self,
320            token_field_cell: &NSTokenFieldCell,
321            objects: &NSArray,
322            pboard: &NSPasteboard,
323        ) -> bool;
324
325        #[cfg(all(
326            feature = "NSActionCell",
327            feature = "NSCell",
328            feature = "NSPasteboard",
329            feature = "NSTextFieldCell"
330        ))]
331        #[optional]
332        #[unsafe(method(tokenFieldCell:readFromPasteboard:))]
333        #[unsafe(method_family = none)]
334        unsafe fn tokenFieldCell_readFromPasteboard(
335            &self,
336            token_field_cell: &NSTokenFieldCell,
337            pboard: &NSPasteboard,
338        ) -> Option<Retained<NSArray>>;
339
340        #[cfg(all(
341            feature = "NSActionCell",
342            feature = "NSCell",
343            feature = "NSMenu",
344            feature = "NSTextFieldCell"
345        ))]
346        #[optional]
347        #[unsafe(method(tokenFieldCell:menuForRepresentedObject:))]
348        #[unsafe(method_family = none)]
349        unsafe fn tokenFieldCell_menuForRepresentedObject(
350            &self,
351            token_field_cell: &NSTokenFieldCell,
352            represented_object: &AnyObject,
353        ) -> Option<Retained<NSMenu>>;
354
355        #[cfg(all(
356            feature = "NSActionCell",
357            feature = "NSCell",
358            feature = "NSTextFieldCell"
359        ))]
360        #[optional]
361        #[unsafe(method(tokenFieldCell:hasMenuForRepresentedObject:))]
362        #[unsafe(method_family = none)]
363        unsafe fn tokenFieldCell_hasMenuForRepresentedObject(
364            &self,
365            token_field_cell: &NSTokenFieldCell,
366            represented_object: &AnyObject,
367        ) -> bool;
368
369        #[cfg(all(
370            feature = "NSActionCell",
371            feature = "NSCell",
372            feature = "NSTextFieldCell"
373        ))]
374        #[optional]
375        #[unsafe(method(tokenFieldCell:styleForRepresentedObject:))]
376        #[unsafe(method_family = none)]
377        unsafe fn tokenFieldCell_styleForRepresentedObject(
378            &self,
379            token_field_cell: &NSTokenFieldCell,
380            represented_object: &AnyObject,
381        ) -> NSTokenStyle;
382    }
383);
384
385/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdefaulttokenstyle?language=objc)
386pub static NSDefaultTokenStyle: NSTokenStyle = NSTokenStyle(NSTokenStyle::Default.0);
387
388/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsplaintexttokenstyle?language=objc)
389pub static NSPlainTextTokenStyle: NSTokenStyle = NSTokenStyle(NSTokenStyle::None.0);
390
391/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsroundedtokenstyle?language=objc)
392pub static NSRoundedTokenStyle: NSTokenStyle = NSTokenStyle(NSTokenStyle::Rounded.0);