1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSScrollElasticity(pub NSInteger);
impl NSScrollElasticity {
    #[doc(alias = "NSScrollElasticityAutomatic")]
    pub const Automatic: Self = Self(0);
    #[doc(alias = "NSScrollElasticityNone")]
    pub const None: Self = Self(1);
    #[doc(alias = "NSScrollElasticityAllowed")]
    pub const Allowed: Self = Self(2);
}

unsafe impl Encode for NSScrollElasticity {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for NSScrollElasticity {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "NSResponder", feature = "NSView"))]
    pub struct NSScrollView;

    #[cfg(all(feature = "NSResponder", feature = "NSView"))]
    unsafe impl ClassType for NSScrollView {
        #[inherits(NSResponder, NSObject)]
        type Super = NSView;
        type Mutability = MainThreadOnly;
    }
);

#[cfg(all(
    feature = "NSAccessibilityProtocols",
    feature = "NSResponder",
    feature = "NSView"
))]
unsafe impl NSAccessibility for NSScrollView {}

#[cfg(all(
    feature = "NSAccessibilityProtocols",
    feature = "NSResponder",
    feature = "NSView"
))]
unsafe impl NSAccessibilityElementProtocol for NSScrollView {}

#[cfg(all(feature = "NSAnimation", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSAnimatablePropertyContainer for NSScrollView {}

#[cfg(all(feature = "NSAppearance", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSAppearanceCustomization for NSScrollView {}

#[cfg(all(feature = "NSResponder", feature = "NSView"))]
unsafe impl NSCoding for NSScrollView {}

#[cfg(all(feature = "NSDragging", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSDraggingDestination for NSScrollView {}

#[cfg(all(feature = "NSResponder", feature = "NSView"))]
unsafe impl NSObjectProtocol for NSScrollView {}

#[cfg(all(feature = "NSResponder", feature = "NSTextFinder", feature = "NSView"))]
unsafe impl NSTextFinderBarContainer for NSScrollView {}

#[cfg(all(
    feature = "NSResponder",
    feature = "NSUserInterfaceItemIdentification",
    feature = "NSView"
))]
unsafe impl NSUserInterfaceItemIdentification for NSScrollView {}

