objc2_av_kit/generated/
AVRoutePickerView.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-av-foundation")]
10use objc2_av_foundation::*;
11#[cfg(feature = "objc2-av-routing")]
12#[cfg(not(any(target_os = "tvos", target_os = "watchos")))]
13use objc2_av_routing::*;
14use objc2_foundation::*;
15
16use crate::*;
17
18/// Normal or default state of the picker.
19///
20/// Highlighted state of the picker. The picker has this state when a mouse-down event occurs inside the button. It loses this highlight when a mouse-up event occurs.
21///
22/// Active state of the picker. The picker has this state when AirPlay is active.
23///
24/// Highlighted state of the active picker. The picker has this state when it is highlighted and AirPlay is active.
25///
26/// See also [Apple's documentation](https://developer.apple.com/documentation/avkit/avroutepickerviewbuttonstate?language=objc)
27// NS_ENUM
28#[repr(transparent)]
29#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
30pub struct AVRoutePickerViewButtonState(pub NSInteger);
31impl AVRoutePickerViewButtonState {
32    #[doc(alias = "AVRoutePickerViewButtonStateNormal")]
33    pub const Normal: Self = Self(0);
34    #[doc(alias = "AVRoutePickerViewButtonStateNormalHighlighted")]
35    pub const NormalHighlighted: Self = Self(1);
36    #[doc(alias = "AVRoutePickerViewButtonStateActive")]
37    pub const Active: Self = Self(2);
38    #[doc(alias = "AVRoutePickerViewButtonStateActiveHighlighted")]
39    pub const ActiveHighlighted: Self = Self(3);
40}
41
42unsafe impl Encode for AVRoutePickerViewButtonState {
43    const ENCODING: Encoding = NSInteger::ENCODING;
44}
45
46unsafe impl RefEncode for AVRoutePickerViewButtonState {
47    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
48}
49
50/// A system style for the route picker button.
51///
52/// A plain style for the route picker button, which has the same appearance as the system style without the blurred background view.
53///
54/// A custom style for the route picker button, which allows customizing the background view and focused appearance.
55///
56/// See also [Apple's documentation](https://developer.apple.com/documentation/avkit/avroutepickerviewbuttonstyle?language=objc)
57// NS_ENUM
58#[repr(transparent)]
59#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
60pub struct AVRoutePickerViewButtonStyle(pub NSInteger);
61impl AVRoutePickerViewButtonStyle {
62    #[doc(alias = "AVRoutePickerViewButtonStyleSystem")]
63    pub const System: Self = Self(0);
64    #[doc(alias = "AVRoutePickerViewButtonStylePlain")]
65    pub const Plain: Self = Self(1);
66    #[doc(alias = "AVRoutePickerViewButtonStyleCustom")]
67    pub const Custom: Self = Self(2);
68}
69
70unsafe impl Encode for AVRoutePickerViewButtonStyle {
71    const ENCODING: Encoding = NSInteger::ENCODING;
72}
73
74unsafe impl RefEncode for AVRoutePickerViewButtonStyle {
75    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
76}
77
78extern_class!(
79    /// [Apple's documentation](https://developer.apple.com/documentation/avkit/avroutepickerview?language=objc)
80    #[unsafe(super(NSView, NSResponder, NSObject))]
81    #[derive(Debug, PartialEq, Eq, Hash)]
82    #[cfg(feature = "objc2-app-kit")]
83    #[cfg(target_os = "macos")]
84    pub struct AVRoutePickerView;
85);
86
87#[cfg(feature = "objc2-app-kit")]
88#[cfg(target_os = "macos")]
89extern_conformance!(
90    unsafe impl NSAccessibility for AVRoutePickerView {}
91);
92
93#[cfg(feature = "objc2-app-kit")]
94#[cfg(target_os = "macos")]
95extern_conformance!(
96    unsafe impl NSAccessibilityElementProtocol for AVRoutePickerView {}
97);
98
99#[cfg(feature = "objc2-app-kit")]
100#[cfg(target_os = "macos")]
101extern_conformance!(
102    unsafe impl NSAnimatablePropertyContainer for AVRoutePickerView {}
103);
104
105#[cfg(feature = "objc2-app-kit")]
106#[cfg(target_os = "macos")]
107extern_conformance!(
108    unsafe impl NSAppearanceCustomization for AVRoutePickerView {}
109);
110
111#[cfg(feature = "objc2-app-kit")]
112#[cfg(target_os = "macos")]
113extern_conformance!(
114    unsafe impl NSCoding for AVRoutePickerView {}
115);
116
117#[cfg(feature = "objc2-app-kit")]
118#[cfg(target_os = "macos")]
119extern_conformance!(
120    unsafe impl NSDraggingDestination for AVRoutePickerView {}
121);
122
123#[cfg(feature = "objc2-app-kit")]
124#[cfg(target_os = "macos")]
125extern_conformance!(
126    unsafe impl NSObjectProtocol for AVRoutePickerView {}
127);
128
129#[cfg(feature = "objc2-app-kit")]
130#[cfg(target_os = "macos")]
131extern_conformance!(
132    unsafe impl NSUserInterfaceItemIdentification for AVRoutePickerView {}
133);
134
135#[cfg(feature = "objc2-app-kit")]
136#[cfg(target_os = "macos")]
137impl AVRoutePickerView {
138    extern_methods!(
139        /// The route picker view's delegate.
140        #[unsafe(method(delegate))]
141        #[unsafe(method_family = none)]
142        pub unsafe fn delegate(
143            &self,
144        ) -> Option<Retained<ProtocolObject<dyn AVRoutePickerViewDelegate>>>;
145
146        /// Setter for [`delegate`][Self::delegate].
147        ///
148        /// This is a [weak property][objc2::topics::weak_property].
149        #[unsafe(method(setDelegate:))]
150        #[unsafe(method_family = none)]
151        pub unsafe fn setDelegate(
152            &self,
153            delegate: Option<&ProtocolObject<dyn AVRoutePickerViewDelegate>>,
154        );
155
156        #[cfg(feature = "objc2-av-foundation")]
157        /// The player for which to perform routing operations.
158        #[unsafe(method(player))]
159        #[unsafe(method_family = none)]
160        pub unsafe fn player(&self) -> Option<Retained<AVPlayer>>;
161
162        #[cfg(feature = "objc2-av-foundation")]
163        /// Setter for [`player`][Self::player].
164        #[unsafe(method(setPlayer:))]
165        #[unsafe(method_family = none)]
166        pub unsafe fn setPlayer(&self, player: Option<&AVPlayer>);
167
168        /// Parameter `state`: The state for which to get the picker button color.
169        ///
170        /// Returns the color of the picker button for a given state.
171        #[unsafe(method(routePickerButtonColorForState:))]
172        #[unsafe(method_family = none)]
173        pub unsafe fn routePickerButtonColorForState(
174            &self,
175            state: AVRoutePickerViewButtonState,
176        ) -> Retained<NSColor>;
177
178        /// Parameter `color`: The color the button should have for a given state.
179        ///
180        /// Parameter `state`: The state for which to set the color of the button image.
181        ///
182        /// Sets the color of the picker button for a given state.
183        ///
184        /// If set to nil, the default color will be used for the given state.
185        #[unsafe(method(setRoutePickerButtonColor:forState:))]
186        #[unsafe(method_family = none)]
187        pub unsafe fn setRoutePickerButtonColor_forState(
188            &self,
189            color: Option<&NSColor>,
190            state: AVRoutePickerViewButtonState,
191        );
192
193        /// Whether or not the picker button has a border. Default is YES.
194        #[unsafe(method(isRoutePickerButtonBordered))]
195        #[unsafe(method_family = none)]
196        pub unsafe fn isRoutePickerButtonBordered(&self) -> bool;
197
198        /// Setter for [`isRoutePickerButtonBordered`][Self::isRoutePickerButtonBordered].
199        #[unsafe(method(setRoutePickerButtonBordered:))]
200        #[unsafe(method_family = none)]
201        pub unsafe fn setRoutePickerButtonBordered(&self, route_picker_button_bordered: bool);
202
203        /// The view's tint color when AirPlay is active.
204        #[unsafe(method(activeTintColor))]
205        #[unsafe(method_family = none)]
206        pub unsafe fn activeTintColor(&self) -> Option<Retained<NSColor>>;
207
208        /// Setter for [`activeTintColor`][Self::activeTintColor].
209        ///
210        /// # Safety
211        ///
212        /// `active_tint_color` might not allow `None`.
213        #[unsafe(method(setActiveTintColor:))]
214        #[unsafe(method_family = none)]
215        pub unsafe fn setActiveTintColor(&self, active_tint_color: Option<&NSColor>);
216
217        /// The route picker button style.
218        #[unsafe(method(routePickerButtonStyle))]
219        #[unsafe(method_family = none)]
220        pub unsafe fn routePickerButtonStyle(&self) -> AVRoutePickerViewButtonStyle;
221
222        /// Setter for [`routePickerButtonStyle`][Self::routePickerButtonStyle].
223        #[unsafe(method(setRoutePickerButtonStyle:))]
224        #[unsafe(method_family = none)]
225        pub unsafe fn setRoutePickerButtonStyle(
226            &self,
227            route_picker_button_style: AVRoutePickerViewButtonStyle,
228        );
229
230        /// Whether or not the route picker should sort video capable output devices to the top of the list. Setting this to YES will cause the route picker view to show a videocentric icon.
231        #[unsafe(method(prioritizesVideoDevices))]
232        #[unsafe(method_family = none)]
233        pub unsafe fn prioritizesVideoDevices(&self) -> bool;
234
235        /// Setter for [`prioritizesVideoDevices`][Self::prioritizesVideoDevices].
236        #[unsafe(method(setPrioritizesVideoDevices:))]
237        #[unsafe(method_family = none)]
238        pub unsafe fn setPrioritizesVideoDevices(&self, prioritizes_video_devices: bool);
239
240        #[cfg(feature = "objc2-av-routing")]
241        /// A controller which enables connection to 3rd party devices (non-airplay) via the picker.
242        #[unsafe(method(customRoutingController))]
243        #[unsafe(method_family = none)]
244        pub unsafe fn customRoutingController(&self)
245            -> Option<Retained<AVCustomRoutingController>>;
246
247        #[cfg(feature = "objc2-av-routing")]
248        /// Setter for [`customRoutingController`][Self::customRoutingController].
249        #[unsafe(method(setCustomRoutingController:))]
250        #[unsafe(method_family = none)]
251        pub unsafe fn setCustomRoutingController(
252            &self,
253            custom_routing_controller: Option<&AVCustomRoutingController>,
254        );
255    );
256}
257
258/// Methods declared on superclass `NSView`.
259#[cfg(feature = "objc2-app-kit")]
260#[cfg(target_os = "macos")]
261impl AVRoutePickerView {
262    extern_methods!(
263        #[unsafe(method(initWithFrame:))]
264        #[unsafe(method_family = init)]
265        pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
266
267        /// # Safety
268        ///
269        /// `coder` possibly has further requirements.
270        #[unsafe(method(initWithCoder:))]
271        #[unsafe(method_family = init)]
272        pub unsafe fn initWithCoder(
273            this: Allocated<Self>,
274            coder: &NSCoder,
275        ) -> Option<Retained<Self>>;
276    );
277}
278
279/// Methods declared on superclass `NSResponder`.
280#[cfg(feature = "objc2-app-kit")]
281#[cfg(target_os = "macos")]
282impl AVRoutePickerView {
283    extern_methods!(
284        #[unsafe(method(init))]
285        #[unsafe(method_family = init)]
286        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
287    );
288}
289
290/// Methods declared on superclass `NSObject`.
291#[cfg(feature = "objc2-app-kit")]
292#[cfg(target_os = "macos")]
293impl AVRoutePickerView {
294    extern_methods!(
295        #[unsafe(method(new))]
296        #[unsafe(method_family = new)]
297        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
298    );
299}
300
301extern_protocol!(
302    /// Defines an interface for delegates of AVRoutePickerView.
303    ///
304    /// See also [Apple's documentation](https://developer.apple.com/documentation/avkit/avroutepickerviewdelegate?language=objc)
305    pub unsafe trait AVRoutePickerViewDelegate: NSObjectProtocol {
306        #[cfg(feature = "objc2-app-kit")]
307        #[cfg(target_os = "macos")]
308        /// Informs the delegate that the route picker view will start presenting routes to the user.
309        #[optional]
310        #[unsafe(method(routePickerViewWillBeginPresentingRoutes:))]
311        #[unsafe(method_family = none)]
312        unsafe fn routePickerViewWillBeginPresentingRoutes(
313            &self,
314            route_picker_view: &AVRoutePickerView,
315        );
316
317        #[cfg(feature = "objc2-app-kit")]
318        #[cfg(target_os = "macos")]
319        /// Informs the delegate that the route picker view finished presenting routes to the user.
320        #[optional]
321        #[unsafe(method(routePickerViewDidEndPresentingRoutes:))]
322        #[unsafe(method_family = none)]
323        unsafe fn routePickerViewDidEndPresentingRoutes(
324            &self,
325            route_picker_view: &AVRoutePickerView,
326        );
327    }
328);