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 NSButtonType(pub NSUInteger);
impl NSButtonType {
#[doc(alias = "NSButtonTypeMomentaryLight")]
pub const MomentaryLight: Self = Self(0);
#[doc(alias = "NSButtonTypePushOnPushOff")]
pub const PushOnPushOff: Self = Self(1);
#[doc(alias = "NSButtonTypeToggle")]
pub const Toggle: Self = Self(2);
#[doc(alias = "NSButtonTypeSwitch")]
pub const Switch: Self = Self(3);
#[doc(alias = "NSButtonTypeRadio")]
pub const Radio: Self = Self(4);
#[doc(alias = "NSButtonTypeMomentaryChange")]
pub const MomentaryChange: Self = Self(5);
#[doc(alias = "NSButtonTypeOnOff")]
pub const OnOff: Self = Self(6);
#[doc(alias = "NSButtonTypeMomentaryPushIn")]
pub const MomentaryPushIn: Self = Self(7);
#[doc(alias = "NSButtonTypeAccelerator")]
pub const Accelerator: Self = Self(8);
#[doc(alias = "NSButtonTypeMultiLevelAccelerator")]
pub const MultiLevelAccelerator: Self = Self(9);
}
unsafe impl Encode for NSButtonType {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSButtonType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSBezelStyle(pub NSUInteger);
impl NSBezelStyle {
#[doc(alias = "NSBezelStyleAutomatic")]
pub const Automatic: Self = Self(0);
#[doc(alias = "NSBezelStylePush")]
pub const Push: Self = Self(1);
#[doc(alias = "NSBezelStyleFlexiblePush")]
pub const FlexiblePush: Self = Self(2);
#[doc(alias = "NSBezelStyleDisclosure")]
pub const Disclosure: Self = Self(5);
#[doc(alias = "NSBezelStyleCircular")]
pub const Circular: Self = Self(7);
#[doc(alias = "NSBezelStyleHelpButton")]
pub const HelpButton: Self = Self(9);
#[doc(alias = "NSBezelStyleSmallSquare")]
pub const SmallSquare: Self = Self(10);
#[doc(alias = "NSBezelStyleToolbar")]
pub const Toolbar: Self = Self(11);
#[doc(alias = "NSBezelStyleAccessoryBarAction")]
pub const AccessoryBarAction: Self = Self(12);
#[doc(alias = "NSBezelStyleAccessoryBar")]
pub const AccessoryBar: Self = Self(13);
#[doc(alias = "NSBezelStylePushDisclosure")]
pub const PushDisclosure: Self = Self(14);
#[doc(alias = "NSBezelStyleBadge")]
pub const Badge: Self = Self(15);
#[doc(alias = "NSBezelStyleGlass")]
pub const Glass: Self = Self(16);
#[doc(alias = "NSBezelStyleShadowlessSquare")]
#[deprecated]
pub const ShadowlessSquare: Self = Self(6);
#[doc(alias = "NSBezelStyleTexturedSquare")]
#[deprecated]
pub const TexturedSquare: Self = Self(8);
#[doc(alias = "NSBezelStyleRounded")]
#[deprecated]
pub const Rounded: Self = Self(NSBezelStyle::Push.0);
#[doc(alias = "NSBezelStyleRegularSquare")]
#[deprecated]
pub const RegularSquare: Self = Self(NSBezelStyle::FlexiblePush.0);
#[doc(alias = "NSBezelStyleTexturedRounded")]
#[deprecated]
pub const TexturedRounded: Self = Self(NSBezelStyle::Toolbar.0);
#[doc(alias = "NSBezelStyleRoundRect")]
#[deprecated]
pub const RoundRect: Self = Self(NSBezelStyle::AccessoryBarAction.0);
#[doc(alias = "NSBezelStyleRecessed")]
#[deprecated]
pub const Recessed: Self = Self(NSBezelStyle::AccessoryBar.0);
#[doc(alias = "NSBezelStyleRoundedDisclosure")]
#[deprecated]
pub const RoundedDisclosure: Self = Self(NSBezelStyle::PushDisclosure.0);
#[doc(alias = "NSBezelStyleInline")]
#[deprecated]
pub const Inline: Self = Self(NSBezelStyle::Badge.0);
}
unsafe impl Encode for NSBezelStyle {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSBezelStyle {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(NSActionCell, NSCell, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
pub struct NSButtonCell;
);
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSActionCell",
feature = "NSCell"
))]
extern_conformance!(
unsafe impl NSAccessibility for NSButtonCell {}
);
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSActionCell",
feature = "NSCell"
))]
extern_conformance!(
unsafe impl NSAccessibilityElementProtocol for NSButtonCell {}
);
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
extern_conformance!(
unsafe impl NSCoding for NSButtonCell {}
);
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
extern_conformance!(
unsafe impl NSCopying for NSButtonCell {}
);
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
unsafe impl CopyingHelper for NSButtonCell {
type Result = Self;
}
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
extern_conformance!(
unsafe impl NSObjectProtocol for NSButtonCell {}
);
#[cfg(all(
feature = "NSActionCell",
feature = "NSCell",
feature = "NSUserInterfaceItemIdentification"
))]
extern_conformance!(
unsafe impl NSUserInterfaceItemIdentification for NSButtonCell {}
);
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
impl NSButtonCell {
extern_methods!(
#[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>;
#[unsafe(method(initWithCoder:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
#[unsafe(method(bezelStyle))]
#[unsafe(method_family = none)]
pub fn bezelStyle(&self) -> NSBezelStyle;
#[unsafe(method(setBezelStyle:))]
#[unsafe(method_family = none)]
pub fn setBezelStyle(&self, bezel_style: NSBezelStyle);
#[unsafe(method(setButtonType:))]
#[unsafe(method_family = none)]
pub fn setButtonType(&self, r#type: NSButtonType);
#[unsafe(method(highlightsBy))]
#[unsafe(method_family = none)]
pub fn highlightsBy(&self) -> NSCellStyleMask;
#[unsafe(method(setHighlightsBy:))]
#[unsafe(method_family = none)]
pub fn setHighlightsBy(&self, highlights_by: NSCellStyleMask);
#[unsafe(method(showsStateBy))]
#[unsafe(method_family = none)]
pub fn showsStateBy(&self) -> NSCellStyleMask;
#[unsafe(method(setShowsStateBy:))]
#[unsafe(method_family = none)]
pub fn setShowsStateBy(&self, shows_state_by: NSCellStyleMask);
#[unsafe(method(title))]
#[unsafe(method_family = none)]
pub fn title(&self) -> Retained<NSString>;
#[unsafe(method(setTitle:))]
#[unsafe(method_family = none)]
pub fn setTitle(&self, title: Option<&NSString>);
#[unsafe(method(attributedTitle))]
#[unsafe(method_family = none)]
pub fn attributedTitle(&self) -> Retained<NSAttributedString>;
#[unsafe(method(setAttributedTitle:))]
#[unsafe(method_family = none)]
pub fn setAttributedTitle(&self, attributed_title: &NSAttributedString);
#[unsafe(method(alternateTitle))]
#[unsafe(method_family = none)]
pub fn alternateTitle(&self) -> Retained<NSString>;
#[unsafe(method(setAlternateTitle:))]
#[unsafe(method_family = none)]
pub fn setAlternateTitle(&self, alternate_title: &NSString);
#[unsafe(method(attributedAlternateTitle))]
#[unsafe(method_family = none)]
pub fn attributedAlternateTitle(&self) -> Retained<NSAttributedString>;
#[unsafe(method(setAttributedAlternateTitle:))]
#[unsafe(method_family = none)]
pub fn setAttributedAlternateTitle(&self, attributed_alternate_title: &NSAttributedString);
#[cfg(feature = "NSImage")]
#[unsafe(method(alternateImage))]
#[unsafe(method_family = none)]
pub fn alternateImage(&self) -> Option<Retained<NSImage>>;
#[cfg(feature = "NSImage")]
#[unsafe(method(setAlternateImage:))]
#[unsafe(method_family = none)]
pub fn setAlternateImage(&self, alternate_image: Option<&NSImage>);
#[unsafe(method(imagePosition))]
#[unsafe(method_family = none)]
pub fn imagePosition(&self) -> NSCellImagePosition;
#[unsafe(method(setImagePosition:))]
#[unsafe(method_family = none)]
pub fn setImagePosition(&self, image_position: NSCellImagePosition);
#[unsafe(method(imageScaling))]
#[unsafe(method_family = none)]
pub fn imageScaling(&self) -> NSImageScaling;
#[unsafe(method(setImageScaling:))]
#[unsafe(method_family = none)]
pub fn setImageScaling(&self, image_scaling: NSImageScaling);
#[unsafe(method(keyEquivalent))]
#[unsafe(method_family = none)]
pub fn keyEquivalent(&self) -> Retained<NSString>;
#[unsafe(method(setKeyEquivalent:))]
#[unsafe(method_family = none)]
pub fn setKeyEquivalent(&self, key_equivalent: &NSString);
#[cfg(feature = "NSEvent")]
#[unsafe(method(keyEquivalentModifierMask))]
#[unsafe(method_family = none)]
pub fn keyEquivalentModifierMask(&self) -> NSEventModifierFlags;
#[cfg(feature = "NSEvent")]
#[unsafe(method(setKeyEquivalentModifierMask:))]
#[unsafe(method_family = none)]
pub fn setKeyEquivalentModifierMask(
&self,
key_equivalent_modifier_mask: NSEventModifierFlags,
);
#[unsafe(method(isTransparent))]
#[unsafe(method_family = none)]
pub fn isTransparent(&self) -> bool;
#[unsafe(method(setTransparent:))]
#[unsafe(method_family = none)]
pub fn setTransparent(&self, transparent: bool);
#[unsafe(method(isOpaque))]
#[unsafe(method_family = none)]
pub fn isOpaque(&self) -> bool;
#[unsafe(method(imageDimsWhenDisabled))]
#[unsafe(method_family = none)]
pub fn imageDimsWhenDisabled(&self) -> bool;
#[unsafe(method(setImageDimsWhenDisabled:))]
#[unsafe(method_family = none)]
pub fn setImageDimsWhenDisabled(&self, image_dims_when_disabled: bool);
#[unsafe(method(showsBorderOnlyWhileMouseInside))]
#[unsafe(method_family = none)]
pub fn showsBorderOnlyWhileMouseInside(&self) -> bool;
#[unsafe(method(setShowsBorderOnlyWhileMouseInside:))]
#[unsafe(method_family = none)]
pub fn setShowsBorderOnlyWhileMouseInside(
&self,
shows_border_only_while_mouse_inside: bool,
);
#[cfg(feature = "NSSound")]
#[unsafe(method(sound))]
#[unsafe(method_family = none)]
pub fn sound(&self) -> Option<Retained<NSSound>>;
#[cfg(feature = "NSSound")]
#[unsafe(method(setSound:))]
#[unsafe(method_family = none)]
pub fn setSound(&self, sound: Option<&NSSound>);
#[cfg(feature = "NSColor")]
#[unsafe(method(backgroundColor))]
#[unsafe(method_family = none)]
pub fn backgroundColor(&self) -> Option<Retained<NSColor>>;
#[cfg(feature = "NSColor")]
#[unsafe(method(setBackgroundColor:))]
#[unsafe(method_family = none)]
pub fn setBackgroundColor(&self, background_color: Option<&NSColor>);
#[unsafe(method(setPeriodicDelay:interval:))]
#[unsafe(method_family = none)]
pub fn setPeriodicDelay_interval(&self, delay: c_float, interval: c_float);
#[unsafe(method(getPeriodicDelay:interval:))]
#[unsafe(method_family = none)]
pub unsafe fn getPeriodicDelay_interval(
&self,
delay: NonNull<c_float>,
interval: NonNull<c_float>,
);
#[unsafe(method(performClick:))]
#[unsafe(method_family = none)]
pub unsafe fn performClick(&self, sender: Option<&AnyObject>);
#[cfg(feature = "NSEvent")]
#[unsafe(method(mouseEntered:))]
#[unsafe(method_family = none)]
pub fn mouseEntered(&self, event: &NSEvent);
#[cfg(feature = "NSEvent")]
#[unsafe(method(mouseExited:))]
#[unsafe(method_family = none)]
pub fn mouseExited(&self, event: &NSEvent);
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[unsafe(method(drawBezelWithFrame:inView:))]
#[unsafe(method_family = none)]
pub fn drawBezelWithFrame_inView(&self, frame: NSRect, control_view: &NSView);
#[cfg(all(feature = "NSImage", feature = "NSResponder", feature = "NSView"))]
#[unsafe(method(drawImage:withFrame:inView:))]
#[unsafe(method_family = none)]
pub fn drawImage_withFrame_inView(
&self,
image: &NSImage,
frame: NSRect,
control_view: &NSView,
);
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[unsafe(method(drawTitle:withFrame:inView:))]
#[unsafe(method_family = none)]
pub fn drawTitle_withFrame_inView(
&self,
title: &NSAttributedString,
frame: NSRect,
control_view: &NSView,
) -> NSRect;
);
}
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
impl NSButtonCell {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
);
}
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
impl NSButtonCell {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}
#[deprecated]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSGradientType(pub NSUInteger);
impl NSGradientType {
#[doc(alias = "NSGradientNone")]
#[deprecated]
pub const None: Self = Self(0);
#[doc(alias = "NSGradientConcaveWeak")]
#[deprecated]
pub const ConcaveWeak: Self = Self(1);
#[doc(alias = "NSGradientConcaveStrong")]
#[deprecated]
pub const ConcaveStrong: Self = Self(2);
#[doc(alias = "NSGradientConvexWeak")]
#[deprecated]
pub const ConvexWeak: Self = Self(3);
#[doc(alias = "NSGradientConvexStrong")]
#[deprecated]
pub const ConvexStrong: Self = Self(4);
}
unsafe impl Encode for NSGradientType {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSGradientType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[deprecated]
pub static NSMomentaryLightButton: NSButtonType = NSButtonType(NSButtonType::MomentaryLight.0);
#[deprecated]
pub static NSPushOnPushOffButton: NSButtonType = NSButtonType(NSButtonType::PushOnPushOff.0);
#[deprecated]
pub static NSToggleButton: NSButtonType = NSButtonType(NSButtonType::Toggle.0);
#[deprecated]
pub static NSSwitchButton: NSButtonType = NSButtonType(NSButtonType::Switch.0);
#[deprecated]
pub static NSRadioButton: NSButtonType = NSButtonType(NSButtonType::Radio.0);
#[deprecated]
pub static NSMomentaryChangeButton: NSButtonType = NSButtonType(NSButtonType::MomentaryChange.0);
#[deprecated]
pub static NSOnOffButton: NSButtonType = NSButtonType(NSButtonType::OnOff.0);
#[deprecated]
pub static NSMomentaryPushInButton: NSButtonType = NSButtonType(NSButtonType::MomentaryPushIn.0);
#[deprecated]
pub static NSAcceleratorButton: NSButtonType = NSButtonType(NSButtonType::Accelerator.0);
#[deprecated]
pub static NSMultiLevelAcceleratorButton: NSButtonType =
NSButtonType(NSButtonType::MultiLevelAccelerator.0);
#[deprecated = "This constant is misnamed and has the same effect as NSButtonTypeMomentaryLight. Use that name instead, or switch to NSButtonTypeMomentaryPushIn."]
pub static NSMomentaryPushButton: NSButtonType = NSButtonType(NSButtonType::MomentaryLight.0);
#[deprecated = "This constant is misnamed and has the same effect as NSButtonTypeMomentaryPushIn. Use that name instead, or switch to NSButtonTypeMomentaryLight."]
pub static NSMomentaryLight: NSButtonType = NSButtonType(NSButtonType::MomentaryPushIn.0);
#[deprecated]
pub static NSRoundedBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::Push.0);
#[deprecated]
pub static NSRegularSquareBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::FlexiblePush.0);
#[deprecated]
pub static NSDisclosureBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::Disclosure.0);
#[deprecated]
pub static NSShadowlessSquareBezelStyle: NSBezelStyle =
NSBezelStyle(NSBezelStyle::ShadowlessSquare.0);
#[deprecated]
pub static NSCircularBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::Circular.0);
#[deprecated]
pub static NSTexturedSquareBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::TexturedSquare.0);
#[deprecated]
pub static NSHelpButtonBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::HelpButton.0);
#[deprecated]
pub static NSSmallSquareBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::SmallSquare.0);
#[deprecated]
pub static NSTexturedRoundedBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::Toolbar.0);
#[deprecated]
pub static NSRoundRectBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::AccessoryBarAction.0);
#[deprecated]
pub static NSRecessedBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::AccessoryBar.0);
#[deprecated]
pub static NSRoundedDisclosureBezelStyle: NSBezelStyle =
NSBezelStyle(NSBezelStyle::PushDisclosure.0);
#[deprecated]
pub static NSInlineBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::Badge.0);
#[deprecated = "This bezel style is obsolete and should not be used."]
pub static NSSmallIconButtonBezelStyle: NSBezelStyle = NSBezelStyle(2);
#[deprecated]
pub static NSThickSquareBezelStyle: NSBezelStyle = NSBezelStyle(3);
#[deprecated]
pub static NSThickerSquareBezelStyle: NSBezelStyle = NSBezelStyle(4);
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
impl NSButtonCell {
extern_methods!(
#[deprecated = "The gradientType property is unused, and setting it has no effect."]
#[unsafe(method(gradientType))]
#[unsafe(method_family = none)]
pub fn gradientType(&self) -> NSGradientType;
#[deprecated = "The gradientType property is unused, and setting it has no effect."]
#[unsafe(method(setGradientType:))]
#[unsafe(method_family = none)]
pub fn setGradientType(&self, gradient_type: NSGradientType);
#[deprecated = "Mnemonics are not used on macOS. Set the title property directly instead."]
#[unsafe(method(setTitleWithMnemonic:))]
#[unsafe(method_family = none)]
pub unsafe fn setTitleWithMnemonic(&self, string_with_ampersand: Option<&NSString>);
#[deprecated = "Mnemonics are not used on macOS. Set the alternateTitle property directly instead."]
#[unsafe(method(setAlternateTitleWithMnemonic:))]
#[unsafe(method_family = none)]
pub unsafe fn setAlternateTitleWithMnemonic(
&self,
string_with_ampersand: Option<&NSString>,
);
#[deprecated = "Mnemonics are not used on macOS. Calling this method has no effect."]
#[unsafe(method(setAlternateMnemonicLocation:))]
#[unsafe(method_family = none)]
pub fn setAlternateMnemonicLocation(&self, location: NSUInteger);
#[deprecated = "Mnemonics are not used on macOS. This property always returns NSNotFound."]
#[unsafe(method(alternateMnemonicLocation))]
#[unsafe(method_family = none)]
pub fn alternateMnemonicLocation(&self) -> NSUInteger;
#[deprecated = "Mnemonics are not used on macOS. This property always returns an empty string."]
#[unsafe(method(alternateMnemonic))]
#[unsafe(method_family = none)]
pub fn alternateMnemonic(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSFont")]
#[deprecated = "The keyEquivalentFont property is no longer used. It always returns the NSButtonCell's font, and setting it has no effect."]
#[unsafe(method(keyEquivalentFont))]
#[unsafe(method_family = none)]
pub fn keyEquivalentFont(&self) -> Option<Retained<NSFont>>;
#[cfg(feature = "NSFont")]
#[deprecated = "The keyEquivalentFont property is no longer used. It always returns the NSButtonCell's font, and setting it has no effect."]
#[unsafe(method(setKeyEquivalentFont:))]
#[unsafe(method_family = none)]
pub fn setKeyEquivalentFont(&self, key_equivalent_font: Option<&NSFont>);
#[cfg(feature = "objc2-core-foundation")]
#[deprecated = "The keyEquivalentFont property is no longer used. Setting it has no effect."]
#[unsafe(method(setKeyEquivalentFont:size:))]
#[unsafe(method_family = none)]
pub fn setKeyEquivalentFont_size(&self, font_name: &NSString, font_size: CGFloat);
);
}