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