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")]
86unsafe impl NSAccessibility for AVRoutePickerView {}
87
88#[cfg(feature = "objc2-app-kit")]
89#[cfg(target_os = "macos")]
90unsafe impl NSAccessibilityElementProtocol for AVRoutePickerView {}
91
92#[cfg(feature = "objc2-app-kit")]
93#[cfg(target_os = "macos")]
94unsafe impl NSAnimatablePropertyContainer for AVRoutePickerView {}
95
96#[cfg(feature = "objc2-app-kit")]
97#[cfg(target_os = "macos")]
98unsafe impl NSAppearanceCustomization for AVRoutePickerView {}
99
100#[cfg(feature = "objc2-app-kit")]
101#[cfg(target_os = "macos")]
102unsafe impl NSCoding for AVRoutePickerView {}
103
104#[cfg(feature = "objc2-app-kit")]
105#[cfg(target_os = "macos")]
106unsafe impl NSDraggingDestination for AVRoutePickerView {}
107
108#[cfg(feature = "objc2-app-kit")]
109#[cfg(target_os = "macos")]
110unsafe impl NSObjectProtocol for AVRoutePickerView {}
111
112#[cfg(feature = "objc2-app-kit")]
113#[cfg(target_os = "macos")]
114unsafe impl NSUserInterfaceItemIdentification for AVRoutePickerView {}
115
116#[cfg(feature = "objc2-app-kit")]
117#[cfg(target_os = "macos")]
118impl AVRoutePickerView {
119    extern_methods!(
120        /// The route picker view's delegate.
121        #[unsafe(method(delegate))]
122        #[unsafe(method_family = none)]
123        pub unsafe fn delegate(
124            &self,
125        ) -> Option<Retained<ProtocolObject<dyn AVRoutePickerViewDelegate>>>;
126
127        /// This is a [weak property][objc2::topics::weak_property].
128        /// Setter for [`delegate`][Self::delegate].
129        #[unsafe(method(setDelegate:))]
130        #[unsafe(method_family = none)]
131        pub unsafe fn setDelegate(
132            &self,
133            delegate: Option<&ProtocolObject<dyn AVRoutePickerViewDelegate>>,
134        );
135
136        #[cfg(feature = "objc2-av-foundation")]
137        /// The player for which to perform routing operations.
138        #[unsafe(method(player))]
139        #[unsafe(method_family = none)]
140        pub unsafe fn player(&self) -> Option<Retained<AVPlayer>>;
141
142        #[cfg(feature = "objc2-av-foundation")]
143        /// Setter for [`player`][Self::player].
144        #[unsafe(method(setPlayer:))]
145        #[unsafe(method_family = none)]
146        pub unsafe fn setPlayer(&self, player: Option<&AVPlayer>);
147
148        /// Parameter `state`: The state for which to get the picker button color.
149        ///
150        /// Returns the color of the picker button for a given state.
151        #[unsafe(method(routePickerButtonColorForState:))]
152        #[unsafe(method_family = none)]
153        pub unsafe fn routePickerButtonColorForState(
154            &self,
155            state: AVRoutePickerViewButtonState,
156        ) -> Retained<NSColor>;
157
158        /// Parameter `color`: The color the button should have for a given state.
159        ///
160        /// Parameter `state`: The state for which to set the color of the button image.
161        ///
162        /// Sets the color of the picker button for a given state.
163        ///
164        /// If set to nil, the default color will be used for the given state.
165        #[unsafe(method(setRoutePickerButtonColor:forState:))]
166        #[unsafe(method_family = none)]
167        pub unsafe fn setRoutePickerButtonColor_forState(
168            &self,
169            color: Option<&NSColor>,
170            state: AVRoutePickerViewButtonState,
171        );
172
173        /// Whether or not the picker button has a border. Default is YES.
174        #[unsafe(method(isRoutePickerButtonBordered))]
175        #[unsafe(method_family = none)]
176        pub unsafe fn isRoutePickerButtonBordered(&self) -> bool;
177
178        /// Setter for [`isRoutePickerButtonBordered`][Self::isRoutePickerButtonBordered].
179        #[unsafe(method(setRoutePickerButtonBordered:))]
180        #[unsafe(method_family = none)]
181        pub unsafe fn setRoutePickerButtonBordered(&self, route_picker_button_bordered: bool);
182
183        /// The view's tint color when AirPlay is active.
184        #[unsafe(method(activeTintColor))]
185        #[unsafe(method_family = none)]
186        pub unsafe fn activeTintColor(&self) -> Option<Retained<NSColor>>;
187
188        /// Setter for [`activeTintColor`][Self::activeTintColor].
189        #[unsafe(method(setActiveTintColor:))]
190        #[unsafe(method_family = none)]
191        pub unsafe fn setActiveTintColor(&self, active_tint_color: Option<&NSColor>);
192
193        /// The route picker button style.
194        #[unsafe(method(routePickerButtonStyle))]
195        #[unsafe(method_family = none)]
196        pub unsafe fn routePickerButtonStyle(&self) -> AVRoutePickerViewButtonStyle;
197
198        /// Setter for [`routePickerButtonStyle`][Self::routePickerButtonStyle].
199        #[unsafe(method(setRoutePickerButtonStyle:))]
200        #[unsafe(method_family = none)]
201        pub unsafe fn setRoutePickerButtonStyle(
202            &self,
203            route_picker_button_style: AVRoutePickerViewButtonStyle,
204        );
205
206        /// 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.
207        #[unsafe(method(prioritizesVideoDevices))]
208        #[unsafe(method_family = none)]
209        pub unsafe fn prioritizesVideoDevices(&self) -> bool;
210
211        /// Setter for [`prioritizesVideoDevices`][Self::prioritizesVideoDevices].
212        #[unsafe(method(setPrioritizesVideoDevices:))]
213        #[unsafe(method_family = none)]
214        pub unsafe fn setPrioritizesVideoDevices(&self, prioritizes_video_devices: bool);
215    );
216}
217
218/// Methods declared on superclass `NSView`.
219#[cfg(feature = "objc2-app-kit")]
220#[cfg(target_os = "macos")]
221impl AVRoutePickerView {
222    extern_methods!(
223        #[unsafe(method(initWithFrame:))]
224        #[unsafe(method_family = init)]
225        pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
226
227        #[unsafe(method(initWithCoder:))]
228        #[unsafe(method_family = init)]
229        pub unsafe fn initWithCoder(
230            this: Allocated<Self>,
231            coder: &NSCoder,
232        ) -> Option<Retained<Self>>;
233    );
234}
235
236/// Methods declared on superclass `NSResponder`.
237#[cfg(feature = "objc2-app-kit")]
238#[cfg(target_os = "macos")]
239impl AVRoutePickerView {
240    extern_methods!(
241        #[unsafe(method(init))]
242        #[unsafe(method_family = init)]
243        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
244    );
245}
246
247/// Methods declared on superclass `NSObject`.
248#[cfg(feature = "objc2-app-kit")]
249#[cfg(target_os = "macos")]
250impl AVRoutePickerView {
251    extern_methods!(
252        #[unsafe(method(new))]
253        #[unsafe(method_family = new)]
254        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
255    );
256}
257
258extern_protocol!(
259    /// Defines an interface for delegates of AVRoutePickerView.
260    ///
261    /// See also [Apple's documentation](https://developer.apple.com/documentation/avkit/avroutepickerviewdelegate?language=objc)
262    pub unsafe trait AVRoutePickerViewDelegate: NSObjectProtocol {
263        #[cfg(feature = "objc2-app-kit")]
264        #[cfg(target_os = "macos")]
265        /// Informs the delegate that the route picker view will start presenting routes to the user.
266        #[optional]
267        #[unsafe(method(routePickerViewWillBeginPresentingRoutes:))]
268        #[unsafe(method_family = none)]
269        unsafe fn routePickerViewWillBeginPresentingRoutes(
270            &self,
271            route_picker_view: &AVRoutePickerView,
272        );
273
274        #[cfg(feature = "objc2-app-kit")]
275        #[cfg(target_os = "macos")]
276        /// Informs the delegate that the route picker view finished presenting routes to the user.
277        #[optional]
278        #[unsafe(method(routePickerViewDidEndPresentingRoutes:))]
279        #[unsafe(method_family = none)]
280        unsafe fn routePickerViewDidEndPresentingRoutes(
281            &self,
282            route_picker_view: &AVRoutePickerView,
283        );
284    }
285);