objc2-car-play 0.3.2

Bindings to the CarPlay framework
Documentation
//! 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::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/carplay/cpsearchtemplate?language=objc)
    #[unsafe(super(CPTemplate, NSObject))]
    #[thread_kind = MainThreadOnly]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "CPTemplate")]
    pub struct CPSearchTemplate;
);

#[cfg(feature = "CPTemplate")]
extern_conformance!(
    unsafe impl NSCoding for CPSearchTemplate {}
);

#[cfg(feature = "CPTemplate")]
extern_conformance!(
    unsafe impl NSObjectProtocol for CPSearchTemplate {}
);

#[cfg(feature = "CPTemplate")]
extern_conformance!(
    unsafe impl NSSecureCoding for CPSearchTemplate {}
);

#[cfg(feature = "CPTemplate")]
impl CPSearchTemplate {
    extern_methods!(
        #[unsafe(method(delegate))]
        #[unsafe(method_family = none)]
        pub unsafe fn delegate(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn CPSearchTemplateDelegate>>>;

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

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "CPTemplate")]
impl CPSearchTemplate {
    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>;
    );
}

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/carplay/cpsearchtemplatedelegate?language=objc)
    pub unsafe trait CPSearchTemplateDelegate: NSObjectProtocol + MainThreadOnly {
        #[cfg(all(feature = "CPListItem", feature = "CPTemplate", feature = "block2"))]
        /// The user has entered characters in the search text field.
        ///
        ///
        /// Parameter `searchTemplate`: The search template in use by the user
        ///
        /// Parameter `searchText`: The search text entered by the user
        ///
        /// Parameter `completionHandler`: You must call the completionHandler with updated search results
        #[unsafe(method(searchTemplate:updatedSearchText:completionHandler:))]
        #[unsafe(method_family = none)]
        unsafe fn searchTemplate_updatedSearchText_completionHandler(
            &self,
            search_template: &CPSearchTemplate,
            search_text: &NSString,
            completion_handler: &block2::DynBlock<dyn Fn(NonNull<NSArray<CPListItem>>)>,
        );

        #[cfg(all(feature = "CPListItem", feature = "CPTemplate", feature = "block2"))]
        /// The user has selected an item in the search result list.
        ///
        ///
        /// Parameter `searchTemplate`: The search template in use by the user
        ///
        /// Parameter `item`: The item selected by the user
        ///
        /// Parameter `completionHandler`: You must call the completionHandler when you have handled the row selection in the search result
        #[unsafe(method(searchTemplate:selectedResult:completionHandler:))]
        #[unsafe(method_family = none)]
        unsafe fn searchTemplate_selectedResult_completionHandler(
            &self,
            search_template: &CPSearchTemplate,
            item: &CPListItem,
            completion_handler: &block2::DynBlock<dyn Fn()>,
        );

        #[cfg(feature = "CPTemplate")]
        /// The user has selected the keyboard's search button. Generally, you should push a
        /// `CPListTemplate`containing the current search results.
        ///
        ///
        /// Parameter `searchTemplate`: The search template in use by the user
        #[optional]
        #[unsafe(method(searchTemplateSearchButtonPressed:))]
        #[unsafe(method_family = none)]
        unsafe fn searchTemplateSearchButtonPressed(&self, search_template: &CPSearchTemplate);
    }
);