use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSSegmentSwitchTracking(pub NSUInteger);
impl NSSegmentSwitchTracking {
#[doc(alias = "NSSegmentSwitchTrackingSelectOne")]
pub const SelectOne: Self = Self(0);
#[doc(alias = "NSSegmentSwitchTrackingSelectAny")]
pub const SelectAny: Self = Self(1);
#[doc(alias = "NSSegmentSwitchTrackingMomentary")]
pub const Momentary: Self = Self(2);
#[doc(alias = "NSSegmentSwitchTrackingMomentaryAccelerator")]
pub const MomentaryAccelerator: Self = Self(3);
}
unsafe impl Encode for NSSegmentSwitchTracking {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSSegmentSwitchTracking {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSSegmentStyle(pub NSInteger);
impl NSSegmentStyle {
#[doc(alias = "NSSegmentStyleAutomatic")]
pub const Automatic: Self = Self(0);
#[doc(alias = "NSSegmentStyleRounded")]
pub const Rounded: Self = Self(1);
#[doc(alias = "NSSegmentStyleRoundRect")]
pub const RoundRect: Self = Self(3);
#[doc(alias = "NSSegmentStyleTexturedSquare")]
pub const TexturedSquare: Self = Self(4);
#[doc(alias = "NSSegmentStyleSmallSquare")]
pub const SmallSquare: Self = Self(6);
#[doc(alias = "NSSegmentStyleSeparated")]
pub const Separated: Self = Self(8);
#[doc(alias = "NSSegmentStyleTexturedRounded")]
pub const TexturedRounded: Self = Self(2);
#[doc(alias = "NSSegmentStyleCapsule")]
pub const Capsule: Self = Self(5);
}
unsafe impl Encode for NSSegmentStyle {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSSegmentStyle {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSSegmentDistribution(pub NSInteger);
impl NSSegmentDistribution {
#[doc(alias = "NSSegmentDistributionFit")]
pub const Fit: Self = Self(0);
#[doc(alias = "NSSegmentDistributionFill")]
pub const Fill: Self = Self(1);
#[doc(alias = "NSSegmentDistributionFillEqually")]
pub const FillEqually: Self = Self(2);
#[doc(alias = "NSSegmentDistributionFillProportionally")]
pub const FillProportionally: Self = Self(3);
}
unsafe impl Encode for NSSegmentDistribution {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSSegmentDistribution {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(NSControl, NSView, NSResponder, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
pub struct NSSegmentedControl;
);
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSAccessibility for NSSegmentedControl {}
);
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSAccessibilityElementProtocol for NSSegmentedControl {}
);
#[cfg(all(
feature = "NSAnimation",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSAnimatablePropertyContainer for NSSegmentedControl {}
);
#[cfg(all(
feature = "NSAppearance",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSAppearanceCustomization for NSSegmentedControl {}
);
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
extern_conformance!(
unsafe impl NSCoding for NSSegmentedControl {}
);
#[cfg(all(
feature = "NSControl",
feature = "NSDragging",
feature = "NSResponder",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSDraggingDestination for NSSegmentedControl {}
);
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
extern_conformance!(
unsafe impl NSObjectProtocol for NSSegmentedControl {}
);
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSUserInterfaceCompression",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSUserInterfaceCompression for NSSegmentedControl {}
);
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSUserInterfaceItemIdentification",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSUserInterfaceItemIdentification for NSSegmentedControl {}
);
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
impl NSSegmentedControl {
extern_methods!(
#[unsafe(method(segmentCount))]
#[unsafe(method_family = none)]
pub fn segmentCount(&self) -> NSInteger;
#[unsafe(method(setSegmentCount:))]
#[unsafe(method_family = none)]
pub fn setSegmentCount(&self, segment_count: NSInteger);
#[unsafe(method(selectedSegment))]
#[unsafe(method_family = none)]
pub fn selectedSegment(&self) -> NSInteger;
#[unsafe(method(setSelectedSegment:))]
#[unsafe(method_family = none)]
pub fn setSelectedSegment(&self, selected_segment: NSInteger);
#[unsafe(method(selectSegmentWithTag:))]
#[unsafe(method_family = none)]
pub fn selectSegmentWithTag(&self, tag: NSInteger) -> bool;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setWidth:forSegment:))]
#[unsafe(method_family = none)]
pub fn setWidth_forSegment(&self, width: CGFloat, segment: NSInteger);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(widthForSegment:))]
#[unsafe(method_family = none)]
pub fn widthForSegment(&self, segment: NSInteger) -> CGFloat;
#[cfg(feature = "NSImage")]
#[unsafe(method(setImage:forSegment:))]
#[unsafe(method_family = none)]
pub fn setImage_forSegment(&self, image: Option<&NSImage>, segment: NSInteger);
#[cfg(feature = "NSImage")]
#[unsafe(method(imageForSegment:))]
#[unsafe(method_family = none)]
pub fn imageForSegment(&self, segment: NSInteger) -> Option<Retained<NSImage>>;
#[cfg(feature = "NSCell")]
#[unsafe(method(setImageScaling:forSegment:))]
#[unsafe(method_family = none)]
pub fn setImageScaling_forSegment(&self, scaling: NSImageScaling, segment: NSInteger);
#[cfg(feature = "NSCell")]
#[unsafe(method(imageScalingForSegment:))]
#[unsafe(method_family = none)]
pub fn imageScalingForSegment(&self, segment: NSInteger) -> NSImageScaling;
#[unsafe(method(setLabel:forSegment:))]
#[unsafe(method_family = none)]
pub fn setLabel_forSegment(&self, label: &NSString, segment: NSInteger);
#[unsafe(method(labelForSegment:))]
#[unsafe(method_family = none)]
pub fn labelForSegment(&self, segment: NSInteger) -> Option<Retained<NSString>>;
#[cfg(feature = "NSMenu")]
#[unsafe(method(setMenu:forSegment:))]
#[unsafe(method_family = none)]
pub fn setMenu_forSegment(&self, menu: Option<&NSMenu>, segment: NSInteger);
#[cfg(feature = "NSMenu")]
#[unsafe(method(menuForSegment:))]
#[unsafe(method_family = none)]
pub fn menuForSegment(&self, segment: NSInteger) -> Option<Retained<NSMenu>>;
#[unsafe(method(setSelected:forSegment:))]
#[unsafe(method_family = none)]
pub fn setSelected_forSegment(&self, selected: bool, segment: NSInteger);
#[unsafe(method(isSelectedForSegment:))]
#[unsafe(method_family = none)]
pub fn isSelectedForSegment(&self, segment: NSInteger) -> bool;
#[unsafe(method(setEnabled:forSegment:))]
#[unsafe(method_family = none)]
pub fn setEnabled_forSegment(&self, enabled: bool, segment: NSInteger);
#[unsafe(method(isEnabledForSegment:))]
#[unsafe(method_family = none)]
pub fn isEnabledForSegment(&self, segment: NSInteger) -> bool;
#[unsafe(method(setToolTip:forSegment:))]
#[unsafe(method_family = none)]
pub fn setToolTip_forSegment(&self, tool_tip: Option<&NSString>, segment: NSInteger);
#[unsafe(method(toolTipForSegment:))]
#[unsafe(method_family = none)]
pub fn toolTipForSegment(&self, segment: NSInteger) -> Option<Retained<NSString>>;
#[unsafe(method(setTag:forSegment:))]
#[unsafe(method_family = none)]
pub fn setTag_forSegment(&self, tag: NSInteger, segment: NSInteger);
#[unsafe(method(tagForSegment:))]
#[unsafe(method_family = none)]
pub fn tagForSegment(&self, segment: NSInteger) -> NSInteger;
#[unsafe(method(setShowsMenuIndicator:forSegment:))]
#[unsafe(method_family = none)]
pub fn setShowsMenuIndicator_forSegment(
&self,
shows_menu_indicator: bool,
segment: NSInteger,
);
#[unsafe(method(showsMenuIndicatorForSegment:))]
#[unsafe(method_family = none)]
pub fn showsMenuIndicatorForSegment(&self, segment: NSInteger) -> bool;
#[unsafe(method(segmentStyle))]
#[unsafe(method_family = none)]
pub fn segmentStyle(&self) -> NSSegmentStyle;
#[unsafe(method(setSegmentStyle:))]
#[unsafe(method_family = none)]
pub fn setSegmentStyle(&self, segment_style: NSSegmentStyle);
#[unsafe(method(isSpringLoaded))]
#[unsafe(method_family = none)]
pub fn isSpringLoaded(&self) -> bool;
#[unsafe(method(setSpringLoaded:))]
#[unsafe(method_family = none)]
pub fn setSpringLoaded(&self, spring_loaded: bool);
#[unsafe(method(trackingMode))]
#[unsafe(method_family = none)]
pub fn trackingMode(&self) -> NSSegmentSwitchTracking;
#[unsafe(method(setTrackingMode:))]
#[unsafe(method_family = none)]
pub fn setTrackingMode(&self, tracking_mode: NSSegmentSwitchTracking);
#[unsafe(method(doubleValueForSelectedSegment))]
#[unsafe(method_family = none)]
pub fn doubleValueForSelectedSegment(&self) -> c_double;
#[cfg(feature = "NSColor")]
#[unsafe(method(selectedSegmentBezelColor))]
#[unsafe(method_family = none)]
pub fn selectedSegmentBezelColor(&self) -> Option<Retained<NSColor>>;
#[cfg(feature = "NSColor")]
#[unsafe(method(setSelectedSegmentBezelColor:))]
#[unsafe(method_family = none)]
pub fn setSelectedSegmentBezelColor(&self, selected_segment_bezel_color: Option<&NSColor>);
#[unsafe(method(indexOfSelectedItem))]
#[unsafe(method_family = none)]
pub fn indexOfSelectedItem(&self) -> NSInteger;
#[cfg(feature = "NSText")]
#[unsafe(method(setAlignment:forSegment:))]
#[unsafe(method_family = none)]
pub fn setAlignment_forSegment(&self, alignment: NSTextAlignment, segment: NSInteger);
#[cfg(feature = "NSText")]
#[unsafe(method(alignmentForSegment:))]
#[unsafe(method_family = none)]
pub fn alignmentForSegment(&self, segment: NSInteger) -> NSTextAlignment;
#[unsafe(method(segmentDistribution))]
#[unsafe(method_family = none)]
pub fn segmentDistribution(&self) -> NSSegmentDistribution;
#[unsafe(method(setSegmentDistribution:))]
#[unsafe(method_family = none)]
pub fn setSegmentDistribution(&self, segment_distribution: NSSegmentDistribution);
#[cfg(feature = "NSUserInterfaceCompression")]
#[unsafe(method(compressWithPrioritizedCompressionOptions:))]
#[unsafe(method_family = none)]
pub fn compressWithPrioritizedCompressionOptions(
&self,
prioritized_options: &NSArray<NSUserInterfaceCompressionOptions>,
);
#[cfg(feature = "NSUserInterfaceCompression")]
#[unsafe(method(minimumSizeWithPrioritizedCompressionOptions:))]
#[unsafe(method_family = none)]
pub fn minimumSizeWithPrioritizedCompressionOptions(
&self,
prioritized_options: &NSArray<NSUserInterfaceCompressionOptions>,
) -> NSSize;
#[cfg(feature = "NSUserInterfaceCompression")]
#[unsafe(method(activeCompressionOptions))]
#[unsafe(method_family = none)]
pub fn activeCompressionOptions(&self) -> Retained<NSUserInterfaceCompressionOptions>;
#[unsafe(method(borderShape))]
#[unsafe(method_family = none)]
pub fn borderShape(&self) -> NSControlBorderShape;
#[unsafe(method(setBorderShape:))]
#[unsafe(method_family = none)]
pub fn setBorderShape(&self, border_shape: NSControlBorderShape);
);
}
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
impl NSSegmentedControl {
extern_methods!(
#[unsafe(method(initWithFrame:))]
#[unsafe(method_family = init)]
pub fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
#[unsafe(method(initWithCoder:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
);
}
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
impl NSSegmentedControl {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
);
}
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
impl NSSegmentedControl {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
impl NSSegmentedControl {
extern_methods!(
#[unsafe(method(segmentedControlWithLabels:trackingMode:target:action:))]
#[unsafe(method_family = none)]
pub unsafe fn segmentedControlWithLabels_trackingMode_target_action(
labels: &NSArray<NSString>,
tracking_mode: NSSegmentSwitchTracking,
target: Option<&AnyObject>,
action: Option<Sel>,
mtm: MainThreadMarker,
) -> Retained<Self>;
#[cfg(feature = "NSImage")]
#[unsafe(method(segmentedControlWithImages:trackingMode:target:action:))]
#[unsafe(method_family = none)]
pub unsafe fn segmentedControlWithImages_trackingMode_target_action(
images: &NSArray<NSImage>,
tracking_mode: NSSegmentSwitchTracking,
target: Option<&AnyObject>,
action: Option<Sel>,
mtm: MainThreadMarker,
) -> Retained<Self>;
);
}