objc2-pdf-kit 0.3.2

Bindings to the PDFKit framework
Documentation
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
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
use objc2_app_kit::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
#[cfg(feature = "objc2-core-graphics")]
use objc2_core_graphics::*;
use objc2_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/pdfkit/pdfdisplaymode?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct PDFDisplayMode(pub NSInteger);
impl PDFDisplayMode {
    #[doc(alias = "kPDFDisplaySinglePage")]
    pub const SinglePage: Self = Self(0);
    #[doc(alias = "kPDFDisplaySinglePageContinuous")]
    pub const SinglePageContinuous: Self = Self(1);
    #[doc(alias = "kPDFDisplayTwoUp")]
    pub const TwoUp: Self = Self(2);
    #[doc(alias = "kPDFDisplayTwoUpContinuous")]
    pub const TwoUpContinuous: Self = Self(3);
}

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

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

/// [Apple's documentation](https://developer.apple.com/documentation/pdfkit/pdfdisplaydirection?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct PDFDisplayDirection(pub NSInteger);
impl PDFDisplayDirection {
    #[doc(alias = "kPDFDisplayDirectionVertical")]
    pub const Vertical: Self = Self(0);
    #[doc(alias = "kPDFDisplayDirectionHorizontal")]
    pub const Horizontal: Self = Self(1);
}

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

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

