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 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 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#[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#[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 #[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 #[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
178impl 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 #[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 #[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 #[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 #[unsafe(method(setScrubberLayout:))]
291 #[unsafe(method_family = none)]
292 pub fn setScrubberLayout(&self, scrubber_layout: &NSScrubberLayout);
293
294 #[unsafe(method(numberOfItems))]
296 #[unsafe(method_family = none)]
297 pub fn numberOfItems(&self) -> NSInteger;
298
299 #[unsafe(method(highlightedIndex))]
301 #[unsafe(method_family = none)]
302 pub fn highlightedIndex(&self) -> NSInteger;
303
304 #[unsafe(method(selectedIndex))]
306 #[unsafe(method_family = none)]
307 pub fn selectedIndex(&self) -> NSInteger;
308
309 #[unsafe(method(setSelectedIndex:))]
311 #[unsafe(method_family = none)]
312 pub fn setSelectedIndex(&self, selected_index: NSInteger);
313
314 #[unsafe(method(mode))]
318 #[unsafe(method_family = none)]
319 pub fn mode(&self) -> NSScrubberMode;
320
321 #[unsafe(method(setMode:))]
323 #[unsafe(method_family = none)]
324 pub fn setMode(&self, mode: NSScrubberMode);
325
326 #[unsafe(method(itemAlignment))]
331 #[unsafe(method_family = none)]
332 pub fn itemAlignment(&self) -> NSScrubberAlignment;
333
334 #[unsafe(method(setItemAlignment:))]
336 #[unsafe(method_family = none)]
337 pub fn setItemAlignment(&self, item_alignment: NSScrubberAlignment);
338
339 #[unsafe(method(isContinuous))]
347 #[unsafe(method_family = none)]
348 pub fn isContinuous(&self) -> bool;
349
350 #[unsafe(method(setContinuous:))]
352 #[unsafe(method_family = none)]
353 pub fn setContinuous(&self, continuous: bool);
354
355 #[unsafe(method(floatsSelectionViews))]
362 #[unsafe(method_family = none)]
363 pub fn floatsSelectionViews(&self) -> bool;
364
365 #[unsafe(method(setFloatsSelectionViews:))]
367 #[unsafe(method_family = none)]
368 pub fn setFloatsSelectionViews(&self, floats_selection_views: bool);
369
370 #[unsafe(method(selectionBackgroundStyle))]
373 #[unsafe(method_family = none)]
374 pub fn selectionBackgroundStyle(&self) -> Option<Retained<NSScrubberSelectionStyle>>;
375
376 #[unsafe(method(setSelectionBackgroundStyle:))]
378 #[unsafe(method_family = none)]
379 pub fn setSelectionBackgroundStyle(
380 &self,
381 selection_background_style: Option<&NSScrubberSelectionStyle>,
382 );
383
384 #[unsafe(method(selectionOverlayStyle))]
387 #[unsafe(method_family = none)]
388 pub fn selectionOverlayStyle(&self) -> Option<Retained<NSScrubberSelectionStyle>>;
389
390 #[unsafe(method(setSelectionOverlayStyle:))]
392 #[unsafe(method_family = none)]
393 pub fn setSelectionOverlayStyle(
394 &self,
395 selection_overlay_style: Option<&NSScrubberSelectionStyle>,
396 );
397
398 #[unsafe(method(showsArrowButtons))]
403 #[unsafe(method_family = none)]
404 pub fn showsArrowButtons(&self) -> bool;
405
406 #[unsafe(method(setShowsArrowButtons:))]
408 #[unsafe(method_family = none)]
409 pub fn setShowsArrowButtons(&self, shows_arrow_buttons: bool);
410
411 #[unsafe(method(showsAdditionalContentIndicators))]
416 #[unsafe(method_family = none)]
417 pub fn showsAdditionalContentIndicators(&self) -> bool;
418
419 #[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 #[unsafe(method(backgroundColor))]
433 #[unsafe(method_family = none)]
434 pub fn backgroundColor(&self) -> Option<Retained<NSColor>>;
435
436 #[cfg(feature = "NSColor")]
437 #[unsafe(method(setBackgroundColor:))]
441 #[unsafe(method_family = none)]
442 pub fn setBackgroundColor(&self, background_color: Option<&NSColor>);
443
444 #[unsafe(method(backgroundView))]
450 #[unsafe(method_family = none)]
451 pub fn backgroundView(&self) -> Option<Retained<NSView>>;
452
453 #[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 #[unsafe(method(initWithCoder:))]
466 #[unsafe(method_family = init)]
467 pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
468
469 #[unsafe(method(reloadData))]
471 #[unsafe(method_family = none)]
472 pub fn reloadData(&self);
473
474 #[cfg(feature = "block2")]
475 #[unsafe(method(performSequentialBatchUpdates:))]
481 #[unsafe(method_family = none)]
482 pub fn performSequentialBatchUpdates(&self, update_block: &block2::DynBlock<dyn Fn() + '_>);
483
484 #[unsafe(method(insertItemsAtIndexes:))]
488 #[unsafe(method_family = none)]
489 pub fn insertItemsAtIndexes(&self, indexes: &NSIndexSet);
490
491 #[unsafe(method(removeItemsAtIndexes:))]
494 #[unsafe(method_family = none)]
495 pub fn removeItemsAtIndexes(&self, indexes: &NSIndexSet);
496
497 #[unsafe(method(reloadItemsAtIndexes:))]
499 #[unsafe(method_family = none)]
500 pub fn reloadItemsAtIndexes(&self, indexes: &NSIndexSet);
501
502 #[unsafe(method(moveItemAtIndex:toIndex:))]
506 #[unsafe(method_family = none)]
507 pub fn moveItemAtIndex_toIndex(&self, old_index: NSInteger, new_index: NSInteger);
508
509 #[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 #[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 #[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 #[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 #[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#[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#[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}