1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-app-kit")]
7#[cfg(target_os = "macos")]
8use objc2_app_kit::*;
9#[cfg(feature = "objc2-core-foundation")]
10use objc2_core_foundation::*;
11#[cfg(feature = "objc2-core-graphics")]
12use objc2_core_graphics::*;
13use objc2_foundation::*;
14
15use crate::*;
16
17#[repr(transparent)]
20#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
21pub struct PDFDisplayMode(pub NSInteger);
22impl PDFDisplayMode {
23 #[doc(alias = "kPDFDisplaySinglePage")]
24 pub const SinglePage: Self = Self(0);
25 #[doc(alias = "kPDFDisplaySinglePageContinuous")]
26 pub const SinglePageContinuous: Self = Self(1);
27 #[doc(alias = "kPDFDisplayTwoUp")]
28 pub const TwoUp: Self = Self(2);
29 #[doc(alias = "kPDFDisplayTwoUpContinuous")]
30 pub const TwoUpContinuous: Self = Self(3);
31}
32
33unsafe impl Encode for PDFDisplayMode {
34 const ENCODING: Encoding = NSInteger::ENCODING;
35}
36
37unsafe impl RefEncode for PDFDisplayMode {
38 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
39}
40
41#[repr(transparent)]
44#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
45pub struct PDFDisplayDirection(pub NSInteger);
46impl PDFDisplayDirection {
47 #[doc(alias = "kPDFDisplayDirectionVertical")]
48 pub const Vertical: Self = Self(0);
49 #[doc(alias = "kPDFDisplayDirectionHorizontal")]
50 pub const Horizontal: Self = Self(1);
51}
52
53unsafe impl Encode for PDFDisplayDirection {
54 const ENCODING: Encoding = NSInteger::ENCODING;
55}
56
57unsafe impl RefEncode for PDFDisplayDirection {
58 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
59}
60
61#[repr(transparent)]
64#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
65pub struct PDFInterpolationQuality(pub NSInteger);
66impl PDFInterpolationQuality {
67 #[doc(alias = "kPDFInterpolationQualityNone")]
68 pub const None: Self = Self(0);
69 #[doc(alias = "kPDFInterpolationQualityLow")]
70 pub const Low: Self = Self(1);
71 #[doc(alias = "kPDFInterpolationQualityHigh")]
72 pub const High: Self = Self(2);
73}
74
75unsafe impl Encode for PDFInterpolationQuality {
76 const ENCODING: Encoding = NSInteger::ENCODING;
77}
78
79unsafe impl RefEncode for PDFInterpolationQuality {
80 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
81}
82
83extern "C" {
84 pub static PDFViewDocumentChangedNotification: &'static NSNotificationName;
86}
87
88extern "C" {
89 pub static PDFViewChangedHistoryNotification: &'static NSNotificationName;
91}
92
93extern "C" {
94 pub static PDFViewPageChangedNotification: &'static NSNotificationName;
96}
97
98extern "C" {
99 pub static PDFViewScaleChangedNotification: &'static NSNotificationName;
101}
102
103extern "C" {
104 pub static PDFViewAnnotationHitNotification: &'static NSNotificationName;
106}
107
108extern "C" {
109 pub static PDFViewCopyPermissionNotification: &'static NSNotificationName;
111}
112
113extern "C" {
114 pub static PDFViewPrintPermissionNotification: &'static NSNotificationName;
116}
117
118extern "C" {
119 pub static PDFViewAnnotationWillHitNotification: &'static NSNotificationName;
121}
122
123extern "C" {
124 pub static PDFViewSelectionChangedNotification: &'static NSNotificationName;
126}
127
128extern "C" {
129 pub static PDFViewDisplayModeChangedNotification: &'static NSNotificationName;
131}
132
133extern "C" {
134 pub static PDFViewDisplayBoxChangedNotification: &'static NSNotificationName;
136}
137
138extern "C" {
139 pub static PDFViewVisiblePagesChangedNotification: &'static NSNotificationName;
141}
142
143extern_class!(
144 #[unsafe(super(NSView, NSResponder, NSObject))]
146 #[derive(Debug, PartialEq, Eq, Hash)]
147 #[cfg(feature = "objc2-app-kit")]
148 #[cfg(target_os = "macos")]
149 pub struct PDFView;
150);
151
152#[cfg(feature = "objc2-app-kit")]
153#[cfg(target_os = "macos")]
154extern_conformance!(
155 unsafe impl NSAccessibility for PDFView {}
156);
157
158#[cfg(feature = "objc2-app-kit")]
159#[cfg(target_os = "macos")]
160extern_conformance!(
161 unsafe impl NSAccessibilityElementProtocol for PDFView {}
162);
163
164#[cfg(feature = "objc2-app-kit")]
165#[cfg(target_os = "macos")]
166extern_conformance!(
167 unsafe impl NSAnimatablePropertyContainer for PDFView {}
168);
169
170#[cfg(feature = "objc2-app-kit")]
171#[cfg(target_os = "macos")]
172extern_conformance!(
173 unsafe impl NSAnimationDelegate for PDFView {}
174);
175
176#[cfg(feature = "objc2-app-kit")]
177#[cfg(target_os = "macos")]
178extern_conformance!(
179 unsafe impl NSAppearanceCustomization for PDFView {}
180);
181
182#[cfg(feature = "objc2-app-kit")]
183#[cfg(target_os = "macos")]
184extern_conformance!(
185 unsafe impl NSCoding for PDFView {}
186);
187
188#[cfg(feature = "objc2-app-kit")]
189#[cfg(target_os = "macos")]
190extern_conformance!(
191 unsafe impl NSDraggingDestination for PDFView {}
192);
193
194#[cfg(feature = "objc2-app-kit")]
195#[cfg(target_os = "macos")]
196extern_conformance!(
197 unsafe impl NSMenuDelegate for PDFView {}
198);
199
200#[cfg(feature = "objc2-app-kit")]
201#[cfg(target_os = "macos")]
202extern_conformance!(
203 unsafe impl NSObjectProtocol for PDFView {}
204);
205
206#[cfg(feature = "objc2-app-kit")]
207#[cfg(target_os = "macos")]
208extern_conformance!(
209 unsafe impl NSUserInterfaceItemIdentification for PDFView {}
210);
211
212#[cfg(feature = "objc2-app-kit")]
213#[cfg(target_os = "macos")]
214impl PDFView {
215 extern_methods!(
216 #[cfg(feature = "PDFDocument")]
217 #[unsafe(method(document))]
218 #[unsafe(method_family = none)]
219 pub unsafe fn document(&self) -> Option<Retained<PDFDocument>>;
220
221 #[cfg(feature = "PDFDocument")]
222 #[unsafe(method(setDocument:))]
224 #[unsafe(method_family = none)]
225 pub unsafe fn setDocument(&self, document: Option<&PDFDocument>);
226
227 #[unsafe(method(canGoToFirstPage))]
228 #[unsafe(method_family = none)]
229 pub unsafe fn canGoToFirstPage(&self) -> bool;
230
231 #[unsafe(method(goToFirstPage:))]
235 #[unsafe(method_family = none)]
236 pub unsafe fn goToFirstPage(&self, sender: Option<&AnyObject>);
237
238 #[unsafe(method(canGoToLastPage))]
239 #[unsafe(method_family = none)]
240 pub unsafe fn canGoToLastPage(&self) -> bool;
241
242 #[unsafe(method(goToLastPage:))]
246 #[unsafe(method_family = none)]
247 pub unsafe fn goToLastPage(&self, sender: Option<&AnyObject>);
248
249 #[unsafe(method(canGoToNextPage))]
250 #[unsafe(method_family = none)]
251 pub unsafe fn canGoToNextPage(&self) -> bool;
252
253 #[unsafe(method(goToNextPage:))]
257 #[unsafe(method_family = none)]
258 pub unsafe fn goToNextPage(&self, sender: Option<&AnyObject>);
259
260 #[unsafe(method(canGoToPreviousPage))]
261 #[unsafe(method_family = none)]
262 pub unsafe fn canGoToPreviousPage(&self) -> bool;
263
264 #[unsafe(method(goToPreviousPage:))]
268 #[unsafe(method_family = none)]
269 pub unsafe fn goToPreviousPage(&self, sender: Option<&AnyObject>);
270
271 #[unsafe(method(canGoBack))]
272 #[unsafe(method_family = none)]
273 pub unsafe fn canGoBack(&self) -> bool;
274
275 #[unsafe(method(goBack:))]
279 #[unsafe(method_family = none)]
280 pub unsafe fn goBack(&self, sender: Option<&AnyObject>);
281
282 #[unsafe(method(canGoForward))]
283 #[unsafe(method_family = none)]
284 pub unsafe fn canGoForward(&self) -> bool;
285
286 #[unsafe(method(goForward:))]
290 #[unsafe(method_family = none)]
291 pub unsafe fn goForward(&self, sender: Option<&AnyObject>);
292
293 #[cfg(feature = "PDFPage")]
294 #[unsafe(method(currentPage))]
295 #[unsafe(method_family = none)]
296 pub unsafe fn currentPage(&self) -> Option<Retained<PDFPage>>;
297
298 #[cfg(feature = "PDFPage")]
299 #[unsafe(method(goToPage:))]
300 #[unsafe(method_family = none)]
301 pub unsafe fn goToPage(&self, page: &PDFPage);
302
303 #[cfg(feature = "PDFDestination")]
304 #[unsafe(method(currentDestination))]
305 #[unsafe(method_family = none)]
306 pub unsafe fn currentDestination(&self) -> Option<Retained<PDFDestination>>;
307
308 #[cfg(feature = "PDFDestination")]
309 #[unsafe(method(goToDestination:))]
310 #[unsafe(method_family = none)]
311 pub unsafe fn goToDestination(&self, destination: &PDFDestination);
312
313 #[cfg(feature = "PDFSelection")]
314 #[unsafe(method(goToSelection:))]
315 #[unsafe(method_family = none)]
316 pub unsafe fn goToSelection(&self, selection: &PDFSelection);
317
318 #[cfg(feature = "PDFPage")]
319 #[unsafe(method(goToRect:onPage:))]
320 #[unsafe(method_family = none)]
321 pub unsafe fn goToRect_onPage(&self, rect: NSRect, page: &PDFPage);
322
323 #[unsafe(method(displayMode))]
324 #[unsafe(method_family = none)]
325 pub unsafe fn displayMode(&self) -> PDFDisplayMode;
326
327 #[unsafe(method(setDisplayMode:))]
329 #[unsafe(method_family = none)]
330 pub unsafe fn setDisplayMode(&self, display_mode: PDFDisplayMode);
331
332 #[unsafe(method(displayDirection))]
333 #[unsafe(method_family = none)]
334 pub unsafe fn displayDirection(&self) -> PDFDisplayDirection;
335
336 #[unsafe(method(setDisplayDirection:))]
338 #[unsafe(method_family = none)]
339 pub unsafe fn setDisplayDirection(&self, display_direction: PDFDisplayDirection);
340
341 #[unsafe(method(displaysPageBreaks))]
342 #[unsafe(method_family = none)]
343 pub unsafe fn displaysPageBreaks(&self) -> bool;
344
345 #[unsafe(method(setDisplaysPageBreaks:))]
347 #[unsafe(method_family = none)]
348 pub unsafe fn setDisplaysPageBreaks(&self, displays_page_breaks: bool);
349
350 #[unsafe(method(pageBreakMargins))]
351 #[unsafe(method_family = none)]
352 pub unsafe fn pageBreakMargins(&self) -> NSEdgeInsets;
353
354 #[unsafe(method(setPageBreakMargins:))]
356 #[unsafe(method_family = none)]
357 pub unsafe fn setPageBreakMargins(&self, page_break_margins: NSEdgeInsets);
358
359 #[cfg(feature = "PDFPage")]
360 #[unsafe(method(displayBox))]
361 #[unsafe(method_family = none)]
362 pub unsafe fn displayBox(&self) -> PDFDisplayBox;
363
364 #[cfg(feature = "PDFPage")]
365 #[unsafe(method(setDisplayBox:))]
367 #[unsafe(method_family = none)]
368 pub unsafe fn setDisplayBox(&self, display_box: PDFDisplayBox);
369
370 #[unsafe(method(displaysAsBook))]
371 #[unsafe(method_family = none)]
372 pub unsafe fn displaysAsBook(&self) -> bool;
373
374 #[unsafe(method(setDisplaysAsBook:))]
376 #[unsafe(method_family = none)]
377 pub unsafe fn setDisplaysAsBook(&self, displays_as_book: bool);
378
379 #[unsafe(method(displaysRTL))]
380 #[unsafe(method_family = none)]
381 pub unsafe fn displaysRTL(&self) -> bool;
382
383 #[unsafe(method(setDisplaysRTL:))]
385 #[unsafe(method_family = none)]
386 pub unsafe fn setDisplaysRTL(&self, displays_rtl: bool);
387
388 #[unsafe(method(backgroundColor))]
389 #[unsafe(method_family = none)]
390 pub unsafe fn backgroundColor(&self) -> Retained<NSColor>;
391
392 #[unsafe(method(setBackgroundColor:))]
394 #[unsafe(method_family = none)]
395 pub unsafe fn setBackgroundColor(&self, background_color: &NSColor);
396
397 #[unsafe(method(interpolationQuality))]
398 #[unsafe(method_family = none)]
399 pub unsafe fn interpolationQuality(&self) -> PDFInterpolationQuality;
400
401 #[unsafe(method(setInterpolationQuality:))]
403 #[unsafe(method_family = none)]
404 pub unsafe fn setInterpolationQuality(
405 &self,
406 interpolation_quality: PDFInterpolationQuality,
407 );
408
409 #[unsafe(method(pageShadowsEnabled))]
410 #[unsafe(method_family = none)]
411 pub unsafe fn pageShadowsEnabled(&self) -> bool;
412
413 #[unsafe(method(enablePageShadows:))]
415 #[unsafe(method_family = none)]
416 pub unsafe fn enablePageShadows(&self, page_shadows_enabled: bool);
417
418 #[unsafe(method(delegate))]
419 #[unsafe(method_family = none)]
420 pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn PDFViewDelegate>>>;
421
422 #[unsafe(method(setDelegate:))]
426 #[unsafe(method_family = none)]
427 pub unsafe fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn PDFViewDelegate>>);
428
429 #[cfg(feature = "PDFPageOverlayViewProvider")]
430 #[unsafe(method(pageOverlayViewProvider))]
431 #[unsafe(method_family = none)]
432 pub unsafe fn pageOverlayViewProvider(
433 &self,
434 ) -> Option<Retained<ProtocolObject<dyn PDFPageOverlayViewProvider>>>;
435
436 #[cfg(feature = "PDFPageOverlayViewProvider")]
437 #[unsafe(method(setPageOverlayViewProvider:))]
441 #[unsafe(method_family = none)]
442 pub unsafe fn setPageOverlayViewProvider(
443 &self,
444 page_overlay_view_provider: Option<&ProtocolObject<dyn PDFPageOverlayViewProvider>>,
445 );
446
447 #[cfg(feature = "objc2-core-foundation")]
448 #[unsafe(method(scaleFactor))]
449 #[unsafe(method_family = none)]
450 pub unsafe fn scaleFactor(&self) -> CGFloat;
451
452 #[cfg(feature = "objc2-core-foundation")]
453 #[unsafe(method(setScaleFactor:))]
455 #[unsafe(method_family = none)]
456 pub unsafe fn setScaleFactor(&self, scale_factor: CGFloat);
457
458 #[cfg(feature = "objc2-core-foundation")]
459 #[unsafe(method(minScaleFactor))]
460 #[unsafe(method_family = none)]
461 pub unsafe fn minScaleFactor(&self) -> CGFloat;
462
463 #[cfg(feature = "objc2-core-foundation")]
464 #[unsafe(method(setMinScaleFactor:))]
466 #[unsafe(method_family = none)]
467 pub unsafe fn setMinScaleFactor(&self, min_scale_factor: CGFloat);
468
469 #[cfg(feature = "objc2-core-foundation")]
470 #[unsafe(method(maxScaleFactor))]
471 #[unsafe(method_family = none)]
472 pub unsafe fn maxScaleFactor(&self) -> CGFloat;
473
474 #[cfg(feature = "objc2-core-foundation")]
475 #[unsafe(method(setMaxScaleFactor:))]
477 #[unsafe(method_family = none)]
478 pub unsafe fn setMaxScaleFactor(&self, max_scale_factor: CGFloat);
479
480 #[unsafe(method(autoScales))]
481 #[unsafe(method_family = none)]
482 pub unsafe fn autoScales(&self) -> bool;
483
484 #[unsafe(method(setAutoScales:))]
486 #[unsafe(method_family = none)]
487 pub unsafe fn setAutoScales(&self, auto_scales: bool);
488
489 #[cfg(feature = "objc2-core-foundation")]
490 #[unsafe(method(scaleFactorForSizeToFit))]
491 #[unsafe(method_family = none)]
492 pub unsafe fn scaleFactorForSizeToFit(&self) -> CGFloat;
493
494 #[unsafe(method(zoomIn:))]
498 #[unsafe(method_family = none)]
499 pub unsafe fn zoomIn(&self, sender: Option<&AnyObject>);
500
501 #[unsafe(method(canZoomIn))]
502 #[unsafe(method_family = none)]
503 pub unsafe fn canZoomIn(&self) -> bool;
504
505 #[unsafe(method(zoomOut:))]
509 #[unsafe(method_family = none)]
510 pub unsafe fn zoomOut(&self, sender: Option<&AnyObject>);
511
512 #[unsafe(method(canZoomOut))]
513 #[unsafe(method_family = none)]
514 pub unsafe fn canZoomOut(&self) -> bool;
515
516 #[cfg(feature = "PDFPage")]
517 #[unsafe(method(areaOfInterestForMouse:))]
518 #[unsafe(method_family = none)]
519 pub unsafe fn areaOfInterestForMouse(&self, event: &NSEvent) -> PDFAreaOfInterest;
520
521 #[cfg(feature = "PDFPage")]
522 #[unsafe(method(areaOfInterestForPoint:))]
523 #[unsafe(method_family = none)]
524 pub unsafe fn areaOfInterestForPoint(&self, cursor_location: NSPoint) -> PDFAreaOfInterest;
525
526 #[cfg(feature = "PDFPage")]
527 #[unsafe(method(setCursorForAreaOfInterest:))]
528 #[unsafe(method_family = none)]
529 pub unsafe fn setCursorForAreaOfInterest(&self, area: PDFAreaOfInterest);
530
531 #[cfg(feature = "PDFAction")]
532 #[unsafe(method(performAction:))]
533 #[unsafe(method_family = none)]
534 pub unsafe fn performAction(&self, action: &PDFAction);
535
536 #[cfg(feature = "PDFSelection")]
537 #[unsafe(method(currentSelection))]
538 #[unsafe(method_family = none)]
539 pub unsafe fn currentSelection(&self) -> Option<Retained<PDFSelection>>;
540
541 #[cfg(feature = "PDFSelection")]
542 #[unsafe(method(setCurrentSelection:))]
544 #[unsafe(method_family = none)]
545 pub unsafe fn setCurrentSelection(&self, current_selection: Option<&PDFSelection>);
546
547 #[cfg(feature = "PDFSelection")]
548 #[unsafe(method(setCurrentSelection:animate:))]
549 #[unsafe(method_family = none)]
550 pub unsafe fn setCurrentSelection_animate(
551 &self,
552 selection: Option<&PDFSelection>,
553 animate: bool,
554 );
555
556 #[unsafe(method(clearSelection))]
557 #[unsafe(method_family = none)]
558 pub unsafe fn clearSelection(&self);
559
560 #[unsafe(method(selectAll:))]
564 #[unsafe(method_family = none)]
565 pub unsafe fn selectAll(&self, sender: Option<&AnyObject>);
566
567 #[unsafe(method(scrollSelectionToVisible:))]
571 #[unsafe(method_family = none)]
572 pub unsafe fn scrollSelectionToVisible(&self, sender: Option<&AnyObject>);
573
574 #[cfg(feature = "PDFSelection")]
575 #[unsafe(method(highlightedSelections))]
576 #[unsafe(method_family = none)]
577 pub unsafe fn highlightedSelections(&self) -> Option<Retained<NSArray<PDFSelection>>>;
578
579 #[cfg(feature = "PDFSelection")]
580 #[unsafe(method(setHighlightedSelections:))]
584 #[unsafe(method_family = none)]
585 pub unsafe fn setHighlightedSelections(
586 &self,
587 highlighted_selections: Option<&NSArray<PDFSelection>>,
588 );
589
590 #[cfg(all(feature = "PDFPage", feature = "objc2-core-graphics"))]
591 #[unsafe(method(drawPage:toContext:))]
592 #[unsafe(method_family = none)]
593 pub unsafe fn drawPage_toContext(&self, page: &PDFPage, context: &CGContext);
594
595 #[cfg(all(feature = "PDFPage", feature = "objc2-core-graphics"))]
596 #[unsafe(method(drawPagePost:toContext:))]
597 #[unsafe(method_family = none)]
598 pub unsafe fn drawPagePost_toContext(&self, page: &PDFPage, context: &CGContext);
599
600 #[unsafe(method(copy:))]
604 #[unsafe(method_family = none)]
605 pub unsafe fn copy(&self, sender: Option<&AnyObject>);
606
607 #[unsafe(method(printWithInfo:autoRotate:))]
608 #[unsafe(method_family = none)]
609 pub unsafe fn printWithInfo_autoRotate(&self, print_info: &NSPrintInfo, do_rotate: bool);
610
611 #[cfg(feature = "PDFDocument")]
612 #[unsafe(method(printWithInfo:autoRotate:pageScaling:))]
613 #[unsafe(method_family = none)]
614 pub unsafe fn printWithInfo_autoRotate_pageScaling(
615 &self,
616 print_info: &NSPrintInfo,
617 do_rotate: bool,
618 scale: PDFPrintScalingMode,
619 );
620
621 #[cfg(feature = "PDFPage")]
622 #[unsafe(method(pageForPoint:nearest:))]
623 #[unsafe(method_family = none)]
624 pub unsafe fn pageForPoint_nearest(
625 &self,
626 point: NSPoint,
627 nearest: bool,
628 ) -> Option<Retained<PDFPage>>;
629
630 #[cfg(feature = "PDFPage")]
631 #[unsafe(method(convertPoint:toPage:))]
632 #[unsafe(method_family = none)]
633 pub unsafe fn convertPoint_toPage(&self, point: NSPoint, page: &PDFPage) -> NSPoint;
634
635 #[cfg(feature = "PDFPage")]
636 #[unsafe(method(convertRect:toPage:))]
637 #[unsafe(method_family = none)]
638 pub unsafe fn convertRect_toPage(&self, rect: NSRect, page: &PDFPage) -> NSRect;
639
640 #[cfg(feature = "PDFPage")]
641 #[unsafe(method(convertPoint:fromPage:))]
642 #[unsafe(method_family = none)]
643 pub unsafe fn convertPoint_fromPage(&self, point: NSPoint, page: &PDFPage) -> NSPoint;
644
645 #[cfg(feature = "PDFPage")]
646 #[unsafe(method(convertRect:fromPage:))]
647 #[unsafe(method_family = none)]
648 pub unsafe fn convertRect_fromPage(&self, rect: NSRect, page: &PDFPage) -> NSRect;
649
650 #[unsafe(method(documentView))]
651 #[unsafe(method_family = none)]
652 pub unsafe fn documentView(&self) -> Option<Retained<NSView>>;
653
654 #[unsafe(method(layoutDocumentView))]
655 #[unsafe(method_family = none)]
656 pub unsafe fn layoutDocumentView(&self);
657
658 #[cfg(feature = "PDFPage")]
659 #[unsafe(method(annotationsChangedOnPage:))]
660 #[unsafe(method_family = none)]
661 pub unsafe fn annotationsChangedOnPage(&self, page: &PDFPage);
662
663 #[cfg(feature = "PDFPage")]
664 #[unsafe(method(rowSizeForPage:))]
665 #[unsafe(method_family = none)]
666 pub unsafe fn rowSizeForPage(&self, page: &PDFPage) -> NSSize;
667
668 #[unsafe(method(acceptsDraggedFiles))]
669 #[unsafe(method_family = none)]
670 pub unsafe fn acceptsDraggedFiles(&self) -> bool;
671
672 #[unsafe(method(setAcceptsDraggedFiles:))]
674 #[unsafe(method_family = none)]
675 pub unsafe fn setAcceptsDraggedFiles(&self, accepts_dragged_files: bool);
676
677 #[cfg(feature = "PDFPage")]
678 #[unsafe(method(visiblePages))]
679 #[unsafe(method_family = none)]
680 pub unsafe fn visiblePages(&self) -> Retained<NSArray<PDFPage>>;
681
682 #[deprecated]
683 #[unsafe(method(enableDataDetectors))]
684 #[unsafe(method_family = none)]
685 pub unsafe fn enableDataDetectors(&self) -> bool;
686
687 #[deprecated]
689 #[unsafe(method(setEnableDataDetectors:))]
690 #[unsafe(method_family = none)]
691 pub unsafe fn setEnableDataDetectors(&self, enable_data_detectors: bool);
692
693 #[unsafe(method(isInMarkupMode))]
694 #[unsafe(method_family = none)]
695 pub unsafe fn isInMarkupMode(&self) -> bool;
696
697 #[unsafe(method(setInMarkupMode:))]
699 #[unsafe(method_family = none)]
700 pub unsafe fn setInMarkupMode(&self, in_markup_mode: bool);
701 );
702}
703
704#[cfg(feature = "objc2-app-kit")]
706#[cfg(target_os = "macos")]
707impl PDFView {
708 extern_methods!(
709 #[unsafe(method(initWithFrame:))]
710 #[unsafe(method_family = init)]
711 pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
712
713 #[unsafe(method(initWithCoder:))]
717 #[unsafe(method_family = init)]
718 pub unsafe fn initWithCoder(
719 this: Allocated<Self>,
720 coder: &NSCoder,
721 ) -> Option<Retained<Self>>;
722 );
723}
724
725#[cfg(feature = "objc2-app-kit")]
727#[cfg(target_os = "macos")]
728impl PDFView {
729 extern_methods!(
730 #[unsafe(method(init))]
731 #[unsafe(method_family = init)]
732 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
733 );
734}
735
736#[cfg(feature = "objc2-app-kit")]
738#[cfg(target_os = "macos")]
739impl PDFView {
740 extern_methods!(
741 #[unsafe(method(new))]
742 #[unsafe(method_family = new)]
743 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
744 );
745}
746
747extern_protocol!(
748 pub unsafe trait PDFViewDelegate: NSObjectProtocol {
750 #[cfg(feature = "objc2-app-kit")]
751 #[cfg(target_os = "macos")]
752 #[optional]
753 #[unsafe(method(PDFViewWillClickOnLink:withURL:))]
754 #[unsafe(method_family = none)]
755 unsafe fn PDFViewWillClickOnLink_withURL(&self, sender: &PDFView, url: &NSURL);
756
757 #[cfg(all(feature = "objc2-app-kit", feature = "objc2-core-foundation"))]
758 #[cfg(target_os = "macos")]
759 #[optional]
760 #[unsafe(method(PDFViewWillChangeScaleFactor:toScale:))]
761 #[unsafe(method_family = none)]
762 unsafe fn PDFViewWillChangeScaleFactor_toScale(
763 &self,
764 sender: &PDFView,
765 scaler: CGFloat,
766 ) -> CGFloat;
767
768 #[cfg(feature = "objc2-app-kit")]
769 #[cfg(target_os = "macos")]
770 #[optional]
771 #[unsafe(method(PDFViewPrintJobTitle:))]
772 #[unsafe(method_family = none)]
773 unsafe fn PDFViewPrintJobTitle(&self, sender: &PDFView) -> Retained<NSString>;
774
775 #[cfg(feature = "objc2-app-kit")]
776 #[cfg(target_os = "macos")]
777 #[optional]
778 #[unsafe(method(PDFViewPerformPrint:))]
779 #[unsafe(method_family = none)]
780 unsafe fn PDFViewPerformPrint(&self, sender: &PDFView);
781
782 #[cfg(feature = "objc2-app-kit")]
783 #[cfg(target_os = "macos")]
784 #[optional]
785 #[unsafe(method(PDFViewPerformFind:))]
786 #[unsafe(method_family = none)]
787 unsafe fn PDFViewPerformFind(&self, sender: &PDFView);
788
789 #[cfg(feature = "objc2-app-kit")]
790 #[cfg(target_os = "macos")]
791 #[optional]
792 #[unsafe(method(PDFViewPerformGoToPage:))]
793 #[unsafe(method_family = none)]
794 unsafe fn PDFViewPerformGoToPage(&self, sender: &PDFView);
795
796 #[cfg(all(
797 feature = "PDFAction",
798 feature = "PDFActionRemoteGoTo",
799 feature = "objc2-app-kit"
800 ))]
801 #[cfg(target_os = "macos")]
802 #[optional]
803 #[unsafe(method(PDFViewOpenPDF:forRemoteGoToAction:))]
804 #[unsafe(method_family = none)]
805 unsafe fn PDFViewOpenPDF_forRemoteGoToAction(
806 &self,
807 sender: &PDFView,
808 action: &PDFActionRemoteGoTo,
809 );
810 }
811);
812
813#[cfg(feature = "objc2-app-kit")]
815#[cfg(target_os = "macos")]
816impl PDFView {
817 extern_methods!(
818 #[deprecated]
822 #[unsafe(method(takePasswordFrom:))]
823 #[unsafe(method_family = none)]
824 pub unsafe fn takePasswordFrom(&self, sender: &AnyObject);
825
826 #[cfg(feature = "PDFPage")]
827 #[deprecated]
828 #[unsafe(method(drawPage:))]
829 #[unsafe(method_family = none)]
830 pub unsafe fn drawPage(&self, page: &PDFPage);
831
832 #[cfg(feature = "PDFPage")]
833 #[deprecated]
834 #[unsafe(method(drawPagePost:))]
835 #[unsafe(method_family = none)]
836 pub unsafe fn drawPagePost(&self, page: &PDFPage);
837
838 #[deprecated]
839 #[unsafe(method(shouldAntiAlias))]
840 #[unsafe(method_family = none)]
841 pub unsafe fn shouldAntiAlias(&self) -> bool;
842
843 #[deprecated]
845 #[unsafe(method(setShouldAntiAlias:))]
846 #[unsafe(method_family = none)]
847 pub unsafe fn setShouldAntiAlias(&self, should_anti_alias: bool);
848
849 #[cfg(feature = "objc2-core-foundation")]
850 #[deprecated]
851 #[unsafe(method(greekingThreshold))]
852 #[unsafe(method_family = none)]
853 pub unsafe fn greekingThreshold(&self) -> CGFloat;
854
855 #[cfg(feature = "objc2-core-foundation")]
856 #[deprecated]
858 #[unsafe(method(setGreekingThreshold:))]
859 #[unsafe(method_family = none)]
860 pub unsafe fn setGreekingThreshold(&self, greeking_threshold: CGFloat);
861
862 #[deprecated]
866 #[unsafe(method(takeBackgroundColorFrom:))]
867 #[unsafe(method_family = none)]
868 pub unsafe fn takeBackgroundColorFrom(&self, sender: &AnyObject);
869
870 #[deprecated]
871 #[unsafe(method(allowsDragging))]
872 #[unsafe(method_family = none)]
873 pub unsafe fn allowsDragging(&self) -> bool;
874
875 #[deprecated]
877 #[unsafe(method(setAllowsDragging:))]
878 #[unsafe(method_family = none)]
879 pub unsafe fn setAllowsDragging(&self, allows_dragging: bool);
880 );
881}