objc2_pdf_kit/generated/
PDFSelection.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-app-kit")]
7#[cfg(target_os = "macos")]
8use objc2_app_kit::*;
9use objc2_foundation::*;
10
11use crate::*;
12
13/// [Apple's documentation](https://developer.apple.com/documentation/pdfkit/pdfselectiongranularity?language=objc)
14// NS_ENUM
15#[repr(transparent)]
16#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
17pub struct PDFSelectionGranularity(pub NSUInteger);
18impl PDFSelectionGranularity {
19    #[doc(alias = "PDFSelectionGranularityCharacter")]
20    pub const Character: Self = Self(0);
21    #[doc(alias = "PDFSelectionGranularityWord")]
22    pub const Word: Self = Self(1);
23    #[doc(alias = "PDFSelectionGranularityLine")]
24    pub const Line: Self = Self(2);
25}
26
27unsafe impl Encode for PDFSelectionGranularity {
28    const ENCODING: Encoding = NSUInteger::ENCODING;
29}
30
31unsafe impl RefEncode for PDFSelectionGranularity {
32    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
33}
34
35extern_class!(
36    /// [Apple's documentation](https://developer.apple.com/documentation/pdfkit/pdfselection?language=objc)
37    #[unsafe(super(NSObject))]
38    #[derive(Debug, PartialEq, Eq, Hash)]
39    pub struct PDFSelection;
40);
41
42extern_conformance!(
43    unsafe impl NSCopying for PDFSelection {}
44);
45
46unsafe impl CopyingHelper for PDFSelection {
47    type Result = Self;
48}
49
50extern_conformance!(
51    unsafe impl NSObjectProtocol for PDFSelection {}
52);
53
54impl PDFSelection {
55    extern_methods!(
56        #[cfg(feature = "PDFDocument")]
57        #[unsafe(method(initWithDocument:))]
58        #[unsafe(method_family = init)]
59        pub unsafe fn initWithDocument(
60            this: Allocated<Self>,
61            document: &PDFDocument,
62        ) -> Retained<Self>;
63
64        #[cfg(feature = "PDFPage")]
65        #[unsafe(method(pages))]
66        #[unsafe(method_family = none)]
67        pub unsafe fn pages(&self) -> Retained<NSArray<PDFPage>>;
68
69        #[cfg(feature = "objc2-app-kit")]
70        #[cfg(target_os = "macos")]
71        #[unsafe(method(color))]
72        #[unsafe(method_family = none)]
73        pub unsafe fn color(&self) -> Option<Retained<NSColor>>;
74
75        #[cfg(feature = "objc2-app-kit")]
76        #[cfg(target_os = "macos")]
77        /// Setter for [`color`][Self::color].
78        ///
79        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
80        #[unsafe(method(setColor:))]
81        #[unsafe(method_family = none)]
82        pub unsafe fn setColor(&self, color: Option<&NSColor>);
83
84        #[unsafe(method(string))]
85        #[unsafe(method_family = none)]
86        pub unsafe fn string(&self) -> Option<Retained<NSString>>;
87
88        #[unsafe(method(attributedString))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn attributedString(&self) -> Option<Retained<NSAttributedString>>;
91
92        #[cfg(feature = "PDFPage")]
93        #[unsafe(method(boundsForPage:))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn boundsForPage(&self, page: &PDFPage) -> NSRect;
96
97        #[cfg(feature = "PDFPage")]
98        #[unsafe(method(numberOfTextRangesOnPage:))]
99        #[unsafe(method_family = none)]
100        pub unsafe fn numberOfTextRangesOnPage(&self, page: &PDFPage) -> NSUInteger;
101
102        #[cfg(feature = "PDFPage")]
103        #[unsafe(method(rangeAtIndex:onPage:))]
104        #[unsafe(method_family = none)]
105        pub unsafe fn rangeAtIndex_onPage(&self, index: NSUInteger, page: &PDFPage) -> NSRange;
106
107        #[unsafe(method(selectionsByLine))]
108        #[unsafe(method_family = none)]
109        pub unsafe fn selectionsByLine(&self) -> Retained<NSArray<PDFSelection>>;
110
111        #[unsafe(method(addSelection:))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn addSelection(&self, selection: &PDFSelection);
114
115        #[unsafe(method(addSelections:))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn addSelections(&self, selections: &NSArray<PDFSelection>);
118
119        #[unsafe(method(extendSelectionAtEnd:))]
120        #[unsafe(method_family = none)]
121        pub unsafe fn extendSelectionAtEnd(&self, succeed: NSInteger);
122
123        #[unsafe(method(extendSelectionAtStart:))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn extendSelectionAtStart(&self, precede: NSInteger);
126
127        #[unsafe(method(extendSelectionForLineBoundaries))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn extendSelectionForLineBoundaries(&self);
130
131        #[cfg(feature = "PDFPage")]
132        #[unsafe(method(drawForPage:active:))]
133        #[unsafe(method_family = none)]
134        pub unsafe fn drawForPage_active(&self, page: &PDFPage, active: bool);
135
136        #[cfg(feature = "PDFPage")]
137        #[unsafe(method(drawForPage:withBox:active:))]
138        #[unsafe(method_family = none)]
139        pub unsafe fn drawForPage_withBox_active(
140            &self,
141            page: &PDFPage,
142            r#box: PDFDisplayBox,
143            active: bool,
144        );
145    );
146}
147
148/// Methods declared on superclass `NSObject`.
149impl PDFSelection {
150    extern_methods!(
151        #[unsafe(method(init))]
152        #[unsafe(method_family = init)]
153        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
154
155        #[unsafe(method(new))]
156        #[unsafe(method_family = new)]
157        pub unsafe fn new() -> Retained<Self>;
158    );
159}