extern_methods!(
    #[cfg(all(feature = "NSResponder", feature = "NSView"))]
    unsafe impl NSScrollView {
        #[method_id(@__retain_semantics Init initWithFrame:)]
        pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;

        #[method_id(@__retain_semantics Init initWithCoder:)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;

        #[cfg(all(feature = "NSCell", feature = "NSScroller"))]
        #[method(frameSizeForContentSize:horizontalScrollerClass:verticalScrollerClass:borderType:controlSize:scrollerStyle:)]
        pub unsafe fn frameSizeForContentSize_horizontalScrollerClass_verticalScrollerClass_borderType_controlSize_scrollerStyle(
            c_size: NSSize,
            horizontal_scroller_class: Option<&AnyClass>,
            vertical_scroller_class: Option<&AnyClass>,
            r#type: NSBorderType,
            control_size: NSControlSize,
            scroller_style: NSScrollerStyle,
            mtm: MainThreadMarker,
        ) -> NSSize;

        #[cfg(all(feature = "NSCell", feature = "NSScroller"))]
        #[method(contentSizeForFrameSize:horizontalScrollerClass:verticalScrollerClass:borderType:controlSize:scrollerStyle:)]
        pub unsafe fn contentSizeForFrameSize_horizontalScrollerClass_verticalScrollerClass_borderType_controlSize_scrollerStyle(
            f_size: NSSize,
            horizontal_scroller_class: Option<&AnyClass>,
            vertical_scroller_class: Option<&AnyClass>,
            r#type: NSBorderType,
            control_size: NSControlSize,
            scroller_style: NSScrollerStyle,
            mtm: MainThreadMarker,
        ) -> NSSize;

        #[deprecated = "Use +frameSizeForContentSize:horizontalScrollerClass:verticalScrollerClass:borderType:controlSize:scrollerStyle: instead"]
        #[method(frameSizeForContentSize:hasHorizontalScroller:hasVerticalScroller:borderType:)]
        pub unsafe fn frameSizeForContentSize_hasHorizontalScroller_hasVerticalScroller_borderType(
            c_size: NSSize,
            h_flag: bool,
            v_flag: bool,
            r#type: NSBorderType,
            mtm: MainThreadMarker,
        ) -> NSSize;

        #[deprecated = "+contentSizeForFrameSize:horizontalScrollerClass:verticalScrollerClass:borderType:controlSize:scrollerStyle: instead"]
        #[method(contentSizeForFrameSize:hasHorizontalScroller:hasVerticalScroller:borderType:)]
        pub unsafe fn contentSizeForFrameSize_hasHorizontalScroller_hasVerticalScroller_borderType(
            f_size: NSSize,
            h_flag: bool,
            v_flag: bool,
            r#type: NSBorderType,
            mtm: MainThreadMarker,
        ) -> NSSize;

        #[method(documentVisibleRect)]
        pub unsafe fn documentVisibleRect(&self) -> NSRect;

        #[method(contentSize)]
        pub unsafe fn contentSize(&self) -> NSSize;

        #[method_id(@__retain_semantics Other documentView)]
        pub unsafe fn documentView(&self) -> Option<Retained<NSView>>;

        #[method(setDocumentView:)]
        pub unsafe fn setDocumentView(&self, document_view: Option<&NSView>);

        #[cfg(feature = "NSClipView")]
        #[method_id(@__retain_semantics Other contentView)]
        pub unsafe fn contentView(&self) -> Retained<NSClipView>;

        #[cfg(feature = "NSClipView")]
        #[method(setContentView:)]
        pub unsafe fn setContentView(&self, content_view: &NSClipView);

        #[cfg(feature = "NSCursor")]
        #[method_id(@__retain_semantics Other documentCursor)]
        pub unsafe fn documentCursor(&self) -> Option<Retained<NSCursor>>;

        #[cfg(feature = "NSCursor")]
        #[method(setDocumentCursor:)]
        pub unsafe fn setDocumentCursor(&self, document_cursor: Option<&NSCursor>);

        #[method(borderType)]
        pub unsafe fn borderType(&self) -> NSBorderType;

        #[method(setBorderType:)]
        pub unsafe fn setBorderType(&self, border_type: NSBorderType);

        #[cfg(feature = "NSColor")]
        #[method_id(@__retain_semantics Other backgroundColor)]
        pub unsafe fn backgroundColor(&self) -> Retained<NSColor>;

        #[cfg(feature = "NSColor")]
        #[method(setBackgroundColor:)]
        pub unsafe fn setBackgroundColor(&self, background_color: &NSColor);

        #[method(drawsBackground)]
        pub unsafe fn drawsBackground(&self) -> bool;

        #[method(setDrawsBackground:)]
        pub unsafe fn setDrawsBackground(&self, draws_background: bool);

        #[method(hasVerticalScroller)]
        pub unsafe fn hasVerticalScroller(&self) -> bool;

        #[method(setHasVerticalScroller:)]
        pub unsafe fn setHasVerticalScroller(&self, has_vertical_scroller: bool);

        #[method(hasHorizontalScroller)]
        pub unsafe fn hasHorizontalScroller(&self) -> bool;

        #[method(setHasHorizontalScroller:)]
        pub unsafe fn setHasHorizontalScroller(&self, has_horizontal_scroller: bool);

        #[cfg(all(feature = "NSControl", feature = "NSScroller"))]
        #[method_id(@__retain_semantics Other verticalScroller)]
        pub unsafe fn verticalScroller(&self) -> Option<Retained<NSScroller>>;

        #[cfg(all(feature = "NSControl", feature = "NSScroller"))]
        #[method(setVerticalScroller:)]
        pub unsafe fn setVerticalScroller(&self, vertical_scroller: Option<&NSScroller>);

        #[cfg(all(feature = "NSControl", feature = "NSScroller"))]
        #[method_id(@__retain_semantics Other horizontalScroller)]
        pub unsafe fn horizontalScroller(&self) -> Option<Retained<NSScroller>>;

        #[cfg(all(feature = "NSControl", feature = "NSScroller"))]
        #[method(setHorizontalScroller:)]
        pub unsafe fn setHorizontalScroller(&self, horizontal_scroller: Option<&NSScroller>);

        #[method(autohidesScrollers)]
        pub unsafe fn autohidesScrollers(&self) -> bool;

        #[method(setAutohidesScrollers:)]
        pub unsafe fn setAutohidesScrollers(&self, autohides_scrollers: bool);

        #[method(horizontalLineScroll)]
        pub unsafe fn horizontalLineScroll(&self) -> CGFloat;

        #[method(setHorizontalLineScroll:)]
        pub unsafe fn setHorizontalLineScroll(&self, horizontal_line_scroll: CGFloat);

        #[method(verticalLineScroll)]
        pub unsafe fn verticalLineScroll(&self) -> CGFloat;

        #[method(setVerticalLineScroll:)]
        pub unsafe fn setVerticalLineScroll(&self, vertical_line_scroll: CGFloat);

        #[method(lineScroll)]
        pub unsafe fn lineScroll(&self) -> CGFloat;

        #[method(setLineScroll:)]
        pub unsafe fn setLineScroll(&self, line_scroll: CGFloat);

        #[method(horizontalPageScroll)]
        pub unsafe fn horizontalPageScroll(&self) -> CGFloat;

        #[method(setHorizontalPageScroll:)]
        pub unsafe fn setHorizontalPageScroll(&self, horizontal_page_scroll: CGFloat);

        #[method(verticalPageScroll)]
        pub unsafe fn verticalPageScroll(&self) -> CGFloat;

        #[method(setVerticalPageScroll:)]
        pub unsafe fn setVerticalPageScroll(&self, vertical_page_scroll: CGFloat);

        #[method(pageScroll)]
        pub unsafe fn pageScroll(&self) -> CGFloat;

        #[method(setPageScroll:)]
        pub unsafe fn setPageScroll(&self, page_scroll: CGFloat);

        #[method(scrollsDynamically)]
        pub unsafe fn scrollsDynamically(&self) -> bool;

        #[method(setScrollsDynamically:)]
        pub unsafe fn setScrollsDynamically(&self, scrolls_dynamically: bool);

        #[method(tile)]
        pub unsafe fn tile(&self);

        #[cfg(feature = "NSClipView")]
        #[method(reflectScrolledClipView:)]
        pub unsafe fn reflectScrolledClipView(&self, c_view: &NSClipView);

        #[cfg(feature = "NSEvent")]
        #[method(scrollWheel:)]
        pub unsafe fn scrollWheel(&self, event: &NSEvent);

        #[cfg(feature = "NSScroller")]
        #[method(scrollerStyle)]
        pub unsafe fn scrollerStyle(&self) -> NSScrollerStyle;

        #[cfg(feature = "NSScroller")]
        #[method(setScrollerStyle:)]
        pub unsafe fn setScrollerStyle(&self, scroller_style: NSScrollerStyle);

        #[cfg(feature = "NSScroller")]
        #[method(scrollerKnobStyle)]
        pub unsafe fn scrollerKnobStyle(&self) -> NSScrollerKnobStyle;

        #[cfg(feature = "NSScroller")]
        #[method(setScrollerKnobStyle:)]
        pub unsafe fn setScrollerKnobStyle(&self, scroller_knob_style: NSScrollerKnobStyle);

        #[method(flashScrollers)]
        pub unsafe fn flashScrollers(&self);

        #[method(horizontalScrollElasticity)]
        pub unsafe fn horizontalScrollElasticity(&self) -> NSScrollElasticity;

        #[method(setHorizontalScrollElasticity:)]
        pub unsafe fn setHorizontalScrollElasticity(
            &self,
            horizontal_scroll_elasticity: NSScrollElasticity,
        );

        #[method(verticalScrollElasticity)]
        pub unsafe fn verticalScrollElasticity(&self) -> NSScrollElasticity;

        #[method(setVerticalScrollElasticity:)]
        pub unsafe fn setVerticalScrollElasticity(
            &self,
            vertical_scroll_elasticity: NSScrollElasticity,
        );

        #[method(usesPredominantAxisScrolling)]
        pub unsafe fn usesPredominantAxisScrolling(&self) -> bool;

        #[method(setUsesPredominantAxisScrolling:)]
        pub unsafe fn setUsesPredominantAxisScrolling(&self, uses_predominant_axis_scrolling: bool);

        #[method(allowsMagnification)]
        pub unsafe fn allowsMagnification(&self) -> bool;

        #[method(setAllowsMagnification:)]
        pub unsafe fn setAllowsMagnification(&self, allows_magnification: bool);

        #[method(magnification)]
        pub unsafe fn magnification(&self) -> CGFloat;

        #[method(setMagnification:)]
        pub unsafe fn setMagnification(&self, magnification: CGFloat);

        #[method(maxMagnification)]
        pub unsafe fn maxMagnification(&self) -> CGFloat;

        #[method(setMaxMagnification:)]
        pub unsafe fn setMaxMagnification(&self, max_magnification: CGFloat);

        #[method(minMagnification)]
        pub unsafe fn minMagnification(&self) -> CGFloat;

        #[method(setMinMagnification:)]
        pub unsafe fn setMinMagnification(&self, min_magnification: CGFloat);

        #[method(magnifyToFitRect:)]
        pub unsafe fn magnifyToFitRect(&self, rect: NSRect);

        #[method(setMagnification:centeredAtPoint:)]
        pub unsafe fn setMagnification_centeredAtPoint(
            &self,
            magnification: CGFloat,
            point: NSPoint,
        );

        #[cfg(feature = "NSEvent")]
        #[method(addFloatingSubview:forAxis:)]
        pub unsafe fn addFloatingSubview_forAxis(&self, view: &NSView, axis: NSEventGestureAxis);

        #[method(automaticallyAdjustsContentInsets)]
        pub unsafe fn automaticallyAdjustsContentInsets(&self) -> bool;

        #[method(setAutomaticallyAdjustsContentInsets:)]
        pub unsafe fn setAutomaticallyAdjustsContentInsets(
            &self,
            automatically_adjusts_content_insets: bool,
        );

        #[method(contentInsets)]
        pub unsafe fn contentInsets(&self) -> NSEdgeInsets;

        #[method(setContentInsets:)]
        pub unsafe fn setContentInsets(&self, content_insets: NSEdgeInsets);

        #[method(scrollerInsets)]
        pub unsafe fn scrollerInsets(&self) -> NSEdgeInsets;

        #[method(setScrollerInsets:)]
        pub unsafe fn setScrollerInsets(&self, scroller_insets: NSEdgeInsets);
    }
);

