icrate 0.0.1

Bindings to Apple's frameworks
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use crate::common::*;
use crate::AppKit::*;
use crate::CoreData::*;
use crate::Foundation::*;

ns_options!(
    #[underlying(NSUInteger)]
    pub enum NSFontTraitMask {
        NSItalicFontMask = 0x00000001,
        NSBoldFontMask = 0x00000002,
        NSUnboldFontMask = 0x00000004,
        NSNonStandardCharacterSetFontMask = 0x00000008,
        NSNarrowFontMask = 0x00000010,
        NSExpandedFontMask = 0x00000020,
        NSCondensedFontMask = 0x00000040,
        NSSmallCapsFontMask = 0x00000080,
        NSPosterFontMask = 0x00000100,
        NSCompressedFontMask = 0x00000200,
        NSFixedPitchFontMask = 0x00000400,
        NSUnitalicFontMask = 0x01000000,
    }
);

ns_options!(
    #[underlying(NSUInteger)]
    pub enum NSFontCollectionOptions {
        NSFontCollectionApplicationOnlyMask = 1 << 0,
    }
);

ns_enum!(
    #[underlying(NSUInteger)]
    pub enum NSFontAction {
        NSNoFontChangeAction = 0,
        NSViaPanelFontAction = 1,
        NSAddTraitFontAction = 2,
        NSSizeUpFontAction = 3,
        NSSizeDownFontAction = 4,
        NSHeavierFontAction = 5,
        NSLighterFontAction = 6,
        NSRemoveTraitFontAction = 7,
    }
);

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSFontManager;

    unsafe impl ClassType for NSFontManager {
        type Super = NSObject;
    }
);

