objc2-av-kit 0.3.2

Bindings to the AVKit framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
use objc2_app_kit::*;
#[cfg(feature = "objc2-av-foundation")]
use objc2_av_foundation::*;
#[cfg(feature = "objc2-av-routing")]
#[cfg(not(any(target_os = "tvos", target_os = "watchos")))]
use objc2_av_routing::*;
use objc2_foundation::*;

use crate::*;

/// Normal or default state of the picker.
///
/// 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.
///
/// Active state of the picker. The picker has this state when AirPlay is active.
///
/// Highlighted state of the active picker. The picker has this state when it is highlighted and AirPlay is active.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avkit/avroutepickerviewbuttonstate?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct AVRoutePickerViewButtonState(pub NSInteger);
impl AVRoutePickerViewButtonState {
    #[doc(alias = "AVRoutePickerViewButtonStateNormal")]
    pub const Normal: Self = Self(0);
    #[doc(alias = "AVRoutePickerViewButtonStateNormalHighlighted")]
    pub const NormalHighlighted: Self = Self(1);
    #[doc(alias = "AVRoutePickerViewButtonStateActive")]
    pub const Active: Self = Self(2);
    #[doc(alias = "AVRoutePickerViewButtonStateActiveHighlighted")]
    pub const ActiveHighlighted: Self = Self(3);
}

