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::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UISwitchStyle(pub NSInteger);
impl UISwitchStyle {
#[doc(alias = "UISwitchStyleAutomatic")]
pub const Automatic: Self = Self(0);
#[doc(alias = "UISwitchStyleCheckbox")]
pub const Checkbox: Self = Self(1);
#[doc(alias = "UISwitchStyleSliding")]
pub const Sliding: Self = Self(2);
}
unsafe impl Encode for UISwitchStyle {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for UISwitchStyle {
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 UISwitch;
);
#[cfg(all(
feature = "UIControl",
feature = "UIResponder",
feature = "UIView",
feature = "objc2-quartz-core"
))]
#[cfg(not(target_os = "watchos"))]
extern_conformance!(
unsafe impl CALayerDelegate for UISwitch {}
);
#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
unsafe impl NSCoding for UISwitch {}
);
#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
unsafe impl NSObjectProtocol for UISwitch {}
);
#[cfg(all(
feature = "UIAppearance",
feature = "UIControl",
feature = "UIResponder",
feature = "UIView"
))]
extern_conformance!(
unsafe impl UIAppearance for UISwitch {}
);
#[cfg(all(
feature = "UIAppearance",
feature = "UIControl",
feature = "UIResponder",
feature = "UIView"
))]
extern_conformance!(
unsafe impl UIAppearanceContainer for UISwitch {}
);
#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
unsafe impl UICoordinateSpace for UISwitch {}
);
#[cfg(all(
feature = "UIControl",
feature = "UIDynamicBehavior",
feature = "UIResponder",
feature = "UIView"
))]
extern_conformance!(
unsafe impl UIDynamicItem for UISwitch {}
);
#[cfg(all(
feature = "UIControl",
feature = "UIFocus",
feature = "UIResponder",
feature = "UIView"
))]
extern_conformance!(
unsafe impl UIFocusEnvironment for UISwitch {}
);
#[cfg(all(
feature = "UIControl",
feature = "UIFocus",
feature = "UIResponder",
feature = "UIView"
))]
extern_conformance!(
unsafe impl UIFocusItem for UISwitch {}
);
#[cfg(all(
feature = "UIControl",
feature = "UIFocus",
feature = "UIResponder",
feature = "UIView"
))]
extern_conformance!(
unsafe impl UIFocusItemContainer for UISwitch {}
);
#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
unsafe impl UIResponderStandardEditActions for UISwitch {}
);
#[cfg(all(
feature = "UIControl",
feature = "UIResponder",
feature = "UITraitCollection",
feature = "UIView"
))]
extern_conformance!(
unsafe impl UITraitEnvironment for UISwitch {}
);
#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
impl UISwitch {
extern_methods!(
#[cfg(feature = "UIColor")]
#[unsafe(method(onTintColor))]
#[unsafe(method_family = none)]
pub fn onTintColor(&self) -> Option<Retained<UIColor>>;
#[cfg(feature = "UIColor")]
#[unsafe(method(setOnTintColor:))]
#[unsafe(method_family = none)]
pub fn setOnTintColor(&self, on_tint_color: Option<&UIColor>);
#[cfg(feature = "UIColor")]
#[unsafe(method(thumbTintColor))]
#[unsafe(method_family = none)]
pub fn thumbTintColor(&self) -> Option<Retained<UIColor>>;
#[cfg(feature = "UIColor")]
#[unsafe(method(setThumbTintColor:))]
#[unsafe(method_family = none)]
pub fn setThumbTintColor(&self, thumb_tint_color: Option<&UIColor>);
#[cfg(feature = "UIImage")]
#[unsafe(method(onImage))]
#[unsafe(method_family = none)]
pub fn onImage(&self) -> Option<Retained<UIImage>>;
#[cfg(feature = "UIImage")]
#[unsafe(method(setOnImage:))]
#[unsafe(method_family = none)]
pub fn setOnImage(&self, on_image: Option<&UIImage>);
#[cfg(feature = "UIImage")]
#[unsafe(method(offImage))]
#[unsafe(method_family = none)]
pub fn offImage(&self) -> Option<Retained<UIImage>>;
#[cfg(feature = "UIImage")]
#[unsafe(method(setOffImage:))]
#[unsafe(method_family = none)]
pub fn setOffImage(&self, off_image: Option<&UIImage>);
#[unsafe(method(title))]
#[unsafe(method_family = none)]
pub fn title(&self) -> Option<Retained<NSString>>;
#[unsafe(method(setTitle:))]
#[unsafe(method_family = none)]
pub fn setTitle(&self, title: Option<&NSString>);
#[unsafe(method(style))]
#[unsafe(method_family = none)]
pub fn style(&self) -> UISwitchStyle;
#[unsafe(method(preferredStyle))]
#[unsafe(method_family = none)]
pub fn preferredStyle(&self) -> UISwitchStyle;
#[unsafe(method(setPreferredStyle:))]
#[unsafe(method_family = none)]
pub fn setPreferredStyle(&self, preferred_style: UISwitchStyle);
#[unsafe(method(isOn))]
#[unsafe(method_family = none)]
pub fn isOn(&self) -> bool;
#[unsafe(method(setOn:))]
#[unsafe(method_family = none)]
pub fn setOn(&self, on: bool);
#[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(setOn:animated:))]
#[unsafe(method_family = none)]
pub fn setOn_animated(&self, on: bool, animated: bool);
);
}
#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
impl UISwitch {
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 UISwitch {
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 UISwitch {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}