extern_methods!(
    unsafe impl NSFontManager {
        #[method(setFontPanelFactory:)]
        pub unsafe fn setFontPanelFactory(factoryId: Option<&Class>);

        #[method(setFontManagerFactory:)]
        pub unsafe fn setFontManagerFactory(factoryId: Option<&Class>);

        #[method_id(@__retain_semantics Other sharedFontManager)]
        pub unsafe fn sharedFontManager() -> Id<NSFontManager, Shared>;

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

        #[method_id(@__retain_semantics Other selectedFont)]
        pub unsafe fn selectedFont(&self) -> Option<Id<NSFont, Shared>>;

        #[method(setSelectedFont:isMultiple:)]
        pub unsafe fn setSelectedFont_isMultiple(&self, fontObj: &NSFont, flag: bool);

        #[method(setFontMenu:)]
        pub unsafe fn setFontMenu(&self, newMenu: &NSMenu);

        #[method_id(@__retain_semantics Other fontMenu:)]
        pub unsafe fn fontMenu(&self, create: bool) -> Option<Id<NSMenu, Shared>>;

        #[method_id(@__retain_semantics Other fontPanel:)]
        pub unsafe fn fontPanel(&self, create: bool) -> Option<Id<NSFontPanel, Shared>>;

        #[method_id(@__retain_semantics Other fontWithFamily:traits:weight:size:)]
        pub unsafe fn fontWithFamily_traits_weight_size(
            &self,
            family: &NSString,
            traits: NSFontTraitMask,
            weight: NSInteger,
            size: CGFloat,
        ) -> Option<Id<NSFont, Shared>>;

        #[method(traitsOfFont:)]
        pub unsafe fn traitsOfFont(&self, fontObj: &NSFont) -> NSFontTraitMask;

        #[method(weightOfFont:)]
        pub unsafe fn weightOfFont(&self, fontObj: &NSFont) -> NSInteger;

        #[method_id(@__retain_semantics Other availableFonts)]
        pub unsafe fn availableFonts(&self) -> Id<NSArray<NSString>, Shared>;

        #[method_id(@__retain_semantics Other availableFontFamilies)]
        pub unsafe fn availableFontFamilies(&self) -> Id<NSArray<NSString>, Shared>;

        #[method_id(@__retain_semantics Other availableMembersOfFontFamily:)]
        pub unsafe fn availableMembersOfFontFamily(
            &self,
            fam: &NSString,
        ) -> Option<Id<NSArray<NSArray>, Shared>>;

        #[method_id(@__retain_semantics Other convertFont:)]
        pub unsafe fn convertFont(&self, fontObj: &NSFont) -> Id<NSFont, Shared>;

        #[method_id(@__retain_semantics Other convertFont:toSize:)]
        pub unsafe fn convertFont_toSize(
            &self,
            fontObj: &NSFont,
            size: CGFloat,
        ) -> Id<NSFont, Shared>;

        #[method_id(@__retain_semantics Other convertFont:toFace:)]
        pub unsafe fn convertFont_toFace(
            &self,
            fontObj: &NSFont,
            typeface: &NSString,
        ) -> Option<Id<NSFont, Shared>>;

        #[method_id(@__retain_semantics Other convertFont:toFamily:)]
        pub unsafe fn convertFont_toFamily(
            &self,
            fontObj: &NSFont,
            family: &NSString,
        ) -> Id<NSFont, Shared>;

        #[method_id(@__retain_semantics Other convertFont:toHaveTrait:)]
        pub unsafe fn convertFont_toHaveTrait(
            &self,
            fontObj: &NSFont,
            trait_: NSFontTraitMask,
        ) -> Id<NSFont, Shared>;

        #[method_id(@__retain_semantics Other convertFont:toNotHaveTrait:)]
        pub unsafe fn convertFont_toNotHaveTrait(
            &self,
            fontObj: &NSFont,
            trait_: NSFontTraitMask,
        ) -> Id<NSFont, Shared>;

        #[method_id(@__retain_semantics Other convertWeight:ofFont:)]
        pub unsafe fn convertWeight_ofFont(
            &self,
            upFlag: bool,
            fontObj: &NSFont,
        ) -> Id<NSFont, Shared>;

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

        #[method(setEnabled:)]
        pub unsafe fn setEnabled(&self, enabled: bool);

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

        #[method(setAction:)]
        pub unsafe fn setAction(&self, action: Sel);

        #[method_id(@__retain_semantics Other delegate)]
        pub unsafe fn delegate(&self) -> Option<Id<Object, Shared>>;

        #[method(setDelegate:)]
        pub unsafe fn setDelegate(&self, delegate: Option<&Object>);

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

        #[method_id(@__retain_semantics Other localizedNameForFamily:face:)]
        pub unsafe fn localizedNameForFamily_face(
            &self,
            family: &NSString,
            faceKey: Option<&NSString>,
        ) -> Id<NSString, Shared>;

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

        #[method_id(@__retain_semantics Other convertAttributes:)]
        pub unsafe fn convertAttributes(
            &self,
            attributes: &NSDictionary<NSString, Object>,
        ) -> Id<NSDictionary<NSString, Object>, Shared>;

        #[method_id(@__retain_semantics Other availableFontNamesMatchingFontDescriptor:)]
        pub unsafe fn availableFontNamesMatchingFontDescriptor(
            &self,
            descriptor: &NSFontDescriptor,
        ) -> Option<Id<NSArray, Shared>>;

        #[method_id(@__retain_semantics Other collectionNames)]
        pub unsafe fn collectionNames(&self) -> Id<NSArray, Shared>;

        #[method_id(@__retain_semantics Other fontDescriptorsInCollection:)]
        pub unsafe fn fontDescriptorsInCollection(
            &self,
            collectionNames: &NSString,
        ) -> Option<Id<NSArray, Shared>>;

        #[method(addCollection:options:)]
        pub unsafe fn addCollection_options(
            &self,
            collectionName: &NSString,
            collectionOptions: NSFontCollectionOptions,
        ) -> bool;

        #[method(removeCollection:)]
        pub unsafe fn removeCollection(&self, collectionName: &NSString) -> bool;

        #[method(addFontDescriptors:toCollection:)]
        pub unsafe fn addFontDescriptors_toCollection(
            &self,
            descriptors: &NSArray,
            collectionName: &NSString,
        );

        #[method(removeFontDescriptor:fromCollection:)]
        pub unsafe fn removeFontDescriptor_fromCollection(
            &self,
            descriptor: &NSFontDescriptor,
            collection: &NSString,
        );

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

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

        #[method_id(@__retain_semantics Other target)]
        pub unsafe fn target(&self) -> Option<Id<Object, Shared>>;

        #[method(setTarget:)]
        pub unsafe fn setTarget(&self, target: Option<&Object>);
    }
);

extern_methods!(
    /// NSFontManagerMenuActionMethods
    unsafe impl NSFontManager {
        #[method(fontNamed:hasTraits:)]
        pub unsafe fn fontNamed_hasTraits(
            &self,
            fName: &NSString,
            someTraits: NSFontTraitMask,
        ) -> bool;

        #[method_id(@__retain_semantics Other availableFontNamesWithTraits:)]
        pub unsafe fn availableFontNamesWithTraits(
            &self,
            someTraits: NSFontTraitMask,
        ) -> Option<Id<NSArray<NSString>, Shared>>;

        #[method(addFontTrait:)]
        pub unsafe fn addFontTrait(&self, sender: Option<&Object>);

        #[method(removeFontTrait:)]
        pub unsafe fn removeFontTrait(&self, sender: Option<&Object>);

        #[method(modifyFontViaPanel:)]
        pub unsafe fn modifyFontViaPanel(&self, sender: Option<&Object>);

        #[method(modifyFont:)]
        pub unsafe fn modifyFont(&self, sender: Option<&Object>);

        #[method(orderFrontFontPanel:)]
        pub unsafe fn orderFrontFontPanel(&self, sender: Option<&Object>);

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