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
146unsafe impl NSCoding for NSScrubberSelectionStyle {}
147
148unsafe impl NSObjectProtocol for NSScrubberSelectionStyle {}
149
150impl NSScrubberSelectionStyle {
151 extern_methods!(
152 #[unsafe(method(outlineOverlayStyle))]
153 #[unsafe(method_family = none)]
154 pub unsafe fn outlineOverlayStyle(
155 mtm: MainThreadMarker,
156 ) -> Retained<NSScrubberSelectionStyle>;
157
158 #[unsafe(method(roundedBackgroundStyle))]
159 #[unsafe(method_family = none)]
160 pub unsafe fn roundedBackgroundStyle(
161 mtm: MainThreadMarker,
162 ) -> Retained<NSScrubberSelectionStyle>;
163
164 #[unsafe(method(init))]
165 #[unsafe(method_family = init)]
166 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
167
168 #[unsafe(method(initWithCoder:))]
169 #[unsafe(method_family = init)]
170 pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
171
172 #[cfg(all(
173 feature = "NSResponder",
174 feature = "NSScrubberItemView",
175 feature = "NSView"
176 ))]
177 #[unsafe(method(makeSelectionView))]
178 #[unsafe(method_family = none)]
179 pub unsafe fn makeSelectionView(&self) -> Option<Retained<NSScrubberSelectionView>>;
180 );
181}
182
183impl NSScrubberSelectionStyle {
185 extern_methods!(
186 #[unsafe(method(new))]
187 #[unsafe(method_family = new)]
188 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
189 );
190}
191
192extern_class!(
193 #[unsafe(super(NSView, NSResponder, NSObject))]
206 #[derive(Debug, PartialEq, Eq, Hash)]
207 #[cfg(all(feature = "NSResponder", feature = "NSView"))]
208 pub struct NSScrubber;
209);
210
211#[cfg(all(
212 feature = "NSAccessibilityProtocols",
213 feature = "NSResponder",
214 feature = "NSView"
215))]
216unsafe impl NSAccessibility for NSScrubber {}
217
218#[cfg(all(
219 feature = "NSAccessibilityProtocols",
220 feature = "NSResponder",
221 feature = "NSView"
222))]
223unsafe impl NSAccessibilityElementProtocol for NSScrubber {}
224
225#[cfg(all(feature = "NSAnimation", feature = "NSResponder", feature = "NSView"))]
226unsafe impl NSAnimatablePropertyContainer for NSScrubber {}
227
228#[cfg(all(feature = "NSAppearance", feature = "NSResponder", feature = "NSView"))]
229unsafe impl NSAppearanceCustomization for NSScrubber {}
230
231#[cfg(all(feature = "NSResponder", feature = "NSView"))]
232unsafe impl NSCoding for NSScrubber {}
233
234#[cfg(all(feature = "NSDragging", feature = "NSResponder", feature = "NSView"))]
235unsafe impl NSDraggingDestination for NSScrubber {}
236
237#[cfg(all(feature = "NSResponder", feature = "NSView"))]
238unsafe impl NSObjectProtocol for NSScrubber {}
239
240#[cfg(all(
241 feature = "NSResponder",
242 feature = "NSUserInterfaceItemIdentification",
243 feature = "NSView"
244))]
245unsafe impl NSUserInterfaceItemIdentification for NSScrubber {}
246
247#[cfg(all(feature = "NSResponder", feature = "NSView"))]
248impl NSScrubber {
249 extern_methods!(
250 #[unsafe(method(dataSource))]
251 #[unsafe(method_family = none)]
252 pub unsafe fn dataSource(
253 &self,
254 ) -> Option<Retained<ProtocolObject<dyn NSScrubberDataSource>>>;
255
256 #[unsafe(method(setDataSource:))]
259 #[unsafe(method_family = none)]
260 pub unsafe fn setDataSource(
261 &self,
262 data_source: Option<&ProtocolObject<dyn NSScrubberDataSource>>,
263 );
264
265 #[unsafe(method(delegate))]
266 #[unsafe(method_family = none)]
267 pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSScrubberDelegate>>>;
268
269 #[unsafe(method(setDelegate:))]
272 #[unsafe(method_family = none)]
273 pub unsafe fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn NSScrubberDelegate>>);
274
275 #[cfg(feature = "NSScrubberLayout")]
276 #[unsafe(method(scrubberLayout))]
277 #[unsafe(method_family = none)]
278 pub unsafe fn scrubberLayout(&self) -> Retained<NSScrubberLayout>;
279
280 #[cfg(feature = "NSScrubberLayout")]
281 #[unsafe(method(setScrubberLayout:))]
283 #[unsafe(method_family = none)]
284 pub unsafe fn setScrubberLayout(&self, scrubber_layout: &NSScrubberLayout);
285
286 #[unsafe(method(numberOfItems))]
288 #[unsafe(method_family = none)]
289 pub unsafe fn numberOfItems(&self) -> NSInteger;
290
291 #[unsafe(method(highlightedIndex))]
293 #[unsafe(method_family = none)]
294 pub unsafe fn highlightedIndex(&self) -> NSInteger;
295
296 #[unsafe(method(selectedIndex))]
298 #[unsafe(method_family = none)]
299 pub unsafe fn selectedIndex(&self) -> NSInteger;
300
301 #[unsafe(method(setSelectedIndex:))]
303 #[unsafe(method_family = none)]
304 pub unsafe fn setSelectedIndex(&self, selected_index: NSInteger);
305
306 #[unsafe(method(mode))]
310 #[unsafe(method_family = none)]
311 pub unsafe fn mode(&self) -> NSScrubberMode;
312
313 #[unsafe(method(setMode:))]
315 #[unsafe(method_family = none)]
316 pub unsafe fn setMode(&self, mode: NSScrubberMode);
317
318 #[unsafe(method(itemAlignment))]
323 #[unsafe(method_family = none)]
324 pub unsafe fn itemAlignment(&self) -> NSScrubberAlignment;
325
326 #[unsafe(method(setItemAlignment:))]
328 #[unsafe(method_family = none)]
329 pub unsafe fn setItemAlignment(&self, item_alignment: NSScrubberAlignment);
330
331 #[unsafe(method(isContinuous))]
339 #[unsafe(method_family = none)]
340 pub unsafe fn isContinuous(&self) -> bool;
341
342 #[unsafe(method(setContinuous:))]
344 #[unsafe(method_family = none)]
345 pub unsafe fn setContinuous(&self, continuous: bool);
346
347 #[unsafe(method(floatsSelectionViews))]
354 #[unsafe(method_family = none)]
355 pub unsafe fn floatsSelectionViews(&self) -> bool;
356
357 #[unsafe(method(setFloatsSelectionViews:))]
359 #[unsafe(method_family = none)]
360 pub unsafe fn setFloatsSelectionViews(&self, floats_selection_views: bool);
361
362 #[unsafe(method(selectionBackgroundStyle))]
365 #[unsafe(method_family = none)]
366 pub unsafe fn selectionBackgroundStyle(&self)
367 -> Option<Retained<NSScrubberSelectionStyle>>;
368
369 #[unsafe(method(setSelectionBackgroundStyle:))]
371 #[unsafe(method_family = none)]
372 pub unsafe fn setSelectionBackgroundStyle(
373 &self,
374 selection_background_style: Option<&NSScrubberSelectionStyle>,
375 );
376
377 #[unsafe(method(selectionOverlayStyle))]
380 #[unsafe(method_family = none)]
381 pub unsafe fn selectionOverlayStyle(&self) -> Option<Retained<NSScrubberSelectionStyle>>;
382
383 #[unsafe(method(setSelectionOverlayStyle:))]
385 #[unsafe(method_family = none)]
386 pub unsafe fn setSelectionOverlayStyle(
387 &self,
388 selection_overlay_style: Option<&NSScrubberSelectionStyle>,
389 );
390
391 #[unsafe(method(showsArrowButtons))]
396 #[unsafe(method_family = none)]
397 pub unsafe fn showsArrowButtons(&self) -> bool;
398
399 #[unsafe(method(setShowsArrowButtons:))]
401 #[unsafe(method_family = none)]
402 pub unsafe fn setShowsArrowButtons(&self, shows_arrow_buttons: bool);
403
404 #[unsafe(method(showsAdditionalContentIndicators))]
409 #[unsafe(method_family = none)]
410 pub unsafe fn showsAdditionalContentIndicators(&self) -> bool;
411
412 #[unsafe(method(setShowsAdditionalContentIndicators:))]
414 #[unsafe(method_family = none)]
415 pub unsafe fn setShowsAdditionalContentIndicators(
416 &self,
417 shows_additional_content_indicators: bool,
418 );
419
420 #[cfg(feature = "NSColor")]
421 #[unsafe(method(backgroundColor))]
426 #[unsafe(method_family = none)]
427 pub unsafe fn backgroundColor(&self) -> Option<Retained<NSColor>>;
428
429 #[cfg(feature = "NSColor")]
430 #[unsafe(method(setBackgroundColor:))]
432 #[unsafe(method_family = none)]
433 pub unsafe fn setBackgroundColor(&self, background_color: Option<&NSColor>);
434
435 #[unsafe(method(backgroundView))]
441 #[unsafe(method_family = none)]
442 pub unsafe fn backgroundView(&self) -> Option<Retained<NSView>>;
443
444 #[unsafe(method(setBackgroundView:))]
446 #[unsafe(method_family = none)]
447 pub unsafe fn setBackgroundView(&self, background_view: Option<&NSView>);
448
449 #[unsafe(method(initWithFrame:))]
450 #[unsafe(method_family = init)]
451 pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
452
453 #[unsafe(method(initWithCoder:))]
454 #[unsafe(method_family = init)]
455 pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
456
457 #[unsafe(method(reloadData))]
459 #[unsafe(method_family = none)]
460 pub unsafe fn reloadData(&self);
461
462 #[cfg(feature = "block2")]
463 #[unsafe(method(performSequentialBatchUpdates:))]
469 #[unsafe(method_family = none)]
470 pub unsafe fn performSequentialBatchUpdates(
471 &self,
472 update_block: &block2::Block<dyn Fn() + '_>,
473 );
474
475 #[unsafe(method(insertItemsAtIndexes:))]
479 #[unsafe(method_family = none)]
480 pub unsafe fn insertItemsAtIndexes(&self, indexes: &NSIndexSet);
481
482 #[unsafe(method(removeItemsAtIndexes:))]
485 #[unsafe(method_family = none)]
486 pub unsafe fn removeItemsAtIndexes(&self, indexes: &NSIndexSet);
487
488 #[unsafe(method(reloadItemsAtIndexes:))]
490 #[unsafe(method_family = none)]
491 pub unsafe fn reloadItemsAtIndexes(&self, indexes: &NSIndexSet);
492
493 #[unsafe(method(moveItemAtIndex:toIndex:))]
497 #[unsafe(method_family = none)]
498 pub unsafe fn moveItemAtIndex_toIndex(&self, old_index: NSInteger, new_index: NSInteger);
499
500 #[unsafe(method(scrollItemAtIndex:toAlignment:))]
503 #[unsafe(method_family = none)]
504 pub unsafe fn scrollItemAtIndex_toAlignment(
505 &self,
506 index: NSInteger,
507 alignment: NSScrubberAlignment,
508 );
509
510 #[cfg(feature = "NSScrubberItemView")]
511 #[unsafe(method(itemViewForItemAtIndex:))]
515 #[unsafe(method_family = none)]
516 pub unsafe fn itemViewForItemAtIndex(
517 &self,
518 index: NSInteger,
519 ) -> Option<Retained<NSScrubberItemView>>;
520
521 #[cfg(feature = "NSUserInterfaceItemIdentification")]
522 #[unsafe(method(registerClass:forItemIdentifier:))]
530 #[unsafe(method_family = none)]
531 pub unsafe fn registerClass_forItemIdentifier(
532 &self,
533 item_view_class: Option<&AnyClass>,
534 item_identifier: &NSUserInterfaceItemIdentifier,
535 );
536
537 #[cfg(all(feature = "NSNib", feature = "NSUserInterfaceItemIdentification"))]
538 #[unsafe(method(registerNib:forItemIdentifier:))]
545 #[unsafe(method_family = none)]
546 pub unsafe fn registerNib_forItemIdentifier(
547 &self,
548 nib: Option<&NSNib>,
549 item_identifier: &NSUserInterfaceItemIdentifier,
550 );
551
552 #[cfg(all(
553 feature = "NSScrubberItemView",
554 feature = "NSUserInterfaceItemIdentification"
555 ))]
556 #[unsafe(method(makeItemWithIdentifier:owner:))]
562 #[unsafe(method_family = none)]
563 pub unsafe fn makeItemWithIdentifier_owner(
564 &self,
565 item_identifier: &NSUserInterfaceItemIdentifier,
566 owner: Option<&AnyObject>,
567 ) -> Option<Retained<NSScrubberItemView>>;
568 );
569}
570
571#[cfg(all(feature = "NSResponder", feature = "NSView"))]
573impl NSScrubber {
574 extern_methods!(
575 #[unsafe(method(init))]
576 #[unsafe(method_family = init)]
577 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
578 );
579}
580
581#[cfg(all(feature = "NSResponder", feature = "NSView"))]
583impl NSScrubber {
584 extern_methods!(
585 #[unsafe(method(new))]
586 #[unsafe(method_family = new)]
587 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
588 );
589}