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:))]
232 #[unsafe(method_family = none)]
233 pub unsafe fn goToFirstPage(&self, sender: Option<&AnyObject>);
234
235 #[unsafe(method(canGoToLastPage))]
236 #[unsafe(method_family = none)]
237 pub unsafe fn canGoToLastPage(&self) -> bool;
238
239 #[unsafe(method(goToLastPage:))]
240 #[unsafe(method_family = none)]
241 pub unsafe fn goToLastPage(&self, sender: Option<&AnyObject>);
242
243 #[unsafe(method(canGoToNextPage))]
244 #[unsafe(method_family = none)]
245 pub unsafe fn canGoToNextPage(&self) -> bool;
246
247 #[unsafe(method(goToNextPage:))]
248 #[unsafe(method_family = none)]
249 pub unsafe fn goToNextPage(&self, sender: Option<&AnyObject>);
250
251 #[unsafe(method(canGoToPreviousPage))]
252 #[unsafe(method_family = none)]
253 pub unsafe fn canGoToPreviousPage(&self) -> bool;
254
255 #[unsafe(method(goToPreviousPage:))]
256 #[unsafe(method_family = none)]
257 pub unsafe fn goToPreviousPage(&self, sender: Option<&AnyObject>);
258
259 #[unsafe(method(canGoBack))]
260 #[unsafe(method_family = none)]
261 pub unsafe fn canGoBack(&self) -> bool;
262
263 #[unsafe(method(goBack:))]
264 #[unsafe(method_family = none)]
265 pub unsafe fn goBack(&self, sender: Option<&AnyObject>);
266
267 #[unsafe(method(canGoForward))]
268 #[unsafe(method_family = none)]
269 pub unsafe fn canGoForward(&self) -> bool;
270
271 #[unsafe(method(goForward:))]
272 #[unsafe(method_family = none)]
273 pub unsafe fn goForward(&self, sender: Option<&AnyObject>);
274
275 #[cfg(feature = "PDFPage")]
276 #[unsafe(method(currentPage))]
277 #[unsafe(method_family = none)]
278 pub unsafe fn currentPage(&self) -> Option<Retained<PDFPage>>;
279
280 #[cfg(feature = "PDFPage")]
281 #[unsafe(method(goToPage:))]
282 #[unsafe(method_family = none)]
283 pub unsafe fn goToPage(&self, page: &PDFPage);
284
285 #[cfg(feature = "PDFDestination")]
286 #[unsafe(method(currentDestination))]
287 #[unsafe(method_family = none)]
288 pub unsafe fn currentDestination(&self) -> Option<Retained<PDFDestination>>;
289
290 #[cfg(feature = "PDFDestination")]
291 #[unsafe(method(goToDestination:))]
292 #[unsafe(method_family = none)]
293 pub unsafe fn goToDestination(&self, destination: &PDFDestination);
294
295 #[cfg(feature = "PDFSelection")]
296 #[unsafe(method(goToSelection:))]
297 #[unsafe(method_family = none)]
298 pub unsafe fn goToSelection(&self, selection: &PDFSelection);
299
300 #[cfg(feature = "PDFPage")]
301 #[unsafe(method(goToRect:onPage:))]
302 #[unsafe(method_family = none)]
303 pub unsafe fn goToRect_onPage(&self, rect: NSRect, page: &PDFPage);
304
305 #[unsafe(method(displayMode))]
306 #[unsafe(method_family = none)]
307 pub unsafe fn displayMode(&self) -> PDFDisplayMode;
308
309 #[unsafe(method(setDisplayMode:))]
311 #[unsafe(method_family = none)]
312 pub unsafe fn setDisplayMode(&self, display_mode: PDFDisplayMode);
313
314 #[unsafe(method(displayDirection))]
315 #[unsafe(method_family = none)]
316 pub unsafe fn displayDirection(&self) -> PDFDisplayDirection;
317
318 #[unsafe(method(setDisplayDirection:))]
320 #[unsafe(method_family = none)]
321 pub unsafe fn setDisplayDirection(&self, display_direction: PDFDisplayDirection);
322
323 #[unsafe(method(displaysPageBreaks))]
324 #[unsafe(method_family = none)]
325 pub unsafe fn displaysPageBreaks(&self) -> bool;
326
327 #[unsafe(method(setDisplaysPageBreaks:))]
329 #[unsafe(method_family = none)]
330 pub unsafe fn setDisplaysPageBreaks(&self, displays_page_breaks: bool);
331
332 #[unsafe(method(pageBreakMargins))]
333 #[unsafe(method_family = none)]
334 pub unsafe fn pageBreakMargins(&self) -> NSEdgeInsets;
335
336 #[unsafe(method(setPageBreakMargins:))]
338 #[unsafe(method_family = none)]
339 pub unsafe fn setPageBreakMargins(&self, page_break_margins: NSEdgeInsets);
340
341 #[cfg(feature = "PDFPage")]
342 #[unsafe(method(displayBox))]
343 #[unsafe(method_family = none)]
344 pub unsafe fn displayBox(&self) -> PDFDisplayBox;
345
346 #[cfg(feature = "PDFPage")]
347 #[unsafe(method(setDisplayBox:))]
349 #[unsafe(method_family = none)]
350 pub unsafe fn setDisplayBox(&self, display_box: PDFDisplayBox);
351
352 #[unsafe(method(displaysAsBook))]
353 #[unsafe(method_family = none)]
354 pub unsafe fn displaysAsBook(&self) -> bool;
355
356 #[unsafe(method(setDisplaysAsBook:))]
358 #[unsafe(method_family = none)]
359 pub unsafe fn setDisplaysAsBook(&self, displays_as_book: bool);
360
361 #[unsafe(method(displaysRTL))]
362 #[unsafe(method_family = none)]
363 pub unsafe fn displaysRTL(&self) -> bool;
364
365 #[unsafe(method(setDisplaysRTL:))]
367 #[unsafe(method_family = none)]
368 pub unsafe fn setDisplaysRTL(&self, displays_rtl: bool);
369
370 #[unsafe(method(backgroundColor))]
371 #[unsafe(method_family = none)]
372 pub unsafe fn backgroundColor(&self) -> Retained<NSColor>;
373
374 #[unsafe(method(setBackgroundColor:))]
376 #[unsafe(method_family = none)]
377 pub unsafe fn setBackgroundColor(&self, background_color: &NSColor);
378
379 #[unsafe(method(interpolationQuality))]
380 #[unsafe(method_family = none)]
381 pub unsafe fn interpolationQuality(&self) -> PDFInterpolationQuality;
382
383 #[unsafe(method(setInterpolationQuality:))]
385 #[unsafe(method_family = none)]
386 pub unsafe fn setInterpolationQuality(
387 &self,
388 interpolation_quality: PDFInterpolationQuality,
389 );
390
391 #[unsafe(method(pageShadowsEnabled))]
392 #[unsafe(method_family = none)]
393 pub unsafe fn pageShadowsEnabled(&self) -> bool;
394
395 #[unsafe(method(enablePageShadows:))]
397 #[unsafe(method_family = none)]
398 pub unsafe fn enablePageShadows(&self, page_shadows_enabled: bool);
399
400 #[unsafe(method(delegate))]
401 #[unsafe(method_family = none)]
402 pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn PDFViewDelegate>>>;
403
404 #[unsafe(method(setDelegate:))]
407 #[unsafe(method_family = none)]
408 pub unsafe fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn PDFViewDelegate>>);
409
410 #[cfg(feature = "PDFPageOverlayViewProvider")]
411 #[unsafe(method(pageOverlayViewProvider))]
412 #[unsafe(method_family = none)]
413 pub unsafe fn pageOverlayViewProvider(
414 &self,
415 ) -> Option<Retained<ProtocolObject<dyn PDFPageOverlayViewProvider>>>;
416
417 #[cfg(feature = "PDFPageOverlayViewProvider")]
418 #[unsafe(method(setPageOverlayViewProvider:))]
421 #[unsafe(method_family = none)]
422 pub unsafe fn setPageOverlayViewProvider(
423 &self,
424 page_overlay_view_provider: Option<&ProtocolObject<dyn PDFPageOverlayViewProvider>>,
425 );
426
427 #[cfg(feature = "objc2-core-foundation")]
428 #[unsafe(method(scaleFactor))]
429 #[unsafe(method_family = none)]
430 pub unsafe fn scaleFactor(&self) -> CGFloat;
431
432 #[cfg(feature = "objc2-core-foundation")]
433 #[unsafe(method(setScaleFactor:))]
435 #[unsafe(method_family = none)]
436 pub unsafe fn setScaleFactor(&self, scale_factor: CGFloat);
437
438 #[cfg(feature = "objc2-core-foundation")]
439 #[unsafe(method(minScaleFactor))]
440 #[unsafe(method_family = none)]
441 pub unsafe fn minScaleFactor(&self) -> CGFloat;
442
443 #[cfg(feature = "objc2-core-foundation")]
444 #[unsafe(method(setMinScaleFactor:))]
446 #[unsafe(method_family = none)]
447 pub unsafe fn setMinScaleFactor(&self, min_scale_factor: CGFloat);
448
449 #[cfg(feature = "objc2-core-foundation")]
450 #[unsafe(method(maxScaleFactor))]
451 #[unsafe(method_family = none)]
452 pub unsafe fn maxScaleFactor(&self) -> CGFloat;
453
454 #[cfg(feature = "objc2-core-foundation")]
455 #[unsafe(method(setMaxScaleFactor:))]
457 #[unsafe(method_family = none)]
458 pub unsafe fn setMaxScaleFactor(&self, max_scale_factor: CGFloat);
459
460 #[unsafe(method(autoScales))]
461 #[unsafe(method_family = none)]
462 pub unsafe fn autoScales(&self) -> bool;
463
464 #[unsafe(method(setAutoScales:))]
466 #[unsafe(method_family = none)]
467 pub unsafe fn setAutoScales(&self, auto_scales: bool);
468
469 #[cfg(feature = "objc2-core-foundation")]
470 #[unsafe(method(scaleFactorForSizeToFit))]
471 #[unsafe(method_family = none)]
472 pub unsafe fn scaleFactorForSizeToFit(&self) -> CGFloat;
473
474 #[unsafe(method(zoomIn:))]
475 #[unsafe(method_family = none)]
476 pub unsafe fn zoomIn(&self, sender: Option<&AnyObject>);
477
478 #[unsafe(method(canZoomIn))]
479 #[unsafe(method_family = none)]
480 pub unsafe fn canZoomIn(&self) -> bool;
481
482 #[unsafe(method(zoomOut:))]
483 #[unsafe(method_family = none)]
484 pub unsafe fn zoomOut(&self, sender: Option<&AnyObject>);
485
486 #[unsafe(method(canZoomOut))]
487 #[unsafe(method_family = none)]
488 pub unsafe fn canZoomOut(&self) -> bool;
489
490 #[cfg(feature = "PDFPage")]
491 #[unsafe(method(areaOfInterestForMouse:))]
492 #[unsafe(method_family = none)]
493 pub unsafe fn areaOfInterestForMouse(&self, event: &NSEvent) -> PDFAreaOfInterest;
494
495 #[cfg(feature = "PDFPage")]
496 #[unsafe(method(areaOfInterestForPoint:))]
497 #[unsafe(method_family = none)]
498 pub unsafe fn areaOfInterestForPoint(&self, cursor_location: NSPoint) -> PDFAreaOfInterest;
499
500 #[cfg(feature = "PDFPage")]
501 #[unsafe(method(setCursorForAreaOfInterest:))]
502 #[unsafe(method_family = none)]
503 pub unsafe fn setCursorForAreaOfInterest(&self, area: PDFAreaOfInterest);
504
505 #[cfg(feature = "PDFAction")]
506 #[unsafe(method(performAction:))]
507 #[unsafe(method_family = none)]
508 pub unsafe fn performAction(&self, action: &PDFAction);
509
510 #[cfg(feature = "PDFSelection")]
511 #[unsafe(method(currentSelection))]
512 #[unsafe(method_family = none)]
513 pub unsafe fn currentSelection(&self) -> Option<Retained<PDFSelection>>;
514
515 #[cfg(feature = "PDFSelection")]
516 #[unsafe(method(setCurrentSelection:))]
518 #[unsafe(method_family = none)]
519 pub unsafe fn setCurrentSelection(&self, current_selection: Option<&PDFSelection>);
520
521 #[cfg(feature = "PDFSelection")]
522 #[unsafe(method(setCurrentSelection:animate:))]
523 #[unsafe(method_family = none)]
524 pub unsafe fn setCurrentSelection_animate(
525 &self,
526 selection: Option<&PDFSelection>,
527 animate: bool,
528 );
529
530 #[unsafe(method(clearSelection))]
531 #[unsafe(method_family = none)]
532 pub unsafe fn clearSelection(&self);
533
534 #[unsafe(method(selectAll:))]
535 #[unsafe(method_family = none)]
536 pub unsafe fn selectAll(&self, sender: Option<&AnyObject>);
537
538 #[unsafe(method(scrollSelectionToVisible:))]
539 #[unsafe(method_family = none)]
540 pub unsafe fn scrollSelectionToVisible(&self, sender: Option<&AnyObject>);
541
542 #[cfg(feature = "PDFSelection")]
543 #[unsafe(method(highlightedSelections))]
544 #[unsafe(method_family = none)]
545 pub unsafe fn highlightedSelections(&self) -> Option<Retained<NSArray<PDFSelection>>>;
546
547 #[cfg(feature = "PDFSelection")]
548 #[unsafe(method(setHighlightedSelections:))]
550 #[unsafe(method_family = none)]
551 pub unsafe fn setHighlightedSelections(
552 &self,
553 highlighted_selections: Option<&NSArray<PDFSelection>>,
554 );
555
556 #[cfg(all(feature = "PDFPage", feature = "objc2-core-graphics"))]
557 #[unsafe(method(drawPage:toContext:))]
558 #[unsafe(method_family = none)]
559 pub unsafe fn drawPage_toContext(&self, page: &PDFPage, context: &CGContext);
560
561 #[cfg(all(feature = "PDFPage", feature = "objc2-core-graphics"))]
562 #[unsafe(method(drawPagePost:toContext:))]
563 #[unsafe(method_family = none)]
564 pub unsafe fn drawPagePost_toContext(&self, page: &PDFPage, context: &CGContext);
565
566 #[unsafe(method(copy:))]
567 #[unsafe(method_family = none)]
568 pub unsafe fn copy(&self, sender: Option<&AnyObject>);
569
570 #[unsafe(method(printWithInfo:autoRotate:))]
571 #[unsafe(method_family = none)]
572 pub unsafe fn printWithInfo_autoRotate(&self, print_info: &NSPrintInfo, do_rotate: bool);
573
574 #[cfg(feature = "PDFDocument")]
575 #[unsafe(method(printWithInfo:autoRotate:pageScaling:))]
576 #[unsafe(method_family = none)]
577 pub unsafe fn printWithInfo_autoRotate_pageScaling(
578 &self,
579 print_info: &NSPrintInfo,
580 do_rotate: bool,
581 scale: PDFPrintScalingMode,
582 );
583
584 #[cfg(feature = "PDFPage")]
585 #[unsafe(method(pageForPoint:nearest:))]
586 #[unsafe(method_family = none)]
587 pub unsafe fn pageForPoint_nearest(
588 &self,
589 point: NSPoint,
590 nearest: bool,
591 ) -> Option<Retained<PDFPage>>;
592
593 #[cfg(feature = "PDFPage")]
594 #[unsafe(method(convertPoint:toPage:))]
595 #[unsafe(method_family = none)]
596 pub unsafe fn convertPoint_toPage(&self, point: NSPoint, page: &PDFPage) -> NSPoint;
597
598 #[cfg(feature = "PDFPage")]
599 #[unsafe(method(convertRect:toPage:))]
600 #[unsafe(method_family = none)]
601 pub unsafe fn convertRect_toPage(&self, rect: NSRect, page: &PDFPage) -> NSRect;
602
603 #[cfg(feature = "PDFPage")]
604 #[unsafe(method(convertPoint:fromPage:))]
605 #[unsafe(method_family = none)]
606 pub unsafe fn convertPoint_fromPage(&self, point: NSPoint, page: &PDFPage) -> NSPoint;
607
608 #[cfg(feature = "PDFPage")]
609 #[unsafe(method(convertRect:fromPage:))]
610 #[unsafe(method_family = none)]
611 pub unsafe fn convertRect_fromPage(&self, rect: NSRect, page: &PDFPage) -> NSRect;
612
613 #[unsafe(method(documentView))]
614 #[unsafe(method_family = none)]
615 pub unsafe fn documentView(&self) -> Option<Retained<NSView>>;
616
617 #[unsafe(method(layoutDocumentView))]
618 #[unsafe(method_family = none)]
619 pub unsafe fn layoutDocumentView(&self);
620
621 #[cfg(feature = "PDFPage")]
622 #[unsafe(method(annotationsChangedOnPage:))]
623 #[unsafe(method_family = none)]
624 pub unsafe fn annotationsChangedOnPage(&self, page: &PDFPage);
625
626 #[cfg(feature = "PDFPage")]
627 #[unsafe(method(rowSizeForPage:))]
628 #[unsafe(method_family = none)]
629 pub unsafe fn rowSizeForPage(&self, page: &PDFPage) -> NSSize;
630
631 #[unsafe(method(acceptsDraggedFiles))]
632 #[unsafe(method_family = none)]
633 pub unsafe fn acceptsDraggedFiles(&self) -> bool;
634
635 #[unsafe(method(setAcceptsDraggedFiles:))]
637 #[unsafe(method_family = none)]
638 pub unsafe fn setAcceptsDraggedFiles(&self, accepts_dragged_files: bool);
639
640 #[cfg(feature = "PDFPage")]
641 #[unsafe(method(visiblePages))]
642 #[unsafe(method_family = none)]
643 pub unsafe fn visiblePages(&self) -> Retained<NSArray<PDFPage>>;
644
645 #[deprecated]
646 #[unsafe(method(enableDataDetectors))]
647 #[unsafe(method_family = none)]
648 pub unsafe fn enableDataDetectors(&self) -> bool;
649
650 #[deprecated]
652 #[unsafe(method(setEnableDataDetectors:))]
653 #[unsafe(method_family = none)]
654 pub unsafe fn setEnableDataDetectors(&self, enable_data_detectors: bool);
655
656 #[unsafe(method(isInMarkupMode))]
657 #[unsafe(method_family = none)]
658 pub unsafe fn isInMarkupMode(&self) -> bool;
659
660 #[unsafe(method(setInMarkupMode:))]
662 #[unsafe(method_family = none)]
663 pub unsafe fn setInMarkupMode(&self, in_markup_mode: bool);
664 );
665}
666
667#[cfg(feature = "objc2-app-kit")]
669#[cfg(target_os = "macos")]
670impl PDFView {
671 extern_methods!(
672 #[unsafe(method(initWithFrame:))]
673 #[unsafe(method_family = init)]
674 pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
675
676 #[unsafe(method(initWithCoder:))]
677 #[unsafe(method_family = init)]
678 pub unsafe fn initWithCoder(
679 this: Allocated<Self>,
680 coder: &NSCoder,
681 ) -> Option<Retained<Self>>;
682 );
683}
684
685#[cfg(feature = "objc2-app-kit")]
687#[cfg(target_os = "macos")]
688impl PDFView {
689 extern_methods!(
690 #[unsafe(method(init))]
691 #[unsafe(method_family = init)]
692 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
693 );
694}
695
696#[cfg(feature = "objc2-app-kit")]
698#[cfg(target_os = "macos")]
699impl PDFView {
700 extern_methods!(
701 #[unsafe(method(new))]
702 #[unsafe(method_family = new)]
703 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
704 );
705}
706
707extern_protocol!(
708 pub unsafe trait PDFViewDelegate: NSObjectProtocol {
710 #[cfg(feature = "objc2-app-kit")]
711 #[cfg(target_os = "macos")]
712 #[optional]
713 #[unsafe(method(PDFViewWillClickOnLink:withURL:))]
714 #[unsafe(method_family = none)]
715 unsafe fn PDFViewWillClickOnLink_withURL(&self, sender: &PDFView, url: &NSURL);
716
717 #[cfg(all(feature = "objc2-app-kit", feature = "objc2-core-foundation"))]
718 #[cfg(target_os = "macos")]
719 #[optional]
720 #[unsafe(method(PDFViewWillChangeScaleFactor:toScale:))]
721 #[unsafe(method_family = none)]
722 unsafe fn PDFViewWillChangeScaleFactor_toScale(
723 &self,
724 sender: &PDFView,
725 scaler: CGFloat,
726 ) -> CGFloat;
727
728 #[cfg(feature = "objc2-app-kit")]
729 #[cfg(target_os = "macos")]
730 #[optional]
731 #[unsafe(method(PDFViewPrintJobTitle:))]
732 #[unsafe(method_family = none)]
733 unsafe fn PDFViewPrintJobTitle(&self, sender: &PDFView) -> Retained<NSString>;
734
735 #[cfg(feature = "objc2-app-kit")]
736 #[cfg(target_os = "macos")]
737 #[optional]
738 #[unsafe(method(PDFViewPerformPrint:))]
739 #[unsafe(method_family = none)]
740 unsafe fn PDFViewPerformPrint(&self, sender: &PDFView);
741
742 #[cfg(feature = "objc2-app-kit")]
743 #[cfg(target_os = "macos")]
744 #[optional]
745 #[unsafe(method(PDFViewPerformFind:))]
746 #[unsafe(method_family = none)]
747 unsafe fn PDFViewPerformFind(&self, sender: &PDFView);
748
749 #[cfg(feature = "objc2-app-kit")]
750 #[cfg(target_os = "macos")]
751 #[optional]
752 #[unsafe(method(PDFViewPerformGoToPage:))]
753 #[unsafe(method_family = none)]
754 unsafe fn PDFViewPerformGoToPage(&self, sender: &PDFView);
755
756 #[cfg(all(
757 feature = "PDFAction",
758 feature = "PDFActionRemoteGoTo",
759 feature = "objc2-app-kit"
760 ))]
761 #[cfg(target_os = "macos")]
762 #[optional]
763 #[unsafe(method(PDFViewOpenPDF:forRemoteGoToAction:))]
764 #[unsafe(method_family = none)]
765 unsafe fn PDFViewOpenPDF_forRemoteGoToAction(
766 &self,
767 sender: &PDFView,
768 action: &PDFActionRemoteGoTo,
769 );
770 }
771);
772
773#[cfg(feature = "objc2-app-kit")]
775#[cfg(target_os = "macos")]
776impl PDFView {
777 extern_methods!(
778 #[deprecated]
779 #[unsafe(method(takePasswordFrom:))]
780 #[unsafe(method_family = none)]
781 pub unsafe fn takePasswordFrom(&self, sender: &AnyObject);
782
783 #[cfg(feature = "PDFPage")]
784 #[deprecated]
785 #[unsafe(method(drawPage:))]
786 #[unsafe(method_family = none)]
787 pub unsafe fn drawPage(&self, page: &PDFPage);
788
789 #[cfg(feature = "PDFPage")]
790 #[deprecated]
791 #[unsafe(method(drawPagePost:))]
792 #[unsafe(method_family = none)]
793 pub unsafe fn drawPagePost(&self, page: &PDFPage);
794
795 #[deprecated]
796 #[unsafe(method(shouldAntiAlias))]
797 #[unsafe(method_family = none)]
798 pub unsafe fn shouldAntiAlias(&self) -> bool;
799
800 #[deprecated]
802 #[unsafe(method(setShouldAntiAlias:))]
803 #[unsafe(method_family = none)]
804 pub unsafe fn setShouldAntiAlias(&self, should_anti_alias: bool);
805
806 #[cfg(feature = "objc2-core-foundation")]
807 #[deprecated]
808 #[unsafe(method(greekingThreshold))]
809 #[unsafe(method_family = none)]
810 pub unsafe fn greekingThreshold(&self) -> CGFloat;
811
812 #[cfg(feature = "objc2-core-foundation")]
813 #[deprecated]
815 #[unsafe(method(setGreekingThreshold:))]
816 #[unsafe(method_family = none)]
817 pub unsafe fn setGreekingThreshold(&self, greeking_threshold: CGFloat);
818
819 #[deprecated]
820 #[unsafe(method(takeBackgroundColorFrom:))]
821 #[unsafe(method_family = none)]
822 pub unsafe fn takeBackgroundColorFrom(&self, sender: &AnyObject);
823
824 #[deprecated]
825 #[unsafe(method(allowsDragging))]
826 #[unsafe(method_family = none)]
827 pub unsafe fn allowsDragging(&self) -> bool;
828
829 #[deprecated]
831 #[unsafe(method(setAllowsDragging:))]
832 #[unsafe(method_family = none)]
833 pub unsafe fn setAllowsDragging(&self, allows_dragging: bool);
834 );
835}