/// [Apple's documentation](https://developer.apple.com/documentation/pdfkit/pdfinterpolationquality?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct PDFInterpolationQuality(pub NSInteger);
impl PDFInterpolationQuality {
    #[doc(alias = "kPDFInterpolationQualityNone")]
    pub const None: Self = Self(0);
    #[doc(alias = "kPDFInterpolationQualityLow")]
    pub const Low: Self = Self(1);
    #[doc(alias = "kPDFInterpolationQualityHigh")]
    pub const High: Self = Self(2);
}

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

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

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/pdfkit/pdfviewdocumentchangednotification?language=objc)
    pub static PDFViewDocumentChangedNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/pdfkit/pdfviewchangedhistorynotification?language=objc)
    pub static PDFViewChangedHistoryNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/pdfkit/pdfviewpagechangednotification?language=objc)
    pub static PDFViewPageChangedNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/pdfkit/pdfviewscalechangednotification?language=objc)
    pub static PDFViewScaleChangedNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/pdfkit/pdfviewannotationhitnotification?language=objc)
    pub static PDFViewAnnotationHitNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/pdfkit/pdfviewcopypermissionnotification?language=objc)
    pub static PDFViewCopyPermissionNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/pdfkit/pdfviewprintpermissionnotification?language=objc)
    pub static PDFViewPrintPermissionNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/pdfkit/pdfviewannotationwillhitnotification?language=objc)
    pub static PDFViewAnnotationWillHitNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/pdfkit/pdfviewselectionchangednotification?language=objc)
    pub static PDFViewSelectionChangedNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/pdfkit/pdfviewdisplaymodechangednotification?language=objc)
    pub static PDFViewDisplayModeChangedNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/pdfkit/pdfviewdisplayboxchangednotification?language=objc)
    pub static PDFViewDisplayBoxChangedNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/pdfkit/pdfviewvisiblepageschangednotification?language=objc)
    pub static PDFViewVisiblePagesChangedNotification: &'static NSNotificationName;
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/pdfkit/pdfview?language=objc)
    #[unsafe(super(NSView, NSResponder, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "objc2-app-kit")]
    #[cfg(target_os = "macos")]
    pub struct PDFView;
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSAccessibility for PDFView {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSAccessibilityElementProtocol for PDFView {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSAnimatablePropertyContainer for PDFView {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSAnimationDelegate for PDFView {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSAppearanceCustomization for PDFView {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSCoding for PDFView {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSDraggingDestination for PDFView {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSMenuDelegate for PDFView {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSObjectProtocol for PDFView {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSUserInterfaceItemIdentification for PDFView {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl PDFView {
    extern_methods!(
        #[cfg(feature = "PDFDocument")]
        #[unsafe(method(document))]
        #[unsafe(method_family = none)]
        pub unsafe fn document(&self) -> Option<Retained<PDFDocument>>;

        #[cfg(feature = "PDFDocument")]
        /// Setter for [`document`][Self::document].
        #[unsafe(method(setDocument:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDocument(&self, document: Option<&PDFDocument>);

        #[unsafe(method(canGoToFirstPage))]
        #[unsafe(method_family = none)]
        pub unsafe fn canGoToFirstPage(&self) -> bool;

        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[unsafe(method(goToFirstPage:))]
        #[unsafe(method_family = none)]
        pub unsafe fn goToFirstPage(&self, sender: Option<&AnyObject>);

        #[unsafe(method(canGoToLastPage))]
        #[unsafe(method_family = none)]
        pub unsafe fn canGoToLastPage(&self) -> bool;

        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[unsafe(method(goToLastPage:))]
        #[unsafe(method_family = none)]
        pub unsafe fn goToLastPage(&self, sender: Option<&AnyObject>);

        #[unsafe(method(canGoToNextPage))]
        #[unsafe(method_family = none)]
        pub unsafe fn canGoToNextPage(&self) -> bool;

        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[unsafe(method(goToNextPage:))]
        #[unsafe(method_family = none)]
        pub unsafe fn goToNextPage(&self, sender: Option<&AnyObject>);

        #[unsafe(method(canGoToPreviousPage))]
        #[unsafe(method_family = none)]
        pub unsafe fn canGoToPreviousPage(&self) -> bool;

        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[unsafe(method(goToPreviousPage:))]
        #[unsafe(method_family = none)]
        pub unsafe fn goToPreviousPage(&self, sender: Option<&AnyObject>);

        #[unsafe(method(canGoBack))]
        #[unsafe(method_family = none)]
        pub unsafe fn canGoBack(&self) -> bool;

        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[unsafe(method(goBack:))]
        #[unsafe(method_family = none)]
        pub unsafe fn goBack(&self, sender: Option<&AnyObject>);

        #[unsafe(method(canGoForward))]
        #[unsafe(method_family = none)]
        pub unsafe fn canGoForward(&self) -> bool;

        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[unsafe(method(goForward:))]
        #[unsafe(method_family = none)]
        pub unsafe fn goForward(&self, sender: Option<&AnyObject>);

        #[cfg(feature = "PDFPage")]
        #[unsafe(method(currentPage))]
        #[unsafe(method_family = none)]
        pub unsafe fn currentPage(&self) -> Option<Retained<PDFPage>>;

        #[cfg(feature = "PDFPage")]
        #[unsafe(method(goToPage:))]
        #[unsafe(method_family = none)]
        pub unsafe fn goToPage(&self, page: &PDFPage);

        #[cfg(feature = "PDFDestination")]
        #[unsafe(method(currentDestination))]
        #[unsafe(method_family = none)]
        pub unsafe fn currentDestination(&self) -> Option<Retained<PDFDestination>>;

        #[cfg(feature = "PDFDestination")]
        #[unsafe(method(goToDestination:))]
        #[unsafe(method_family = none)]
        pub unsafe fn goToDestination(&self, destination: &PDFDestination);

        #[cfg(feature = "PDFSelection")]
        #[unsafe(method(goToSelection:))]
        #[unsafe(method_family = none)]
        pub unsafe fn goToSelection(&self, selection: &PDFSelection);

        #[cfg(feature = "PDFPage")]
        #[unsafe(method(goToRect:onPage:))]
        #[unsafe(method_family = none)]
        pub unsafe fn goToRect_onPage(&self, rect: NSRect, page: &PDFPage);

        #[unsafe(method(displayMode))]
        #[unsafe(method_family = none)]
        pub unsafe fn displayMode(&self) -> PDFDisplayMode;

        /// Setter for [`displayMode`][Self::displayMode].
        #[unsafe(method(setDisplayMode:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDisplayMode(&self, display_mode: PDFDisplayMode);

        #[unsafe(method(displayDirection))]
        #[unsafe(method_family = none)]
        pub unsafe fn displayDirection(&self) -> PDFDisplayDirection;

        /// Setter for [`displayDirection`][Self::displayDirection].
        #[unsafe(method(setDisplayDirection:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDisplayDirection(&self, display_direction: PDFDisplayDirection);

        #[unsafe(method(displaysPageBreaks))]
        #[unsafe(method_family = none)]
        pub unsafe fn displaysPageBreaks(&self) -> bool;

        /// Setter for [`displaysPageBreaks`][Self::displaysPageBreaks].
        #[unsafe(method(setDisplaysPageBreaks:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDisplaysPageBreaks(&self, displays_page_breaks: bool);

        #[unsafe(method(pageBreakMargins))]
        #[unsafe(method_family = none)]
        pub unsafe fn pageBreakMargins(&self) -> NSEdgeInsets;

        /// Setter for [`pageBreakMargins`][Self::pageBreakMargins].
        #[unsafe(method(setPageBreakMargins:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPageBreakMargins(&self, page_break_margins: NSEdgeInsets);

        #[cfg(feature = "PDFPage")]
        #[unsafe(method(displayBox))]
        #[unsafe(method_family = none)]
        pub unsafe fn displayBox(&self) -> PDFDisplayBox;

        #[cfg(feature = "PDFPage")]
        /// Setter for [`displayBox`][Self::displayBox].
        #[unsafe(method(setDisplayBox:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDisplayBox(&self, display_box: PDFDisplayBox);

        #[unsafe(method(displaysAsBook))]
        #[unsafe(method_family = none)]
        pub unsafe fn displaysAsBook(&self) -> bool;

        /// Setter for [`displaysAsBook`][Self::displaysAsBook].
        #[unsafe(method(setDisplaysAsBook:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDisplaysAsBook(&self, displays_as_book: bool);

        #[unsafe(method(displaysRTL))]
        #[unsafe(method_family = none)]
        pub unsafe fn displaysRTL(&self) -> bool;

        /// Setter for [`displaysRTL`][Self::displaysRTL].
        #[unsafe(method(setDisplaysRTL:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDisplaysRTL(&self, displays_rtl: bool);

        #[unsafe(method(backgroundColor))]
        #[unsafe(method_family = none)]
        pub unsafe fn backgroundColor(&self) -> Retained<NSColor>;

        /// Setter for [`backgroundColor`][Self::backgroundColor].
        #[unsafe(method(setBackgroundColor:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setBackgroundColor(&self, background_color: &NSColor);

        #[unsafe(method(interpolationQuality))]
        #[unsafe(method_family = none)]
        pub unsafe fn interpolationQuality(&self) -> PDFInterpolationQuality;

        /// Setter for [`interpolationQuality`][Self::interpolationQuality].
        #[unsafe(method(setInterpolationQuality:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setInterpolationQuality(
            &self,
            interpolation_quality: PDFInterpolationQuality,
        );

        #[unsafe(method(pageShadowsEnabled))]
        #[unsafe(method_family = none)]
        pub unsafe fn pageShadowsEnabled(&self) -> bool;

        /// Setter for [`pageShadowsEnabled`][Self::pageShadowsEnabled].
        #[unsafe(method(enablePageShadows:))]
        #[unsafe(method_family = none)]
        pub unsafe fn enablePageShadows(&self, page_shadows_enabled: bool);

        #[unsafe(method(delegate))]
        #[unsafe(method_family = none)]
        pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn PDFViewDelegate>>>;

        /// Setter for [`delegate`][Self::delegate].
        ///
        /// This is a [weak property][objc2::topics::weak_property].
        #[unsafe(method(setDelegate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn PDFViewDelegate>>);

        #[cfg(feature = "PDFPageOverlayViewProvider")]
        #[unsafe(method(pageOverlayViewProvider))]
        #[unsafe(method_family = none)]
        pub unsafe fn pageOverlayViewProvider(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn PDFPageOverlayViewProvider>>>;

        #[cfg(feature = "PDFPageOverlayViewProvider")]
        /// Setter for [`pageOverlayViewProvider`][Self::pageOverlayViewProvider].
        ///
        /// This is a [weak property][objc2::topics::weak_property].
        #[unsafe(method(setPageOverlayViewProvider:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPageOverlayViewProvider(
            &self,
            page_overlay_view_provider: Option<&ProtocolObject<dyn PDFPageOverlayViewProvider>>,
        );

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(scaleFactor))]
        #[unsafe(method_family = none)]
        pub unsafe fn scaleFactor(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`scaleFactor`][Self::scaleFactor].
        #[unsafe(method(setScaleFactor:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setScaleFactor(&self, scale_factor: CGFloat);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(minScaleFactor))]
        #[unsafe(method_family = none)]
        pub unsafe fn minScaleFactor(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`minScaleFactor`][Self::minScaleFactor].
        #[unsafe(method(setMinScaleFactor:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setMinScaleFactor(&self, min_scale_factor: CGFloat);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(maxScaleFactor))]
        #[unsafe(method_family = none)]
        pub unsafe fn maxScaleFactor(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`maxScaleFactor`][Self::maxScaleFactor].
        #[unsafe(method(setMaxScaleFactor:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setMaxScaleFactor(&self, max_scale_factor: CGFloat);

        #[unsafe(method(autoScales))]
        #[unsafe(method_family = none)]
        pub unsafe fn autoScales(&self) -> bool;

        /// Setter for [`autoScales`][Self::autoScales].
        #[unsafe(method(setAutoScales:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAutoScales(&self, auto_scales: bool);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(scaleFactorForSizeToFit))]
        #[unsafe(method_family = none)]
        pub unsafe fn scaleFactorForSizeToFit(&self) -> CGFloat;

        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[unsafe(method(zoomIn:))]
        #[unsafe(method_family = none)]
        pub unsafe fn zoomIn(&self, sender: Option<&AnyObject>);

        #[unsafe(method(canZoomIn))]
        #[unsafe(method_family = none)]
        pub unsafe fn canZoomIn(&self) -> bool;

        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[unsafe(method(zoomOut:))]
        #[unsafe(method_family = none)]
        pub unsafe fn zoomOut(&self, sender: Option<&AnyObject>);

        #[unsafe(method(canZoomOut))]
        #[unsafe(method_family = none)]
        pub unsafe fn canZoomOut(&self) -> bool;

        #[cfg(feature = "PDFPage")]
        #[unsafe(method(areaOfInterestForMouse:))]
        #[unsafe(method_family = none)]
        pub unsafe fn areaOfInterestForMouse(&self, event: &NSEvent) -> PDFAreaOfInterest;

        #[cfg(feature = "PDFPage")]
        #[unsafe(method(areaOfInterestForPoint:))]
        #[unsafe(method_family = none)]
        pub unsafe fn areaOfInterestForPoint(&self, cursor_location: NSPoint) -> PDFAreaOfInterest;

        #[cfg(feature = "PDFPage")]
        #[unsafe(method(setCursorForAreaOfInterest:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCursorForAreaOfInterest(&self, area: PDFAreaOfInterest);

        #[cfg(feature = "PDFAction")]
        #[unsafe(method(performAction:))]
        #[unsafe(method_family = none)]
        pub unsafe fn performAction(&self, action: &PDFAction);

        #[cfg(feature = "PDFSelection")]
        #[unsafe(method(currentSelection))]
        #[unsafe(method_family = none)]
        pub unsafe fn currentSelection(&self) -> Option<Retained<PDFSelection>>;

        #[cfg(feature = "PDFSelection")]
        /// Setter for [`currentSelection`][Self::currentSelection].
        #[unsafe(method(setCurrentSelection:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCurrentSelection(&self, current_selection: Option<&PDFSelection>);

        #[cfg(feature = "PDFSelection")]
        #[unsafe(method(setCurrentSelection:animate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCurrentSelection_animate(
            &self,
            selection: Option<&PDFSelection>,
            animate: bool,
        );

        #[unsafe(method(clearSelection))]
        #[unsafe(method_family = none)]
        pub unsafe fn clearSelection(&self);

        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[unsafe(method(selectAll:))]
        #[unsafe(method_family = none)]
        pub unsafe fn selectAll(&self, sender: Option<&AnyObject>);

        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[unsafe(method(scrollSelectionToVisible:))]
        #[unsafe(method_family = none)]
        pub unsafe fn scrollSelectionToVisible(&self, sender: Option<&AnyObject>);

        #[cfg(feature = "PDFSelection")]
        #[unsafe(method(highlightedSelections))]
        #[unsafe(method_family = none)]
        pub unsafe fn highlightedSelections(&self) -> Option<Retained<NSArray<PDFSelection>>>;

        #[cfg(feature = "PDFSelection")]
        /// Setter for [`highlightedSelections`][Self::highlightedSelections].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setHighlightedSelections:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setHighlightedSelections(
            &self,
            highlighted_selections: Option<&NSArray<PDFSelection>>,
        );

        #[cfg(all(feature = "PDFPage", feature = "objc2-core-graphics"))]
        #[unsafe(method(drawPage:toContext:))]
        #[unsafe(method_family = none)]
        pub unsafe fn drawPage_toContext(&self, page: &PDFPage, context: &CGContext);

        #[cfg(all(feature = "PDFPage", feature = "objc2-core-graphics"))]
        #[unsafe(method(drawPagePost:toContext:))]
        #[unsafe(method_family = none)]
        pub unsafe fn drawPagePost_toContext(&self, page: &PDFPage, context: &CGContext);

        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[unsafe(method(copy:))]
        #[unsafe(method_family = none)]
        pub unsafe fn copy(&self, sender: Option<&AnyObject>);

        #[unsafe(method(printWithInfo:autoRotate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn printWithInfo_autoRotate(&self, print_info: &NSPrintInfo, do_rotate: bool);

        #[cfg(feature = "PDFDocument")]
        #[unsafe(method(printWithInfo:autoRotate:pageScaling:))]
        #[unsafe(method_family = none)]
        pub unsafe fn printWithInfo_autoRotate_pageScaling(
            &self,
            print_info: &NSPrintInfo,
            do_rotate: bool,
            scale: PDFPrintScalingMode,
        );

        #[cfg(feature = "PDFPage")]
        #[unsafe(method(pageForPoint:nearest:))]
        #[unsafe(method_family = none)]
        pub unsafe fn pageForPoint_nearest(
            &self,
            point: NSPoint,
            nearest: bool,
        ) -> Option<Retained<PDFPage>>;

        #[cfg(feature = "PDFPage")]
        #[unsafe(method(convertPoint:toPage:))]
        #[unsafe(method_family = none)]
        pub unsafe fn convertPoint_toPage(&self, point: NSPoint, page: &PDFPage) -> NSPoint;

        #[cfg(feature = "PDFPage")]
        #[unsafe(method(convertRect:toPage:))]
        #[unsafe(method_family = none)]
        pub unsafe fn convertRect_toPage(&self, rect: NSRect, page: &PDFPage) -> NSRect;

        #[cfg(feature = "PDFPage")]
        #[unsafe(method(convertPoint:fromPage:))]
        #[unsafe(method_family = none)]
        pub unsafe fn convertPoint_fromPage(&self, point: NSPoint, page: &PDFPage) -> NSPoint;

        #[cfg(feature = "PDFPage")]
        #[unsafe(method(convertRect:fromPage:))]
        #[unsafe(method_family = none)]
        pub unsafe fn convertRect_fromPage(&self, rect: NSRect, page: &PDFPage) -> NSRect;

        #[unsafe(method(documentView))]
        #[unsafe(method_family = none)]
        pub unsafe fn documentView(&self) -> Option<Retained<NSView>>;

        #[unsafe(method(layoutDocumentView))]
        #[unsafe(method_family = none)]
        pub unsafe fn layoutDocumentView(&self);

        #[cfg(feature = "PDFPage")]
        #[unsafe(method(annotationsChangedOnPage:))]
        #[unsafe(method_family = none)]
        pub unsafe fn annotationsChangedOnPage(&self, page: &PDFPage);

        #[cfg(feature = "PDFPage")]
        #[unsafe(method(rowSizeForPage:))]
        #[unsafe(method_family = none)]
        pub unsafe fn rowSizeForPage(&self, page: &PDFPage) -> NSSize;

        #[unsafe(method(acceptsDraggedFiles))]
        #[unsafe(method_family = none)]
        pub unsafe fn acceptsDraggedFiles(&self) -> bool;

        /// Setter for [`acceptsDraggedFiles`][Self::acceptsDraggedFiles].
        #[unsafe(method(setAcceptsDraggedFiles:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAcceptsDraggedFiles(&self, accepts_dragged_files: bool);

        #[cfg(feature = "PDFPage")]
        #[unsafe(method(visiblePages))]
        #[unsafe(method_family = none)]
        pub unsafe fn visiblePages(&self) -> Retained<NSArray<PDFPage>>;

        #[deprecated]
        #[unsafe(method(enableDataDetectors))]
        #[unsafe(method_family = none)]
        pub unsafe fn enableDataDetectors(&self) -> bool;

        /// Setter for [`enableDataDetectors`][Self::enableDataDetectors].
        #[deprecated]
        #[unsafe(method(setEnableDataDetectors:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setEnableDataDetectors(&self, enable_data_detectors: bool);

        #[unsafe(method(isInMarkupMode))]
        #[unsafe(method_family = none)]
        pub unsafe fn isInMarkupMode(&self) -> bool;

        /// Setter for [`isInMarkupMode`][Self::isInMarkupMode].
        #[unsafe(method(setInMarkupMode:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setInMarkupMode(&self, in_markup_mode: bool);
    );
}

/// Methods declared on superclass `NSView`.
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl PDFView {
    extern_methods!(
        #[unsafe(method(initWithFrame:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;

        /// # Safety
        ///
        /// `coder` possibly has further requirements.
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;
    );
}

/// Methods declared on superclass `NSResponder`.
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl PDFView {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl PDFView {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/pdfkit/pdfviewdelegate?language=objc)
    pub unsafe trait PDFViewDelegate: NSObjectProtocol {
        #[cfg(feature = "objc2-app-kit")]
        #[cfg(target_os = "macos")]
        #[optional]
        #[unsafe(method(PDFViewWillClickOnLink:withURL:))]
        #[unsafe(method_family = none)]
        unsafe fn PDFViewWillClickOnLink_withURL(&self, sender: &PDFView, url: &NSURL);

        #[cfg(all(feature = "objc2-app-kit", feature = "objc2-core-foundation"))]
        #[cfg(target_os = "macos")]
        #[optional]
        #[unsafe(method(PDFViewWillChangeScaleFactor:toScale:))]
        #[unsafe(method_family = none)]
        unsafe fn PDFViewWillChangeScaleFactor_toScale(
            &self,
            sender: &PDFView,
            scaler: CGFloat,
        ) -> CGFloat;

        #[cfg(feature = "objc2-app-kit")]
        #[cfg(target_os = "macos")]
        #[optional]
        #[unsafe(method(PDFViewPrintJobTitle:))]
        #[unsafe(method_family = none)]
        unsafe fn PDFViewPrintJobTitle(&self, sender: &PDFView) -> Retained<NSString>;

        #[cfg(feature = "objc2-app-kit")]
        #[cfg(target_os = "macos")]
        #[optional]
        #[unsafe(method(PDFViewPerformPrint:))]
        #[unsafe(method_family = none)]
        unsafe fn PDFViewPerformPrint(&self, sender: &PDFView);

        #[cfg(feature = "objc2-app-kit")]
        #[cfg(target_os = "macos")]
        #[optional]
        #[unsafe(method(PDFViewPerformFind:))]
        #[unsafe(method_family = none)]
        unsafe fn PDFViewPerformFind(&self, sender: &PDFView);

        #[cfg(feature = "objc2-app-kit")]
        #[cfg(target_os = "macos")]
        #[optional]
        #[unsafe(method(PDFViewPerformGoToPage:))]
        #[unsafe(method_family = none)]
        unsafe fn PDFViewPerformGoToPage(&self, sender: &PDFView);

        #[cfg(all(
            feature = "PDFAction",
            feature = "PDFActionRemoteGoTo",
            feature = "objc2-app-kit"
        ))]
        #[cfg(target_os = "macos")]
        #[optional]
        #[unsafe(method(PDFViewOpenPDF:forRemoteGoToAction:))]
        #[unsafe(method_family = none)]
        unsafe fn PDFViewOpenPDF_forRemoteGoToAction(
            &self,
            sender: &PDFView,
            action: &PDFActionRemoteGoTo,
        );
    }
);

/// PDFViewDeprecated.
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl PDFView {
    extern_methods!(
        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[deprecated]
        #[unsafe(method(takePasswordFrom:))]
        #[unsafe(method_family = none)]
        pub unsafe fn takePasswordFrom(&self, sender: &AnyObject);

        #[cfg(feature = "PDFPage")]
        #[deprecated]
        #[unsafe(method(drawPage:))]
        #[unsafe(method_family = none)]
        pub unsafe fn drawPage(&self, page: &PDFPage);

        #[cfg(feature = "PDFPage")]
        #[deprecated]
        #[unsafe(method(drawPagePost:))]
        #[unsafe(method_family = none)]
        pub unsafe fn drawPagePost(&self, page: &PDFPage);

        #[deprecated]
        #[unsafe(method(shouldAntiAlias))]
        #[unsafe(method_family = none)]
        pub unsafe fn shouldAntiAlias(&self) -> bool;

        /// Setter for [`shouldAntiAlias`][Self::shouldAntiAlias].
        #[deprecated]
        #[unsafe(method(setShouldAntiAlias:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setShouldAntiAlias(&self, should_anti_alias: bool);

        #[cfg(feature = "objc2-core-foundation")]
        #[deprecated]
        #[unsafe(method(greekingThreshold))]
        #[unsafe(method_family = none)]
        pub unsafe fn greekingThreshold(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`greekingThreshold`][Self::greekingThreshold].
        #[deprecated]
        #[unsafe(method(setGreekingThreshold:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setGreekingThreshold(&self, greeking_threshold: CGFloat);

        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[deprecated]
        #[unsafe(method(takeBackgroundColorFrom:))]
        #[unsafe(method_family = none)]
        pub unsafe fn takeBackgroundColorFrom(&self, sender: &AnyObject);

        #[deprecated]
        #[unsafe(method(allowsDragging))]
        #[unsafe(method_family = none)]
        pub unsafe fn allowsDragging(&self) -> bool;

        /// Setter for [`allowsDragging`][Self::allowsDragging].
        #[deprecated]
        #[unsafe(method(setAllowsDragging:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAllowsDragging(&self, allows_dragging: bool);
    );
}