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