//! 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-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-quartz-core")]
#[cfg(not(target_os = "watchos"))]
use objc2_quartz_core::*;

use crate::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipickerview?language=objc)
    #[unsafe(super(UIView, UIResponder, NSObject))]
    #[thread_kind = MainThreadOnly]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "UIResponder", feature = "UIView"))]
    pub struct UIPickerView;
);

#[cfg(all(
    feature = "UIResponder",
    feature = "UIView",
    feature = "objc2-quartz-core"
))]
#[cfg(not(target_os = "watchos"))]
extern_conformance!(
    unsafe impl CALayerDelegate for UIPickerView {}
);

#[cfg(all(feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl NSCoding for UIPickerView {}
);

#[cfg(all(feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl NSObjectProtocol for UIPickerView {}
);

#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UIAppearance for UIPickerView {}
);

#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UIAppearanceContainer for UIPickerView {}
);

#[cfg(all(feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UICoordinateSpace for UIPickerView {}
);

#[cfg(all(
    feature = "UIDynamicBehavior",
    feature = "UIResponder",
    feature = "UIView"
))]
extern_conformance!(
    unsafe impl UIDynamicItem for UIPickerView {}
);

#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UIFocusEnvironment for UIPickerView {}
);

#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UIFocusItem for UIPickerView {}
);

#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UIFocusItemContainer for UIPickerView {}
);

#[cfg(all(feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UIResponderStandardEditActions for UIPickerView {}
);

#[cfg(all(
    feature = "UIResponder",
    feature = "UITraitCollection",
    feature = "UIView"
))]
extern_conformance!(
    unsafe impl UITraitEnvironment for UIPickerView {}
);

#[cfg(all(feature = "UIResponder", feature = "UIView"))]
impl UIPickerView {
    extern_methods!(
        #[unsafe(method(dataSource))]
        #[unsafe(method_family = none)]
        pub fn dataSource(&self) -> Option<Retained<ProtocolObject<dyn UIPickerViewDataSource>>>;

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

        #[unsafe(method(delegate))]
        #[unsafe(method_family = none)]
        pub fn delegate(&self) -> Option<Retained<ProtocolObject<dyn UIPickerViewDelegate>>>;

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

        #[deprecated = "This property has no effect on iOS 7 and later."]
        #[unsafe(method(showsSelectionIndicator))]
        #[unsafe(method_family = none)]
        pub fn showsSelectionIndicator(&self) -> bool;

        /// Setter for [`showsSelectionIndicator`][Self::showsSelectionIndicator].
        #[deprecated = "This property has no effect on iOS 7 and later."]
        #[unsafe(method(setShowsSelectionIndicator:))]
        #[unsafe(method_family = none)]
        pub fn setShowsSelectionIndicator(&self, shows_selection_indicator: bool);

        #[unsafe(method(numberOfComponents))]
        #[unsafe(method_family = none)]
        pub fn numberOfComponents(&self) -> NSInteger;

        #[unsafe(method(numberOfRowsInComponent:))]
        #[unsafe(method_family = none)]
        pub fn numberOfRowsInComponent(&self, component: NSInteger) -> NSInteger;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(rowSizeForComponent:))]
        #[unsafe(method_family = none)]
        pub fn rowSizeForComponent(&self, component: NSInteger) -> CGSize;

        #[unsafe(method(viewForRow:forComponent:))]
        #[unsafe(method_family = none)]
        pub fn viewForRow_forComponent(
            &self,
            row: NSInteger,
            component: NSInteger,
        ) -> Option<Retained<UIView>>;

        #[unsafe(method(reloadAllComponents))]
        #[unsafe(method_family = none)]
        pub fn reloadAllComponents(&self);

        #[unsafe(method(reloadComponent:))]
        #[unsafe(method_family = none)]
        pub fn reloadComponent(&self, component: NSInteger);

        #[unsafe(method(selectRow:inComponent:animated:))]
        #[unsafe(method_family = none)]
        pub fn selectRow_inComponent_animated(
            &self,
            row: NSInteger,
            component: NSInteger,
            animated: bool,
        );

        #[unsafe(method(selectedRowInComponent:))]
        #[unsafe(method_family = none)]
        pub fn selectedRowInComponent(&self, component: NSInteger) -> NSInteger;
    );
}

/// Methods declared on superclass `UIView`.
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
impl UIPickerView {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(initWithFrame:))]
        #[unsafe(method_family = init)]
        pub fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> 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>>;

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
impl UIPickerView {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipickerviewdatasource?language=objc)
    pub unsafe trait UIPickerViewDataSource: NSObjectProtocol + MainThreadOnly {
        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[unsafe(method(numberOfComponentsInPickerView:))]
        #[unsafe(method_family = none)]
        fn numberOfComponentsInPickerView(&self, picker_view: &UIPickerView) -> NSInteger;

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[unsafe(method(pickerView:numberOfRowsInComponent:))]
        #[unsafe(method_family = none)]
        fn pickerView_numberOfRowsInComponent(
            &self,
            picker_view: &UIPickerView,
            component: NSInteger,
        ) -> NSInteger;
    }
);

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipickerviewdelegate?language=objc)
    pub unsafe trait UIPickerViewDelegate: NSObjectProtocol + MainThreadOnly {
        #[cfg(all(
            feature = "UIResponder",
            feature = "UIView",
            feature = "objc2-core-foundation"
        ))]
        #[optional]
        #[unsafe(method(pickerView:widthForComponent:))]
        #[unsafe(method_family = none)]
        fn pickerView_widthForComponent(
            &self,
            picker_view: &UIPickerView,
            component: NSInteger,
        ) -> CGFloat;

        #[cfg(all(
            feature = "UIResponder",
            feature = "UIView",
            feature = "objc2-core-foundation"
        ))]
        #[optional]
        #[unsafe(method(pickerView:rowHeightForComponent:))]
        #[unsafe(method_family = none)]
        fn pickerView_rowHeightForComponent(
            &self,
            picker_view: &UIPickerView,
            component: NSInteger,
        ) -> CGFloat;

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[optional]
        #[unsafe(method(pickerView:titleForRow:forComponent:))]
        #[unsafe(method_family = none)]
        fn pickerView_titleForRow_forComponent(
            &self,
            picker_view: &UIPickerView,
            row: NSInteger,
            component: NSInteger,
        ) -> Option<Retained<NSString>>;

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[optional]
        #[unsafe(method(pickerView:attributedTitleForRow:forComponent:))]
        #[unsafe(method_family = none)]
        fn pickerView_attributedTitleForRow_forComponent(
            &self,
            picker_view: &UIPickerView,
            row: NSInteger,
            component: NSInteger,
        ) -> Option<Retained<NSAttributedString>>;

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[optional]
        #[unsafe(method(pickerView:viewForRow:forComponent:reusingView:))]
        #[unsafe(method_family = none)]
        fn pickerView_viewForRow_forComponent_reusingView(
            &self,
            picker_view: &UIPickerView,
            row: NSInteger,
            component: NSInteger,
            view: Option<&UIView>,
        ) -> Retained<UIView>;

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[optional]
        #[unsafe(method(pickerView:didSelectRow:inComponent:))]
        #[unsafe(method_family = none)]
        fn pickerView_didSelectRow_inComponent(
            &self,
            picker_view: &UIPickerView,
            row: NSInteger,
            component: NSInteger,
        );
    }
);
