use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSFontAssetRequestOptions(pub NSUInteger);
bitflags::bitflags! {
impl NSFontAssetRequestOptions: NSUInteger {
#[doc(alias = "NSFontAssetRequestOptionUsesStandardUI")]
const UsesStandardUI = 1<<0;
}
}
unsafe impl Encode for NSFontAssetRequestOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSFontAssetRequestOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSFontAssetRequest;
);
extern_conformance!(
unsafe impl NSObjectProtocol for NSFontAssetRequest {}
);
extern_conformance!(
unsafe impl NSProgressReporting for NSFontAssetRequest {}
);
impl NSFontAssetRequest {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(feature = "NSFontDescriptor")]
#[unsafe(method(initWithFontDescriptors:options:))]
#[unsafe(method_family = init)]
pub fn initWithFontDescriptors_options(
this: Allocated<Self>,
font_descriptors: &NSArray<NSFontDescriptor>,
options: NSFontAssetRequestOptions,
) -> Retained<Self>;
#[cfg(feature = "NSFontDescriptor")]
#[unsafe(method(downloadedFontDescriptors))]
#[unsafe(method_family = none)]
pub fn downloadedFontDescriptors(&self) -> Retained<NSArray<NSFontDescriptor>>;
#[unsafe(method(progress))]
#[unsafe(method_family = none)]
pub fn progress(&self) -> Retained<NSProgress>;
#[cfg(feature = "block2")]
#[unsafe(method(downloadFontAssetsWithCompletionHandler:))]
#[unsafe(method_family = none)]
pub fn downloadFontAssetsWithCompletionHandler(
&self,
completion_handler: &block2::DynBlock<dyn Fn(*mut NSError) -> Bool>,
);
);
}
impl NSFontAssetRequest {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}