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