//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-quartz-core")]
#[cfg(not(target_os = "watchos"))]
use objc2_quartz_core::*;

use crate::*;

// NS_ENUM
#[deprecated = "The segmentedControlStyle property no longer has any effect"]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UISegmentedControlStyle(pub NSInteger);
impl UISegmentedControlStyle {
    #[deprecated = "The segmentedControlStyle property no longer has any effect"]
    #[doc(alias = "UISegmentedControlStylePlain")]
    pub const Plain: Self = Self(0);
    #[deprecated = "The segmentedControlStyle property no longer has any effect"]
    #[doc(alias = "UISegmentedControlStyleBordered")]
    pub const Bordered: Self = Self(1);
    #[deprecated = "The segmentedControlStyle property no longer has any effect"]
    #[doc(alias = "UISegmentedControlStyleBar")]
    pub const Bar: Self = Self(2);
    #[deprecated = "The segmentedControlStyle property no longer has any effect"]
    #[doc(alias = "UISegmentedControlStyleBezeled")]
    pub const Bezeled: Self = Self(3);
}

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

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

pub const UISegmentedControlNoSegment: c_int = -1;

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UISegmentedControlSegment(pub NSInteger);
impl UISegmentedControlSegment {
    #[doc(alias = "UISegmentedControlSegmentAny")]
    pub const Any: Self = Self(0);
    #[doc(alias = "UISegmentedControlSegmentLeft")]
    pub const Left: Self = Self(1);
    #[doc(alias = "UISegmentedControlSegmentCenter")]
    pub const Center: Self = Self(2);
    #[doc(alias = "UISegmentedControlSegmentRight")]
    pub const Right: Self = Self(3);
    #[doc(alias = "UISegmentedControlSegmentAlone")]
    pub const Alone: Self = Self(4);
}

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

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

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
    pub struct UISegmentedControl;

    #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
    unsafe impl ClassType for UISegmentedControl {
        #[inherits(UIView, UIResponder, NSObject)]
        type Super = UIControl;
        type Mutability = MainThreadOnly;
    }
);

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

#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
unsafe impl NSCoding for UISegmentedControl {}

#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
unsafe impl NSObjectProtocol for UISegmentedControl {}

#[cfg(all(
    feature = "UIAppearance",
    feature = "UIControl",
    feature = "UIResponder",
    feature = "UIView"
))]
unsafe impl UIAppearance for UISegmentedControl {}

#[cfg(all(
    feature = "UIAppearance",
    feature = "UIControl",
    feature = "UIResponder",
    feature = "UIView"
))]
unsafe impl UIAppearanceContainer for UISegmentedControl {}

#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
unsafe impl UICoordinateSpace for UISegmentedControl {}

#[cfg(all(
    feature = "UIControl",
    feature = "UIDynamicBehavior",
    feature = "UIResponder",
    feature = "UIView"
))]
unsafe impl UIDynamicItem for UISegmentedControl {}

#[cfg(all(
    feature = "UIControl",
    feature = "UIFocus",
    feature = "UIResponder",
    feature = "UIView"
))]
unsafe impl UIFocusEnvironment for UISegmentedControl {}

#[cfg(all(
    feature = "UIControl",
    feature = "UIFocus",
    feature = "UIResponder",
    feature = "UIView"
))]
unsafe impl UIFocusItem for UISegmentedControl {}

#[cfg(all(
    feature = "UIControl",
    feature = "UIFocus",
    feature = "UIResponder",
    feature = "UIView"
))]
unsafe impl UIFocusItemContainer for UISegmentedControl {}

#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
unsafe impl UIResponderStandardEditActions for UISegmentedControl {}

#[cfg(all(
    feature = "UIControl",
    feature = "UIResponder",
    feature = "UITraitCollection",
    feature = "UIView"
))]
unsafe impl UITraitEnvironment for UISegmentedControl {}

