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