objc2-ui-kit 0.2.2

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

use crate::*;

pub type UITextSearchDocumentIdentifier = TodoProtocols;

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UITextSearchFoundTextStyle(pub NSInteger);
impl UITextSearchFoundTextStyle {
    #[doc(alias = "UITextSearchFoundTextStyleNormal")]
    pub const Normal: Self = Self(0);
    #[doc(alias = "UITextSearchFoundTextStyleFound")]
    pub const Found: Self = Self(1);
    #[doc(alias = "UITextSearchFoundTextStyleHighlighted")]
    pub const Highlighted: Self = Self(2);
}

unsafe impl Encode for UITextSearchFoundTextStyle {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

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

extern_protocol!(
    pub unsafe trait UITextSearchAggregator: NSObjectProtocol + IsMainThreadOnly {
        #[cfg(feature = "UITextInput")]
        #[method_id(@__retain_semantics Other allFoundRanges)]
        unsafe fn allFoundRanges(&self) -> Retained<NSOrderedSet<UITextRange>>;

        #[cfg(feature = "UITextInput")]
        #[method(foundRange:forSearchString:inDocument:)]
        unsafe fn foundRange_forSearchString_inDocument(
            &self,
            range: &UITextRange,
            string: &NSString,
            document: Option<&UITextSearchDocumentIdentifier>,
        );

        #[cfg(feature = "UITextInput")]
        #[method(invalidateFoundRange:inDocument:)]
        unsafe fn invalidateFoundRange_inDocument(
            &self,
            range: &UITextRange,
            document: Option<&UITextSearchDocumentIdentifier>,
        );

        #[method(invalidate)]
        unsafe fn invalidate(&self);

        #[method(finishedSearching)]
        unsafe fn finishedSearching(&self);
    }

    unsafe impl ProtocolType for dyn UITextSearchAggregator {}
);

extern_protocol!(
    pub unsafe trait UITextSearching: NSObjectProtocol + IsMainThreadOnly {
        #[cfg(feature = "UITextInput")]
        #[method_id(@__retain_semantics Other selectedTextRange)]
        unsafe fn selectedTextRange(&self) -> Option<Retained<UITextRange>>;

        #[cfg(feature = "UITextInput")]
        #[method(compareFoundRange:toRange:inDocument:)]
        unsafe fn compareFoundRange_toRange_inDocument(
            &self,
            found_range: &UITextRange,
            to_range: &UITextRange,
            document: Option<&UITextSearchDocumentIdentifier>,
        ) -> NSComparisonResult;

        #[cfg(feature = "UIFindSession")]
        #[method(performTextSearchWithQueryString:usingOptions:resultAggregator:)]
        unsafe fn performTextSearchWithQueryString_usingOptions_resultAggregator(
            &self,
            string: &NSString,
            options: &UITextSearchOptions,
            aggregator: &ProtocolObject<dyn UITextSearchAggregator>,
        );

        #[cfg(feature = "UITextInput")]
        #[method(decorateFoundTextRange:inDocument:usingStyle:)]
        unsafe fn decorateFoundTextRange_inDocument_usingStyle(
            &self,
            range: &UITextRange,
            document: Option<&UITextSearchDocumentIdentifier>,
            style: UITextSearchFoundTextStyle,
        );

        #[method(clearAllDecoratedFoundText)]
        unsafe fn clearAllDecoratedFoundText(&self);

        #[optional]
        #[method(supportsTextReplacement)]
        unsafe fn supportsTextReplacement(&self) -> bool;

        #[cfg(feature = "UITextInput")]
        #[optional]
        #[method(shouldReplaceFoundTextInRange:inDocument:withText:)]
        unsafe fn shouldReplaceFoundTextInRange_inDocument_withText(
            &self,
            range: &UITextRange,
            document: Option<&UITextSearchDocumentIdentifier>,
            replacement_text: &NSString,
        ) -> bool;

        #[cfg(feature = "UITextInput")]
        #[optional]
        #[method(replaceFoundTextInRange:inDocument:withText:)]
        unsafe fn replaceFoundTextInRange_inDocument_withText(
            &self,
            range: &UITextRange,
            document: Option<&UITextSearchDocumentIdentifier>,
            replacement_text: &NSString,
        );

        #[cfg(feature = "UIFindSession")]
        #[optional]
        #[method(replaceAllOccurrencesOfQueryString:usingOptions:withText:)]
        unsafe fn replaceAllOccurrencesOfQueryString_usingOptions_withText(
            &self,
            query_string: &NSString,
            options: &UITextSearchOptions,
            replacement_text: &NSString,
        );

        #[cfg(feature = "UITextInput")]
        #[optional]
        #[method(willHighlightFoundTextRange:inDocument:)]
        unsafe fn willHighlightFoundTextRange_inDocument(
            &self,
            range: &UITextRange,
            document: Option<&UITextSearchDocumentIdentifier>,
        );

        #[cfg(feature = "UITextInput")]
        #[optional]
        #[method(scrollRangeToVisible:inDocument:)]
        unsafe fn scrollRangeToVisible_inDocument(
            &self,
            range: &UITextRange,
            document: Option<&UITextSearchDocumentIdentifier>,
        );

        #[optional]
        #[method_id(@__retain_semantics Other selectedTextSearchDocument)]
        unsafe fn selectedTextSearchDocument(
            &self,
        ) -> Option<Retained<UITextSearchDocumentIdentifier>>;

        #[optional]
        #[method(compareOrderFromDocument:toDocument:)]
        unsafe fn compareOrderFromDocument_toDocument(
            &self,
            from_document: &UITextSearchDocumentIdentifier,
            to_document: &UITextSearchDocumentIdentifier,
        ) -> NSComparisonResult;
    }

    unsafe impl ProtocolType for dyn UITextSearching {}
);