unsafe impl Encode for AVRoutePickerViewButtonState {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for AVRoutePickerViewButtonState {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// A system style for the route picker button.
///
/// A plain style for the route picker button, which has the same appearance as the system style without the blurred background view.
///
/// A custom style for the route picker button, which allows customizing the background view and focused appearance.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avkit/avroutepickerviewbuttonstyle?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct AVRoutePickerViewButtonStyle(pub NSInteger);
impl AVRoutePickerViewButtonStyle {
    #[doc(alias = "AVRoutePickerViewButtonStyleSystem")]
    pub const System: Self = Self(0);
    #[doc(alias = "AVRoutePickerViewButtonStylePlain")]
    pub const Plain: Self = Self(1);
    #[doc(alias = "AVRoutePickerViewButtonStyleCustom")]
    pub const Custom: Self = Self(2);
}

unsafe impl Encode for AVRoutePickerViewButtonStyle {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for AVRoutePickerViewButtonStyle {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/avkit/avroutepickerview?language=objc)
    #[unsafe(super(NSView, NSResponder, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "objc2-app-kit")]
    #[cfg(target_os = "macos")]
    pub struct AVRoutePickerView;
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSAccessibility for AVRoutePickerView {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSAccessibilityElementProtocol for AVRoutePickerView {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSAnimatablePropertyContainer for AVRoutePickerView {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSAppearanceCustomization for AVRoutePickerView {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSCoding for AVRoutePickerView {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSDraggingDestination for AVRoutePickerView {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSObjectProtocol for AVRoutePickerView {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSUserInterfaceItemIdentification for AVRoutePickerView {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl AVRoutePickerView {
    extern_methods!(
        /// The route picker view's delegate.
        #[unsafe(method(delegate))]
        #[unsafe(method_family = none)]
        pub unsafe fn delegate(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn AVRoutePickerViewDelegate>>>;

        /// Setter for [`delegate`][Self::delegate].
        ///
        /// This is a [weak property][objc2::topics::weak_property].
        #[unsafe(method(setDelegate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDelegate(
            &self,
            delegate: Option<&ProtocolObject<dyn AVRoutePickerViewDelegate>>,
        );

        #[cfg(feature = "objc2-av-foundation")]
        /// The player for which to perform routing operations.
        #[unsafe(method(player))]
        #[unsafe(method_family = none)]
        pub unsafe fn player(&self) -> Option<Retained<AVPlayer>>;

        #[cfg(feature = "objc2-av-foundation")]
        /// Setter for [`player`][Self::player].
        #[unsafe(method(setPlayer:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPlayer(&self, player: Option<&AVPlayer>);

        /// Parameter `state`: The state for which to get the picker button color.
        ///
        /// Returns the color of the picker button for a given state.
        #[unsafe(method(routePickerButtonColorForState:))]
        #[unsafe(method_family = none)]
        pub unsafe fn routePickerButtonColorForState(
            &self,
            state: AVRoutePickerViewButtonState,
        ) -> Retained<NSColor>;

        /// Parameter `color`: The color the button should have for a given state.
        ///
        /// Parameter `state`: The state for which to set the color of the button image.
        ///
        /// Sets the color of the picker button for a given state.
        ///
        /// If set to nil, the default color will be used for the given state.
        #[unsafe(method(setRoutePickerButtonColor:forState:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setRoutePickerButtonColor_forState(
            &self,
            color: Option<&NSColor>,
            state: AVRoutePickerViewButtonState,
        );

        /// Whether or not the picker button has a border. Default is YES.
        #[unsafe(method(isRoutePickerButtonBordered))]
        #[unsafe(method_family = none)]
        pub unsafe fn isRoutePickerButtonBordered(&self) -> bool;

        /// Setter for [`isRoutePickerButtonBordered`][Self::isRoutePickerButtonBordered].
        #[unsafe(method(setRoutePickerButtonBordered:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setRoutePickerButtonBordered(&self, route_picker_button_bordered: bool);

        /// The view's tint color when AirPlay is active.
        #[unsafe(method(activeTintColor))]
        #[unsafe(method_family = none)]
        pub unsafe fn activeTintColor(&self) -> Option<Retained<NSColor>>;

        /// Setter for [`activeTintColor`][Self::activeTintColor].
        ///
        /// # Safety
        ///
        /// `active_tint_color` might not allow `None`.
        #[unsafe(method(setActiveTintColor:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setActiveTintColor(&self, active_tint_color: Option<&NSColor>);

        /// The route picker button style.
        #[unsafe(method(routePickerButtonStyle))]
        #[unsafe(method_family = none)]
        pub unsafe fn routePickerButtonStyle(&self) -> AVRoutePickerViewButtonStyle;

        /// Setter for [`routePickerButtonStyle`][Self::routePickerButtonStyle].
        #[unsafe(method(setRoutePickerButtonStyle:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setRoutePickerButtonStyle(
            &self,
            route_picker_button_style: AVRoutePickerViewButtonStyle,
        );

        /// 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.
        #[unsafe(method(prioritizesVideoDevices))]
        #[unsafe(method_family = none)]
        pub unsafe fn prioritizesVideoDevices(&self) -> bool;

        /// Setter for [`prioritizesVideoDevices`][Self::prioritizesVideoDevices].
        #[unsafe(method(setPrioritizesVideoDevices:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPrioritizesVideoDevices(&self, prioritizes_video_devices: bool);

        #[cfg(feature = "objc2-av-routing")]
        /// A controller which enables connection to 3rd party devices (non-airplay) via the picker.
        #[unsafe(method(customRoutingController))]
        #[unsafe(method_family = none)]
        pub unsafe fn customRoutingController(&self)
            -> Option<Retained<AVCustomRoutingController>>;

        #[cfg(feature = "objc2-av-routing")]
        /// Setter for [`customRoutingController`][Self::customRoutingController].
        #[unsafe(method(setCustomRoutingController:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCustomRoutingController(
            &self,
            custom_routing_controller: Option<&AVCustomRoutingController>,
        );
    );
}

/// Methods declared on superclass `NSView`.
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl AVRoutePickerView {
    extern_methods!(
        #[unsafe(method(initWithFrame:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;

        /// # Safety
        ///
        /// `coder` possibly has further requirements.
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;
    );
}

/// Methods declared on superclass `NSResponder`.
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl AVRoutePickerView {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl AVRoutePickerView {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}

extern_protocol!(
    /// Defines an interface for delegates of AVRoutePickerView.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avkit/avroutepickerviewdelegate?language=objc)
    pub unsafe trait AVRoutePickerViewDelegate: NSObjectProtocol {
        #[cfg(feature = "objc2-app-kit")]
        #[cfg(target_os = "macos")]
        /// Informs the delegate that the route picker view will start presenting routes to the user.
        #[optional]
        #[unsafe(method(routePickerViewWillBeginPresentingRoutes:))]
        #[unsafe(method_family = none)]
        unsafe fn routePickerViewWillBeginPresentingRoutes(
            &self,
            route_picker_view: &AVRoutePickerView,
        );

        #[cfg(feature = "objc2-app-kit")]
        #[cfg(target_os = "macos")]
        /// Informs the delegate that the route picker view finished presenting routes to the user.
        #[optional]
        #[unsafe(method(routePickerViewDidEndPresentingRoutes:))]
        #[unsafe(method_family = none)]
        unsafe fn routePickerViewDidEndPresentingRoutes(
            &self,
            route_picker_view: &AVRoutePickerView,
        );
    }
);