objc2_car_play/generated/
CPSearchTemplate.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// [Apple's documentation](https://developer.apple.com/documentation/carplay/cpsearchtemplate?language=objc)
12    #[unsafe(super(CPTemplate, NSObject))]
13    #[thread_kind = MainThreadOnly]
14    #[derive(Debug, PartialEq, Eq, Hash)]
15    #[cfg(feature = "CPTemplate")]
16    pub struct CPSearchTemplate;
17);
18
19#[cfg(feature = "CPTemplate")]
20extern_conformance!(
21    unsafe impl NSCoding for CPSearchTemplate {}
22);
23
24#[cfg(feature = "CPTemplate")]
25extern_conformance!(
26    unsafe impl NSObjectProtocol for CPSearchTemplate {}
27);
28
29#[cfg(feature = "CPTemplate")]
30extern_conformance!(
31    unsafe impl NSSecureCoding for CPSearchTemplate {}
32);
33
34#[cfg(feature = "CPTemplate")]
35impl CPSearchTemplate {
36    extern_methods!(
37        #[unsafe(method(delegate))]
38        #[unsafe(method_family = none)]
39        pub unsafe fn delegate(
40            &self,
41        ) -> Option<Retained<ProtocolObject<dyn CPSearchTemplateDelegate>>>;
42
43        /// Setter for [`delegate`][Self::delegate].
44        ///
45        /// This is a [weak property][objc2::topics::weak_property].
46        #[unsafe(method(setDelegate:))]
47        #[unsafe(method_family = none)]
48        pub unsafe fn setDelegate(
49            &self,
50            delegate: Option<&ProtocolObject<dyn CPSearchTemplateDelegate>>,
51        );
52    );
53}
54
55/// Methods declared on superclass `NSObject`.
56#[cfg(feature = "CPTemplate")]
57impl CPSearchTemplate {
58    extern_methods!(
59        #[unsafe(method(init))]
60        #[unsafe(method_family = init)]
61        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
62
63        #[unsafe(method(new))]
64        #[unsafe(method_family = new)]
65        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
66    );
67}
68
69extern_protocol!(
70    /// [Apple's documentation](https://developer.apple.com/documentation/carplay/cpsearchtemplatedelegate?language=objc)
71    pub unsafe trait CPSearchTemplateDelegate: NSObjectProtocol + MainThreadOnly {
72        #[cfg(all(feature = "CPListItem", feature = "CPTemplate", feature = "block2"))]
73        /// The user has entered characters in the search text field.
74        ///
75        ///
76        /// Parameter `searchTemplate`: The search template in use by the user
77        ///
78        /// Parameter `searchText`: The search text entered by the user
79        ///
80        /// Parameter `completionHandler`: You must call the completionHandler with updated search results
81        #[unsafe(method(searchTemplate:updatedSearchText:completionHandler:))]
82        #[unsafe(method_family = none)]
83        unsafe fn searchTemplate_updatedSearchText_completionHandler(
84            &self,
85            search_template: &CPSearchTemplate,
86            search_text: &NSString,
87            completion_handler: &block2::DynBlock<dyn Fn(NonNull<NSArray<CPListItem>>)>,
88        );
89
90        #[cfg(all(feature = "CPListItem", feature = "CPTemplate", feature = "block2"))]
91        /// The user has selected an item in the search result list.
92        ///
93        ///
94        /// Parameter `searchTemplate`: The search template in use by the user
95        ///
96        /// Parameter `item`: The item selected by the user
97        ///
98        /// Parameter `completionHandler`: You must call the completionHandler when you have handled the row selection in the search result
99        #[unsafe(method(searchTemplate:selectedResult:completionHandler:))]
100        #[unsafe(method_family = none)]
101        unsafe fn searchTemplate_selectedResult_completionHandler(
102            &self,
103            search_template: &CPSearchTemplate,
104            item: &CPListItem,
105            completion_handler: &block2::DynBlock<dyn Fn()>,
106        );
107
108        #[cfg(feature = "CPTemplate")]
109        /// The user has selected the keyboard's search button. Generally, you should push a
110        /// `CPListTemplate`containing the current search results.
111        ///
112        ///
113        /// Parameter `searchTemplate`: The search template in use by the user
114        #[optional]
115        #[unsafe(method(searchTemplateSearchButtonPressed:))]
116        #[unsafe(method_family = none)]
117        unsafe fn searchTemplateSearchButtonPressed(&self, search_template: &CPSearchTemplate);
118    }
119);