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