use core::cell::UnsafeCell;
use core::ffi::*;
use core::marker::{PhantomData, PhantomPinned};
use core::ptr::NonNull;
#[cfg(feature = "objc2")]
use objc2::__framework_prelude::*;
use objc2_core_foundation::*;
#[cfg(feature = "objc2-core-graphics")]
use objc2_core_graphics::*;
use crate::*;
#[doc(alias = "CTFrameRef")]
#[repr(C)]
pub struct CTFrame {
inner: [u8; 0],
_p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
}
cf_type!(
unsafe impl CTFrame {}
);
#[cfg(feature = "objc2")]
cf_objc2_type!(
unsafe impl RefEncode<"__CTFrame"> for CTFrame {}
);
unsafe impl ConcreteType for CTFrame {
#[doc(alias = "CTFrameGetTypeID")]
#[inline]
fn type_id() -> CFTypeID {
extern "C-unwind" {
fn CTFrameGetTypeID() -> CFTypeID;
}
unsafe { CTFrameGetTypeID() }
}
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CTFrameProgression(pub u32);
impl CTFrameProgression {
#[doc(alias = "kCTFrameProgressionTopToBottom")]
pub const TopToBottom: Self = Self(0);
#[doc(alias = "kCTFrameProgressionRightToLeft")]
pub const RightToLeft: Self = Self(1);
#[doc(alias = "kCTFrameProgressionLeftToRight")]
pub const LeftToRight: Self = Self(2);
}
#[cfg(feature = "objc2")]
unsafe impl Encode for CTFrameProgression {
const ENCODING: Encoding = u32::ENCODING;
}
#[cfg(feature = "objc2")]
unsafe impl RefEncode for CTFrameProgression {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern "C" {
pub static kCTFrameProgressionAttributeName: &'static CFString;
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CTFramePathFillRule(pub u32);
impl CTFramePathFillRule {
#[doc(alias = "kCTFramePathFillEvenOdd")]
pub const EvenOdd: Self = Self(0);
#[doc(alias = "kCTFramePathFillWindingNumber")]
pub const WindingNumber: Self = Self(1);
}
#[cfg(feature = "objc2")]
unsafe impl Encode for CTFramePathFillRule {
const ENCODING: Encoding = u32::ENCODING;
}
#[cfg(feature = "objc2")]
unsafe impl RefEncode for CTFramePathFillRule {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern "C" {
pub static kCTFramePathFillRuleAttributeName: &'static CFString;
}
extern "C" {
pub static kCTFramePathWidthAttributeName: &'static CFString;
}
extern "C" {
pub static kCTFrameClippingPathsAttributeName: &'static CFString;
}
extern "C" {
pub static kCTFramePathClippingPathAttributeName: &'static CFString;
}
impl CTFrame {
#[doc(alias = "CTFrameGetStringRange")]
#[inline]
pub unsafe fn string_range(&self) -> CFRange {
extern "C-unwind" {
fn CTFrameGetStringRange(frame: &CTFrame) -> CFRange;
}
unsafe { CTFrameGetStringRange(self) }
}
#[doc(alias = "CTFrameGetVisibleStringRange")]
#[inline]
pub unsafe fn visible_string_range(&self) -> CFRange {
extern "C-unwind" {
fn CTFrameGetVisibleStringRange(frame: &CTFrame) -> CFRange;
}
unsafe { CTFrameGetVisibleStringRange(self) }
}
#[doc(alias = "CTFrameGetPath")]
#[cfg(feature = "objc2-core-graphics")]
#[inline]
pub unsafe fn path(&self) -> CFRetained<CGPath> {
extern "C-unwind" {
fn CTFrameGetPath(frame: &CTFrame) -> Option<NonNull<CGPath>>;
}
let ret = unsafe { CTFrameGetPath(self) };
let ret =
ret.expect("function was marked as returning non-null, but actually returned NULL");
unsafe { CFRetained::retain(ret) }
}
#[doc(alias = "CTFrameGetFrameAttributes")]
#[inline]
pub unsafe fn frame_attributes(&self) -> Option<CFRetained<CFDictionary>> {
extern "C-unwind" {
fn CTFrameGetFrameAttributes(frame: &CTFrame) -> Option<NonNull<CFDictionary>>;
}
let ret = unsafe { CTFrameGetFrameAttributes(self) };
ret.map(|ret| unsafe { CFRetained::retain(ret) })
}
#[doc(alias = "CTFrameGetLines")]
#[inline]
pub unsafe fn lines(&self) -> CFRetained<CFArray> {
extern "C-unwind" {
fn CTFrameGetLines(frame: &CTFrame) -> Option<NonNull<CFArray>>;
}
let ret = unsafe { CTFrameGetLines(self) };
let ret =
ret.expect("function was marked as returning non-null, but actually returned NULL");
unsafe { CFRetained::retain(ret) }
}
#[doc(alias = "CTFrameGetLineOrigins")]
#[inline]
pub unsafe fn line_origins(&self, range: CFRange, origins: NonNull<CGPoint>) {
extern "C-unwind" {
fn CTFrameGetLineOrigins(frame: &CTFrame, range: CFRange, origins: NonNull<CGPoint>);
}
unsafe { CTFrameGetLineOrigins(self, range, origins) }
}
#[doc(alias = "CTFrameDraw")]
#[cfg(feature = "objc2-core-graphics")]
#[inline]
pub unsafe fn draw(&self, context: &CGContext) {
extern "C-unwind" {
fn CTFrameDraw(frame: &CTFrame, context: &CGContext);
}
unsafe { CTFrameDraw(self, context) }
}
}
extern "C-unwind" {
#[deprecated = "renamed to `CTFrame::string_range`"]
pub fn CTFrameGetStringRange(frame: &CTFrame) -> CFRange;
}
extern "C-unwind" {
#[deprecated = "renamed to `CTFrame::visible_string_range`"]
pub fn CTFrameGetVisibleStringRange(frame: &CTFrame) -> CFRange;
}
#[cfg(feature = "objc2-core-graphics")]
#[deprecated = "renamed to `CTFrame::path`"]
#[inline]
pub unsafe extern "C-unwind" fn CTFrameGetPath(frame: &CTFrame) -> CFRetained<CGPath> {
extern "C-unwind" {
fn CTFrameGetPath(frame: &CTFrame) -> Option<NonNull<CGPath>>;
}
let ret = unsafe { CTFrameGetPath(frame) };
let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
unsafe { CFRetained::retain(ret) }
}
#[deprecated = "renamed to `CTFrame::frame_attributes`"]
#[inline]
pub unsafe extern "C-unwind" fn CTFrameGetFrameAttributes(
frame: &CTFrame,
) -> Option<CFRetained<CFDictionary>> {
extern "C-unwind" {
fn CTFrameGetFrameAttributes(frame: &CTFrame) -> Option<NonNull<CFDictionary>>;
}
let ret = unsafe { CTFrameGetFrameAttributes(frame) };
ret.map(|ret| unsafe { CFRetained::retain(ret) })
}
#[deprecated = "renamed to `CTFrame::lines`"]
#[inline]
pub unsafe extern "C-unwind" fn CTFrameGetLines(frame: &CTFrame) -> CFRetained<CFArray> {
extern "C-unwind" {
fn CTFrameGetLines(frame: &CTFrame) -> Option<NonNull<CFArray>>;
}
let ret = unsafe { CTFrameGetLines(frame) };
let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
unsafe { CFRetained::retain(ret) }
}
extern "C-unwind" {
#[deprecated = "renamed to `CTFrame::line_origins`"]
pub fn CTFrameGetLineOrigins(frame: &CTFrame, range: CFRange, origins: NonNull<CGPoint>);
}
extern "C-unwind" {
#[cfg(feature = "objc2-core-graphics")]
#[deprecated = "renamed to `CTFrame::draw`"]
pub fn CTFrameDraw(frame: &CTFrame, context: &CGContext);
}