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::*;
#[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 {
#[doc(alias = "UISegmentedControlStylePlain")]
#[deprecated = "The segmentedControlStyle property no longer has any effect"]
pub const Plain: Self = Self(0);
#[doc(alias = "UISegmentedControlStyleBordered")]
#[deprecated = "The segmentedControlStyle property no longer has any effect"]
pub const Bordered: Self = Self(1);
#[doc(alias = "UISegmentedControlStyleBar")]
#[deprecated = "The segmentedControlStyle property no longer has any effect"]
pub const Bar: Self = Self(2);
#[doc(alias = "UISegmentedControlStyleBezeled")]
#[deprecated = "The segmentedControlStyle property no longer has any effect"]
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;
#[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!(
#[unsafe(super(UIControl, UIView, UIResponder, NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
pub struct UISegmentedControl;
);
#[cfg(all(
feature = "UIControl",
feature = "UIResponder",
feature = "UIView",
feature = "objc2-quartz-core"
))]
#[cfg(not(target_os = "watchos"))]
extern_conformance!(
unsafe impl CALayerDelegate for UISegmentedControl {}
);
#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
unsafe impl NSCoding for UISegmentedControl {}
);
#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
unsafe impl NSObjectProtocol for UISegmentedControl {}
);
#[cfg(all(
feature = "UIAppearance",
feature = "UIControl",
feature = "UIResponder",
feature = "UIView"
))]
extern_conformance!(
unsafe impl UIAppearance for UISegmentedControl {}
);
#[cfg(all(
feature = "UIAppearance",
feature = "UIControl",
feature = "UIResponder",
feature = "UIView"
))]
extern_conformance!(
unsafe impl UIAppearanceContainer for UISegmentedControl {}
);
#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
unsafe impl UICoordinateSpace for UISegmentedControl {}
);
#[cfg(all(
feature = "UIControl",
feature = "UIDynamicBehavior",
feature = "UIResponder",
feature = "UIView"
))]
extern_conformance!(
unsafe impl UIDynamicItem for UISegmentedControl {}
);
#[cfg(all(
feature = "UIControl",
feature = "UIFocus",
feature = "UIResponder",
feature = "UIView"
))]
extern_conformance!(
unsafe impl UIFocusEnvironment for UISegmentedControl {}
);
#[cfg(all(
feature = "UIControl",
feature = "UIFocus",
feature = "UIResponder",
feature = "UIView"
))]
extern_conformance!(
unsafe impl UIFocusItem for UISegmentedControl {}
);
#[cfg(all(
feature = "UIControl",
feature = "UIFocus",
feature = "UIResponder",
feature = "UIView"
))]
extern_conformance!(
unsafe impl UIFocusItemContainer for UISegmentedControl {}
);
#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
unsafe impl UIResponderStandardEditActions for UISegmentedControl {}
);
#[cfg(all(
feature = "UIControl",
feature = "UIResponder",
feature = "UITraitCollection",
feature = "UIView"
))]
extern_conformance!(
unsafe impl UITraitEnvironment for UISegmentedControl {}
);
#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
impl UISegmentedControl {
extern_methods!(
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(initWithFrame:))]
#[unsafe(method_family = init)]
pub fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
#[unsafe(method(initWithCoder:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
#[unsafe(method(initWithItems:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithItems(
this: Allocated<Self>,
items: Option<&NSArray>,
) -> Retained<Self>;
#[cfg(all(
feature = "UIAction",
feature = "UIMenuElement",
feature = "objc2-core-foundation"
))]
#[unsafe(method(initWithFrame:actions:))]
#[unsafe(method_family = init)]
pub fn initWithFrame_actions(
this: Allocated<Self>,
frame: CGRect,
actions: &NSArray<UIAction>,
) -> Retained<Self>;
#[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
#[unsafe(method(insertSegmentWithAction:atIndex:animated:))]
#[unsafe(method_family = none)]
pub fn insertSegmentWithAction_atIndex_animated(
&self,
action: &UIAction,
segment: NSUInteger,
animated: bool,
);
#[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
#[unsafe(method(setAction:forSegmentAtIndex:))]
#[unsafe(method_family = none)]
pub fn setAction_forSegmentAtIndex(&self, action: &UIAction, segment: NSUInteger);
#[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
#[unsafe(method(actionForSegmentAtIndex:))]
#[unsafe(method_family = none)]
pub fn actionForSegmentAtIndex(&self, segment: NSUInteger) -> Option<Retained<UIAction>>;
#[cfg(feature = "UIAction")]
#[unsafe(method(segmentIndexForActionIdentifier:))]
#[unsafe(method_family = none)]
pub fn segmentIndexForActionIdentifier(
&self,
action_identifier: &UIActionIdentifier,
) -> NSInteger;
#[deprecated = "The segmentedControlStyle property no longer has any effect"]
#[unsafe(method(segmentedControlStyle))]
#[unsafe(method_family = none)]
pub fn segmentedControlStyle(&self) -> UISegmentedControlStyle;
#[deprecated = "The segmentedControlStyle property no longer has any effect"]
#[unsafe(method(setSegmentedControlStyle:))]
#[unsafe(method_family = none)]
pub fn setSegmentedControlStyle(&self, segmented_control_style: UISegmentedControlStyle);
#[unsafe(method(isMomentary))]
#[unsafe(method_family = none)]
pub fn isMomentary(&self) -> bool;
#[unsafe(method(setMomentary:))]
#[unsafe(method_family = none)]
pub fn setMomentary(&self, momentary: bool);
#[unsafe(method(numberOfSegments))]
#[unsafe(method_family = none)]
pub fn numberOfSegments(&self) -> NSUInteger;
#[unsafe(method(apportionsSegmentWidthsByContent))]
#[unsafe(method_family = none)]
pub fn apportionsSegmentWidthsByContent(&self) -> bool;
#[unsafe(method(setApportionsSegmentWidthsByContent:))]
#[unsafe(method_family = none)]
pub fn setApportionsSegmentWidthsByContent(
&self,
apportions_segment_widths_by_content: bool,
);
#[unsafe(method(insertSegmentWithTitle:atIndex:animated:))]
#[unsafe(method_family = none)]
pub fn insertSegmentWithTitle_atIndex_animated(
&self,
title: Option<&NSString>,
segment: NSUInteger,
animated: bool,
);
#[cfg(feature = "UIImage")]
#[unsafe(method(insertSegmentWithImage:atIndex:animated:))]
#[unsafe(method_family = none)]
pub fn insertSegmentWithImage_atIndex_animated(
&self,
image: Option<&UIImage>,
segment: NSUInteger,
animated: bool,
);
#[unsafe(method(removeSegmentAtIndex:animated:))]
#[unsafe(method_family = none)]
pub fn removeSegmentAtIndex_animated(&self, segment: NSUInteger, animated: bool);
#[unsafe(method(removeAllSegments))]
#[unsafe(method_family = none)]
pub fn removeAllSegments(&self);
#[unsafe(method(setTitle:forSegmentAtIndex:))]
#[unsafe(method_family = none)]
pub fn setTitle_forSegmentAtIndex(&self, title: Option<&NSString>, segment: NSUInteger);
#[unsafe(method(titleForSegmentAtIndex:))]
#[unsafe(method_family = none)]
pub fn titleForSegmentAtIndex(&self, segment: NSUInteger) -> Option<Retained<NSString>>;
#[cfg(feature = "UIImage")]
#[unsafe(method(setImage:forSegmentAtIndex:))]
#[unsafe(method_family = none)]
pub fn setImage_forSegmentAtIndex(&self, image: Option<&UIImage>, segment: NSUInteger);
#[cfg(feature = "UIImage")]
#[unsafe(method(imageForSegmentAtIndex:))]
#[unsafe(method_family = none)]
pub fn imageForSegmentAtIndex(&self, segment: NSUInteger) -> Option<Retained<UIImage>>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setWidth:forSegmentAtIndex:))]
#[unsafe(method_family = none)]
pub fn setWidth_forSegmentAtIndex(&self, width: CGFloat, segment: NSUInteger);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(widthForSegmentAtIndex:))]
#[unsafe(method_family = none)]
pub fn widthForSegmentAtIndex(&self, segment: NSUInteger) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setContentOffset:forSegmentAtIndex:))]
#[unsafe(method_family = none)]
pub fn setContentOffset_forSegmentAtIndex(&self, offset: CGSize, segment: NSUInteger);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(contentOffsetForSegmentAtIndex:))]
#[unsafe(method_family = none)]
pub fn contentOffsetForSegmentAtIndex(&self, segment: NSUInteger) -> CGSize;
#[unsafe(method(setEnabled:forSegmentAtIndex:))]
#[unsafe(method_family = none)]
pub fn setEnabled_forSegmentAtIndex(&self, enabled: bool, segment: NSUInteger);
#[unsafe(method(isEnabledForSegmentAtIndex:))]
#[unsafe(method_family = none)]
pub fn isEnabledForSegmentAtIndex(&self, segment: NSUInteger) -> bool;
#[unsafe(method(selectedSegmentIndex))]
#[unsafe(method_family = none)]
pub fn selectedSegmentIndex(&self) -> NSInteger;
#[unsafe(method(setSelectedSegmentIndex:))]
#[unsafe(method_family = none)]
pub fn setSelectedSegmentIndex(&self, selected_segment_index: NSInteger);
#[cfg(feature = "UIColor")]
#[unsafe(method(selectedSegmentTintColor))]
#[unsafe(method_family = none)]
pub fn selectedSegmentTintColor(&self) -> Option<Retained<UIColor>>;
#[cfg(feature = "UIColor")]
#[unsafe(method(setSelectedSegmentTintColor:))]
#[unsafe(method_family = none)]
pub fn setSelectedSegmentTintColor(&self, selected_segment_tint_color: Option<&UIColor>);
#[cfg(all(feature = "UIBarCommon", feature = "UIImage"))]
#[unsafe(method(setBackgroundImage:forState:barMetrics:))]
#[unsafe(method_family = none)]
pub fn setBackgroundImage_forState_barMetrics(
&self,
background_image: Option<&UIImage>,
state: UIControlState,
bar_metrics: UIBarMetrics,
);
#[cfg(all(feature = "UIBarCommon", feature = "UIImage"))]
#[unsafe(method(backgroundImageForState:barMetrics:))]
#[unsafe(method_family = none)]
pub fn backgroundImageForState_barMetrics(
&self,
state: UIControlState,
bar_metrics: UIBarMetrics,
) -> Option<Retained<UIImage>>;
#[cfg(all(feature = "UIBarCommon", feature = "UIImage"))]
#[unsafe(method(setDividerImage:forLeftSegmentState:rightSegmentState:barMetrics:))]
#[unsafe(method_family = none)]
pub 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"))]
#[unsafe(method(dividerImageForLeftSegmentState:rightSegmentState:barMetrics:))]
#[unsafe(method_family = none)]
pub fn dividerImageForLeftSegmentState_rightSegmentState_barMetrics(
&self,
left_state: UIControlState,
right_state: UIControlState,
bar_metrics: UIBarMetrics,
) -> Option<Retained<UIImage>>;
#[unsafe(method(setTitleTextAttributes:forState:))]
#[unsafe(method_family = none)]
pub unsafe fn setTitleTextAttributes_forState(
&self,
attributes: Option<&NSDictionary<NSAttributedStringKey, AnyObject>>,
state: UIControlState,
);
#[unsafe(method(titleTextAttributesForState:))]
#[unsafe(method_family = none)]
pub fn titleTextAttributesForState(
&self,
state: UIControlState,
) -> Option<Retained<NSDictionary<NSAttributedStringKey, AnyObject>>>;
#[cfg(all(
feature = "UIBarCommon",
feature = "UIGeometry",
feature = "objc2-core-foundation"
))]
#[unsafe(method(setContentPositionAdjustment:forSegmentType:barMetrics:))]
#[unsafe(method_family = none)]
pub fn setContentPositionAdjustment_forSegmentType_barMetrics(
&self,
adjustment: UIOffset,
left_center_right_or_alone: UISegmentedControlSegment,
bar_metrics: UIBarMetrics,
);
#[cfg(all(
feature = "UIBarCommon",
feature = "UIGeometry",
feature = "objc2-core-foundation"
))]
#[unsafe(method(contentPositionAdjustmentForSegmentType:barMetrics:))]
#[unsafe(method_family = none)]
pub fn contentPositionAdjustmentForSegmentType_barMetrics(
&self,
left_center_right_or_alone: UISegmentedControlSegment,
bar_metrics: UIBarMetrics,
) -> UIOffset;
);
}
#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
impl UISegmentedControl {
extern_methods!(
#[cfg(all(
feature = "UIAction",
feature = "UIMenuElement",
feature = "objc2-core-foundation"
))]
#[unsafe(method(initWithFrame:primaryAction:))]
#[unsafe(method_family = init)]
pub fn initWithFrame_primaryAction(
this: Allocated<Self>,
frame: CGRect,
primary_action: Option<&UIAction>,
) -> Retained<Self>;
);
}
#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
impl UISegmentedControl {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
);
}
#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
impl UISegmentedControl {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}
#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
impl UISegmentedControl {
extern_methods!();
}
#[cfg(all(
feature = "UIControl",
feature = "UIResponder",
feature = "UISpringLoadedInteractionSupporting",
feature = "UIView"
))]
extern_conformance!(
unsafe impl UISpringLoadedInteractionSupporting for UISegmentedControl {}
);