objc2_core_audio_kit/generated/
AUViewController.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::*;
9#[cfg(feature = "objc2-audio-toolbox")]
10use objc2_audio_toolbox::*;
11#[cfg(feature = "objc2-core-foundation")]
12use objc2_core_foundation::*;
13use objc2_foundation::*;
14
15use crate::*;
16
17/// [Apple's documentation](https://developer.apple.com/documentation/coreaudiokit/auviewcontrollerbase?language=objc)
18#[cfg(feature = "objc2-app-kit")]
19#[cfg(target_os = "macos")]
20pub type AUViewControllerBase = NSViewController;
21
22#[cfg(feature = "objc2-app-kit")]
23#[cfg(target_os = "macos")]
24extern_conformance!(
25    unsafe impl NSCoding for AUViewController {}
26);
27
28#[cfg(feature = "objc2-app-kit")]
29#[cfg(target_os = "macos")]
30extern_conformance!(
31    unsafe impl NSEditor for AUViewController {}
32);
33
34#[cfg(feature = "objc2-app-kit")]
35#[cfg(target_os = "macos")]
36extern_conformance!(
37    unsafe impl NSExtensionRequestHandling for AUViewController {}
38);
39
40#[cfg(feature = "objc2-app-kit")]
41#[cfg(target_os = "macos")]
42extern_conformance!(
43    unsafe impl NSObjectProtocol for AUViewController {}
44);
45
46#[cfg(feature = "objc2-app-kit")]
47#[cfg(target_os = "macos")]
48extern_conformance!(
49    unsafe impl NSSeguePerforming for AUViewController {}
50);
51
52#[cfg(feature = "objc2-app-kit")]
53#[cfg(target_os = "macos")]
54extern_conformance!(
55    unsafe impl NSUserInterfaceItemIdentification for AUViewController {}
56);
57
58#[cfg(feature = "objc2-app-kit")]
59#[cfg(target_os = "macos")]
60impl AUViewController {
61    extern_methods!();
62}
63
64/// Methods declared on superclass `NSViewController`.
65#[cfg(feature = "objc2-app-kit")]
66#[cfg(target_os = "macos")]
67impl AUViewController {
68    extern_methods!(
69        #[unsafe(method(initWithNibName:bundle:))]
70        #[unsafe(method_family = init)]
71        pub unsafe fn initWithNibName_bundle(
72            this: Allocated<Self>,
73            nib_name_or_nil: Option<&NSNibName>,
74            nib_bundle_or_nil: Option<&NSBundle>,
75        ) -> Retained<Self>;
76
77        /// # Safety
78        ///
79        /// `coder` possibly has further requirements.
80        #[unsafe(method(initWithCoder:))]
81        #[unsafe(method_family = init)]
82        pub unsafe fn initWithCoder(
83            this: Allocated<Self>,
84            coder: &NSCoder,
85        ) -> Option<Retained<Self>>;
86    );
87}
88
89/// Methods declared on superclass `NSResponder`.
90#[cfg(feature = "objc2-app-kit")]
91#[cfg(target_os = "macos")]
92impl AUViewController {
93    extern_methods!(
94        #[unsafe(method(init))]
95        #[unsafe(method_family = init)]
96        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
97    );
98}
99
100/// Methods declared on superclass `NSObject`.
101#[cfg(feature = "objc2-app-kit")]
102#[cfg(target_os = "macos")]
103impl AUViewController {
104    extern_methods!(
105        #[unsafe(method(new))]
106        #[unsafe(method_family = new)]
107        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
108    );
109}
110
111extern_class!(
112    /// Properties of the configuration that a host uses to embed the view of an audio unit.
113    ///
114    /// Hosts may support embedding the view of an audio unit in different configurations. These
115    /// configurations may vary in the size reserved for the audio unit's view and the additional
116    /// control surfaces that are displayed along with it. The host can propose several view
117    /// configurations and the audio unit should report the ones which it supports.
118    ///
119    /// See the documentation for supportedViewConfigurations.
120    ///
121    /// See also [Apple's documentation](https://developer.apple.com/documentation/coreaudiokit/auaudiounitviewconfiguration?language=objc)
122    #[unsafe(super(NSObject))]
123    #[derive(Debug, PartialEq, Eq, Hash)]
124    pub struct AUAudioUnitViewConfiguration;
125);
126
127extern_conformance!(
128    unsafe impl NSCoding for AUAudioUnitViewConfiguration {}
129);
130
131extern_conformance!(
132    unsafe impl NSObjectProtocol for AUAudioUnitViewConfiguration {}
133);
134
135extern_conformance!(
136    unsafe impl NSSecureCoding for AUAudioUnitViewConfiguration {}
137);
138
139impl AUAudioUnitViewConfiguration {
140    extern_methods!(
141        #[cfg(feature = "objc2-core-foundation")]
142        /// Designated initializer.
143        ///
144        /// Parameter `width`: The width associated with this view configuration.
145        ///
146        /// Parameter `height`: The height associated with this view configuration.
147        ///
148        /// Parameter `hostHasController`: This property controls whether the host shows its own control surface in this view
149        /// configuration.
150        ///
151        /// Returns: Returns the newly created view configuration object.
152        #[unsafe(method(initWithWidth:height:hostHasController:))]
153        #[unsafe(method_family = init)]
154        pub unsafe fn initWithWidth_height_hostHasController(
155            this: Allocated<Self>,
156            width: CGFloat,
157            height: CGFloat,
158            host_has_controller: bool,
159        ) -> Retained<Self>;
160
161        #[cfg(feature = "objc2-core-foundation")]
162        /// The width of the view, measured in points.
163        ///
164        /// Setting the width to 0 will match any width.
165        #[unsafe(method(width))]
166        #[unsafe(method_family = none)]
167        pub unsafe fn width(&self) -> CGFloat;
168
169        #[cfg(feature = "objc2-core-foundation")]
170        /// The height of the view, measured in points.
171        ///
172        /// Setting the height to 0 will match any height.
173        #[unsafe(method(height))]
174        #[unsafe(method_family = none)]
175        pub unsafe fn height(&self) -> CGFloat;
176
177        /// Boolean property specifying whether the host displays its own control surface
178        /// when showing the view of the audio unit.
179        #[unsafe(method(hostHasController))]
180        #[unsafe(method_family = none)]
181        pub unsafe fn hostHasController(&self) -> bool;
182    );
183}
184
185/// Methods declared on superclass `NSObject`.
186impl AUAudioUnitViewConfiguration {
187    extern_methods!(
188        #[unsafe(method(init))]
189        #[unsafe(method_family = init)]
190        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
191
192        #[unsafe(method(new))]
193        #[unsafe(method_family = new)]
194        pub unsafe fn new() -> Retained<Self>;
195    );
196}
197
198mod private_AUAudioUnit_ViewController {
199    pub trait Sealed {}
200}
201
202/// Category on [`AUAudioUnit`].
203pub unsafe trait AUAudioUnit_ViewController:
204    ClassType + Sized + private_AUAudioUnit_ViewController::Sealed
205{
206    extern_methods!(
207        #[cfg(all(feature = "block2", feature = "objc2-app-kit"))]
208        #[cfg(target_os = "macos")]
209        /// Obtains an audio unit's view controller (and thereby a view).
210        ///
211        /// Asynchronously requests the audio unit's view controller. This method will later call the
212        /// completion handler, in a thread/dispatch queue context internal to the implementation, with
213        /// a view controller, or nil in the case of an audio unit without a custom view controller.
214        #[unsafe(method(requestViewControllerWithCompletionHandler:))]
215        #[unsafe(method_family = none)]
216        unsafe fn requestViewControllerWithCompletionHandler(
217            &self,
218            completion_handler: &block2::DynBlock<dyn Fn(*mut AUViewControllerBase)>,
219        );
220
221        /// Parameter `availableViewConfigurations`: The list of all available view configurations supported by the host.
222        ///
223        /// Returns: A set of indices of view configurations from the availableViewConfigurations array that the
224        /// audio unit supports.
225        ///
226        /// Query the list of supported view configurations.
227        ///
228        /// The host can query the audio unit for all the view configurations it supports.
229        /// Hosts can support multiple configurations in which they can display the user interfaces of
230        /// audio units (for example: full screen, normal, live mode, etc). These configurations can be
231        /// of different sizes and the host might display its own control surfaces along with the view
232        /// of the audio unit. The host will call this method and pass an array of supported
233        /// configurations.
234        ///
235        /// The audio unit should override this method and implement its own logic to report all the
236        /// view configurations it supports. The size of the view in the selected configuration should
237        /// be large enough to fit the view of the audio unit, otherwise it might be truncated and a
238        /// scroll bar might be necessary to navigate it.
239        ///
240        /// In case an empty set is returned from this method, it is considered that the plugin only
241        /// supports the largest available view configuration.
242        #[unsafe(method(supportedViewConfigurations:))]
243        #[unsafe(method_family = none)]
244        unsafe fn supportedViewConfigurations(
245            &self,
246            available_view_configurations: &NSArray<AUAudioUnitViewConfiguration>,
247        ) -> Retained<NSIndexSet>;
248
249        /// Parameter `viewConfiguration`: The requested view configuration.
250        ///
251        /// The view configuration passed to this method should be one which was indicated as supported
252        /// via supportedViewConfigurations. If any other, unsupported, view configuration is passed or
253        /// if supportedViewConfigurations returns an empty set, the audio unit implementation should
254        /// fall back to its default (largest available) view configuration.
255        ///
256        ///
257        /// Request a view configuration from the audio unit.
258        ///
259        /// The host can use this method to switch the audio unit's view into a new configuration.
260        /// Audio Units should override this method with the logic needed to adapt their view controller
261        /// to the requested configuration.
262        #[unsafe(method(selectViewConfiguration:))]
263        #[unsafe(method_family = none)]
264        unsafe fn selectViewConfiguration(&self, view_configuration: &AUAudioUnitViewConfiguration);
265    );
266}
267
268#[cfg(feature = "objc2-audio-toolbox")]
269impl private_AUAudioUnit_ViewController::Sealed for AUAudioUnit {}
270#[cfg(feature = "objc2-audio-toolbox")]
271unsafe impl AUAudioUnit_ViewController for AUAudioUnit {}