objc2-app-kit 0.3.2

Bindings to the AppKit framework
Documentation
//! 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::*;

use crate::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nssegmentedcell?language=objc)
    #[unsafe(super(NSActionCell, NSCell, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
    pub struct NSSegmentedCell;
);

#[cfg(all(
    feature = "NSAccessibilityProtocols",
    feature = "NSActionCell",
    feature = "NSCell"
))]
extern_conformance!(
    unsafe impl NSAccessibility for NSSegmentedCell {}
);

#[cfg(all(
    feature = "NSAccessibilityProtocols",
    feature = "NSActionCell",
    feature = "NSCell"
))]
extern_conformance!(
    unsafe impl NSAccessibilityElementProtocol for NSSegmentedCell {}
);

#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
extern_conformance!(
    unsafe impl NSCoding for NSSegmentedCell {}
);

#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
extern_conformance!(
    unsafe impl NSCopying for NSSegmentedCell {}
);

#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
unsafe impl CopyingHelper for NSSegmentedCell {
    type Result = Self;
}

#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
extern_conformance!(
    unsafe impl NSObjectProtocol for NSSegmentedCell {}
);

#[cfg(all(
    feature = "NSActionCell",
    feature = "NSCell",
    feature = "NSUserInterfaceItemIdentification"
))]
extern_conformance!(
    unsafe impl NSUserInterfaceItemIdentification for NSSegmentedCell {}
);

#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
impl NSSegmentedCell {
    extern_methods!(
        #[unsafe(method(segmentCount))]
        #[unsafe(method_family = none)]
        pub fn segmentCount(&self) -> NSInteger;

        /// Setter for [`segmentCount`][Self::segmentCount].
        #[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;

        /// Setter for [`selectedSegment`][Self::selectedSegment].
        #[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;

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

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

        #[cfg(feature = "NSSegmentedControl")]
        #[unsafe(method(trackingMode))]
        #[unsafe(method_family = none)]
        pub fn trackingMode(&self) -> NSSegmentSwitchTracking;

        #[cfg(feature = "NSSegmentedControl")]
        /// Setter for [`trackingMode`][Self::trackingMode].
        #[unsafe(method(setTrackingMode:))]
        #[unsafe(method_family = none)]
        pub fn setTrackingMode(&self, tracking_mode: NSSegmentSwitchTracking);

        #[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>>;

        #[unsafe(method(setImageScaling:forSegment:))]
        #[unsafe(method_family = none)]
        pub fn setImageScaling_forSegment(&self, scaling: NSImageScaling, segment: NSInteger);

        #[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>>;

        #[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;

        #[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(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;

        #[cfg(feature = "NSSegmentedControl")]
        #[unsafe(method(segmentStyle))]
        #[unsafe(method_family = none)]
        pub fn segmentStyle(&self) -> NSSegmentStyle;

        #[cfg(feature = "NSSegmentedControl")]
        /// Setter for [`segmentStyle`][Self::segmentStyle].
        #[unsafe(method(setSegmentStyle:))]
        #[unsafe(method_family = none)]
        pub fn setSegmentStyle(&self, segment_style: NSSegmentStyle);

        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
        #[unsafe(method(drawSegment:inFrame:withView:))]
        #[unsafe(method_family = none)]
        pub fn drawSegment_inFrame_withView(
            &self,
            segment: NSInteger,
            frame: NSRect,
            control_view: &NSView,
        );
    );
}

/// Methods declared on superclass `NSCell`.
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
impl NSSegmentedCell {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(initTextCell:))]
        #[unsafe(method_family = init)]
        pub fn initTextCell(this: Allocated<Self>, string: &NSString) -> Retained<Self>;

        #[cfg(feature = "NSImage")]
        #[unsafe(method(initImageCell:))]
        #[unsafe(method_family = init)]
        pub fn initImageCell(this: Allocated<Self>, image: Option<&NSImage>) -> Retained<Self>;

        /// # Safety
        ///
        /// `coder` possibly has further requirements.
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
    );
}

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

/// NSSegmentBackgroundStyle.
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
impl NSSegmentedCell {
    extern_methods!(
        #[unsafe(method(interiorBackgroundStyleForSegment:))]
        #[unsafe(method_family = none)]
        pub fn interiorBackgroundStyleForSegment(&self, segment: NSInteger) -> NSBackgroundStyle;
    );
}