//! 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::*;
use objc2_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsfonttraitmask?language=objc)
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSFontTraitMask(pub NSUInteger);
bitflags::bitflags! {
    impl NSFontTraitMask: NSUInteger {
        #[doc(alias = "NSItalicFontMask")]
        const ItalicFontMask = 0x00000001;
        #[doc(alias = "NSBoldFontMask")]
        const BoldFontMask = 0x00000002;
        #[doc(alias = "NSUnboldFontMask")]
        const UnboldFontMask = 0x00000004;
        #[doc(alias = "NSNonStandardCharacterSetFontMask")]
        const NonStandardCharacterSetFontMask = 0x00000008;
        #[doc(alias = "NSNarrowFontMask")]
        const NarrowFontMask = 0x00000010;
        #[doc(alias = "NSExpandedFontMask")]
        const ExpandedFontMask = 0x00000020;
        #[doc(alias = "NSCondensedFontMask")]
        const CondensedFontMask = 0x00000040;
        #[doc(alias = "NSSmallCapsFontMask")]
        const SmallCapsFontMask = 0x00000080;
        #[doc(alias = "NSPosterFontMask")]
        const PosterFontMask = 0x00000100;
        #[doc(alias = "NSCompressedFontMask")]
        const CompressedFontMask = 0x00000200;
        #[doc(alias = "NSFixedPitchFontMask")]
        const FixedPitchFontMask = 0x00000400;
        #[doc(alias = "NSUnitalicFontMask")]
        const UnitalicFontMask = 0x01000000;
    }
}

unsafe impl Encode for NSFontTraitMask {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for NSFontTraitMask {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsfontcollectionoptions?language=objc)
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSFontCollectionOptions(pub NSUInteger);
bitflags::bitflags! {
    impl NSFontCollectionOptions: NSUInteger {
        #[doc(alias = "NSFontCollectionApplicationOnlyMask")]
        const ApplicationOnlyMask = 1<<0;
    }
}

unsafe impl Encode for NSFontCollectionOptions {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for NSFontCollectionOptions {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsfontaction?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSFontAction(pub NSUInteger);
impl NSFontAction {
    #[doc(alias = "NSNoFontChangeAction")]
    pub const NoFontChangeAction: Self = Self(0);
    #[doc(alias = "NSViaPanelFontAction")]
    pub const ViaPanelFontAction: Self = Self(1);
    #[doc(alias = "NSAddTraitFontAction")]
    pub const AddTraitFontAction: Self = Self(2);
    #[doc(alias = "NSSizeUpFontAction")]
    pub const SizeUpFontAction: Self = Self(3);
    #[doc(alias = "NSSizeDownFontAction")]
    pub const SizeDownFontAction: Self = Self(4);
    #[doc(alias = "NSHeavierFontAction")]
    pub const HeavierFontAction: Self = Self(5);
    #[doc(alias = "NSLighterFontAction")]
    pub const LighterFontAction: Self = Self(6);
    #[doc(alias = "NSRemoveTraitFontAction")]
    pub const RemoveTraitFontAction: Self = Self(7);
}

unsafe impl Encode for NSFontAction {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for NSFontAction {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsfontmanager?language=objc)
    #[unsafe(super(NSObject))]
    #[thread_kind = MainThreadOnly]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSFontManager;
);

#[cfg(feature = "NSMenu")]
unsafe impl NSMenuItemValidation for NSFontManager {}

unsafe impl NSObjectProtocol for NSFontManager {}

impl NSFontManager {
    extern_methods!(
        #[unsafe(method(setFontPanelFactory:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setFontPanelFactory(factory_id: Option<&AnyClass>, mtm: MainThreadMarker);

        #[unsafe(method(setFontManagerFactory:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setFontManagerFactory(factory_id: Option<&AnyClass>, mtm: MainThreadMarker);

        #[unsafe(method(sharedFontManager))]
        #[unsafe(method_family = none)]
        pub unsafe fn sharedFontManager(mtm: MainThreadMarker) -> Retained<NSFontManager>;

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

        #[cfg(feature = "NSFont")]
        #[unsafe(method(selectedFont))]
        #[unsafe(method_family = none)]
        pub unsafe fn selectedFont(&self) -> Option<Retained<NSFont>>;

        #[cfg(feature = "NSFont")]
        #[unsafe(method(setSelectedFont:isMultiple:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setSelectedFont_isMultiple(&self, font_obj: &NSFont, flag: bool);

        #[cfg(feature = "NSMenu")]
        #[unsafe(method(setFontMenu:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setFontMenu(&self, new_menu: &NSMenu);

        #[cfg(feature = "NSMenu")]
        #[unsafe(method(fontMenu:))]
        #[unsafe(method_family = none)]
        pub unsafe fn fontMenu(&self, create: bool) -> Option<Retained<NSMenu>>;

        #[cfg(all(
            feature = "NSFontPanel",
            feature = "NSPanel",
            feature = "NSResponder",
            feature = "NSWindow"
        ))]
        #[unsafe(method(fontPanel:))]
        #[unsafe(method_family = none)]
        pub unsafe fn fontPanel(&self, create: bool) -> Option<Retained<NSFontPanel>>;