extern_methods!(
    /// Methods declared on superclass `NSResponder`
    #[cfg(all(feature = "NSResponder", feature = "NSView"))]
    unsafe impl NSScrollView {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    #[cfg(all(feature = "NSResponder", feature = "NSView"))]
    unsafe impl NSScrollView {
        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
    }
);

extern "C" {
    pub static NSScrollViewWillStartLiveMagnifyNotification: &'static NSNotificationName;
}

extern "C" {
    pub static NSScrollViewDidEndLiveMagnifyNotification: &'static NSNotificationName;
}

extern "C" {
    pub static NSScrollViewWillStartLiveScrollNotification: &'static NSNotificationName;
}

extern "C" {
    pub static NSScrollViewDidLiveScrollNotification: &'static NSNotificationName;
}

extern "C" {
    pub static NSScrollViewDidEndLiveScrollNotification: &'static NSNotificationName;
}

extern_methods!(
    /// NSRulerSupport
    #[cfg(all(feature = "NSResponder", feature = "NSView"))]
    unsafe impl NSScrollView {
        #[method(rulerViewClass)]
        pub unsafe fn rulerViewClass(mtm: MainThreadMarker) -> Option<&'static AnyClass>;

        #[method(setRulerViewClass:)]
        pub unsafe fn setRulerViewClass(ruler_view_class: Option<&AnyClass>, mtm: MainThreadMarker);

        #[method(rulersVisible)]
        pub unsafe fn rulersVisible(&self) -> bool;

        #[method(setRulersVisible:)]
        pub unsafe fn setRulersVisible(&self, rulers_visible: bool);

        #[method(hasHorizontalRuler)]
        pub unsafe fn hasHorizontalRuler(&self) -> bool;

        #[method(setHasHorizontalRuler:)]
        pub unsafe fn setHasHorizontalRuler(&self, has_horizontal_ruler: bool);

        #[method(hasVerticalRuler)]
        pub unsafe fn hasVerticalRuler(&self) -> bool;

        #[method(setHasVerticalRuler:)]
        pub unsafe fn setHasVerticalRuler(&self, has_vertical_ruler: bool);

        #[cfg(feature = "NSRulerView")]
        #[method_id(@__retain_semantics Other horizontalRulerView)]
        pub unsafe fn horizontalRulerView(&self) -> Option<Retained<NSRulerView>>;

        #[cfg(feature = "NSRulerView")]
        #[method(setHorizontalRulerView:)]
        pub unsafe fn setHorizontalRulerView(&self, horizontal_ruler_view: Option<&NSRulerView>);

        #[cfg(feature = "NSRulerView")]
        #[method_id(@__retain_semantics Other verticalRulerView)]
        pub unsafe fn verticalRulerView(&self) -> Option<Retained<NSRulerView>>;

        #[cfg(feature = "NSRulerView")]
        #[method(setVerticalRulerView:)]
        pub unsafe fn setVerticalRulerView(&self, vertical_ruler_view: Option<&NSRulerView>);
    }
);

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSScrollViewFindBarPosition(pub NSInteger);
impl NSScrollViewFindBarPosition {
    #[doc(alias = "NSScrollViewFindBarPositionAboveHorizontalRuler")]
    pub const AboveHorizontalRuler: Self = Self(0);
    #[doc(alias = "NSScrollViewFindBarPositionAboveContent")]
    pub const AboveContent: Self = Self(1);
    #[doc(alias = "NSScrollViewFindBarPositionBelowContent")]
    pub const BelowContent: Self = Self(2);
}

unsafe impl Encode for NSScrollViewFindBarPosition {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for NSScrollViewFindBarPosition {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_methods!(
    /// NSFindBarSupport
    #[cfg(all(feature = "NSResponder", feature = "NSView"))]
    unsafe impl NSScrollView {
        #[method(findBarPosition)]
        pub unsafe fn findBarPosition(&self) -> NSScrollViewFindBarPosition;

        #[method(setFindBarPosition:)]
        pub unsafe fn setFindBarPosition(&self, find_bar_position: NSScrollViewFindBarPosition);
    }
);