use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
use objc2_app_kit::*;
use objc2_foundation::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct PDFSelectionGranularity(pub NSUInteger);
impl PDFSelectionGranularity {
#[doc(alias = "PDFSelectionGranularityCharacter")]
pub const Character: Self = Self(0);
#[doc(alias = "PDFSelectionGranularityWord")]
pub const Word: Self = Self(1);
#[doc(alias = "PDFSelectionGranularityLine")]
pub const Line: Self = Self(2);
}
unsafe impl Encode for PDFSelectionGranularity {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for PDFSelectionGranularity {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct PDFSelection;
);
extern_conformance!(
unsafe impl NSCopying for PDFSelection {}
);
unsafe impl CopyingHelper for PDFSelection {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for PDFSelection {}
);
impl PDFSelection {
extern_methods!(
#[cfg(feature = "PDFDocument")]
#[unsafe(method(initWithDocument:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithDocument(
this: Allocated<Self>,
document: &PDFDocument,
) -> Retained<Self>;
#[cfg(feature = "PDFPage")]
#[unsafe(method(pages))]
#[unsafe(method_family = none)]
pub unsafe fn pages(&self) -> Retained<NSArray<PDFPage>>;
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
#[unsafe(method(color))]
#[unsafe(method_family = none)]
pub unsafe fn color(&self) -> Option<Retained<NSColor>>;
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
#[unsafe(method(setColor:))]
#[unsafe(method_family = none)]
pub unsafe fn setColor(&self, color: Option<&NSColor>);
#[unsafe(method(string))]
#[unsafe(method_family = none)]
pub unsafe fn string(&self) -> Option<Retained<NSString>>;
#[unsafe(method(attributedString))]
#[unsafe(method_family = none)]
pub unsafe fn attributedString(&self) -> Option<Retained<NSAttributedString>>;
#[cfg(feature = "PDFPage")]
#[unsafe(method(boundsForPage:))]
#[unsafe(method_family = none)]
pub unsafe fn boundsForPage(&self, page: &PDFPage) -> NSRect;
#[cfg(feature = "PDFPage")]
#[unsafe(method(numberOfTextRangesOnPage:))]
#[unsafe(method_family = none)]
pub unsafe fn numberOfTextRangesOnPage(&self, page: &PDFPage) -> NSUInteger;
#[cfg(feature = "PDFPage")]
#[unsafe(method(rangeAtIndex:onPage:))]
#[unsafe(method_family = none)]
pub unsafe fn rangeAtIndex_onPage(&self, index: NSUInteger, page: &PDFPage) -> NSRange;
#[unsafe(method(selectionsByLine))]
#[unsafe(method_family = none)]
pub unsafe fn selectionsByLine(&self) -> Retained<NSArray<PDFSelection>>;
#[unsafe(method(addSelection:))]
#[unsafe(method_family = none)]
pub unsafe fn addSelection(&self, selection: &PDFSelection);
#[unsafe(method(addSelections:))]
#[unsafe(method_family = none)]
pub unsafe fn addSelections(&self, selections: &NSArray<PDFSelection>);
#[unsafe(method(extendSelectionAtEnd:))]
#[unsafe(method_family = none)]
pub unsafe fn extendSelectionAtEnd(&self, succeed: NSInteger);
#[unsafe(method(extendSelectionAtStart:))]
#[unsafe(method_family = none)]
pub unsafe fn extendSelectionAtStart(&self, precede: NSInteger);
#[unsafe(method(extendSelectionForLineBoundaries))]
#[unsafe(method_family = none)]
pub unsafe fn extendSelectionForLineBoundaries(&self);
#[cfg(feature = "PDFPage")]
#[unsafe(method(drawForPage:active:))]
#[unsafe(method_family = none)]
pub unsafe fn drawForPage_active(&self, page: &PDFPage, active: bool);
#[cfg(feature = "PDFPage")]
#[unsafe(method(drawForPage:withBox:active:))]
#[unsafe(method_family = none)]
pub unsafe fn drawForPage_withBox_active(
&self,
page: &PDFPage,
r#box: PDFDisplayBox,
active: bool,
);
);
}
impl PDFSelection {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}