//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
#[cfg(feature = "objc2-core-graphics")]
use objc2_core_graphics::*;
use objc2_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/quartzcore/catextlayertruncationmode?language=objc)
// NS_TYPED_ENUM
pub type CATextLayerTruncationMode = NSString;

/// [Apple's documentation](https://developer.apple.com/documentation/quartzcore/catextlayeralignmentmode?language=objc)
// NS_TYPED_ENUM
pub type CATextLayerAlignmentMode = NSString;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/quartzcore/catextlayer?language=objc)
    #[unsafe(super(CALayer, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "CALayer")]
    pub struct CATextLayer;
);

#[cfg(all(feature = "CALayer", feature = "CAMediaTiming"))]
extern_conformance!(
    unsafe impl CAMediaTiming for CATextLayer {}
);

#[cfg(feature = "CALayer")]
extern_conformance!(
    unsafe impl NSCoding for CATextLayer {}
);

#[cfg(feature = "CALayer")]
extern_conformance!(
    unsafe impl NSObjectProtocol for CATextLayer {}
);

#[cfg(feature = "CALayer")]
extern_conformance!(
    unsafe impl NSSecureCoding for CATextLayer {}
);

#[cfg(feature = "CALayer")]
impl CATextLayer {
    extern_methods!(
        #[unsafe(method(string))]
        #[unsafe(method_family = none)]
        pub fn string(&self) -> Option<Retained<AnyObject>>;

        /// Setter for [`string`][Self::string].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        ///
        /// # Safety
        ///
        /// `string` should be of the correct type.
        #[unsafe(method(setString:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setString(&self, string: Option<&AnyObject>);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(font))]
        #[unsafe(method_family = none)]
        pub fn font(&self) -> Option<Retained<CFType>>;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`font`][Self::font].
        ///
        /// # Safety
        ///
        /// `font` should be of the correct type.
        #[unsafe(method(setFont:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setFont(&self, font: Option<&CFType>);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(fontSize))]
        #[unsafe(method_family = none)]
        pub fn fontSize(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`fontSize`][Self::fontSize].
        #[unsafe(method(setFontSize:))]
        #[unsafe(method_family = none)]
        pub fn setFontSize(&self, font_size: CGFloat);

        #[cfg(feature = "objc2-core-graphics")]
        #[unsafe(method(foregroundColor))]
        #[unsafe(method_family = none)]
        pub fn foregroundColor(&self) -> Option<Retained<CGColor>>;

        #[cfg(feature = "objc2-core-graphics")]
        /// Setter for [`foregroundColor`][Self::foregroundColor].
        #[unsafe(method(setForegroundColor:))]
        #[unsafe(method_family = none)]
        pub fn setForegroundColor(&self, foreground_color: Option<&CGColor>);

        #[unsafe(method(isWrapped))]
        #[unsafe(method_family = none)]
        pub fn isWrapped(&self) -> bool;

        /// Setter for [`isWrapped`][Self::isWrapped].
        #[unsafe(method(setWrapped:))]
        #[unsafe(method_family = none)]
        pub fn setWrapped(&self, wrapped: bool);

        #[unsafe(method(truncationMode))]
        #[unsafe(method_family = none)]
        pub fn truncationMode(&self) -> Retained<CATextLayerTruncationMode>;

        /// Setter for [`truncationMode`][Self::truncationMode].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setTruncationMode:))]
        #[unsafe(method_family = none)]
        pub fn setTruncationMode(&self, truncation_mode: &CATextLayerTruncationMode);

        #[unsafe(method(alignmentMode))]
        #[unsafe(method_family = none)]
        pub fn alignmentMode(&self) -> Retained<CATextLayerAlignmentMode>;

        /// Setter for [`alignmentMode`][Self::alignmentMode].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setAlignmentMode:))]
        #[unsafe(method_family = none)]
        pub fn setAlignmentMode(&self, alignment_mode: &CATextLayerAlignmentMode);

        #[unsafe(method(allowsFontSubpixelQuantization))]
        #[unsafe(method_family = none)]
        pub fn allowsFontSubpixelQuantization(&self) -> bool;

        /// Setter for [`allowsFontSubpixelQuantization`][Self::allowsFontSubpixelQuantization].
        #[unsafe(method(setAllowsFontSubpixelQuantization:))]
        #[unsafe(method_family = none)]
        pub fn setAllowsFontSubpixelQuantization(&self, allows_font_subpixel_quantization: bool);
    );
}

/// Methods declared on superclass `CALayer`.
#[cfg(feature = "CALayer")]
impl CATextLayer {
    extern_methods!(
        /// Layer creation and initialization. *
        #[unsafe(method(layer))]
        #[unsafe(method_family = none)]
        pub fn layer() -> Retained<Self>;

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;

        /// # Safety
        ///
        /// `layer` should be of the correct type.
        #[unsafe(method(initWithLayer:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithLayer(this: Allocated<Self>, layer: &AnyObject) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "CALayer")]
impl CATextLayer {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new() -> Retained<Self>;
    );
}

#[cfg(feature = "CALayer")]
impl DefaultRetained for CATextLayer {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/quartzcore/kcatruncationnone?language=objc)
    pub static kCATruncationNone: &'static CATextLayerTruncationMode;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/quartzcore/kcatruncationstart?language=objc)
    pub static kCATruncationStart: &'static CATextLayerTruncationMode;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/quartzcore/kcatruncationend?language=objc)
    pub static kCATruncationEnd: &'static CATextLayerTruncationMode;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/quartzcore/kcatruncationmiddle?language=objc)
    pub static kCATruncationMiddle: &'static CATextLayerTruncationMode;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/quartzcore/kcaalignmentnatural?language=objc)
    pub static kCAAlignmentNatural: &'static CATextLayerAlignmentMode;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/quartzcore/kcaalignmentleft?language=objc)
    pub static kCAAlignmentLeft: &'static CATextLayerAlignmentMode;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/quartzcore/kcaalignmentright?language=objc)
    pub static kCAAlignmentRight: &'static CATextLayerAlignmentMode;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/quartzcore/kcaalignmentcenter?language=objc)
    pub static kCAAlignmentCenter: &'static CATextLayerAlignmentMode;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/quartzcore/kcaalignmentjustified?language=objc)
    pub static kCAAlignmentJustified: &'static CATextLayerAlignmentMode;
}