        #[cfg(all(feature = "NSFont", feature = "objc2-core-foundation"))]
        #[unsafe(method(fontWithFamily:traits:weight:size:))]
        #[unsafe(method_family = none)]
        pub unsafe fn fontWithFamily_traits_weight_size(
            &self,
            family: &NSString,
            traits: NSFontTraitMask,
            weight: NSInteger,
            size: CGFloat,
        ) -> Option<Retained<NSFont>>;

        #[cfg(feature = "NSFont")]
        #[unsafe(method(traitsOfFont:))]
        #[unsafe(method_family = none)]
        pub unsafe fn traitsOfFont(&self, font_obj: &NSFont) -> NSFontTraitMask;

        #[cfg(feature = "NSFont")]
        #[unsafe(method(weightOfFont:))]
        #[unsafe(method_family = none)]
        pub unsafe fn weightOfFont(&self, font_obj: &NSFont) -> NSInteger;

        #[unsafe(method(availableFonts))]
        #[unsafe(method_family = none)]
        pub unsafe fn availableFonts(&self) -> Retained<NSArray<NSString>>;

        #[unsafe(method(availableFontFamilies))]
        #[unsafe(method_family = none)]
        pub unsafe fn availableFontFamilies(&self) -> Retained<NSArray<NSString>>;

        #[unsafe(method(availableMembersOfFontFamily:))]
        #[unsafe(method_family = none)]
        pub unsafe fn availableMembersOfFontFamily(
            &self,
            fam: &NSString,
        ) -> Option<Retained<NSArray<NSArray>>>;

        #[cfg(feature = "NSFont")]
        #[unsafe(method(convertFont:))]
        #[unsafe(method_family = none)]
        pub unsafe fn convertFont(&self, font_obj: &NSFont) -> Retained<NSFont>;

        #[cfg(all(feature = "NSFont", feature = "objc2-core-foundation"))]
        #[unsafe(method(convertFont:toSize:))]
        #[unsafe(method_family = none)]
        pub unsafe fn convertFont_toSize(
            &self,
            font_obj: &NSFont,
            size: CGFloat,
        ) -> Retained<NSFont>;

        #[cfg(feature = "NSFont")]
        #[unsafe(method(convertFont:toFace:))]
        #[unsafe(method_family = none)]
        pub unsafe fn convertFont_toFace(
            &self,
            font_obj: &NSFont,
            typeface: &NSString,
        ) -> Option<Retained<NSFont>>;

        #[cfg(feature = "NSFont")]
        #[unsafe(method(convertFont:toFamily:))]
        #[unsafe(method_family = none)]
        pub unsafe fn convertFont_toFamily(
            &self,
            font_obj: &NSFont,
            family: &NSString,
        ) -> Retained<NSFont>;

        #[cfg(feature = "NSFont")]
        #[unsafe(method(convertFont:toHaveTrait:))]
        #[unsafe(method_family = none)]
        pub unsafe fn convertFont_toHaveTrait(
            &self,
            font_obj: &NSFont,
            r#trait: NSFontTraitMask,
        ) -> Retained<NSFont>;

        #[cfg(feature = "NSFont")]
        #[unsafe(method(convertFont:toNotHaveTrait:))]
        #[unsafe(method_family = none)]
        pub unsafe fn convertFont_toNotHaveTrait(
            &self,
            font_obj: &NSFont,
            r#trait: NSFontTraitMask,
        ) -> Retained<NSFont>;

        #[cfg(feature = "NSFont")]
        #[unsafe(method(convertWeight:ofFont:))]
        #[unsafe(method_family = none)]
        pub unsafe fn convertWeight_ofFont(
            &self,
            up_flag: bool,
            font_obj: &NSFont,
        ) -> Retained<NSFont>;

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

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

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

        /// Setter for [`action`][Self::action].
        #[unsafe(method(setAction:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAction(&self, action: Sel);

        #[deprecated = "NSFontManager doesn't have any delegate method. This property should not be used."]
        #[unsafe(method(delegate))]
        #[unsafe(method_family = none)]
        pub unsafe fn delegate(&self) -> Option<Retained<AnyObject>>;

        /// Setter for [`delegate`][Self::delegate].
        #[deprecated = "NSFontManager doesn't have any delegate method. This property should not be used."]
        #[unsafe(method(setDelegate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDelegate(&self, delegate: Option<&AnyObject>);

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

        #[unsafe(method(localizedNameForFamily:face:))]
        #[unsafe(method_family = none)]
        pub unsafe fn localizedNameForFamily_face(
            &self,
            family: &NSString,
            face_key: Option<&NSString>,
        ) -> Retained<NSString>;

        #[unsafe(method(setSelectedAttributes:isMultiple:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setSelectedAttributes_isMultiple(
            &self,
            attributes: &NSDictionary<NSString, AnyObject>,
            flag: bool,
        );

        #[unsafe(method(convertAttributes:))]
        #[unsafe(method_family = none)]
        pub unsafe fn convertAttributes(
            &self,
            attributes: &NSDictionary<NSString, AnyObject>,
        ) -> Retained<NSDictionary<NSString, AnyObject>>;

