objc2_ui_kit/generated/
UIScrollView.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::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9#[cfg(feature = "objc2-quartz-core")]
10#[cfg(not(target_os = "watchos"))]
11use objc2_quartz_core::*;
12
13use crate::*;
14
15/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiscrollviewindicatorstyle?language=objc)
16// NS_ENUM
17#[repr(transparent)]
18#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
19pub struct UIScrollViewIndicatorStyle(pub NSInteger);
20impl UIScrollViewIndicatorStyle {
21    #[doc(alias = "UIScrollViewIndicatorStyleDefault")]
22    pub const Default: Self = Self(0);
23    #[doc(alias = "UIScrollViewIndicatorStyleBlack")]
24    pub const Black: Self = Self(1);
25    #[doc(alias = "UIScrollViewIndicatorStyleWhite")]
26    pub const White: Self = Self(2);
27}
28
29unsafe impl Encode for UIScrollViewIndicatorStyle {
30    const ENCODING: Encoding = NSInteger::ENCODING;
31}
32
33unsafe impl RefEncode for UIScrollViewIndicatorStyle {
34    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
35}
36
37/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiscrollviewkeyboarddismissmode?language=objc)
38// NS_ENUM
39#[repr(transparent)]
40#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
41pub struct UIScrollViewKeyboardDismissMode(pub NSInteger);
42impl UIScrollViewKeyboardDismissMode {
43    #[doc(alias = "UIScrollViewKeyboardDismissModeNone")]
44    pub const None: Self = Self(0);
45    #[doc(alias = "UIScrollViewKeyboardDismissModeOnDrag")]
46    pub const OnDrag: Self = Self(1);
47    #[doc(alias = "UIScrollViewKeyboardDismissModeInteractive")]
48    pub const Interactive: Self = Self(2);
49    #[doc(alias = "UIScrollViewKeyboardDismissModeOnDragWithAccessory")]
50    pub const OnDragWithAccessory: Self = Self(3);
51    #[doc(alias = "UIScrollViewKeyboardDismissModeInteractiveWithAccessory")]
52    pub const InteractiveWithAccessory: Self = Self(4);
53}
54
55unsafe impl Encode for UIScrollViewKeyboardDismissMode {
56    const ENCODING: Encoding = NSInteger::ENCODING;
57}
58
59unsafe impl RefEncode for UIScrollViewKeyboardDismissMode {
60    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
61}
62
63/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiscrollviewindexdisplaymode?language=objc)
64// NS_ENUM
65#[repr(transparent)]
66#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
67pub struct UIScrollViewIndexDisplayMode(pub NSInteger);
68impl UIScrollViewIndexDisplayMode {
69    #[doc(alias = "UIScrollViewIndexDisplayModeAutomatic")]
70    pub const Automatic: Self = Self(0);
71    #[doc(alias = "UIScrollViewIndexDisplayModeAlwaysHidden")]
72    pub const AlwaysHidden: Self = Self(1);
73}
74
75unsafe impl Encode for UIScrollViewIndexDisplayMode {
76    const ENCODING: Encoding = NSInteger::ENCODING;
77}
78
79unsafe impl RefEncode for UIScrollViewIndexDisplayMode {
80    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
81}
82
83/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiscrollviewcontentinsetadjustmentbehavior?language=objc)
84// NS_ENUM
85#[repr(transparent)]
86#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
87pub struct UIScrollViewContentInsetAdjustmentBehavior(pub NSInteger);
88impl UIScrollViewContentInsetAdjustmentBehavior {
89    #[doc(alias = "UIScrollViewContentInsetAdjustmentAutomatic")]
90    pub const Automatic: Self = Self(0);
91    #[doc(alias = "UIScrollViewContentInsetAdjustmentScrollableAxes")]
92    pub const ScrollableAxes: Self = Self(1);
93    #[doc(alias = "UIScrollViewContentInsetAdjustmentNever")]
94    pub const Never: Self = Self(2);
95    #[doc(alias = "UIScrollViewContentInsetAdjustmentAlways")]
96    pub const Always: Self = Self(3);
97}
98
99unsafe impl Encode for UIScrollViewContentInsetAdjustmentBehavior {
100    const ENCODING: Encoding = NSInteger::ENCODING;
101}
102
103unsafe impl RefEncode for UIScrollViewContentInsetAdjustmentBehavior {
104    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
105}
106
107/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiscrollviewdecelerationrate?language=objc)
108// NS_TYPED_ENUM
109#[cfg(feature = "objc2-core-foundation")]
110pub type UIScrollViewDecelerationRate = CGFloat;
111
112extern "C" {
113    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiscrollviewdecelerationratenormal?language=objc)
114    #[cfg(feature = "objc2-core-foundation")]
115    pub static UIScrollViewDecelerationRateNormal: UIScrollViewDecelerationRate;
116}
117
118extern "C" {
119    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiscrollviewdecelerationratefast?language=objc)
120    #[cfg(feature = "objc2-core-foundation")]
121    pub static UIScrollViewDecelerationRateFast: UIScrollViewDecelerationRate;
122}
123
124extern_class!(
125    /// Styles for a scroll view's edge effect.
126    ///
127    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uiscrolledgeeffectstyle?language=objc)
128    #[unsafe(super(NSObject))]
129    #[thread_kind = MainThreadOnly]
130    #[derive(Debug, PartialEq, Eq, Hash)]
131    pub struct UIScrollEdgeEffectStyle;
132);
133
134extern_conformance!(
135    unsafe impl NSObjectProtocol for UIScrollEdgeEffectStyle {}
136);
137
138impl UIScrollEdgeEffectStyle {
139    extern_methods!(
140        #[unsafe(method(init))]
141        #[unsafe(method_family = init)]
142        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
143
144        #[unsafe(method(new))]
145        #[unsafe(method_family = new)]
146        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
147
148        /// The automatic scroll edge effect style.
149        #[unsafe(method(automaticStyle))]
150        #[unsafe(method_family = none)]
151        pub fn automaticStyle(mtm: MainThreadMarker) -> Retained<UIScrollEdgeEffectStyle>;
152
153        /// A soft-edged scroll edge effect.
154        #[unsafe(method(softStyle))]
155        #[unsafe(method_family = none)]
156        pub fn softStyle(mtm: MainThreadMarker) -> Retained<UIScrollEdgeEffectStyle>;
157
158        /// A scroll edge effect with a hard cutoff and dividing line.
159        #[unsafe(method(hardStyle))]
160        #[unsafe(method_family = none)]
161        pub fn hardStyle(mtm: MainThreadMarker) -> Retained<UIScrollEdgeEffectStyle>;
162    );
163}
164
165extern_class!(
166    /// Properties of the effect on a particular edge of the scroll view.
167    ///
168    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uiscrolledgeeffect?language=objc)
169    #[unsafe(super(NSObject))]
170    #[thread_kind = MainThreadOnly]
171    #[derive(Debug, PartialEq, Eq, Hash)]
172    pub struct UIScrollEdgeEffect;
173);
174
175extern_conformance!(
176    unsafe impl NSObjectProtocol for UIScrollEdgeEffect {}
177);
178
179impl UIScrollEdgeEffect {
180    extern_methods!(
181        #[unsafe(method(init))]
182        #[unsafe(method_family = init)]
183        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
184
185        #[unsafe(method(new))]
186        #[unsafe(method_family = new)]
187        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
188
189        /// The style of this edge effect.
190        #[unsafe(method(style))]
191        #[unsafe(method_family = none)]
192        pub fn style(&self) -> Retained<UIScrollEdgeEffectStyle>;
193
194        /// Setter for [`style`][Self::style].
195        #[unsafe(method(setStyle:))]
196        #[unsafe(method_family = none)]
197        pub fn setStyle(&self, style: &UIScrollEdgeEffectStyle);
198
199        /// Whether this edge effect is hidden.
200        /// Default: false
201        #[unsafe(method(isHidden))]
202        #[unsafe(method_family = none)]
203        pub fn isHidden(&self) -> bool;
204
205        /// Setter for [`isHidden`][Self::isHidden].
206        #[unsafe(method(setHidden:))]
207        #[unsafe(method_family = none)]
208        pub fn setHidden(&self, hidden: bool);
209    );
210}
211
212extern_class!(
213    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiscrollview?language=objc)
214    #[unsafe(super(UIView, UIResponder, NSObject))]
215    #[thread_kind = MainThreadOnly]
216    #[derive(Debug, PartialEq, Eq, Hash)]
217    #[cfg(all(feature = "UIResponder", feature = "UIView"))]
218    pub struct UIScrollView;
219);
220
221#[cfg(all(
222    feature = "UIResponder",
223    feature = "UIView",
224    feature = "objc2-quartz-core"
225))]
226#[cfg(not(target_os = "watchos"))]
227extern_conformance!(
228    unsafe impl CALayerDelegate for UIScrollView {}
229);
230
231#[cfg(all(feature = "UIResponder", feature = "UIView"))]
232extern_conformance!(
233    unsafe impl NSCoding for UIScrollView {}
234);
235
236#[cfg(all(feature = "UIResponder", feature = "UIView"))]
237extern_conformance!(
238    unsafe impl NSObjectProtocol for UIScrollView {}
239);
240
241#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
242extern_conformance!(
243    unsafe impl UIAppearance for UIScrollView {}
244);
245
246#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
247extern_conformance!(
248    unsafe impl UIAppearanceContainer for UIScrollView {}
249);
250
251#[cfg(all(feature = "UIResponder", feature = "UIView"))]
252extern_conformance!(
253    unsafe impl UICoordinateSpace for UIScrollView {}
254);
255
256#[cfg(all(
257    feature = "UIDynamicBehavior",
258    feature = "UIResponder",
259    feature = "UIView"
260))]
261extern_conformance!(
262    unsafe impl UIDynamicItem for UIScrollView {}
263);
264
265#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
266extern_conformance!(
267    unsafe impl UIFocusEnvironment for UIScrollView {}
268);
269
270#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
271extern_conformance!(
272    unsafe impl UIFocusItem for UIScrollView {}
273);
274
275#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
276extern_conformance!(
277    unsafe impl UIFocusItemContainer for UIScrollView {}
278);
279
280#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
281extern_conformance!(
282    unsafe impl UIFocusItemScrollableContainer for UIScrollView {}
283);
284
285#[cfg(all(feature = "UIResponder", feature = "UIView"))]
286extern_conformance!(
287    unsafe impl UIResponderStandardEditActions for UIScrollView {}
288);
289
290#[cfg(all(
291    feature = "UIResponder",
292    feature = "UITraitCollection",
293    feature = "UIView"
294))]
295extern_conformance!(
296    unsafe impl UITraitEnvironment for UIScrollView {}
297);
298
299#[cfg(all(feature = "UIResponder", feature = "UIView"))]
300impl UIScrollView {
301    extern_methods!(
302        #[cfg(feature = "objc2-core-foundation")]
303        #[unsafe(method(contentOffset))]
304        #[unsafe(method_family = none)]
305        pub fn contentOffset(&self) -> CGPoint;
306
307        #[cfg(feature = "objc2-core-foundation")]
308        /// Setter for [`contentOffset`][Self::contentOffset].
309        #[unsafe(method(setContentOffset:))]
310        #[unsafe(method_family = none)]
311        pub fn setContentOffset(&self, content_offset: CGPoint);
312
313        #[cfg(feature = "objc2-core-foundation")]
314        #[unsafe(method(contentSize))]
315        #[unsafe(method_family = none)]
316        pub fn contentSize(&self) -> CGSize;
317
318        #[cfg(feature = "objc2-core-foundation")]
319        /// Setter for [`contentSize`][Self::contentSize].
320        #[unsafe(method(setContentSize:))]
321        #[unsafe(method_family = none)]
322        pub fn setContentSize(&self, content_size: CGSize);
323
324        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
325        #[unsafe(method(contentInset))]
326        #[unsafe(method_family = none)]
327        pub fn contentInset(&self) -> UIEdgeInsets;
328
329        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
330        /// Setter for [`contentInset`][Self::contentInset].
331        #[unsafe(method(setContentInset:))]
332        #[unsafe(method_family = none)]
333        pub fn setContentInset(&self, content_inset: UIEdgeInsets);
334
335        #[cfg(feature = "objc2-core-foundation")]
336        #[unsafe(method(contentAlignmentPoint))]
337        #[unsafe(method_family = none)]
338        pub fn contentAlignmentPoint(&self) -> CGPoint;
339
340        #[cfg(feature = "objc2-core-foundation")]
341        /// Setter for [`contentAlignmentPoint`][Self::contentAlignmentPoint].
342        #[unsafe(method(setContentAlignmentPoint:))]
343        #[unsafe(method_family = none)]
344        pub fn setContentAlignmentPoint(&self, content_alignment_point: CGPoint);
345
346        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
347        #[unsafe(method(adjustedContentInset))]
348        #[unsafe(method_family = none)]
349        pub fn adjustedContentInset(&self) -> UIEdgeInsets;
350
351        #[unsafe(method(adjustedContentInsetDidChange))]
352        #[unsafe(method_family = none)]
353        pub fn adjustedContentInsetDidChange(&self);
354
355        #[unsafe(method(contentInsetAdjustmentBehavior))]
356        #[unsafe(method_family = none)]
357        pub fn contentInsetAdjustmentBehavior(&self) -> UIScrollViewContentInsetAdjustmentBehavior;
358
359        /// Setter for [`contentInsetAdjustmentBehavior`][Self::contentInsetAdjustmentBehavior].
360        #[unsafe(method(setContentInsetAdjustmentBehavior:))]
361        #[unsafe(method_family = none)]
362        pub fn setContentInsetAdjustmentBehavior(
363            &self,
364            content_inset_adjustment_behavior: UIScrollViewContentInsetAdjustmentBehavior,
365        );
366
367        #[unsafe(method(automaticallyAdjustsScrollIndicatorInsets))]
368        #[unsafe(method_family = none)]
369        pub fn automaticallyAdjustsScrollIndicatorInsets(&self) -> bool;
370
371        /// Setter for [`automaticallyAdjustsScrollIndicatorInsets`][Self::automaticallyAdjustsScrollIndicatorInsets].
372        #[unsafe(method(setAutomaticallyAdjustsScrollIndicatorInsets:))]
373        #[unsafe(method_family = none)]
374        pub fn setAutomaticallyAdjustsScrollIndicatorInsets(
375            &self,
376            automatically_adjusts_scroll_indicator_insets: bool,
377        );
378
379        #[cfg(feature = "UILayoutGuide")]
380        #[unsafe(method(contentLayoutGuide))]
381        #[unsafe(method_family = none)]
382        pub fn contentLayoutGuide(&self) -> Retained<UILayoutGuide>;
383
384        #[cfg(feature = "UILayoutGuide")]
385        #[unsafe(method(frameLayoutGuide))]
386        #[unsafe(method_family = none)]
387        pub fn frameLayoutGuide(&self) -> Retained<UILayoutGuide>;
388
389        #[unsafe(method(delegate))]
390        #[unsafe(method_family = none)]
391        pub fn delegate(&self) -> Option<Retained<ProtocolObject<dyn UIScrollViewDelegate>>>;
392
393        /// Setter for [`delegate`][Self::delegate].
394        ///
395        /// This is a [weak property][objc2::topics::weak_property].
396        #[unsafe(method(setDelegate:))]
397        #[unsafe(method_family = none)]
398        pub unsafe fn setDelegate(
399            &self,
400            delegate: Option<&ProtocolObject<dyn UIScrollViewDelegate>>,
401        );
402
403        #[unsafe(method(isDirectionalLockEnabled))]
404        #[unsafe(method_family = none)]
405        pub fn isDirectionalLockEnabled(&self) -> bool;
406
407        /// Setter for [`isDirectionalLockEnabled`][Self::isDirectionalLockEnabled].
408        #[unsafe(method(setDirectionalLockEnabled:))]
409        #[unsafe(method_family = none)]
410        pub fn setDirectionalLockEnabled(&self, directional_lock_enabled: bool);
411
412        #[unsafe(method(bounces))]
413        #[unsafe(method_family = none)]
414        pub fn bounces(&self) -> bool;
415
416        /// Setter for [`bounces`][Self::bounces].
417        #[unsafe(method(setBounces:))]
418        #[unsafe(method_family = none)]
419        pub fn setBounces(&self, bounces: bool);
420
421        #[unsafe(method(bouncesHorizontally))]
422        #[unsafe(method_family = none)]
423        pub fn bouncesHorizontally(&self) -> bool;
424
425        /// Setter for [`bouncesHorizontally`][Self::bouncesHorizontally].
426        #[unsafe(method(setBouncesHorizontally:))]
427        #[unsafe(method_family = none)]
428        pub fn setBouncesHorizontally(&self, bounces_horizontally: bool);
429
430        #[unsafe(method(bouncesVertically))]
431        #[unsafe(method_family = none)]
432        pub fn bouncesVertically(&self) -> bool;
433
434        /// Setter for [`bouncesVertically`][Self::bouncesVertically].
435        #[unsafe(method(setBouncesVertically:))]
436        #[unsafe(method_family = none)]
437        pub fn setBouncesVertically(&self, bounces_vertically: bool);
438
439        #[unsafe(method(alwaysBounceVertical))]
440        #[unsafe(method_family = none)]
441        pub fn alwaysBounceVertical(&self) -> bool;
442
443        /// Setter for [`alwaysBounceVertical`][Self::alwaysBounceVertical].
444        #[unsafe(method(setAlwaysBounceVertical:))]
445        #[unsafe(method_family = none)]
446        pub fn setAlwaysBounceVertical(&self, always_bounce_vertical: bool);
447
448        #[unsafe(method(alwaysBounceHorizontal))]
449        #[unsafe(method_family = none)]
450        pub fn alwaysBounceHorizontal(&self) -> bool;
451
452        /// Setter for [`alwaysBounceHorizontal`][Self::alwaysBounceHorizontal].
453        #[unsafe(method(setAlwaysBounceHorizontal:))]
454        #[unsafe(method_family = none)]
455        pub fn setAlwaysBounceHorizontal(&self, always_bounce_horizontal: bool);
456
457        #[unsafe(method(isPagingEnabled))]
458        #[unsafe(method_family = none)]
459        pub fn isPagingEnabled(&self) -> bool;
460
461        /// Setter for [`isPagingEnabled`][Self::isPagingEnabled].
462        #[unsafe(method(setPagingEnabled:))]
463        #[unsafe(method_family = none)]
464        pub fn setPagingEnabled(&self, paging_enabled: bool);
465
466        #[unsafe(method(isScrollEnabled))]
467        #[unsafe(method_family = none)]
468        pub fn isScrollEnabled(&self) -> bool;
469
470        /// Setter for [`isScrollEnabled`][Self::isScrollEnabled].
471        #[unsafe(method(setScrollEnabled:))]
472        #[unsafe(method_family = none)]
473        pub fn setScrollEnabled(&self, scroll_enabled: bool);
474
475        #[unsafe(method(transfersHorizontalScrollingToParent))]
476        #[unsafe(method_family = none)]
477        pub fn transfersHorizontalScrollingToParent(&self) -> bool;
478
479        /// Setter for [`transfersHorizontalScrollingToParent`][Self::transfersHorizontalScrollingToParent].
480        #[unsafe(method(setTransfersHorizontalScrollingToParent:))]
481        #[unsafe(method_family = none)]
482        pub fn setTransfersHorizontalScrollingToParent(
483            &self,
484            transfers_horizontal_scrolling_to_parent: bool,
485        );
486
487        #[unsafe(method(transfersVerticalScrollingToParent))]
488        #[unsafe(method_family = none)]
489        pub fn transfersVerticalScrollingToParent(&self) -> bool;
490
491        /// Setter for [`transfersVerticalScrollingToParent`][Self::transfersVerticalScrollingToParent].
492        #[unsafe(method(setTransfersVerticalScrollingToParent:))]
493        #[unsafe(method_family = none)]
494        pub fn setTransfersVerticalScrollingToParent(
495            &self,
496            transfers_vertical_scrolling_to_parent: bool,
497        );
498
499        #[unsafe(method(showsVerticalScrollIndicator))]
500        #[unsafe(method_family = none)]
501        pub fn showsVerticalScrollIndicator(&self) -> bool;
502
503        /// Setter for [`showsVerticalScrollIndicator`][Self::showsVerticalScrollIndicator].
504        #[unsafe(method(setShowsVerticalScrollIndicator:))]
505        #[unsafe(method_family = none)]
506        pub fn setShowsVerticalScrollIndicator(&self, shows_vertical_scroll_indicator: bool);
507
508        #[unsafe(method(showsHorizontalScrollIndicator))]
509        #[unsafe(method_family = none)]
510        pub fn showsHorizontalScrollIndicator(&self) -> bool;
511
512        /// Setter for [`showsHorizontalScrollIndicator`][Self::showsHorizontalScrollIndicator].
513        #[unsafe(method(setShowsHorizontalScrollIndicator:))]
514        #[unsafe(method_family = none)]
515        pub fn setShowsHorizontalScrollIndicator(&self, shows_horizontal_scroll_indicator: bool);
516
517        #[unsafe(method(indicatorStyle))]
518        #[unsafe(method_family = none)]
519        pub fn indicatorStyle(&self) -> UIScrollViewIndicatorStyle;
520
521        /// Setter for [`indicatorStyle`][Self::indicatorStyle].
522        #[unsafe(method(setIndicatorStyle:))]
523        #[unsafe(method_family = none)]
524        pub fn setIndicatorStyle(&self, indicator_style: UIScrollViewIndicatorStyle);
525
526        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
527        #[unsafe(method(verticalScrollIndicatorInsets))]
528        #[unsafe(method_family = none)]
529        pub fn verticalScrollIndicatorInsets(&self) -> UIEdgeInsets;
530
531        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
532        /// Setter for [`verticalScrollIndicatorInsets`][Self::verticalScrollIndicatorInsets].
533        #[unsafe(method(setVerticalScrollIndicatorInsets:))]
534        #[unsafe(method_family = none)]
535        pub fn setVerticalScrollIndicatorInsets(
536            &self,
537            vertical_scroll_indicator_insets: UIEdgeInsets,
538        );
539
540        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
541        #[unsafe(method(horizontalScrollIndicatorInsets))]
542        #[unsafe(method_family = none)]
543        pub fn horizontalScrollIndicatorInsets(&self) -> UIEdgeInsets;
544
545        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
546        /// Setter for [`horizontalScrollIndicatorInsets`][Self::horizontalScrollIndicatorInsets].
547        #[unsafe(method(setHorizontalScrollIndicatorInsets:))]
548        #[unsafe(method_family = none)]
549        pub fn setHorizontalScrollIndicatorInsets(
550            &self,
551            horizontal_scroll_indicator_insets: UIEdgeInsets,
552        );
553
554        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
555        #[unsafe(method(scrollIndicatorInsets))]
556        #[unsafe(method_family = none)]
557        pub fn scrollIndicatorInsets(&self) -> UIEdgeInsets;
558
559        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
560        /// Setter for [`scrollIndicatorInsets`][Self::scrollIndicatorInsets].
561        #[unsafe(method(setScrollIndicatorInsets:))]
562        #[unsafe(method_family = none)]
563        pub fn setScrollIndicatorInsets(&self, scroll_indicator_insets: UIEdgeInsets);
564
565        #[cfg(feature = "objc2-core-foundation")]
566        #[unsafe(method(decelerationRate))]
567        #[unsafe(method_family = none)]
568        pub fn decelerationRate(&self) -> UIScrollViewDecelerationRate;
569
570        #[cfg(feature = "objc2-core-foundation")]
571        /// Setter for [`decelerationRate`][Self::decelerationRate].
572        #[unsafe(method(setDecelerationRate:))]
573        #[unsafe(method_family = none)]
574        pub fn setDecelerationRate(&self, deceleration_rate: UIScrollViewDecelerationRate);
575
576        #[unsafe(method(indexDisplayMode))]
577        #[unsafe(method_family = none)]
578        pub fn indexDisplayMode(&self) -> UIScrollViewIndexDisplayMode;
579
580        /// Setter for [`indexDisplayMode`][Self::indexDisplayMode].
581        #[unsafe(method(setIndexDisplayMode:))]
582        #[unsafe(method_family = none)]
583        pub fn setIndexDisplayMode(&self, index_display_mode: UIScrollViewIndexDisplayMode);
584
585        #[cfg(feature = "objc2-core-foundation")]
586        #[unsafe(method(setContentOffset:animated:))]
587        #[unsafe(method_family = none)]
588        pub fn setContentOffset_animated(&self, content_offset: CGPoint, animated: bool);
589
590        #[cfg(feature = "objc2-core-foundation")]
591        #[unsafe(method(scrollRectToVisible:animated:))]
592        #[unsafe(method_family = none)]
593        pub fn scrollRectToVisible_animated(&self, rect: CGRect, animated: bool);
594
595        #[unsafe(method(flashScrollIndicators))]
596        #[unsafe(method_family = none)]
597        pub fn flashScrollIndicators(&self);
598
599        #[cfg(feature = "block2")]
600        #[unsafe(method(withScrollIndicatorsShownForContentOffsetChanges:))]
601        #[unsafe(method_family = none)]
602        pub fn withScrollIndicatorsShownForContentOffsetChanges(
603            &self,
604            changes: &block2::DynBlock<dyn Fn() + '_>,
605        );
606
607        /// The effect for the top edge of the scroll view.
608        #[unsafe(method(topEdgeEffect))]
609        #[unsafe(method_family = none)]
610        pub fn topEdgeEffect(&self) -> Retained<UIScrollEdgeEffect>;
611
612        /// The effect for the left edge of the scroll view.
613        #[unsafe(method(leftEdgeEffect))]
614        #[unsafe(method_family = none)]
615        pub fn leftEdgeEffect(&self) -> Retained<UIScrollEdgeEffect>;
616
617        /// The effect for the bottom edge of the scroll view.
618        #[unsafe(method(bottomEdgeEffect))]
619        #[unsafe(method_family = none)]
620        pub fn bottomEdgeEffect(&self) -> Retained<UIScrollEdgeEffect>;
621
622        /// The effect for the right edge of the scroll view.
623        #[unsafe(method(rightEdgeEffect))]
624        #[unsafe(method_family = none)]
625        pub fn rightEdgeEffect(&self) -> Retained<UIScrollEdgeEffect>;
626
627        #[unsafe(method(isTracking))]
628        #[unsafe(method_family = none)]
629        pub fn isTracking(&self) -> bool;
630
631        #[unsafe(method(isDragging))]
632        #[unsafe(method_family = none)]
633        pub fn isDragging(&self) -> bool;
634
635        #[unsafe(method(isDecelerating))]
636        #[unsafe(method_family = none)]
637        pub fn isDecelerating(&self) -> bool;
638
639        #[unsafe(method(isScrollAnimating))]
640        #[unsafe(method_family = none)]
641        pub fn isScrollAnimating(&self) -> bool;
642
643        #[unsafe(method(delaysContentTouches))]
644        #[unsafe(method_family = none)]
645        pub fn delaysContentTouches(&self) -> bool;
646
647        /// Setter for [`delaysContentTouches`][Self::delaysContentTouches].
648        #[unsafe(method(setDelaysContentTouches:))]
649        #[unsafe(method_family = none)]
650        pub fn setDelaysContentTouches(&self, delays_content_touches: bool);
651
652        #[unsafe(method(canCancelContentTouches))]
653        #[unsafe(method_family = none)]
654        pub fn canCancelContentTouches(&self) -> bool;
655
656        /// Setter for [`canCancelContentTouches`][Self::canCancelContentTouches].
657        #[unsafe(method(setCanCancelContentTouches:))]
658        #[unsafe(method_family = none)]
659        pub fn setCanCancelContentTouches(&self, can_cancel_content_touches: bool);
660
661        #[cfg(all(feature = "UIEvent", feature = "UITouch"))]
662        #[unsafe(method(touchesShouldBegin:withEvent:inContentView:))]
663        #[unsafe(method_family = none)]
664        pub fn touchesShouldBegin_withEvent_inContentView(
665            &self,
666            touches: &NSSet<UITouch>,
667            event: Option<&UIEvent>,
668            view: &UIView,
669        ) -> bool;
670
671        #[unsafe(method(touchesShouldCancelInContentView:))]
672        #[unsafe(method_family = none)]
673        pub fn touchesShouldCancelInContentView(&self, view: &UIView) -> bool;
674
675        #[cfg(feature = "objc2-core-foundation")]
676        #[unsafe(method(minimumZoomScale))]
677        #[unsafe(method_family = none)]
678        pub fn minimumZoomScale(&self) -> CGFloat;
679
680        #[cfg(feature = "objc2-core-foundation")]
681        /// Setter for [`minimumZoomScale`][Self::minimumZoomScale].
682        #[unsafe(method(setMinimumZoomScale:))]
683        #[unsafe(method_family = none)]
684        pub fn setMinimumZoomScale(&self, minimum_zoom_scale: CGFloat);
685
686        #[cfg(feature = "objc2-core-foundation")]
687        #[unsafe(method(maximumZoomScale))]
688        #[unsafe(method_family = none)]
689        pub fn maximumZoomScale(&self) -> CGFloat;
690
691        #[cfg(feature = "objc2-core-foundation")]
692        /// Setter for [`maximumZoomScale`][Self::maximumZoomScale].
693        #[unsafe(method(setMaximumZoomScale:))]
694        #[unsafe(method_family = none)]
695        pub fn setMaximumZoomScale(&self, maximum_zoom_scale: CGFloat);
696
697        #[cfg(feature = "objc2-core-foundation")]
698        #[unsafe(method(zoomScale))]
699        #[unsafe(method_family = none)]
700        pub fn zoomScale(&self) -> CGFloat;
701
702        #[cfg(feature = "objc2-core-foundation")]
703        /// Setter for [`zoomScale`][Self::zoomScale].
704        #[unsafe(method(setZoomScale:))]
705        #[unsafe(method_family = none)]
706        pub fn setZoomScale(&self, zoom_scale: CGFloat);
707
708        #[cfg(feature = "objc2-core-foundation")]
709        #[unsafe(method(setZoomScale:animated:))]
710        #[unsafe(method_family = none)]
711        pub fn setZoomScale_animated(&self, scale: CGFloat, animated: bool);
712
713        #[cfg(feature = "objc2-core-foundation")]
714        #[unsafe(method(zoomToRect:animated:))]
715        #[unsafe(method_family = none)]
716        pub fn zoomToRect_animated(&self, rect: CGRect, animated: bool);
717
718        #[unsafe(method(bouncesZoom))]
719        #[unsafe(method_family = none)]
720        pub fn bouncesZoom(&self) -> bool;
721
722        /// Setter for [`bouncesZoom`][Self::bouncesZoom].
723        #[unsafe(method(setBouncesZoom:))]
724        #[unsafe(method_family = none)]
725        pub fn setBouncesZoom(&self, bounces_zoom: bool);
726
727        #[unsafe(method(isZooming))]
728        #[unsafe(method_family = none)]
729        pub fn isZooming(&self) -> bool;
730
731        #[unsafe(method(isZoomBouncing))]
732        #[unsafe(method_family = none)]
733        pub fn isZoomBouncing(&self) -> bool;
734
735        #[unsafe(method(isZoomAnimating))]
736        #[unsafe(method_family = none)]
737        pub fn isZoomAnimating(&self) -> bool;
738
739        #[unsafe(method(scrollsToTop))]
740        #[unsafe(method_family = none)]
741        pub fn scrollsToTop(&self) -> bool;
742
743        /// Setter for [`scrollsToTop`][Self::scrollsToTop].
744        #[unsafe(method(setScrollsToTop:))]
745        #[unsafe(method_family = none)]
746        pub fn setScrollsToTop(&self, scrolls_to_top: bool);
747
748        #[unsafe(method(stopScrollingAndZooming))]
749        #[unsafe(method_family = none)]
750        pub fn stopScrollingAndZooming(&self);
751
752        #[cfg(all(feature = "UIGestureRecognizer", feature = "UIPanGestureRecognizer"))]
753        #[unsafe(method(panGestureRecognizer))]
754        #[unsafe(method_family = none)]
755        pub fn panGestureRecognizer(&self) -> Retained<UIPanGestureRecognizer>;
756
757        #[cfg(all(feature = "UIGestureRecognizer", feature = "UIPinchGestureRecognizer"))]
758        #[unsafe(method(pinchGestureRecognizer))]
759        #[unsafe(method_family = none)]
760        pub fn pinchGestureRecognizer(&self) -> Option<Retained<UIPinchGestureRecognizer>>;
761
762        #[cfg(feature = "UIGestureRecognizer")]
763        #[deprecated = "Configuring the panGestureRecognizer for indirect scrolling automatically supports directional presses now, so this property is no longer useful."]
764        #[unsafe(method(directionalPressGestureRecognizer))]
765        #[unsafe(method_family = none)]
766        pub fn directionalPressGestureRecognizer(&self) -> Retained<UIGestureRecognizer>;
767
768        #[unsafe(method(keyboardDismissMode))]
769        #[unsafe(method_family = none)]
770        pub fn keyboardDismissMode(&self) -> UIScrollViewKeyboardDismissMode;
771
772        /// Setter for [`keyboardDismissMode`][Self::keyboardDismissMode].
773        #[unsafe(method(setKeyboardDismissMode:))]
774        #[unsafe(method_family = none)]
775        pub fn setKeyboardDismissMode(
776            &self,
777            keyboard_dismiss_mode: UIScrollViewKeyboardDismissMode,
778        );
779
780        #[cfg(all(feature = "UIControl", feature = "UIRefreshControl"))]
781        #[unsafe(method(refreshControl))]
782        #[unsafe(method_family = none)]
783        pub fn refreshControl(&self) -> Option<Retained<UIRefreshControl>>;
784
785        #[cfg(all(feature = "UIControl", feature = "UIRefreshControl"))]
786        /// Setter for [`refreshControl`][Self::refreshControl].
787        #[unsafe(method(setRefreshControl:))]
788        #[unsafe(method_family = none)]
789        pub fn setRefreshControl(&self, refresh_control: Option<&UIRefreshControl>);
790
791        /// Set this to YES to make the scroll view animate its content offset in response to keys like Page Up/Down, Home/End, and the arrow keys.
792        /// The scroll view must be focused or first responder in order to receive these key events. Default is YES for apps linked after iOS 17.0.
793        #[unsafe(method(allowsKeyboardScrolling))]
794        #[unsafe(method_family = none)]
795        pub fn allowsKeyboardScrolling(&self) -> bool;
796
797        /// Setter for [`allowsKeyboardScrolling`][Self::allowsKeyboardScrolling].
798        #[unsafe(method(setAllowsKeyboardScrolling:))]
799        #[unsafe(method_family = none)]
800        pub fn setAllowsKeyboardScrolling(&self, allows_keyboard_scrolling: bool);
801
802        #[cfg(feature = "UIGeometry")]
803        /// Defines which axes are considered for Look to Scroll.
804        /// Does not affect when isPagingEnabled is true.
805        #[unsafe(method(lookToScrollAxes))]
806        #[unsafe(method_family = none)]
807        pub fn lookToScrollAxes(&self) -> UIAxis;
808
809        #[cfg(feature = "UIGeometry")]
810        /// Setter for [`lookToScrollAxes`][Self::lookToScrollAxes].
811        #[unsafe(method(setLookToScrollAxes:))]
812        #[unsafe(method_family = none)]
813        pub fn setLookToScrollAxes(&self, look_to_scroll_axes: UIAxis);
814    );
815}
816
817/// Methods declared on superclass `UIView`.
818#[cfg(all(feature = "UIResponder", feature = "UIView"))]
819impl UIScrollView {
820    extern_methods!(
821        #[cfg(feature = "objc2-core-foundation")]
822        #[unsafe(method(initWithFrame:))]
823        #[unsafe(method_family = init)]
824        pub fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
825
826        /// # Safety
827        ///
828        /// `coder` possibly has further requirements.
829        #[unsafe(method(initWithCoder:))]
830        #[unsafe(method_family = init)]
831        pub unsafe fn initWithCoder(
832            this: Allocated<Self>,
833            coder: &NSCoder,
834        ) -> Option<Retained<Self>>;
835
836        #[unsafe(method(init))]
837        #[unsafe(method_family = init)]
838        pub fn init(this: Allocated<Self>) -> Retained<Self>;
839    );
840}
841
842/// Methods declared on superclass `NSObject`.
843#[cfg(all(feature = "UIResponder", feature = "UIView"))]
844impl UIScrollView {
845    extern_methods!(
846        #[unsafe(method(new))]
847        #[unsafe(method_family = new)]
848        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
849    );
850}
851
852extern_protocol!(
853    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiscrollviewdelegate?language=objc)
854    pub unsafe trait UIScrollViewDelegate: NSObjectProtocol + MainThreadOnly {
855        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
856        #[optional]
857        #[unsafe(method(scrollViewDidScroll:))]
858        #[unsafe(method_family = none)]
859        fn scrollViewDidScroll(&self, scroll_view: &UIScrollView);
860
861        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
862        #[optional]
863        #[unsafe(method(scrollViewDidZoom:))]
864        #[unsafe(method_family = none)]
865        fn scrollViewDidZoom(&self, scroll_view: &UIScrollView);
866
867        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
868        #[optional]
869        #[unsafe(method(scrollViewWillBeginDragging:))]
870        #[unsafe(method_family = none)]
871        fn scrollViewWillBeginDragging(&self, scroll_view: &UIScrollView);
872
873        #[cfg(all(
874            feature = "UIResponder",
875            feature = "UIView",
876            feature = "objc2-core-foundation"
877        ))]
878        /// # Safety
879        ///
880        /// `target_content_offset` must be a valid pointer.
881        #[optional]
882        #[unsafe(method(scrollViewWillEndDragging:withVelocity:targetContentOffset:))]
883        #[unsafe(method_family = none)]
884        unsafe fn scrollViewWillEndDragging_withVelocity_targetContentOffset(
885            &self,
886            scroll_view: &UIScrollView,
887            velocity: CGPoint,
888            target_content_offset: NonNull<CGPoint>,
889        );
890
891        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
892        #[optional]
893        #[unsafe(method(scrollViewDidEndDragging:willDecelerate:))]
894        #[unsafe(method_family = none)]
895        fn scrollViewDidEndDragging_willDecelerate(
896            &self,
897            scroll_view: &UIScrollView,
898            decelerate: bool,
899        );
900
901        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
902        #[optional]
903        #[unsafe(method(scrollViewWillBeginDecelerating:))]
904        #[unsafe(method_family = none)]
905        fn scrollViewWillBeginDecelerating(&self, scroll_view: &UIScrollView);
906
907        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
908        #[optional]
909        #[unsafe(method(scrollViewDidEndDecelerating:))]
910        #[unsafe(method_family = none)]
911        fn scrollViewDidEndDecelerating(&self, scroll_view: &UIScrollView);
912
913        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
914        #[optional]
915        #[unsafe(method(scrollViewDidEndScrollingAnimation:))]
916        #[unsafe(method_family = none)]
917        fn scrollViewDidEndScrollingAnimation(&self, scroll_view: &UIScrollView);
918
919        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
920        #[optional]
921        #[unsafe(method(viewForZoomingInScrollView:))]
922        #[unsafe(method_family = none)]
923        fn viewForZoomingInScrollView(
924            &self,
925            scroll_view: &UIScrollView,
926        ) -> Option<Retained<UIView>>;
927
928        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
929        #[optional]
930        #[unsafe(method(scrollViewWillBeginZooming:withView:))]
931        #[unsafe(method_family = none)]
932        fn scrollViewWillBeginZooming_withView(
933            &self,
934            scroll_view: &UIScrollView,
935            view: Option<&UIView>,
936        );
937
938        #[cfg(all(
939            feature = "UIResponder",
940            feature = "UIView",
941            feature = "objc2-core-foundation"
942        ))]
943        #[optional]
944        #[unsafe(method(scrollViewDidEndZooming:withView:atScale:))]
945        #[unsafe(method_family = none)]
946        fn scrollViewDidEndZooming_withView_atScale(
947            &self,
948            scroll_view: &UIScrollView,
949            view: Option<&UIView>,
950            scale: CGFloat,
951        );
952
953        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
954        #[optional]
955        #[unsafe(method(scrollViewShouldScrollToTop:))]
956        #[unsafe(method_family = none)]
957        fn scrollViewShouldScrollToTop(&self, scroll_view: &UIScrollView) -> bool;
958
959        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
960        #[optional]
961        #[unsafe(method(scrollViewDidScrollToTop:))]
962        #[unsafe(method_family = none)]
963        fn scrollViewDidScrollToTop(&self, scroll_view: &UIScrollView);
964
965        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
966        #[optional]
967        #[unsafe(method(scrollViewDidChangeAdjustedContentInset:))]
968        #[unsafe(method_family = none)]
969        fn scrollViewDidChangeAdjustedContentInset(&self, scroll_view: &UIScrollView);
970    }
971);