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    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiscrollview?language=objc)
126    #[unsafe(super(UIView, UIResponder, NSObject))]
127    #[thread_kind = MainThreadOnly]
128    #[derive(Debug, PartialEq, Eq, Hash)]
129    #[cfg(all(feature = "UIResponder", feature = "UIView"))]
130    pub struct UIScrollView;
131);
132
133#[cfg(all(
134    feature = "UIResponder",
135    feature = "UIView",
136    feature = "objc2-quartz-core"
137))]
138#[cfg(not(target_os = "watchos"))]
139extern_conformance!(
140    unsafe impl CALayerDelegate for UIScrollView {}
141);
142
143#[cfg(all(feature = "UIResponder", feature = "UIView"))]
144extern_conformance!(
145    unsafe impl NSCoding for UIScrollView {}
146);
147
148#[cfg(all(feature = "UIResponder", feature = "UIView"))]
149extern_conformance!(
150    unsafe impl NSObjectProtocol for UIScrollView {}
151);
152
153#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
154extern_conformance!(
155    unsafe impl UIAppearance for UIScrollView {}
156);
157
158#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
159extern_conformance!(
160    unsafe impl UIAppearanceContainer for UIScrollView {}
161);
162
163#[cfg(all(feature = "UIResponder", feature = "UIView"))]
164extern_conformance!(
165    unsafe impl UICoordinateSpace for UIScrollView {}
166);
167
168#[cfg(all(
169    feature = "UIDynamicBehavior",
170    feature = "UIResponder",
171    feature = "UIView"
172))]
173extern_conformance!(
174    unsafe impl UIDynamicItem for UIScrollView {}
175);
176
177#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
178extern_conformance!(
179    unsafe impl UIFocusEnvironment for UIScrollView {}
180);
181
182#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
183extern_conformance!(
184    unsafe impl UIFocusItem for UIScrollView {}
185);
186
187#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
188extern_conformance!(
189    unsafe impl UIFocusItemContainer for UIScrollView {}
190);
191
192#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
193extern_conformance!(
194    unsafe impl UIFocusItemScrollableContainer for UIScrollView {}
195);
196
197#[cfg(all(feature = "UIResponder", feature = "UIView"))]
198extern_conformance!(
199    unsafe impl UIResponderStandardEditActions for UIScrollView {}
200);
201
202#[cfg(all(
203    feature = "UIResponder",
204    feature = "UITraitCollection",
205    feature = "UIView"
206))]
207extern_conformance!(
208    unsafe impl UITraitEnvironment for UIScrollView {}
209);
210
211#[cfg(all(feature = "UIResponder", feature = "UIView"))]
212impl UIScrollView {
213    extern_methods!(
214        #[cfg(feature = "objc2-core-foundation")]
215        #[unsafe(method(contentOffset))]
216        #[unsafe(method_family = none)]
217        pub unsafe fn contentOffset(&self) -> CGPoint;
218
219        #[cfg(feature = "objc2-core-foundation")]
220        /// Setter for [`contentOffset`][Self::contentOffset].
221        #[unsafe(method(setContentOffset:))]
222        #[unsafe(method_family = none)]
223        pub unsafe fn setContentOffset(&self, content_offset: CGPoint);
224
225        #[cfg(feature = "objc2-core-foundation")]
226        #[unsafe(method(contentSize))]
227        #[unsafe(method_family = none)]
228        pub unsafe fn contentSize(&self) -> CGSize;
229
230        #[cfg(feature = "objc2-core-foundation")]
231        /// Setter for [`contentSize`][Self::contentSize].
232        #[unsafe(method(setContentSize:))]
233        #[unsafe(method_family = none)]
234        pub unsafe fn setContentSize(&self, content_size: CGSize);
235
236        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
237        #[unsafe(method(contentInset))]
238        #[unsafe(method_family = none)]
239        pub unsafe fn contentInset(&self) -> UIEdgeInsets;
240
241        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
242        /// Setter for [`contentInset`][Self::contentInset].
243        #[unsafe(method(setContentInset:))]
244        #[unsafe(method_family = none)]
245        pub unsafe fn setContentInset(&self, content_inset: UIEdgeInsets);
246
247        #[cfg(feature = "objc2-core-foundation")]
248        #[unsafe(method(contentAlignmentPoint))]
249        #[unsafe(method_family = none)]
250        pub unsafe fn contentAlignmentPoint(&self) -> CGPoint;
251
252        #[cfg(feature = "objc2-core-foundation")]
253        /// Setter for [`contentAlignmentPoint`][Self::contentAlignmentPoint].
254        #[unsafe(method(setContentAlignmentPoint:))]
255        #[unsafe(method_family = none)]
256        pub unsafe fn setContentAlignmentPoint(&self, content_alignment_point: CGPoint);
257
258        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
259        #[unsafe(method(adjustedContentInset))]
260        #[unsafe(method_family = none)]
261        pub unsafe fn adjustedContentInset(&self) -> UIEdgeInsets;
262
263        #[unsafe(method(adjustedContentInsetDidChange))]
264        #[unsafe(method_family = none)]
265        pub unsafe fn adjustedContentInsetDidChange(&self);
266
267        #[unsafe(method(contentInsetAdjustmentBehavior))]
268        #[unsafe(method_family = none)]
269        pub unsafe fn contentInsetAdjustmentBehavior(
270            &self,
271        ) -> UIScrollViewContentInsetAdjustmentBehavior;
272
273        /// Setter for [`contentInsetAdjustmentBehavior`][Self::contentInsetAdjustmentBehavior].
274        #[unsafe(method(setContentInsetAdjustmentBehavior:))]
275        #[unsafe(method_family = none)]
276        pub unsafe fn setContentInsetAdjustmentBehavior(
277            &self,
278            content_inset_adjustment_behavior: UIScrollViewContentInsetAdjustmentBehavior,
279        );
280
281        #[unsafe(method(automaticallyAdjustsScrollIndicatorInsets))]
282        #[unsafe(method_family = none)]
283        pub unsafe fn automaticallyAdjustsScrollIndicatorInsets(&self) -> bool;
284
285        /// Setter for [`automaticallyAdjustsScrollIndicatorInsets`][Self::automaticallyAdjustsScrollIndicatorInsets].
286        #[unsafe(method(setAutomaticallyAdjustsScrollIndicatorInsets:))]
287        #[unsafe(method_family = none)]
288        pub unsafe fn setAutomaticallyAdjustsScrollIndicatorInsets(
289            &self,
290            automatically_adjusts_scroll_indicator_insets: bool,
291        );
292
293        #[cfg(feature = "UILayoutGuide")]
294        #[unsafe(method(contentLayoutGuide))]
295        #[unsafe(method_family = none)]
296        pub unsafe fn contentLayoutGuide(&self) -> Retained<UILayoutGuide>;
297
298        #[cfg(feature = "UILayoutGuide")]
299        #[unsafe(method(frameLayoutGuide))]
300        #[unsafe(method_family = none)]
301        pub unsafe fn frameLayoutGuide(&self) -> Retained<UILayoutGuide>;
302
303        #[unsafe(method(delegate))]
304        #[unsafe(method_family = none)]
305        pub unsafe fn delegate(&self)
306            -> Option<Retained<ProtocolObject<dyn UIScrollViewDelegate>>>;
307
308        /// This is a [weak property][objc2::topics::weak_property].
309        /// Setter for [`delegate`][Self::delegate].
310        #[unsafe(method(setDelegate:))]
311        #[unsafe(method_family = none)]
312        pub unsafe fn setDelegate(
313            &self,
314            delegate: Option<&ProtocolObject<dyn UIScrollViewDelegate>>,
315        );
316
317        #[unsafe(method(isDirectionalLockEnabled))]
318        #[unsafe(method_family = none)]
319        pub unsafe fn isDirectionalLockEnabled(&self) -> bool;
320
321        /// Setter for [`isDirectionalLockEnabled`][Self::isDirectionalLockEnabled].
322        #[unsafe(method(setDirectionalLockEnabled:))]
323        #[unsafe(method_family = none)]
324        pub unsafe fn setDirectionalLockEnabled(&self, directional_lock_enabled: bool);
325
326        #[unsafe(method(bounces))]
327        #[unsafe(method_family = none)]
328        pub unsafe fn bounces(&self) -> bool;
329
330        /// Setter for [`bounces`][Self::bounces].
331        #[unsafe(method(setBounces:))]
332        #[unsafe(method_family = none)]
333        pub unsafe fn setBounces(&self, bounces: bool);
334
335        #[unsafe(method(bouncesHorizontally))]
336        #[unsafe(method_family = none)]
337        pub unsafe fn bouncesHorizontally(&self) -> bool;
338
339        /// Setter for [`bouncesHorizontally`][Self::bouncesHorizontally].
340        #[unsafe(method(setBouncesHorizontally:))]
341        #[unsafe(method_family = none)]
342        pub unsafe fn setBouncesHorizontally(&self, bounces_horizontally: bool);
343
344        #[unsafe(method(bouncesVertically))]
345        #[unsafe(method_family = none)]
346        pub unsafe fn bouncesVertically(&self) -> bool;
347
348        /// Setter for [`bouncesVertically`][Self::bouncesVertically].
349        #[unsafe(method(setBouncesVertically:))]
350        #[unsafe(method_family = none)]
351        pub unsafe fn setBouncesVertically(&self, bounces_vertically: bool);
352
353        #[unsafe(method(alwaysBounceVertical))]
354        #[unsafe(method_family = none)]
355        pub unsafe fn alwaysBounceVertical(&self) -> bool;
356
357        /// Setter for [`alwaysBounceVertical`][Self::alwaysBounceVertical].
358        #[unsafe(method(setAlwaysBounceVertical:))]
359        #[unsafe(method_family = none)]
360        pub unsafe fn setAlwaysBounceVertical(&self, always_bounce_vertical: bool);
361
362        #[unsafe(method(alwaysBounceHorizontal))]
363        #[unsafe(method_family = none)]
364        pub unsafe fn alwaysBounceHorizontal(&self) -> bool;
365
366        /// Setter for [`alwaysBounceHorizontal`][Self::alwaysBounceHorizontal].
367        #[unsafe(method(setAlwaysBounceHorizontal:))]
368        #[unsafe(method_family = none)]
369        pub unsafe fn setAlwaysBounceHorizontal(&self, always_bounce_horizontal: bool);
370
371        #[unsafe(method(isPagingEnabled))]
372        #[unsafe(method_family = none)]
373        pub unsafe fn isPagingEnabled(&self) -> bool;
374
375        /// Setter for [`isPagingEnabled`][Self::isPagingEnabled].
376        #[unsafe(method(setPagingEnabled:))]
377        #[unsafe(method_family = none)]
378        pub unsafe fn setPagingEnabled(&self, paging_enabled: bool);
379
380        #[unsafe(method(isScrollEnabled))]
381        #[unsafe(method_family = none)]
382        pub unsafe fn isScrollEnabled(&self) -> bool;
383
384        /// Setter for [`isScrollEnabled`][Self::isScrollEnabled].
385        #[unsafe(method(setScrollEnabled:))]
386        #[unsafe(method_family = none)]
387        pub unsafe fn setScrollEnabled(&self, scroll_enabled: bool);
388
389        #[unsafe(method(transfersHorizontalScrollingToParent))]
390        #[unsafe(method_family = none)]
391        pub unsafe fn transfersHorizontalScrollingToParent(&self) -> bool;
392
393        /// Setter for [`transfersHorizontalScrollingToParent`][Self::transfersHorizontalScrollingToParent].
394        #[unsafe(method(setTransfersHorizontalScrollingToParent:))]
395        #[unsafe(method_family = none)]
396        pub unsafe fn setTransfersHorizontalScrollingToParent(
397            &self,
398            transfers_horizontal_scrolling_to_parent: bool,
399        );
400
401        #[unsafe(method(transfersVerticalScrollingToParent))]
402        #[unsafe(method_family = none)]
403        pub unsafe fn transfersVerticalScrollingToParent(&self) -> bool;
404
405        /// Setter for [`transfersVerticalScrollingToParent`][Self::transfersVerticalScrollingToParent].
406        #[unsafe(method(setTransfersVerticalScrollingToParent:))]
407        #[unsafe(method_family = none)]
408        pub unsafe fn setTransfersVerticalScrollingToParent(
409            &self,
410            transfers_vertical_scrolling_to_parent: bool,
411        );
412
413        #[unsafe(method(showsVerticalScrollIndicator))]
414        #[unsafe(method_family = none)]
415        pub unsafe fn showsVerticalScrollIndicator(&self) -> bool;
416
417        /// Setter for [`showsVerticalScrollIndicator`][Self::showsVerticalScrollIndicator].
418        #[unsafe(method(setShowsVerticalScrollIndicator:))]
419        #[unsafe(method_family = none)]
420        pub unsafe fn setShowsVerticalScrollIndicator(&self, shows_vertical_scroll_indicator: bool);
421
422        #[unsafe(method(showsHorizontalScrollIndicator))]
423        #[unsafe(method_family = none)]
424        pub unsafe fn showsHorizontalScrollIndicator(&self) -> bool;
425
426        /// Setter for [`showsHorizontalScrollIndicator`][Self::showsHorizontalScrollIndicator].
427        #[unsafe(method(setShowsHorizontalScrollIndicator:))]
428        #[unsafe(method_family = none)]
429        pub unsafe fn setShowsHorizontalScrollIndicator(
430            &self,
431            shows_horizontal_scroll_indicator: bool,
432        );
433
434        #[unsafe(method(indicatorStyle))]
435        #[unsafe(method_family = none)]
436        pub unsafe fn indicatorStyle(&self) -> UIScrollViewIndicatorStyle;
437
438        /// Setter for [`indicatorStyle`][Self::indicatorStyle].
439        #[unsafe(method(setIndicatorStyle:))]
440        #[unsafe(method_family = none)]
441        pub unsafe fn setIndicatorStyle(&self, indicator_style: UIScrollViewIndicatorStyle);
442
443        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
444        #[unsafe(method(verticalScrollIndicatorInsets))]
445        #[unsafe(method_family = none)]
446        pub unsafe fn verticalScrollIndicatorInsets(&self) -> UIEdgeInsets;
447
448        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
449        /// Setter for [`verticalScrollIndicatorInsets`][Self::verticalScrollIndicatorInsets].
450        #[unsafe(method(setVerticalScrollIndicatorInsets:))]
451        #[unsafe(method_family = none)]
452        pub unsafe fn setVerticalScrollIndicatorInsets(
453            &self,
454            vertical_scroll_indicator_insets: UIEdgeInsets,
455        );
456
457        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
458        #[unsafe(method(horizontalScrollIndicatorInsets))]
459        #[unsafe(method_family = none)]
460        pub unsafe fn horizontalScrollIndicatorInsets(&self) -> UIEdgeInsets;
461
462        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
463        /// Setter for [`horizontalScrollIndicatorInsets`][Self::horizontalScrollIndicatorInsets].
464        #[unsafe(method(setHorizontalScrollIndicatorInsets:))]
465        #[unsafe(method_family = none)]
466        pub unsafe fn setHorizontalScrollIndicatorInsets(
467            &self,
468            horizontal_scroll_indicator_insets: UIEdgeInsets,
469        );
470
471        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
472        #[unsafe(method(scrollIndicatorInsets))]
473        #[unsafe(method_family = none)]
474        pub unsafe fn scrollIndicatorInsets(&self) -> UIEdgeInsets;
475
476        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
477        /// Setter for [`scrollIndicatorInsets`][Self::scrollIndicatorInsets].
478        #[unsafe(method(setScrollIndicatorInsets:))]
479        #[unsafe(method_family = none)]
480        pub unsafe fn setScrollIndicatorInsets(&self, scroll_indicator_insets: UIEdgeInsets);
481
482        #[cfg(feature = "objc2-core-foundation")]
483        #[unsafe(method(decelerationRate))]
484        #[unsafe(method_family = none)]
485        pub unsafe fn decelerationRate(&self) -> UIScrollViewDecelerationRate;
486
487        #[cfg(feature = "objc2-core-foundation")]
488        /// Setter for [`decelerationRate`][Self::decelerationRate].
489        #[unsafe(method(setDecelerationRate:))]
490        #[unsafe(method_family = none)]
491        pub unsafe fn setDecelerationRate(&self, deceleration_rate: UIScrollViewDecelerationRate);
492
493        #[unsafe(method(indexDisplayMode))]
494        #[unsafe(method_family = none)]
495        pub unsafe fn indexDisplayMode(&self) -> UIScrollViewIndexDisplayMode;
496
497        /// Setter for [`indexDisplayMode`][Self::indexDisplayMode].
498        #[unsafe(method(setIndexDisplayMode:))]
499        #[unsafe(method_family = none)]
500        pub unsafe fn setIndexDisplayMode(&self, index_display_mode: UIScrollViewIndexDisplayMode);
501
502        #[cfg(feature = "objc2-core-foundation")]
503        #[unsafe(method(setContentOffset:animated:))]
504        #[unsafe(method_family = none)]
505        pub unsafe fn setContentOffset_animated(&self, content_offset: CGPoint, animated: bool);
506
507        #[cfg(feature = "objc2-core-foundation")]
508        #[unsafe(method(scrollRectToVisible:animated:))]
509        #[unsafe(method_family = none)]
510        pub unsafe fn scrollRectToVisible_animated(&self, rect: CGRect, animated: bool);
511
512        #[unsafe(method(flashScrollIndicators))]
513        #[unsafe(method_family = none)]
514        pub unsafe fn flashScrollIndicators(&self);
515
516        #[cfg(feature = "block2")]
517        #[unsafe(method(withScrollIndicatorsShownForContentOffsetChanges:))]
518        #[unsafe(method_family = none)]
519        pub unsafe fn withScrollIndicatorsShownForContentOffsetChanges(
520            &self,
521            changes: &block2::DynBlock<dyn Fn() + '_>,
522        );
523
524        #[unsafe(method(isTracking))]
525        #[unsafe(method_family = none)]
526        pub unsafe fn isTracking(&self) -> bool;
527
528        #[unsafe(method(isDragging))]
529        #[unsafe(method_family = none)]
530        pub unsafe fn isDragging(&self) -> bool;
531
532        #[unsafe(method(isDecelerating))]
533        #[unsafe(method_family = none)]
534        pub unsafe fn isDecelerating(&self) -> bool;
535
536        #[unsafe(method(isScrollAnimating))]
537        #[unsafe(method_family = none)]
538        pub unsafe fn isScrollAnimating(&self) -> bool;
539
540        #[unsafe(method(delaysContentTouches))]
541        #[unsafe(method_family = none)]
542        pub unsafe fn delaysContentTouches(&self) -> bool;
543
544        /// Setter for [`delaysContentTouches`][Self::delaysContentTouches].
545        #[unsafe(method(setDelaysContentTouches:))]
546        #[unsafe(method_family = none)]
547        pub unsafe fn setDelaysContentTouches(&self, delays_content_touches: bool);
548
549        #[unsafe(method(canCancelContentTouches))]
550        #[unsafe(method_family = none)]
551        pub unsafe fn canCancelContentTouches(&self) -> bool;
552
553        /// Setter for [`canCancelContentTouches`][Self::canCancelContentTouches].
554        #[unsafe(method(setCanCancelContentTouches:))]
555        #[unsafe(method_family = none)]
556        pub unsafe fn setCanCancelContentTouches(&self, can_cancel_content_touches: bool);
557
558        #[cfg(all(feature = "UIEvent", feature = "UITouch"))]
559        #[unsafe(method(touchesShouldBegin:withEvent:inContentView:))]
560        #[unsafe(method_family = none)]
561        pub unsafe fn touchesShouldBegin_withEvent_inContentView(
562            &self,
563            touches: &NSSet<UITouch>,
564            event: Option<&UIEvent>,
565            view: &UIView,
566        ) -> bool;
567
568        #[unsafe(method(touchesShouldCancelInContentView:))]
569        #[unsafe(method_family = none)]
570        pub unsafe fn touchesShouldCancelInContentView(&self, view: &UIView) -> bool;
571
572        #[cfg(feature = "objc2-core-foundation")]
573        #[unsafe(method(minimumZoomScale))]
574        #[unsafe(method_family = none)]
575        pub unsafe fn minimumZoomScale(&self) -> CGFloat;
576
577        #[cfg(feature = "objc2-core-foundation")]
578        /// Setter for [`minimumZoomScale`][Self::minimumZoomScale].
579        #[unsafe(method(setMinimumZoomScale:))]
580        #[unsafe(method_family = none)]
581        pub unsafe fn setMinimumZoomScale(&self, minimum_zoom_scale: CGFloat);
582
583        #[cfg(feature = "objc2-core-foundation")]
584        #[unsafe(method(maximumZoomScale))]
585        #[unsafe(method_family = none)]
586        pub unsafe fn maximumZoomScale(&self) -> CGFloat;
587
588        #[cfg(feature = "objc2-core-foundation")]
589        /// Setter for [`maximumZoomScale`][Self::maximumZoomScale].
590        #[unsafe(method(setMaximumZoomScale:))]
591        #[unsafe(method_family = none)]
592        pub unsafe fn setMaximumZoomScale(&self, maximum_zoom_scale: CGFloat);
593
594        #[cfg(feature = "objc2-core-foundation")]
595        #[unsafe(method(zoomScale))]
596        #[unsafe(method_family = none)]
597        pub unsafe fn zoomScale(&self) -> CGFloat;
598
599        #[cfg(feature = "objc2-core-foundation")]
600        /// Setter for [`zoomScale`][Self::zoomScale].
601        #[unsafe(method(setZoomScale:))]
602        #[unsafe(method_family = none)]
603        pub unsafe fn setZoomScale(&self, zoom_scale: CGFloat);
604
605        #[cfg(feature = "objc2-core-foundation")]
606        #[unsafe(method(setZoomScale:animated:))]
607        #[unsafe(method_family = none)]
608        pub unsafe fn setZoomScale_animated(&self, scale: CGFloat, animated: bool);
609
610        #[cfg(feature = "objc2-core-foundation")]
611        #[unsafe(method(zoomToRect:animated:))]
612        #[unsafe(method_family = none)]
613        pub unsafe fn zoomToRect_animated(&self, rect: CGRect, animated: bool);
614
615        #[unsafe(method(bouncesZoom))]
616        #[unsafe(method_family = none)]
617        pub unsafe fn bouncesZoom(&self) -> bool;
618
619        /// Setter for [`bouncesZoom`][Self::bouncesZoom].
620        #[unsafe(method(setBouncesZoom:))]
621        #[unsafe(method_family = none)]
622        pub unsafe fn setBouncesZoom(&self, bounces_zoom: bool);
623
624        #[unsafe(method(isZooming))]
625        #[unsafe(method_family = none)]
626        pub unsafe fn isZooming(&self) -> bool;
627
628        #[unsafe(method(isZoomBouncing))]
629        #[unsafe(method_family = none)]
630        pub unsafe fn isZoomBouncing(&self) -> bool;
631
632        #[unsafe(method(isZoomAnimating))]
633        #[unsafe(method_family = none)]
634        pub unsafe fn isZoomAnimating(&self) -> bool;
635
636        #[unsafe(method(scrollsToTop))]
637        #[unsafe(method_family = none)]
638        pub unsafe fn scrollsToTop(&self) -> bool;
639
640        /// Setter for [`scrollsToTop`][Self::scrollsToTop].
641        #[unsafe(method(setScrollsToTop:))]
642        #[unsafe(method_family = none)]
643        pub unsafe fn setScrollsToTop(&self, scrolls_to_top: bool);
644
645        #[unsafe(method(stopScrollingAndZooming))]
646        #[unsafe(method_family = none)]
647        pub unsafe fn stopScrollingAndZooming(&self);
648
649        #[cfg(all(feature = "UIGestureRecognizer", feature = "UIPanGestureRecognizer"))]
650        #[unsafe(method(panGestureRecognizer))]
651        #[unsafe(method_family = none)]
652        pub unsafe fn panGestureRecognizer(&self) -> Retained<UIPanGestureRecognizer>;
653
654        #[cfg(all(feature = "UIGestureRecognizer", feature = "UIPinchGestureRecognizer"))]
655        #[unsafe(method(pinchGestureRecognizer))]
656        #[unsafe(method_family = none)]
657        pub unsafe fn pinchGestureRecognizer(&self) -> Option<Retained<UIPinchGestureRecognizer>>;
658
659        #[cfg(feature = "UIGestureRecognizer")]
660        #[deprecated = "Configuring the panGestureRecognizer for indirect scrolling automatically supports directional presses now, so this property is no longer useful."]
661        #[unsafe(method(directionalPressGestureRecognizer))]
662        #[unsafe(method_family = none)]
663        pub unsafe fn directionalPressGestureRecognizer(&self) -> Retained<UIGestureRecognizer>;
664
665        #[unsafe(method(keyboardDismissMode))]
666        #[unsafe(method_family = none)]
667        pub unsafe fn keyboardDismissMode(&self) -> UIScrollViewKeyboardDismissMode;
668
669        /// Setter for [`keyboardDismissMode`][Self::keyboardDismissMode].
670        #[unsafe(method(setKeyboardDismissMode:))]
671        #[unsafe(method_family = none)]
672        pub unsafe fn setKeyboardDismissMode(
673            &self,
674            keyboard_dismiss_mode: UIScrollViewKeyboardDismissMode,
675        );
676
677        #[cfg(all(feature = "UIControl", feature = "UIRefreshControl"))]
678        #[unsafe(method(refreshControl))]
679        #[unsafe(method_family = none)]
680        pub unsafe fn refreshControl(&self) -> Option<Retained<UIRefreshControl>>;
681
682        #[cfg(all(feature = "UIControl", feature = "UIRefreshControl"))]
683        /// Setter for [`refreshControl`][Self::refreshControl].
684        #[unsafe(method(setRefreshControl:))]
685        #[unsafe(method_family = none)]
686        pub unsafe fn setRefreshControl(&self, refresh_control: Option<&UIRefreshControl>);
687
688        /// 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.
689        /// 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.
690        #[unsafe(method(allowsKeyboardScrolling))]
691        #[unsafe(method_family = none)]
692        pub unsafe fn allowsKeyboardScrolling(&self) -> bool;
693
694        /// Setter for [`allowsKeyboardScrolling`][Self::allowsKeyboardScrolling].
695        #[unsafe(method(setAllowsKeyboardScrolling:))]
696        #[unsafe(method_family = none)]
697        pub unsafe fn setAllowsKeyboardScrolling(&self, allows_keyboard_scrolling: bool);
698    );
699}
700
701/// Methods declared on superclass `UIView`.
702#[cfg(all(feature = "UIResponder", feature = "UIView"))]
703impl UIScrollView {
704    extern_methods!(
705        #[cfg(feature = "objc2-core-foundation")]
706        #[unsafe(method(initWithFrame:))]
707        #[unsafe(method_family = init)]
708        pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
709
710        #[unsafe(method(initWithCoder:))]
711        #[unsafe(method_family = init)]
712        pub unsafe fn initWithCoder(
713            this: Allocated<Self>,
714            coder: &NSCoder,
715        ) -> Option<Retained<Self>>;
716    );
717}
718
719/// Methods declared on superclass `NSObject`.
720#[cfg(all(feature = "UIResponder", feature = "UIView"))]
721impl UIScrollView {
722    extern_methods!(
723        #[unsafe(method(init))]
724        #[unsafe(method_family = init)]
725        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
726
727        #[unsafe(method(new))]
728        #[unsafe(method_family = new)]
729        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
730    );
731}
732
733extern_protocol!(
734    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiscrollviewdelegate?language=objc)
735    pub unsafe trait UIScrollViewDelegate: NSObjectProtocol + MainThreadOnly {
736        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
737        #[optional]
738        #[unsafe(method(scrollViewDidScroll:))]
739        #[unsafe(method_family = none)]
740        unsafe fn scrollViewDidScroll(&self, scroll_view: &UIScrollView);
741
742        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
743        #[optional]
744        #[unsafe(method(scrollViewDidZoom:))]
745        #[unsafe(method_family = none)]
746        unsafe fn scrollViewDidZoom(&self, scroll_view: &UIScrollView);
747
748        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
749        #[optional]
750        #[unsafe(method(scrollViewWillBeginDragging:))]
751        #[unsafe(method_family = none)]
752        unsafe fn scrollViewWillBeginDragging(&self, scroll_view: &UIScrollView);
753
754        #[cfg(all(
755            feature = "UIResponder",
756            feature = "UIView",
757            feature = "objc2-core-foundation"
758        ))]
759        #[optional]
760        #[unsafe(method(scrollViewWillEndDragging:withVelocity:targetContentOffset:))]
761        #[unsafe(method_family = none)]
762        unsafe fn scrollViewWillEndDragging_withVelocity_targetContentOffset(
763            &self,
764            scroll_view: &UIScrollView,
765            velocity: CGPoint,
766            target_content_offset: NonNull<CGPoint>,
767        );
768
769        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
770        #[optional]
771        #[unsafe(method(scrollViewDidEndDragging:willDecelerate:))]
772        #[unsafe(method_family = none)]
773        unsafe fn scrollViewDidEndDragging_willDecelerate(
774            &self,
775            scroll_view: &UIScrollView,
776            decelerate: bool,
777        );
778
779        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
780        #[optional]
781        #[unsafe(method(scrollViewWillBeginDecelerating:))]
782        #[unsafe(method_family = none)]
783        unsafe fn scrollViewWillBeginDecelerating(&self, scroll_view: &UIScrollView);
784
785        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
786        #[optional]
787        #[unsafe(method(scrollViewDidEndDecelerating:))]
788        #[unsafe(method_family = none)]
789        unsafe fn scrollViewDidEndDecelerating(&self, scroll_view: &UIScrollView);
790
791        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
792        #[optional]
793        #[unsafe(method(scrollViewDidEndScrollingAnimation:))]
794        #[unsafe(method_family = none)]
795        unsafe fn scrollViewDidEndScrollingAnimation(&self, scroll_view: &UIScrollView);
796
797        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
798        #[optional]
799        #[unsafe(method(viewForZoomingInScrollView:))]
800        #[unsafe(method_family = none)]
801        unsafe fn viewForZoomingInScrollView(
802            &self,
803            scroll_view: &UIScrollView,
804        ) -> Option<Retained<UIView>>;
805
806        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
807        #[optional]
808        #[unsafe(method(scrollViewWillBeginZooming:withView:))]
809        #[unsafe(method_family = none)]
810        unsafe fn scrollViewWillBeginZooming_withView(
811            &self,
812            scroll_view: &UIScrollView,
813            view: Option<&UIView>,
814        );
815
816        #[cfg(all(
817            feature = "UIResponder",
818            feature = "UIView",
819            feature = "objc2-core-foundation"
820        ))]
821        #[optional]
822        #[unsafe(method(scrollViewDidEndZooming:withView:atScale:))]
823        #[unsafe(method_family = none)]
824        unsafe fn scrollViewDidEndZooming_withView_atScale(
825            &self,
826            scroll_view: &UIScrollView,
827            view: Option<&UIView>,
828            scale: CGFloat,
829        );
830
831        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
832        #[optional]
833        #[unsafe(method(scrollViewShouldScrollToTop:))]
834        #[unsafe(method_family = none)]
835        unsafe fn scrollViewShouldScrollToTop(&self, scroll_view: &UIScrollView) -> bool;
836
837        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
838        #[optional]
839        #[unsafe(method(scrollViewDidScrollToTop:))]
840        #[unsafe(method_family = none)]
841        unsafe fn scrollViewDidScrollToTop(&self, scroll_view: &UIScrollView);
842
843        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
844        #[optional]
845        #[unsafe(method(scrollViewDidChangeAdjustedContentInset:))]
846        #[unsafe(method_family = none)]
847        unsafe fn scrollViewDidChangeAdjustedContentInset(&self, scroll_view: &UIScrollView);
848    }
849);