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

use crate::*;

extern_protocol!(
    pub unsafe trait NSUserInterfaceItemSearching: NSObjectProtocol {
        #[cfg(feature = "block2")]
        #[method(searchForItemsWithSearchString:resultLimit:matchedItemHandler:)]
        unsafe fn searchForItemsWithSearchString_resultLimit_matchedItemHandler(
            &self,
            search_string: &NSString,
            result_limit: NSInteger,
            handle_matched_items: &block2::Block<dyn Fn(NonNull<NSArray>)>,
        );

        #[method_id(@__retain_semantics Other localizedTitlesForItem:)]
        unsafe fn localizedTitlesForItem(&self, item: &AnyObject) -> Retained<NSArray<NSString>>;

        #[optional]
        #[method(performActionForItem:)]
        unsafe fn performActionForItem(&self, item: &AnyObject);

        #[optional]
        #[method(showAllHelpTopicsForSearchString:)]
        unsafe fn showAllHelpTopicsForSearchString(&self, search_string: &NSString);
    }

    unsafe impl ProtocolType for dyn NSUserInterfaceItemSearching {}
);

extern_methods!(
    /// NSUserInterfaceItemSearching
    #[cfg(all(feature = "NSApplication", feature = "NSResponder"))]
    unsafe impl NSApplication {
        #[method(registerUserInterfaceItemSearchHandler:)]
        pub unsafe fn registerUserInterfaceItemSearchHandler(
            &self,
            handler: &ProtocolObject<dyn NSUserInterfaceItemSearching>,
        );

        #[method(unregisterUserInterfaceItemSearchHandler:)]
        pub unsafe fn unregisterUserInterfaceItemSearchHandler(
            &self,
            handler: &ProtocolObject<dyn NSUserInterfaceItemSearching>,
        );

        #[method(searchString:inUserInterfaceItemString:searchRange:foundRange:)]
        pub unsafe fn searchString_inUserInterfaceItemString_searchRange_foundRange(
            &self,
            search_string: &NSString,
            string_to_search: &NSString,
            search_range: NSRange,
            found_range: *mut NSRange,
        ) -> bool;
    }
);