extern_methods!(
    #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
    unsafe impl UISegmentedControl {
        #[method_id(@__retain_semantics Init initWithFrame:)]
        pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;

        #[method_id(@__retain_semantics Init initWithCoder:)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;

        #[method_id(@__retain_semantics Init initWithItems:)]
        pub unsafe fn initWithItems(
            this: Allocated<Self>,
            items: Option<&NSArray>,
        ) -> Retained<Self>;

        #[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
        #[method_id(@__retain_semantics Init initWithFrame:actions:)]
        pub unsafe fn initWithFrame_actions(
            this: Allocated<Self>,
            frame: CGRect,
            actions: &NSArray<UIAction>,
        ) -> Retained<Self>;

        #[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
        #[method(insertSegmentWithAction:atIndex:animated:)]
        pub unsafe fn insertSegmentWithAction_atIndex_animated(
            &self,
            action: &UIAction,
            segment: NSUInteger,
            animated: bool,
        );

        #[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
        #[method(setAction:forSegmentAtIndex:)]
        pub unsafe fn setAction_forSegmentAtIndex(&self, action: &UIAction, segment: NSUInteger);

        #[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
        #[method_id(@__retain_semantics Other actionForSegmentAtIndex:)]
        pub unsafe fn actionForSegmentAtIndex(
            &self,
            segment: NSUInteger,
        ) -> Option<Retained<UIAction>>;

        #[cfg(feature = "UIAction")]
        #[method(segmentIndexForActionIdentifier:)]
        pub unsafe fn segmentIndexForActionIdentifier(
            &self,
            action_identifier: &UIActionIdentifier,
        ) -> NSInteger;

        #[deprecated = "The segmentedControlStyle property no longer has any effect"]
        #[method(segmentedControlStyle)]
        pub unsafe fn segmentedControlStyle(&self) -> UISegmentedControlStyle;

        #[deprecated = "The segmentedControlStyle property no longer has any effect"]
        #[method(setSegmentedControlStyle:)]
        pub unsafe fn setSegmentedControlStyle(
            &self,
            segmented_control_style: UISegmentedControlStyle,
        );

        #[method(isMomentary)]
        pub unsafe fn isMomentary(&self) -> bool;

        #[method(setMomentary:)]
        pub unsafe fn setMomentary(&self, momentary: bool);

        #[method(numberOfSegments)]
        pub unsafe fn numberOfSegments(&self) -> NSUInteger;

        #[method(apportionsSegmentWidthsByContent)]
        pub unsafe fn apportionsSegmentWidthsByContent(&self) -> bool;

        #[method(setApportionsSegmentWidthsByContent:)]
        pub unsafe fn setApportionsSegmentWidthsByContent(
            &self,
            apportions_segment_widths_by_content: bool,
        );

        #[method(insertSegmentWithTitle:atIndex:animated:)]
        pub unsafe fn insertSegmentWithTitle_atIndex_animated(
            &self,
            title: Option<&NSString>,
            segment: NSUInteger,
            animated: bool,
        );

        #[cfg(feature = "UIImage")]
        #[method(insertSegmentWithImage:atIndex:animated:)]
        pub unsafe fn insertSegmentWithImage_atIndex_animated(
            &self,
            image: Option<&UIImage>,
            segment: NSUInteger,
            animated: bool,
        );

        #[method(removeSegmentAtIndex:animated:)]
        pub unsafe fn removeSegmentAtIndex_animated(&self, segment: NSUInteger, animated: bool);

        #[method(removeAllSegments)]
        pub unsafe fn removeAllSegments(&self);

        #[method(setTitle:forSegmentAtIndex:)]
        pub unsafe fn setTitle_forSegmentAtIndex(
            &self,
            title: Option<&NSString>,
            segment: NSUInteger,
        );

        #[method_id(@__retain_semantics Other titleForSegmentAtIndex:)]
        pub unsafe fn titleForSegmentAtIndex(
            &self,
            segment: NSUInteger,
        ) -> Option<Retained<NSString>>;

        #[cfg(feature = "UIImage")]
        #[method(setImage:forSegmentAtIndex:)]
        pub unsafe fn setImage_forSegmentAtIndex(
            &self,
            image: Option<&UIImage>,
            segment: NSUInteger,
        );

        #[cfg(feature = "UIImage")]
        #[method_id(@__retain_semantics Other imageForSegmentAtIndex:)]
        pub unsafe fn imageForSegmentAtIndex(
            &self,
            segment: NSUInteger,
        ) -> Option<Retained<UIImage>>;

        #[method(setWidth:forSegmentAtIndex:)]
        pub unsafe fn setWidth_forSegmentAtIndex(&self, width: CGFloat, segment: NSUInteger);

        #[method(widthForSegmentAtIndex:)]
        pub unsafe fn widthForSegmentAtIndex(&self, segment: NSUInteger) -> CGFloat;

        #[method(setContentOffset:forSegmentAtIndex:)]
        pub unsafe fn setContentOffset_forSegmentAtIndex(
            &self,
            offset: CGSize,
            segment: NSUInteger,
        );

        #[method(contentOffsetForSegmentAtIndex:)]
        pub unsafe fn contentOffsetForSegmentAtIndex(&self, segment: NSUInteger) -> CGSize;

        #[method(setEnabled:forSegmentAtIndex:)]
        pub unsafe fn setEnabled_forSegmentAtIndex(&self, enabled: bool, segment: NSUInteger);

        #[method(isEnabledForSegmentAtIndex:)]
        pub unsafe fn isEnabledForSegmentAtIndex(&self, segment: NSUInteger) -> bool;

        #[method(selectedSegmentIndex)]
        pub unsafe fn selectedSegmentIndex(&self) -> NSInteger;

        #[method(setSelectedSegmentIndex:)]
        pub unsafe fn setSelectedSegmentIndex(&self, selected_segment_index: NSInteger);

        #[cfg(feature = "UIColor")]
        #[method_id(@__retain_semantics Other selectedSegmentTintColor)]
        pub unsafe fn selectedSegmentTintColor(&self) -> Option<Retained<UIColor>>;

        #[cfg(feature = "UIColor")]
        #[method(setSelectedSegmentTintColor:)]
        pub unsafe fn setSelectedSegmentTintColor(
            &self,
            selected_segment_tint_color: Option<&UIColor>,
        );

        #[cfg(all(feature = "UIBarCommon", feature = "UIImage"))]
        #[method(setBackgroundImage:forState:barMetrics:)]
        pub unsafe fn setBackgroundImage_forState_barMetrics(
            &self,
            background_image: Option<&UIImage>,
            state: UIControlState,
            bar_metrics: UIBarMetrics,
        );

        #[cfg(all(feature = "UIBarCommon", feature = "UIImage"))]
        #[method_id(@__retain_semantics Other backgroundImageForState:barMetrics:)]
        pub unsafe fn backgroundImageForState_barMetrics(
            &self,
            state: UIControlState,
            bar_metrics: UIBarMetrics,
        ) -> Option<Retained<UIImage>>;

        #[cfg(all(feature = "UIBarCommon", feature = "UIImage"))]
        #[method(setDividerImage:forLeftSegmentState:rightSegmentState:barMetrics:)]
        pub unsafe fn setDividerImage_forLeftSegmentState_rightSegmentState_barMetrics(
            &self,
            divider_image: Option<&UIImage>,
            left_state: UIControlState,
            right_state: UIControlState,
            bar_metrics: UIBarMetrics,
        );

        #[cfg(all(feature = "UIBarCommon", feature = "UIImage"))]
        #[method_id(@__retain_semantics Other dividerImageForLeftSegmentState:rightSegmentState:barMetrics:)]
        pub unsafe fn dividerImageForLeftSegmentState_rightSegmentState_barMetrics(
            &self,
            left_state: UIControlState,
            right_state: UIControlState,
            bar_metrics: UIBarMetrics,
        ) -> Option<Retained<UIImage>>;

        #[method(setTitleTextAttributes:forState:)]
        pub unsafe fn setTitleTextAttributes_forState(
            &self,
            attributes: Option<&NSDictionary<NSAttributedStringKey, AnyObject>>,
            state: UIControlState,
        );

        #[method_id(@__retain_semantics Other titleTextAttributesForState:)]
        pub unsafe fn titleTextAttributesForState(
            &self,
            state: UIControlState,
        ) -> Option<Retained<NSDictionary<NSAttributedStringKey, AnyObject>>>;

        #[cfg(all(feature = "UIBarCommon", feature = "UIGeometry"))]
        #[method(setContentPositionAdjustment:forSegmentType:barMetrics:)]
        pub unsafe fn setContentPositionAdjustment_forSegmentType_barMetrics(
            &self,
            adjustment: UIOffset,
            left_center_right_or_alone: UISegmentedControlSegment,
            bar_metrics: UIBarMetrics,
        );

        #[cfg(all(feature = "UIBarCommon", feature = "UIGeometry"))]
        #[method(contentPositionAdjustmentForSegmentType:barMetrics:)]
        pub unsafe fn contentPositionAdjustmentForSegmentType_barMetrics(
            &self,
            left_center_right_or_alone: UISegmentedControlSegment,
            bar_metrics: UIBarMetrics,
        ) -> UIOffset;
    }
);

extern_methods!(
    /// Methods declared on superclass `UIControl`
    #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
    unsafe impl UISegmentedControl {
        #[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
        #[method_id(@__retain_semantics Init initWithFrame:primaryAction:)]
        pub unsafe fn initWithFrame_primaryAction(
            this: Allocated<Self>,
            frame: CGRect,
            primary_action: Option<&UIAction>,
        ) -> Retained<Self>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
    unsafe impl UISegmentedControl {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
    }
);

extern_methods!(
    /// SpringLoading
    #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
    unsafe impl UISegmentedControl {}
);

#[cfg(all(
    feature = "UIControl",
    feature = "UIResponder",
    feature = "UISpringLoadedInteractionSupporting",
    feature = "UIView"
))]
unsafe impl UISpringLoadedInteractionSupporting for UISegmentedControl {}
