objc2_intents_ui/generated/
INUIAddVoiceShortcutViewController.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::*;
6#[cfg(feature = "objc2-app-kit")]
7#[cfg(target_os = "macos")]
8use objc2_app_kit::*;
9use objc2_foundation::*;
10#[cfg(feature = "objc2-intents")]
11use objc2_intents::*;
12
13use crate::*;
14
15extern_class!(
16    /// A view controller that will take the user through the setup flow to add a shortcut to Siri.
17    ///
18    /// First create the
19    /// `INShortcut`object that represents the shortcut the user wants to perform. Then create an
20    /// `INUIAddVoiceShortcutViewController`object and set its delegate. Then, present the view controller modally from another view controller in your app. The delegate must dismiss the view controller when the user completes the set up.
21    ///
22    /// See also [Apple's documentation](https://developer.apple.com/documentation/intentsui/inuiaddvoiceshortcutviewcontroller?language=objc)
23    #[unsafe(super(NSViewController, NSResponder, NSObject))]
24    #[derive(Debug, PartialEq, Eq, Hash)]
25    #[cfg(feature = "objc2-app-kit")]
26    #[cfg(target_os = "macos")]
27    pub struct INUIAddVoiceShortcutViewController;
28);
29
30#[cfg(feature = "objc2-app-kit")]
31#[cfg(target_os = "macos")]
32extern_conformance!(
33    unsafe impl NSCoding for INUIAddVoiceShortcutViewController {}
34);
35
36#[cfg(feature = "objc2-app-kit")]
37#[cfg(target_os = "macos")]
38extern_conformance!(
39    unsafe impl NSEditor for INUIAddVoiceShortcutViewController {}
40);
41
42#[cfg(feature = "objc2-app-kit")]
43#[cfg(target_os = "macos")]
44extern_conformance!(
45    unsafe impl NSObjectProtocol for INUIAddVoiceShortcutViewController {}
46);
47
48#[cfg(feature = "objc2-app-kit")]
49#[cfg(target_os = "macos")]
50extern_conformance!(
51    unsafe impl NSSeguePerforming for INUIAddVoiceShortcutViewController {}
52);
53
54#[cfg(feature = "objc2-app-kit")]
55#[cfg(target_os = "macos")]
56extern_conformance!(
57    unsafe impl NSUserInterfaceItemIdentification for INUIAddVoiceShortcutViewController {}
58);
59
60#[cfg(feature = "objc2-app-kit")]
61#[cfg(target_os = "macos")]
62impl INUIAddVoiceShortcutViewController {
63    extern_methods!(
64        #[unsafe(method(delegate))]
65        #[unsafe(method_family = none)]
66        pub unsafe fn delegate(
67            &self,
68        ) -> Option<Retained<ProtocolObject<dyn INUIAddVoiceShortcutViewControllerDelegate>>>;
69
70        /// Setter for [`delegate`][Self::delegate].
71        ///
72        /// This is a [weak property][objc2::topics::weak_property].
73        #[unsafe(method(setDelegate:))]
74        #[unsafe(method_family = none)]
75        pub unsafe fn setDelegate(
76            &self,
77            delegate: Option<&ProtocolObject<dyn INUIAddVoiceShortcutViewControllerDelegate>>,
78        );
79
80        #[cfg(feature = "objc2-intents")]
81        /// Parameter `shortcut`: The shortcut is what will be run when the resulting voice shortcut is invoked. It also provides the suggested invocation phrase, via the
82        /// `suggestedInvocationPhrase`property on the intent or user activity.
83        #[unsafe(method(initWithShortcut:))]
84        #[unsafe(method_family = init)]
85        pub unsafe fn initWithShortcut(
86            this: Allocated<Self>,
87            shortcut: &INShortcut,
88        ) -> Retained<Self>;
89
90        #[unsafe(method(init))]
91        #[unsafe(method_family = init)]
92        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
93
94        #[unsafe(method(initWithNibName:bundle:))]
95        #[unsafe(method_family = init)]
96        pub unsafe fn initWithNibName_bundle(
97            this: Allocated<Self>,
98            nib_name_or_nil: Option<&NSString>,
99            nib_bundle_or_nil: Option<&NSBundle>,
100        ) -> Retained<Self>;
101    );
102}
103
104/// Methods declared on superclass `NSViewController`.
105#[cfg(feature = "objc2-app-kit")]
106#[cfg(target_os = "macos")]
107impl INUIAddVoiceShortcutViewController {
108    extern_methods!(
109        /// # Safety
110        ///
111        /// `coder` possibly has further requirements.
112        #[unsafe(method(initWithCoder:))]
113        #[unsafe(method_family = init)]
114        pub unsafe fn initWithCoder(
115            this: Allocated<Self>,
116            coder: &NSCoder,
117        ) -> Option<Retained<Self>>;
118    );
119}
120
121/// Methods declared on superclass `NSObject`.
122#[cfg(feature = "objc2-app-kit")]
123#[cfg(target_os = "macos")]
124impl INUIAddVoiceShortcutViewController {
125    extern_methods!(
126        #[unsafe(method(new))]
127        #[unsafe(method_family = new)]
128        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
129    );
130}
131
132extern_protocol!(
133    /// [Apple's documentation](https://developer.apple.com/documentation/intentsui/inuiaddvoiceshortcutviewcontrollerdelegate?language=objc)
134    pub unsafe trait INUIAddVoiceShortcutViewControllerDelegate: NSObjectProtocol {
135        #[cfg(all(feature = "objc2-app-kit", feature = "objc2-intents"))]
136        #[cfg(target_os = "macos")]
137        /// Called after the user finishes the setup flow for the voice shortcut, with either the successfully-added voice shortcut, or an error.
138        ///
139        /// Your implementation of this method should dismiss the view controller.
140        #[unsafe(method(addVoiceShortcutViewController:didFinishWithVoiceShortcut:error:))]
141        #[unsafe(method_family = none)]
142        unsafe fn addVoiceShortcutViewController_didFinishWithVoiceShortcut_error(
143            &self,
144            controller: &INUIAddVoiceShortcutViewController,
145            voice_shortcut: Option<&INVoiceShortcut>,
146            error: Option<&NSError>,
147        );
148
149        #[cfg(feature = "objc2-app-kit")]
150        #[cfg(target_os = "macos")]
151        /// Called if the user cancels the setup flow; the voice shortcut was not added.
152        ///
153        /// Your implementation of this method should dismiss the view controller.
154        #[unsafe(method(addVoiceShortcutViewControllerDidCancel:))]
155        #[unsafe(method_family = none)]
156        unsafe fn addVoiceShortcutViewControllerDidCancel(
157            &self,
158            controller: &INUIAddVoiceShortcutViewController,
159        );
160    }
161);