1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_protocol!(
11 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 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#[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#[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 #[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
187impl 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 #[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 #[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 #[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 #[unsafe(method(setScrubberLayout:))]
303 #[unsafe(method_family = none)]
304 pub unsafe fn setScrubberLayout(&self, scrubber_layout: &NSScrubberLayout);
305
306 #[unsafe(method(numberOfItems))]
308 #[unsafe(method_family = none)]
309 pub unsafe fn numberOfItems(&self) -> NSInteger;
310
311 #[unsafe(method(highlightedIndex))]
313 #[unsafe(method_family = none)]
314 pub unsafe fn highlightedIndex(&self) -> NSInteger;
315
316 #[unsafe(method(selectedIndex))]
318 #[unsafe(method_family = none)]
319 pub unsafe fn selectedIndex(&self) -> NSInteger;
320
321 #[unsafe(method(setSelectedIndex:))]
323 #[unsafe(method_family = none)]
324 pub unsafe fn setSelectedIndex(&self, selected_index: NSInteger);
325
326 #[unsafe(method(mode))]
330 #[unsafe(method_family = none)]
331 pub unsafe fn mode(&self) -> NSScrubberMode;
332
333 #[unsafe(method(setMode:))]
335 #[unsafe(method_family = none)]
336 pub unsafe fn setMode(&self, mode: NSScrubberMode);
337
338 #[unsafe(method(itemAlignment))]
343 #[unsafe(method_family = none)]
344 pub unsafe fn itemAlignment(&self) -> NSScrubberAlignment;
345
346 #[unsafe(method(setItemAlignment:))]
348 #[unsafe(method_family = none)]
349 pub unsafe fn setItemAlignment(&self, item_alignment: NSScrubberAlignment);
350
351 #[unsafe(method(isContinuous))]
359 #[unsafe(method_family = none)]
360 pub unsafe fn isContinuous(&self) -> bool;
361
362 #[unsafe(method(setContinuous:))]
364 #[unsafe(method_family = none)]
365 pub unsafe fn setContinuous(&self, continuous: bool);
366
367 #[unsafe(method(floatsSelectionViews))]
374 #[unsafe(method_family = none)]
375 pub unsafe fn floatsSelectionViews(&self) -> bool;
376
377 #[unsafe(method(setFloatsSelectionViews:))]
379 #[unsafe(method_family = none)]
380 pub unsafe fn setFloatsSelectionViews(&self, floats_selection_views: bool);
381
382 #[unsafe(method(selectionBackgroundStyle))]
385 #[unsafe(method_family = none)]
386 pub unsafe fn selectionBackgroundStyle(&self)
387 -> Option<Retained<NSScrubberSelectionStyle>>;
388
389 #[unsafe(method(setSelectionBackgroundStyle:))]
391 #[unsafe(method_family = none)]
392 pub unsafe fn setSelectionBackgroundStyle(
393 &self,
394 selection_background_style: Option<&NSScrubberSelectionStyle>,
395 );
396
397 #[unsafe(method(selectionOverlayStyle))]
400 #[unsafe(method_family = none)]
401 pub unsafe fn selectionOverlayStyle(&self) -> Option<Retained<NSScrubberSelectionStyle>>;
402
403 #[unsafe(method(setSelectionOverlayStyle:))]
405 #[unsafe(method_family = none)]
406 pub unsafe fn setSelectionOverlayStyle(
407 &self,
408 selection_overlay_style: Option<&NSScrubberSelectionStyle>,
409 );
410
411 #[unsafe(method(showsArrowButtons))]
416 #[unsafe(method_family = none)]
417 pub unsafe fn showsArrowButtons(&self) -> bool;
418
419 #[unsafe(method(setShowsArrowButtons:))]
421 #[unsafe(method_family = none)]
422 pub unsafe fn setShowsArrowButtons(&self, shows_arrow_buttons: bool);
423
424 #[unsafe(method(showsAdditionalContentIndicators))]
429 #[unsafe(method_family = none)]
430 pub unsafe fn showsAdditionalContentIndicators(&self) -> bool;
431
432 #[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 #[unsafe(method(backgroundColor))]
446 #[unsafe(method_family = none)]
447 pub unsafe fn backgroundColor(&self) -> Option<Retained<NSColor>>;
448
449 #[cfg(feature = "NSColor")]
450 #[unsafe(method(setBackgroundColor:))]
452 #[unsafe(method_family = none)]
453 pub unsafe fn setBackgroundColor(&self, background_color: Option<&NSColor>);
454
455 #[unsafe(method(backgroundView))]
461 #[unsafe(method_family = none)]
462 pub unsafe fn backgroundView(&self) -> Option<Retained<NSView>>;
463
464 #[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 #[unsafe(method(reloadData))]
479 #[unsafe(method_family = none)]
480 pub unsafe fn reloadData(&self);
481
482 #[cfg(feature = "block2")]
483 #[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 #[unsafe(method(insertItemsAtIndexes:))]
499 #[unsafe(method_family = none)]
500 pub unsafe fn insertItemsAtIndexes(&self, indexes: &NSIndexSet);
501
502 #[unsafe(method(removeItemsAtIndexes:))]
505 #[unsafe(method_family = none)]
506 pub unsafe fn removeItemsAtIndexes(&self, indexes: &NSIndexSet);
507
508 #[unsafe(method(reloadItemsAtIndexes:))]
510 #[unsafe(method_family = none)]
511 pub unsafe fn reloadItemsAtIndexes(&self, indexes: &NSIndexSet);
512
513 #[unsafe(method(moveItemAtIndex:toIndex:))]
517 #[unsafe(method_family = none)]
518 pub unsafe fn moveItemAtIndex_toIndex(&self, old_index: NSInteger, new_index: NSInteger);
519
520 #[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 #[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 #[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 #[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 #[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#[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#[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}