objc2-accessibility 0.3.2

Bindings to the Accessibility framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// A rule for translating print text to Braille, and back-translating Braille to print text.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/accessibility/axbrailletable?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct AXBrailleTable;
);

extern_conformance!(
    unsafe impl NSCoding for AXBrailleTable {}
);

extern_conformance!(
    unsafe impl NSCopying for AXBrailleTable {}
);

unsafe impl CopyingHelper for AXBrailleTable {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for AXBrailleTable {}
);

impl AXBrailleTable {
    extern_methods!(
        /// A unique string that identifies this table.
        #[unsafe(method(identifier))]
        #[unsafe(method_family = none)]
        pub unsafe fn identifier(&self) -> Retained<NSString>;

        /// The localized name of this table for user display.
        #[unsafe(method(localizedName))]
        #[unsafe(method_family = none)]
        pub unsafe fn localizedName(&self) -> Retained<NSString>;

        /// The identifier of the provider of this table.
        #[unsafe(method(providerIdentifier))]
        #[unsafe(method_family = none)]
        pub unsafe fn providerIdentifier(&self) -> Retained<NSString>;

        /// The localized name of the provider of this table for user display.
        #[unsafe(method(localizedProviderName))]
        #[unsafe(method_family = none)]
        pub unsafe fn localizedProviderName(&self) -> Retained<NSString>;

        /// The 3-character code from ISO 639-2 for the language this Braille table pertains to.
        #[unsafe(method(language))]
        #[unsafe(method_family = none)]
        pub unsafe fn language(&self) -> Retained<NSString>;

        /// All locales this table supports.
        #[unsafe(method(locales))]
        #[unsafe(method_family = none)]
        pub unsafe fn locales(&self) -> Retained<NSSet<NSLocale>>;

        /// Returns true if this table makes use of eight dots as opposed to six dots.
        #[unsafe(method(isEightDot))]
        #[unsafe(method_family = none)]
        pub unsafe fn isEightDot(&self) -> bool;

        /// All locales supported by existing tables.
        #[unsafe(method(supportedLocales))]
        #[unsafe(method_family = none)]
        pub unsafe fn supportedLocales() -> Retained<NSSet<NSLocale>>;

        /// The default table that provides translations for the given locale's language. Returns nil if there is none.
        #[unsafe(method(defaultTableForLocale:))]
        #[unsafe(method_family = none)]
        pub unsafe fn defaultTableForLocale(locale: &NSLocale) -> Option<Retained<AXBrailleTable>>;

        /// All tables that provide translations for the given locale's language.
        #[unsafe(method(tablesForLocale:))]
        #[unsafe(method_family = none)]
        pub unsafe fn tablesForLocale(locale: &NSLocale) -> Retained<NSSet<AXBrailleTable>>;

        /// All tables that are not specific to any language.
        #[unsafe(method(languageAgnosticTables))]
        #[unsafe(method_family = none)]
        pub unsafe fn languageAgnosticTables() -> Retained<NSSet<AXBrailleTable>>;

        /// Returns nil if there is no table with the given identifier.
        #[unsafe(method(initWithIdentifier:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithIdentifier(
            this: Allocated<Self>,
            identifier: &NSString,
        ) -> Option<Retained<Self>>;

        #[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() -> Retained<Self>;
    );
}

extern_class!(
    /// The result of translation or back-translation.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/accessibility/axbrailletranslationresult?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct AXBrailleTranslationResult;
);

extern_conformance!(
    unsafe impl NSCoding for AXBrailleTranslationResult {}
);

extern_conformance!(
    unsafe impl NSCopying for AXBrailleTranslationResult {}
);

unsafe impl CopyingHelper for AXBrailleTranslationResult {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for AXBrailleTranslationResult {}
);

impl AXBrailleTranslationResult {
    extern_methods!(
        /// The resulting string after translation or back-translation.
        #[unsafe(method(resultString))]
        #[unsafe(method_family = none)]
        pub unsafe fn resultString(&self) -> Retained<NSString>;

        /// An array of integers that has the same length as the resultString.
        /// locationMap[i]-th character in the input string corresponds to resultString[i].
        #[unsafe(method(locationMap))]
        #[unsafe(method_family = none)]
        pub unsafe fn locationMap(&self) -> Retained<NSArray<NSNumber>>;

        #[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() -> Retained<Self>;
    );
}

extern_class!(
    /// Translates print text to Braille and Braille to print text according to the given Braille table.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/accessibility/axbrailletranslator?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct AXBrailleTranslator;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for AXBrailleTranslator {}
);

impl AXBrailleTranslator {
    extern_methods!(
        #[unsafe(method(initWithBrailleTable:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithBrailleTable(
            this: Allocated<Self>,
            braille_table: &AXBrailleTable,
        ) -> Retained<Self>;

        /// Output Braille uses the unicode Braille characters (0x2800-0x28FF).
        #[unsafe(method(translatePrintText:))]
        #[unsafe(method_family = none)]
        pub unsafe fn translatePrintText(
            &self,
            print_text: &NSString,
        ) -> Retained<AXBrailleTranslationResult>;

        /// Input Braille should use the unicode Braille characters (0x2800-0x28FF).
        #[unsafe(method(backTranslateBraille:))]
        #[unsafe(method_family = none)]
        pub unsafe fn backTranslateBraille(
            &self,
            braille: &NSString,
        ) -> Retained<AXBrailleTranslationResult>;

        #[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() -> Retained<Self>;
    );
}