objc2_file_provider_ui/generated/FPUIActionExtensionViewController.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_file_provider::*;
10use objc2_foundation::*;
11
12use crate::*;
13
14extern_class!(
15 /// The custom user interface used to perform a selected action.
16 ///
17 /// Subclass this view controller to provide the user interface for your
18 /// actions.
19 ///
20 /// No matter how many actions you define, your File Provider UI extension has
21 /// only one ``FPUIActionExtensionViewController`` subclass. When the user
22 /// selects one of your actions, the system instantiates a copy of your
23 /// subclass, calls its
24 /// ``FPUIActionExtensionViewController/prepareForActionWithIdentifier:itemIdentifiers:``
25 /// method, and presents it to the user.
26 ///
27 /// Your subclass must do the following:
28 ///
29 /// - Override the
30 /// ``FPUIActionExtensionViewController/prepareForActionWithIdentifier:itemIdentifiers:``
31 /// method to check the action identifiers and present an appropriate user
32 /// interface for the selected actions.
33 /// - Provide some sort of feedback, even if
34 /// the action doesn't require interaction with the user. For example, present a
35 /// view that quickly fades out and automatically completes the action.
36 /// - Call the ``FPUIActionExtensionViewController/extensionContext`` object's
37 /// ``FPUIActionExtensionContext/cancelRequestWithError:`` or
38 /// ``FPUIActionExtensionContext/completeRequest`` method when the action is
39 /// finished to complete the action.
40 ///
41 /// See also [Apple's documentation](https://developer.apple.com/documentation/fileproviderui/fpuiactionextensionviewcontroller?language=objc)
42 #[unsafe(super(NSViewController, NSResponder, NSObject))]
43 #[derive(Debug, PartialEq, Eq, Hash)]
44 #[cfg(feature = "objc2-app-kit")]
45 #[cfg(target_os = "macos")]
46 pub struct FPUIActionExtensionViewController;
47);
48
49#[cfg(feature = "objc2-app-kit")]
50#[cfg(target_os = "macos")]
51extern_conformance!(
52 unsafe impl NSCoding for FPUIActionExtensionViewController {}
53);
54
55#[cfg(feature = "objc2-app-kit")]
56#[cfg(target_os = "macos")]
57extern_conformance!(
58 unsafe impl NSEditor for FPUIActionExtensionViewController {}
59);
60
61#[cfg(feature = "objc2-app-kit")]
62#[cfg(target_os = "macos")]
63extern_conformance!(
64 unsafe impl NSObjectProtocol for FPUIActionExtensionViewController {}
65);
66
67#[cfg(feature = "objc2-app-kit")]
68#[cfg(target_os = "macos")]
69extern_conformance!(
70 unsafe impl NSSeguePerforming for FPUIActionExtensionViewController {}
71);
72
73#[cfg(feature = "objc2-app-kit")]
74#[cfg(target_os = "macos")]
75extern_conformance!(
76 unsafe impl NSUserInterfaceItemIdentification for FPUIActionExtensionViewController {}
77);
78
79#[cfg(feature = "objc2-app-kit")]
80#[cfg(target_os = "macos")]
81impl FPUIActionExtensionViewController {
82 extern_methods!(
83 #[cfg(feature = "FPUIActionExtensionContext")]
84 /// The extension context provided by the host app.
85 #[unsafe(method(extensionContext))]
86 #[unsafe(method_family = none)]
87 pub unsafe fn extensionContext(&self) -> Retained<FPUIActionExtensionContext>;
88
89 /// Performs any necessary setup or configuration when an authentication error
90 /// occurs.
91 ///
92 /// While your file provider is enumerating its content, the system calls this
93 /// method whenever your file provider returns an
94 /// <doc
95 /// ://com.apple.documentation/documentation/fileprovider/nsfileprovidererrordomain>
96 /// error with a
97 /// <doc
98 /// ://com.apple.documentation/documentation/fileprovider/nsfileprovidererrorcode/nsfileprovidererrornotauthenticated>
99 /// code. Use this method to present an interface to authenticate the user.
100 ///
101 /// - Parameters:
102 /// - error: An object representing the authentication error. Your File Provider
103 /// extension can pass additional information in the error's
104 /// <doc
105 /// ://com.apple.documentation/documentation/foundation/nserror/1411580-userinfo>
106 /// property.
107 #[unsafe(method(prepareForError:))]
108 #[unsafe(method_family = none)]
109 pub unsafe fn prepareForError(&self, error: &NSError);
110
111 /// Performs any necessary setup or configuration for the specified action.
112 ///
113 /// Use this method to prepare a user interface for handling the action. At a
114 /// minimum, you should display feedback about the action.
115 ///
116 /// For more information, see
117 /// <doc
118 /// :adding-actions-to-the-context-menu>.
119 ///
120 /// - Parameters:
121 /// - actionIdentifier: The identifier for the action performed by the user.
122 ///
123 /// - itemIdentifiers: The identifiers of the items affected by the action.
124 #[unsafe(method(prepareForActionWithIdentifier:itemIdentifiers:))]
125 #[unsafe(method_family = none)]
126 pub unsafe fn prepareForActionWithIdentifier_itemIdentifiers(
127 &self,
128 action_identifier: &NSString,
129 item_identifiers: &NSArray<NSFileProviderItemIdentifier>,
130 );
131 );
132}
133
134/// Methods declared on superclass `NSViewController`.
135#[cfg(feature = "objc2-app-kit")]
136#[cfg(target_os = "macos")]
137impl FPUIActionExtensionViewController {
138 extern_methods!(
139 #[unsafe(method(initWithNibName:bundle:))]
140 #[unsafe(method_family = init)]
141 pub unsafe fn initWithNibName_bundle(
142 this: Allocated<Self>,
143 nib_name_or_nil: Option<&NSNibName>,
144 nib_bundle_or_nil: Option<&NSBundle>,
145 ) -> Retained<Self>;
146
147 #[unsafe(method(initWithCoder:))]
148 #[unsafe(method_family = init)]
149 pub unsafe fn initWithCoder(
150 this: Allocated<Self>,
151 coder: &NSCoder,
152 ) -> Option<Retained<Self>>;
153 );
154}
155
156/// Methods declared on superclass `NSResponder`.
157#[cfg(feature = "objc2-app-kit")]
158#[cfg(target_os = "macos")]
159impl FPUIActionExtensionViewController {
160 extern_methods!(
161 #[unsafe(method(init))]
162 #[unsafe(method_family = init)]
163 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
164 );
165}
166
167/// Methods declared on superclass `NSObject`.
168#[cfg(feature = "objc2-app-kit")]
169#[cfg(target_os = "macos")]
170impl FPUIActionExtensionViewController {
171 extern_methods!(
172 #[unsafe(method(new))]
173 #[unsafe(method_family = new)]
174 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
175 );
176}