        #[cfg(feature = "NSFontDescriptor")]
        #[deprecated = "Use -[NSFontDescriptor matchingFontDescriptorsWithMandatoryKeys:] instead"]
        #[unsafe(method(availableFontNamesMatchingFontDescriptor:))]
        #[unsafe(method_family = none)]
        pub unsafe fn availableFontNamesMatchingFontDescriptor(
            &self,
            descriptor: &NSFontDescriptor,
        ) -> Option<Retained<NSArray>>;

        #[deprecated = "Use +[NSFontCollection allFontCollectionNames] instead"]
        #[unsafe(method(collectionNames))]
        #[unsafe(method_family = none)]
        pub unsafe fn collectionNames(&self) -> Retained<NSArray>;

        #[deprecated = "Use -[NSFontCollection matchingDescriptors] instead"]
        #[unsafe(method(fontDescriptorsInCollection:))]
        #[unsafe(method_family = none)]
        pub unsafe fn fontDescriptorsInCollection(
            &self,
            collection_names: &NSString,
        ) -> Option<Retained<NSArray>>;

        #[deprecated = "Use +[NSFontCollection showFontCollection:withName:visibility:name:] instead"]
        #[unsafe(method(addCollection:options:))]
        #[unsafe(method_family = none)]
        pub unsafe fn addCollection_options(
            &self,
            collection_name: &NSString,
            collection_options: NSFontCollectionOptions,
        ) -> bool;

        #[deprecated = "Use +[NSFontCollection hideFontCollectionWithName:visibility:error:] instead"]
        #[unsafe(method(removeCollection:))]
        #[unsafe(method_family = none)]
        pub unsafe fn removeCollection(&self, collection_name: &NSString) -> bool;

        #[deprecated = "Use -[NSMutableFontCollection addQueryForDescriptors:] instead"]
        #[unsafe(method(addFontDescriptors:toCollection:))]
        #[unsafe(method_family = none)]
        pub unsafe fn addFontDescriptors_toCollection(
            &self,
            descriptors: &NSArray,
            collection_name: &NSString,
        );

        #[cfg(feature = "NSFontDescriptor")]
        #[deprecated = "Use -[NSMutableFontCollection removeQueryForDescriptors:] instead"]
        #[unsafe(method(removeFontDescriptor:fromCollection:))]
        #[unsafe(method_family = none)]
        pub unsafe fn removeFontDescriptor_fromCollection(
            &self,
            descriptor: &NSFontDescriptor,
            collection: &NSString,
        );

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

        #[unsafe(method(convertFontTraits:))]
        #[unsafe(method_family = none)]
        pub unsafe fn convertFontTraits(&self, traits: NSFontTraitMask) -> NSFontTraitMask;

        #[unsafe(method(target))]
        #[unsafe(method_family = none)]
        pub unsafe fn target(&self) -> Option<Retained<AnyObject>>;

        /// This is a [weak property][objc2::topics::weak_property].
        /// Setter for [`target`][Self::target].
        #[unsafe(method(setTarget:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setTarget(&self, target: Option<&AnyObject>);
    );
}

/// Methods declared on superclass `NSObject`.
impl NSFontManager {
    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(mtm: MainThreadMarker) -> Retained<Self>;
    );
}

/// NSFontManagerMenuActionMethods.
impl NSFontManager {
    extern_methods!(
        #[unsafe(method(fontNamed:hasTraits:))]
        #[unsafe(method_family = none)]
        pub unsafe fn fontNamed_hasTraits(
            &self,
            f_name: &NSString,
            some_traits: NSFontTraitMask,
        ) -> bool;

        #[unsafe(method(availableFontNamesWithTraits:))]
        #[unsafe(method_family = none)]
        pub unsafe fn availableFontNamesWithTraits(
            &self,
            some_traits: NSFontTraitMask,
        ) -> Option<Retained<NSArray<NSString>>>;

        #[unsafe(method(addFontTrait:))]
        #[unsafe(method_family = none)]
        pub unsafe fn addFontTrait(&self, sender: Option<&AnyObject>);

        #[unsafe(method(removeFontTrait:))]
        #[unsafe(method_family = none)]
        pub unsafe fn removeFontTrait(&self, sender: Option<&AnyObject>);

        #[unsafe(method(modifyFontViaPanel:))]
        #[unsafe(method_family = none)]
        pub unsafe fn modifyFontViaPanel(&self, sender: Option<&AnyObject>);

        #[unsafe(method(modifyFont:))]
        #[unsafe(method_family = none)]
        pub unsafe fn modifyFont(&self, sender: Option<&AnyObject>);

        #[unsafe(method(orderFrontFontPanel:))]
        #[unsafe(method_family = none)]
        pub unsafe fn orderFrontFontPanel(&self, sender: Option<&AnyObject>);

        #[unsafe(method(orderFrontStylesPanel:))]
        #[unsafe(method_family = none)]
        pub unsafe fn orderFrontStylesPanel(&self, sender: Option<&AnyObject>);
    );
}
