objc2_app_kit/generated/
NSScrubber.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/nsscrubberdatasource?language=objc)
12    pub unsafe trait NSScrubberDataSource: NSObjectProtocol + MainThreadOnly {
13        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
14        #[unsafe(method(numberOfItemsForScrubber:))]
15        #[unsafe(method_family = none)]
16        fn numberOfItemsForScrubber(&self, scrubber: &NSScrubber) -> NSInteger;
17
18        #[cfg(all(
19            feature = "NSResponder",
20            feature = "NSScrubberItemView",
21            feature = "NSView"
22        ))]
23        #[unsafe(method(scrubber:viewForItemAtIndex:))]
24        #[unsafe(method_family = none)]
25        fn scrubber_viewForItemAtIndex(
26            &self,
27            scrubber: &NSScrubber,
28            index: NSInteger,
29        ) -> Retained<NSScrubberItemView>;
30    }
31);
32
33extern_protocol!(
34    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsscrubberdelegate?language=objc)
35    pub unsafe trait NSScrubberDelegate: NSObjectProtocol + MainThreadOnly {
36        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
37        #[optional]
38        #[unsafe(method(scrubber:didSelectItemAtIndex:))]
39        #[unsafe(method_family = none)]
40        fn scrubber_didSelectItemAtIndex(&self, scrubber: &NSScrubber, selected_index: NSInteger);
41
42        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
43        #[optional]
44        #[unsafe(method(scrubber:didHighlightItemAtIndex:))]
45        #[unsafe(method_family = none)]
46        fn scrubber_didHighlightItemAtIndex(
47            &self,
48            scrubber: &NSScrubber,
49            highlighted_index: NSInteger,
50        );
51
52        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
53        #[optional]
54        #[unsafe(method(scrubber:didChangeVisibleRange:))]
55        #[unsafe(method_family = none)]
56        fn scrubber_didChangeVisibleRange(&self, scrubber: &NSScrubber, visible_range: NSRange);
57
58        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
59        #[optional]
60        #[unsafe(method(didBeginInteractingWithScrubber:))]
61        #[unsafe(method_family = none)]
62        fn didBeginInteractingWithScrubber(&self, scrubber: &NSScrubber);
63
64        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
65        #[optional]
66        #[unsafe(method(didFinishInteractingWithScrubber:))]
67        #[unsafe(method_family = none)]
68        fn didFinishInteractingWithScrubber(&self, scrubber: &NSScrubber);
69
70        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
71        #[optional]
72        #[unsafe(method(didCancelInteractingWithScrubber:))]
73        #[unsafe(method_family = none)]
74        fn didCancelInteractingWithScrubber(&self, scrubber: &NSScrubber);
75    }
76);
77
78/// Determines the interaction mode for a NSScrubber control.
79///
80/// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsscrubbermode?language=objc)
81// NS_ENUM
82#[repr(transparent)]
83#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
84pub struct NSScrubberMode(pub NSInteger);
85impl NSScrubberMode {
86    #[doc(alias = "NSScrubberModeFixed")]
87    pub const Fixed: Self = Self(0);
88    #[doc(alias = "NSScrubberModeFree")]
89    pub const Free: Self = Self(1);
90}
91
92unsafe impl Encode for NSScrubberMode {
93    const ENCODING: Encoding = NSInteger::ENCODING;
94}
95
96unsafe impl RefEncode for NSScrubberMode {
97    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
98}
99
100/// NSScrubberAlignment specifies the preferred alignment of elements within the control.
101///
102/// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsscrubberalignment?language=objc)
103// NS_ENUM
104#[repr(transparent)]
105#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
106pub struct NSScrubberAlignment(pub NSInteger);
107impl NSScrubberAlignment {
108    #[doc(alias = "NSScrubberAlignmentNone")]
109    pub const None: Self = Self(0);
110    #[doc(alias = "NSScrubberAlignmentLeading")]
111    pub const Leading: Self = Self(1);
112    #[doc(alias = "NSScrubberAlignmentTrailing")]
113    pub const Trailing: Self = Self(2);
114    #[doc(alias = "NSScrubberAlignmentCenter")]
115    pub const Center: Self = Self(3);
116}
117
118unsafe impl Encode for NSScrubberAlignment {
119    const ENCODING: Encoding = NSInteger::ENCODING;
120}
121
122unsafe impl RefEncode for NSScrubberAlignment {
123    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
124}
125
126extern_class!(
127    /// `NSScrubberSelectionStyle`is an abstract class that provides decorative accessory views for selected and highlighted items within a NSScrubber control. Class properties provide convenient access to built-in styles. For a completely custom style, subclassers can override
128    /// `-makeSelectionView`to create and configure arbitrary
129    /// `NSScrubberSelectionView`subclasses.
130    ///
131    /// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsscrubberselectionstyle?language=objc)
132    #[unsafe(super(NSObject))]
133    #[thread_kind = MainThreadOnly]
134    #[derive(Debug, PartialEq, Eq, Hash)]
135    pub struct NSScrubberSelectionStyle;
136);
137
138extern_conformance!(
139    unsafe impl NSCoding for NSScrubberSelectionStyle {}
140);
141
142extern_conformance!(
143    unsafe impl NSObjectProtocol for NSScrubberSelectionStyle {}
144);
145
146impl NSScrubberSelectionStyle {
147    extern_methods!(
148        #[unsafe(method(outlineOverlayStyle))]
149        #[unsafe(method_family = none)]
150        pub fn outlineOverlayStyle(mtm: MainThreadMarker) -> Retained<NSScrubberSelectionStyle>;
151
152        #[unsafe(method(roundedBackgroundStyle))]
153        #[unsafe(method_family = none)]
154        pub fn roundedBackgroundStyle(mtm: MainThreadMarker) -> Retained<NSScrubberSelectionStyle>;
155
156        #[unsafe(method(init))]
157        #[unsafe(method_family = init)]
158        pub fn init(this: Allocated<Self>) -> Retained<Self>;
159
160        /// # Safety
161        ///
162        /// `coder` possibly has further requirements.
163        #[unsafe(method(initWithCoder:))]
164        #[unsafe(method_family = init)]
165        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
166
167        #[cfg(all(
168            feature = "NSResponder",
169            feature = "NSScrubberItemView",
170            feature = "NSView"
171        ))]
172        #[unsafe(method(makeSelectionView))]
173        #[unsafe(method_family = none)]
174        pub fn makeSelectionView(&self) -> Option<Retained<NSScrubberSelectionView>>;
175    );
176}
177
178/// Methods declared on superclass `NSObject`.
179impl NSScrubberSelectionStyle {
180    extern_methods!(
181        #[unsafe(method(new))]
182        #[unsafe(method_family = new)]
183        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
184    );
185}
186
187extern_class!(
188    /// `NSScrubber`is a control designed for the NSTouchBar environment.
189    ///
190    /// `NSScrubber`arranges a finite number of "items" (represented by views of type
191    /// `NSScrubberItemView`) according to a layout object (see
192    /// `NSScrubberLayout`), and provides several methods for navigating and selecting those items.
193    ///
194    /// Clients provide data to
195    /// `NSScrubber`via a data source object (see the
196    /// `NSScrubberDataSource`protocol) and react to user interaction via a delegate object (see the
197    /// `NSScrubberDelegate`protocol).
198    ///
199    /// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsscrubber?language=objc)
200    #[unsafe(super(NSView, NSResponder, NSObject))]
201    #[derive(Debug, PartialEq, Eq, Hash)]
202    #[cfg(all(feature = "NSResponder", feature = "NSView"))]
203    pub struct NSScrubber;
204);
205
206#[cfg(all(
207    feature = "NSAccessibilityProtocols",
208    feature = "NSResponder",
209    feature = "NSView"
210))]
211extern_conformance!(
212    unsafe impl NSAccessibility for NSScrubber {}
213);
214
215#[cfg(all(
216    feature = "NSAccessibilityProtocols",
217    feature = "NSResponder",
218    feature = "NSView"
219))]
220extern_conformance!(
221    unsafe impl NSAccessibilityElementProtocol for NSScrubber {}
222);
223
224#[cfg(all(feature = "NSAnimation", feature = "NSResponder", feature = "NSView"))]
225extern_conformance!(
226    unsafe impl NSAnimatablePropertyContainer for NSScrubber {}
227);
228
229#[cfg(all(feature = "NSAppearance", feature = "NSResponder", feature = "NSView"))]
230extern_conformance!(
231    unsafe impl NSAppearanceCustomization for NSScrubber {}
232);
233
234#[cfg(all(feature = "NSResponder", feature = "NSView"))]
235extern_conformance!(
236    unsafe impl NSCoding for NSScrubber {}
237);
238
239#[cfg(all(feature = "NSDragging", feature = "NSResponder", feature = "NSView"))]
240extern_conformance!(
241    unsafe impl NSDraggingDestination for NSScrubber {}
242);
243
244#[cfg(all(feature = "NSResponder", feature = "NSView"))]
245extern_conformance!(
246    unsafe impl NSObjectProtocol for NSScrubber {}
247);
248
249#[cfg(all(
250    feature = "NSResponder",
251    feature = "NSUserInterfaceItemIdentification",
252    feature = "NSView"
253))]
254extern_conformance!(
255    unsafe impl NSUserInterfaceItemIdentification for NSScrubber {}
256);
257
258#[cfg(all(feature = "NSResponder", feature = "NSView"))]
259impl NSScrubber {
260    extern_methods!(
261        #[unsafe(method(dataSource))]
262        #[unsafe(method_family = none)]
263        pub fn dataSource(&self) -> Option<Retained<ProtocolObject<dyn NSScrubberDataSource>>>;
264
265        /// Setter for [`dataSource`][Self::dataSource].
266        ///
267        /// This is a [weak property][objc2::topics::weak_property].
268        #[unsafe(method(setDataSource:))]
269        #[unsafe(method_family = none)]
270        pub fn setDataSource(&self, data_source: Option<&ProtocolObject<dyn NSScrubberDataSource>>);
271
272        #[unsafe(method(delegate))]
273        #[unsafe(method_family = none)]
274        pub fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSScrubberDelegate>>>;
275
276        /// Setter for [`delegate`][Self::delegate].
277        ///
278        /// This is a [weak property][objc2::topics::weak_property].
279        #[unsafe(method(setDelegate:))]
280        #[unsafe(method_family = none)]
281        pub fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn NSScrubberDelegate>>);
282
283        #[cfg(feature = "NSScrubberLayout")]
284        #[unsafe(method(scrubberLayout))]
285        #[unsafe(method_family = none)]
286        pub fn scrubberLayout(&self) -> Retained<NSScrubberLayout>;
287
288        #[cfg(feature = "NSScrubberLayout")]
289        /// Setter for [`scrubberLayout`][Self::scrubberLayout].
290        #[unsafe(method(setScrubberLayout:))]
291        #[unsafe(method_family = none)]
292        pub fn setScrubberLayout(&self, scrubber_layout: &NSScrubberLayout);
293
294        /// Returns the number of items represented by the scrubber control.
295        #[unsafe(method(numberOfItems))]
296        #[unsafe(method_family = none)]
297        pub fn numberOfItems(&self) -> NSInteger;
298
299        /// The index of the currently highlighted item within the control. If there is no highlighted item, the value of this property is (-1).
300        #[unsafe(method(highlightedIndex))]
301        #[unsafe(method_family = none)]
302        pub fn highlightedIndex(&self) -> NSInteger;
303
304        /// The index of the selected item within the control. If there is no selected item, the value of this property is (-1). Setting this property through the animator proxy will animate the selection change. Programmatic selection changes do not trigger delegate callbacks.
305        #[unsafe(method(selectedIndex))]
306        #[unsafe(method_family = none)]
307        pub fn selectedIndex(&self) -> NSInteger;
308
309        /// Setter for [`selectedIndex`][Self::selectedIndex].
310        #[unsafe(method(setSelectedIndex:))]
311        #[unsafe(method_family = none)]
312        pub fn setSelectedIndex(&self, selected_index: NSInteger);
313
314        /// Describes the interaction mode for the scrubber control. See the
315        /// `NSScrubberMode`enumeration for a list of possible values. The default value is
316        /// `NSScrubberModeFixed.`
317        #[unsafe(method(mode))]
318        #[unsafe(method_family = none)]
319        pub fn mode(&self) -> NSScrubberMode;
320
321        /// Setter for [`mode`][Self::mode].
322        #[unsafe(method(setMode:))]
323        #[unsafe(method_family = none)]
324        pub fn setMode(&self, mode: NSScrubberMode);
325
326        /// If the value of
327        /// `itemAlignment`is not
328        /// `NSScrubberAlignmentNone,`the scrubber will ensure that some item rests at the preferred alignment within the control following a scrolling or paging interaction. The default value is
329        /// `NSScrubberAlignmentNone.`
330        #[unsafe(method(itemAlignment))]
331        #[unsafe(method_family = none)]
332        pub fn itemAlignment(&self) -> NSScrubberAlignment;
333
334        /// Setter for [`itemAlignment`][Self::itemAlignment].
335        #[unsafe(method(setItemAlignment:))]
336        #[unsafe(method_family = none)]
337        pub fn setItemAlignment(&self, item_alignment: NSScrubberAlignment);
338
339        /// When
340        /// `continuous`is
341        /// `YES,`panning over the control in
342        /// `NSScrubberModeFixed`will immediately select the item under the user's finger, and scrolling in
343        /// `NSScrubberModeFree`will continuously select items as they pass through the current
344        /// `itemAlignment.`The default is
345        /// `NO.`
346        #[unsafe(method(isContinuous))]
347        #[unsafe(method_family = none)]
348        pub fn isContinuous(&self) -> bool;
349
350        /// Setter for [`isContinuous`][Self::isContinuous].
351        #[unsafe(method(setContinuous:))]
352        #[unsafe(method_family = none)]
353        pub fn setContinuous(&self, continuous: bool);
354
355        /// When
356        /// `floatsSelectionViews`is
357        /// `YES,`the selection decorations provided by
358        /// `selectionBackgroundStyle`and
359        /// `selectionOverlayStyle`will smoothly float between selected items, rather than animating their entrance/exit in-place. The default is
360        /// `NO.`
361        #[unsafe(method(floatsSelectionViews))]
362        #[unsafe(method_family = none)]
363        pub fn floatsSelectionViews(&self) -> bool;
364
365        /// Setter for [`floatsSelectionViews`][Self::floatsSelectionViews].
366        #[unsafe(method(setFloatsSelectionViews:))]
367        #[unsafe(method_family = none)]
368        pub fn setFloatsSelectionViews(&self, floats_selection_views: bool);
369
370        /// Specifies a style of decoration to place behind items that are selected and/or highlighted. The default value is
371        /// `nil,`indicating no built-in background decoration.
372        #[unsafe(method(selectionBackgroundStyle))]
373        #[unsafe(method_family = none)]
374        pub fn selectionBackgroundStyle(&self) -> Option<Retained<NSScrubberSelectionStyle>>;
375
376        /// Setter for [`selectionBackgroundStyle`][Self::selectionBackgroundStyle].
377        #[unsafe(method(setSelectionBackgroundStyle:))]
378        #[unsafe(method_family = none)]
379        pub fn setSelectionBackgroundStyle(
380            &self,
381            selection_background_style: Option<&NSScrubberSelectionStyle>,
382        );
383
384        /// Specifies a style of decoration to place above items that are selected and/or highlighted. The default value is
385        /// `nil,`indicating no built-in overlay decoration.
386        #[unsafe(method(selectionOverlayStyle))]
387        #[unsafe(method_family = none)]
388        pub fn selectionOverlayStyle(&self) -> Option<Retained<NSScrubberSelectionStyle>>;
389
390        /// Setter for [`selectionOverlayStyle`][Self::selectionOverlayStyle].
391        #[unsafe(method(setSelectionOverlayStyle:))]
392        #[unsafe(method_family = none)]
393        pub fn setSelectionOverlayStyle(
394            &self,
395            selection_overlay_style: Option<&NSScrubberSelectionStyle>,
396        );
397
398        /// If
399        /// `showsArrowButtons`is
400        /// `YES,`the control provides leading and trailing arrow buttons. Tapping an arrow button moves the selection index by one element; pressing and holding repeatedly moves the selection. The default is
401        /// `NO.`
402        #[unsafe(method(showsArrowButtons))]
403        #[unsafe(method_family = none)]
404        pub fn showsArrowButtons(&self) -> bool;
405
406        /// Setter for [`showsArrowButtons`][Self::showsArrowButtons].
407        #[unsafe(method(setShowsArrowButtons:))]
408        #[unsafe(method_family = none)]
409        pub fn setShowsArrowButtons(&self, shows_arrow_buttons: bool);
410
411        /// If
412        /// `showsAdditionalContentIndicators`is
413        /// `YES,`the control will draw a fade effect to indicate that there is additional unscrolled content. The default is
414        /// `NO.`
415        #[unsafe(method(showsAdditionalContentIndicators))]
416        #[unsafe(method_family = none)]
417        pub fn showsAdditionalContentIndicators(&self) -> bool;
418
419        /// Setter for [`showsAdditionalContentIndicators`][Self::showsAdditionalContentIndicators].
420        #[unsafe(method(setShowsAdditionalContentIndicators:))]
421        #[unsafe(method_family = none)]
422        pub fn setShowsAdditionalContentIndicators(
423            &self,
424            shows_additional_content_indicators: bool,
425        );
426
427        #[cfg(feature = "NSColor")]
428        /// If set,
429        /// `backgroundColor`is displayed behind the scrubber content. The background color is suppressed if the scrubber is assigned a non-nil
430        /// `backgroundView.`The default value is
431        /// `nil.`
432        #[unsafe(method(backgroundColor))]
433        #[unsafe(method_family = none)]
434        pub fn backgroundColor(&self) -> Option<Retained<NSColor>>;
435
436        #[cfg(feature = "NSColor")]
437        /// Setter for [`backgroundColor`][Self::backgroundColor].
438        ///
439        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
440        #[unsafe(method(setBackgroundColor:))]
441        #[unsafe(method_family = none)]
442        pub fn setBackgroundColor(&self, background_color: Option<&NSColor>);
443
444        /// If non-nil, the
445        /// `backgroundView`is displayed below the scrubber content. The view's layout is managed by
446        /// `NSScrubber`to match the content area. If this property is non-nil, the
447        /// `backgroundColor`property has no effect. The default value is
448        /// `nil.`
449        #[unsafe(method(backgroundView))]
450        #[unsafe(method_family = none)]
451        pub fn backgroundView(&self) -> Option<Retained<NSView>>;
452
453        /// Setter for [`backgroundView`][Self::backgroundView].
454        #[unsafe(method(setBackgroundView:))]
455        #[unsafe(method_family = none)]
456        pub fn setBackgroundView(&self, background_view: Option<&NSView>);
457
458        #[unsafe(method(initWithFrame:))]
459        #[unsafe(method_family = init)]
460        pub fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
461
462        /// # Safety
463        ///
464        /// `coder` possibly has further requirements.
465        #[unsafe(method(initWithCoder:))]
466        #[unsafe(method_family = init)]
467        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
468
469        /// Invalidate all data within the scrubber control, triggering a reload of all content, and clearing the current selection.
470        #[unsafe(method(reloadData))]
471        #[unsafe(method_family = none)]
472        pub fn reloadData(&self);
473
474        #[cfg(feature = "block2")]
475        /// Updates inside the
476        /// `performSequentialBatchUpdates`block are processed and displayed all at once, including insertion, removal, moving, reloading items, and changing the selected index. Changes are performed iteratively using the same semantics as
477        /// `NSMutableArray.`NSScrubber expects its dataSource to reflect the changes made inside
478        /// `-performSequentialBatchUpdates:`immediately after the
479        /// `updateBlock`finishes executing.
480        #[unsafe(method(performSequentialBatchUpdates:))]
481        #[unsafe(method_family = none)]
482        pub fn performSequentialBatchUpdates(&self, update_block: &block2::DynBlock<dyn Fn() + '_>);
483
484        /// Inserts new items at the specified indexes. NSScrubber will request views for each new index from the
485        /// `dataSource.`This method uses the same semantics as
486        /// `NSMutableArray;`each index in the set specifies the destination index after all previous insertions have occurred. Therefore, an NSIndexSet of [1,2,3] will result in three new contiguous items.
487        #[unsafe(method(insertItemsAtIndexes:))]
488        #[unsafe(method_family = none)]
489        pub fn insertItemsAtIndexes(&self, indexes: &NSIndexSet);
490
491        /// Removes the items at the specified indexes. This method uses the same semantics as
492        /// `NSMutableArray.`
493        #[unsafe(method(removeItemsAtIndexes:))]
494        #[unsafe(method_family = none)]
495        pub fn removeItemsAtIndexes(&self, indexes: &NSIndexSet);
496
497        /// Reloads the items at the specified indexes. NSScrubber will request new views for each item and smoothly crossfade between them before discarding the original views.
498        #[unsafe(method(reloadItemsAtIndexes:))]
499        #[unsafe(method_family = none)]
500        pub fn reloadItemsAtIndexes(&self, indexes: &NSIndexSet);
501
502        /// Moves an item from one index to another.
503        /// `oldIndex`refers to the item's index prior to the movement, whereas
504        /// `newIndex`refers to the item's final location.
505        #[unsafe(method(moveItemAtIndex:toIndex:))]
506        #[unsafe(method_family = none)]
507        pub fn moveItemAtIndex_toIndex(&self, old_index: NSInteger, new_index: NSInteger);
508
509        /// Scrolls an item to a given alignment within the control. If
510        /// `NSScrubberAlignmentNone`is provided, then the control scrolls the minimum amount necessary to make the item visible. Scrolling is animated if called on the animator proxy.
511        #[unsafe(method(scrollItemAtIndex:toAlignment:))]
512        #[unsafe(method_family = none)]
513        pub fn scrollItemAtIndex_toAlignment(
514            &self,
515            index: NSInteger,
516            alignment: NSScrubberAlignment,
517        );
518
519        #[cfg(feature = "NSScrubberItemView")]
520        /// Returns the
521        /// `NSScrubberItemView`for the given index, if one currently exists; returns
522        /// `nil`otherwise.
523        #[unsafe(method(itemViewForItemAtIndex:))]
524        #[unsafe(method_family = none)]
525        pub fn itemViewForItemAtIndex(
526            &self,
527            index: NSInteger,
528        ) -> Option<Retained<NSScrubberItemView>>;
529
530        #[cfg(feature = "NSUserInterfaceItemIdentification")]
531        /// Registers a
532        /// `NSScrubberItemView`class to be instantiated for the given
533        /// `itemIdentifier.`Raises an exception if
534        /// `itemViewClass`is not a subclass of
535        /// `NSScrubberItemView.`Passing
536        /// `nil`for
537        /// `itemViewClass`removes a previous registration. Registrations made through this method do not persist through NSCoding.
538        ///
539        /// # Safety
540        ///
541        /// `item_view_class` probably has further requirements.
542        #[unsafe(method(registerClass:forItemIdentifier:))]
543        #[unsafe(method_family = none)]
544        pub unsafe fn registerClass_forItemIdentifier(
545            &self,
546            item_view_class: Option<&AnyClass>,
547            item_identifier: &NSUserInterfaceItemIdentifier,
548        );
549
550        #[cfg(all(feature = "NSNib", feature = "NSUserInterfaceItemIdentification"))]
551        /// Register a nib to be instantiated for the given
552        /// `itemIdentifier.`The nib must contain a top-level object which is a subclass of NSScrubberItemView; otherwise,
553        /// `-makeItemWithIdentifier:`may return
554        /// `nil`for this identifier. Passing
555        /// `nil`for
556        /// `nib`removes a previous registration.
557        #[unsafe(method(registerNib:forItemIdentifier:))]
558        #[unsafe(method_family = none)]
559        pub fn registerNib_forItemIdentifier(
560            &self,
561            nib: Option<&NSNib>,
562            item_identifier: &NSUserInterfaceItemIdentifier,
563        );
564
565        #[cfg(all(
566            feature = "NSScrubberItemView",
567            feature = "NSUserInterfaceItemIdentification"
568        ))]
569        /// Creates or reuses a
570        /// `NSScrubberItemView`corresponding to the provided
571        /// `itemIdentifier.``NSScrubber`searches, in order: the reuse queue, the list of registered classes, and then the list of registered nibs. If the reuse queue is empty, and there is no Class or Interface Builder archive registered for the
572        /// `itemIdentifier,`this method returns
573        /// `nil.`
574        ///
575        /// # Safety
576        ///
577        /// `owner` should be of the correct type.
578        #[unsafe(method(makeItemWithIdentifier:owner:))]
579        #[unsafe(method_family = none)]
580        pub unsafe fn makeItemWithIdentifier_owner(
581            &self,
582            item_identifier: &NSUserInterfaceItemIdentifier,
583            owner: Option<&AnyObject>,
584        ) -> Option<Retained<NSScrubberItemView>>;
585    );
586}
587
588/// Methods declared on superclass `NSResponder`.
589#[cfg(all(feature = "NSResponder", feature = "NSView"))]
590impl NSScrubber {
591    extern_methods!(
592        #[unsafe(method(init))]
593        #[unsafe(method_family = init)]
594        pub fn init(this: Allocated<Self>) -> Retained<Self>;
595    );
596}
597
598/// Methods declared on superclass `NSObject`.
599#[cfg(all(feature = "NSResponder", feature = "NSView"))]
600impl NSScrubber {
601    extern_methods!(
602        #[unsafe(method(new))]
603        #[unsafe(method_family = new)]
604        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
605    );
606}