use objc2::__framework_prelude::*;
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);
#[deprecated]
#[doc(alias = "NSBezelStyleShadowlessSquare")]
pub const ShadowlessSquare: Self = Self(6);
#[deprecated]
#[doc(alias = "NSBezelStyleTexturedSquare")]
pub const TexturedSquare: Self = Self(8);
#[deprecated]
#[doc(alias = "NSBezelStyleRounded")]
pub const Rounded: Self = Self(NSBezelStyle::Push.0);
#[deprecated]
#[doc(alias = "NSBezelStyleRegularSquare")]
pub const RegularSquare: Self = Self(NSBezelStyle::FlexiblePush.0);
#[deprecated]
#[doc(alias = "NSBezelStyleTexturedRounded")]
pub const TexturedRounded: Self = Self(NSBezelStyle::Toolbar.0);
#[deprecated]
#[doc(alias = "NSBezelStyleRoundRect")]
pub const RoundRect: Self = Self(NSBezelStyle::AccessoryBarAction.0);
#[deprecated]
#[doc(alias = "NSBezelStyleRecessed")]
pub const Recessed: Self = Self(NSBezelStyle::AccessoryBar.0);
#[deprecated]
#[doc(alias = "NSBezelStyleRoundedDisclosure")]
pub const RoundedDisclosure: Self = Self(NSBezelStyle::PushDisclosure.0);
#[deprecated]
#[doc(alias = "NSBezelStyleInline")]
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!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
pub struct NSButtonCell;
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
unsafe impl ClassType for NSButtonCell {
#[inherits(NSCell, NSObject)]
type Super = NSActionCell;
type Mutability = MainThreadOnly;
}
);
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSActionCell",
feature = "NSCell"
))]
unsafe impl NSAccessibility for NSButtonCell {}
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSActionCell",
feature = "NSCell"
))]
unsafe impl NSAccessibilityElementProtocol for NSButtonCell {}
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
unsafe impl NSCoding for NSButtonCell {}
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
unsafe impl NSCopying for NSButtonCell {}
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
unsafe impl NSObjectProtocol for NSButtonCell {}
#[cfg(all(
feature = "NSActionCell",
feature = "NSCell",
feature = "NSUserInterfaceItemIdentification"
))]
unsafe impl NSUserInterfaceItemIdentification for NSButtonCell {}
extern_methods!(
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
unsafe impl NSButtonCell {
#[method_id(@__retain_semantics Init initTextCell:)]
pub unsafe fn initTextCell(this: Allocated<Self>, string: &NSString) -> Retained<Self>;
#[cfg(feature = "NSImage")]
#[method_id(@__retain_semantics Init initImageCell:)]
pub unsafe fn initImageCell(
this: Allocated<Self>,
image: Option<&NSImage>,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
#[method(bezelStyle)]
pub unsafe fn bezelStyle(&self) -> NSBezelStyle;
#[method(setBezelStyle:)]
pub unsafe fn setBezelStyle(&self, bezel_style: NSBezelStyle);
#[method(setButtonType:)]
pub unsafe fn setButtonType(&self, r#type: NSButtonType);
#[method(highlightsBy)]
pub unsafe fn highlightsBy(&self) -> NSCellStyleMask;
#[method(setHighlightsBy:)]
pub unsafe fn setHighlightsBy(&self, highlights_by: NSCellStyleMask);
#[method(showsStateBy)]
pub unsafe fn showsStateBy(&self) -> NSCellStyleMask;
#[method(setShowsStateBy:)]
pub unsafe fn setShowsStateBy(&self, shows_state_by: NSCellStyleMask);
#[method_id(@__retain_semantics Other title)]
pub unsafe fn title(&self) -> Retained<NSString>;
#[method(setTitle:)]
pub unsafe fn setTitle(&self, title: Option<&NSString>);
#[method_id(@__retain_semantics Other attributedTitle)]
pub unsafe fn attributedTitle(&self) -> Retained<NSAttributedString>;
#[method(setAttributedTitle:)]
pub unsafe fn setAttributedTitle(&self, attributed_title: &NSAttributedString);
#[method_id(@__retain_semantics Other alternateTitle)]
pub unsafe fn alternateTitle(&self) -> Retained<NSString>;
#[method(setAlternateTitle:)]
pub unsafe fn setAlternateTitle(&self, alternate_title: &NSString);
#[method_id(@__retain_semantics Other attributedAlternateTitle)]
pub unsafe fn attributedAlternateTitle(&self) -> Retained<NSAttributedString>;
#[method(setAttributedAlternateTitle:)]
pub unsafe fn setAttributedAlternateTitle(
&self,
attributed_alternate_title: &NSAttributedString,
);
#[cfg(feature = "NSImage")]
#[method_id(@__retain_semantics Other alternateImage)]
pub unsafe fn alternateImage(&self) -> Option<Retained<NSImage>>;
#[cfg(feature = "NSImage")]
#[method(setAlternateImage:)]
pub unsafe fn setAlternateImage(&self, alternate_image: Option<&NSImage>);
#[method(imagePosition)]
pub unsafe fn imagePosition(&self) -> NSCellImagePosition;
#[method(setImagePosition:)]
pub unsafe fn setImagePosition(&self, image_position: NSCellImagePosition);
#[method(imageScaling)]
pub unsafe fn imageScaling(&self) -> NSImageScaling;
#[method(setImageScaling:)]
pub unsafe fn setImageScaling(&self, image_scaling: NSImageScaling);
#[method_id(@__retain_semantics Other keyEquivalent)]
pub unsafe fn keyEquivalent(&self) -> Retained<NSString>;
#[method(setKeyEquivalent:)]
pub unsafe fn setKeyEquivalent(&self, key_equivalent: &NSString);
#[cfg(feature = "NSEvent")]
#[method(keyEquivalentModifierMask)]
pub unsafe fn keyEquivalentModifierMask(&self) -> NSEventModifierFlags;
#[cfg(feature = "NSEvent")]
#[method(setKeyEquivalentModifierMask:)]
pub unsafe fn setKeyEquivalentModifierMask(
&self,
key_equivalent_modifier_mask: NSEventModifierFlags,
);
#[method(isTransparent)]
pub unsafe fn isTransparent(&self) -> bool;
#[method(setTransparent:)]
pub unsafe fn setTransparent(&self, transparent: bool);
#[method(isOpaque)]
pub unsafe fn isOpaque(&self) -> bool;
#[method(imageDimsWhenDisabled)]
pub unsafe fn imageDimsWhenDisabled(&self) -> bool;
#[method(setImageDimsWhenDisabled:)]
pub unsafe fn setImageDimsWhenDisabled(&self, image_dims_when_disabled: bool);
#[method(showsBorderOnlyWhileMouseInside)]
pub unsafe fn showsBorderOnlyWhileMouseInside(&self) -> bool;
#[method(setShowsBorderOnlyWhileMouseInside:)]
pub unsafe fn setShowsBorderOnlyWhileMouseInside(
&self,
shows_border_only_while_mouse_inside: bool,
);
#[cfg(feature = "NSSound")]
#[method_id(@__retain_semantics Other sound)]
pub unsafe fn sound(&self) -> Option<Retained<NSSound>>;
#[cfg(feature = "NSSound")]
#[method(setSound:)]
pub unsafe fn setSound(&self, sound: Option<&NSSound>);
#[cfg(feature = "NSColor")]
#[method_id(@__retain_semantics Other backgroundColor)]
pub unsafe fn backgroundColor(&self) -> Option<Retained<NSColor>>;
#[cfg(feature = "NSColor")]
#[method(setBackgroundColor:)]
pub unsafe fn setBackgroundColor(&self, background_color: Option<&NSColor>);
#[method(setPeriodicDelay:interval:)]
pub unsafe fn setPeriodicDelay_interval(&self, delay: c_float, interval: c_float);
#[method(getPeriodicDelay:interval:)]
pub unsafe fn getPeriodicDelay_interval(
&self,
delay: NonNull<c_float>,
interval: NonNull<c_float>,
);
#[method(performClick:)]
pub unsafe fn performClick(&self, sender: Option<&AnyObject>);
#[cfg(feature = "NSEvent")]
#[method(mouseEntered:)]
pub unsafe fn mouseEntered(&self, event: &NSEvent);
#[cfg(feature = "NSEvent")]
#[method(mouseExited:)]
pub unsafe fn mouseExited(&self, event: &NSEvent);
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[method(drawBezelWithFrame:inView:)]
pub unsafe fn drawBezelWithFrame_inView(&self, frame: NSRect, control_view: &NSView);
#[cfg(all(feature = "NSImage", feature = "NSResponder", feature = "NSView"))]
#[method(drawImage:withFrame:inView:)]
pub unsafe fn drawImage_withFrame_inView(
&self,
image: &NSImage,
frame: NSRect,
control_view: &NSView,
);
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[method(drawTitle:withFrame:inView:)]
pub unsafe fn drawTitle_withFrame_inView(
&self,
title: &NSAttributedString,
frame: NSRect,
control_view: &NSView,
) -> NSRect;
}
);
extern_methods!(
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
unsafe impl NSButtonCell {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
}
);
extern_methods!(
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
unsafe impl NSButtonCell {
#[method_id(@__retain_semantics New new)]
pub unsafe 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 {
pub const NSGradientNone: Self = Self(0);
pub const NSGradientConcaveWeak: Self = Self(1);
pub const NSGradientConcaveStrong: Self = Self(2);
pub const NSGradientConvexWeak: Self = Self(3);
pub const NSGradientConvexStrong: 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);
}
pub static NSMomentaryLightButton: NSButtonType = NSButtonType(NSButtonType::MomentaryLight.0);
pub static NSPushOnPushOffButton: NSButtonType = NSButtonType(NSButtonType::PushOnPushOff.0);
pub static NSToggleButton: NSButtonType = NSButtonType(NSButtonType::Toggle.0);
pub static NSSwitchButton: NSButtonType = NSButtonType(NSButtonType::Switch.0);
pub static NSRadioButton: NSButtonType = NSButtonType(NSButtonType::Radio.0);
pub static NSMomentaryChangeButton: NSButtonType = NSButtonType(NSButtonType::MomentaryChange.0);
pub static NSOnOffButton: NSButtonType = NSButtonType(NSButtonType::OnOff.0);
pub static NSMomentaryPushInButton: NSButtonType = NSButtonType(NSButtonType::MomentaryPushIn.0);
pub static NSAcceleratorButton: NSButtonType = NSButtonType(NSButtonType::Accelerator.0);
pub static NSMultiLevelAcceleratorButton: NSButtonType =
NSButtonType(NSButtonType::MultiLevelAccelerator.0);
pub static NSMomentaryPushButton: NSButtonType = NSButtonType(NSButtonType::MomentaryLight.0);
pub static NSMomentaryLight: NSButtonType = NSButtonType(NSButtonType::MomentaryPushIn.0);
pub static NSRoundedBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::Push.0);
pub static NSRegularSquareBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::FlexiblePush.0);
pub static NSDisclosureBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::Disclosure.0);
pub static NSShadowlessSquareBezelStyle: NSBezelStyle =
NSBezelStyle(NSBezelStyle::ShadowlessSquare.0);
pub static NSCircularBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::Circular.0);
pub static NSTexturedSquareBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::TexturedSquare.0);
pub static NSHelpButtonBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::HelpButton.0);
pub static NSSmallSquareBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::SmallSquare.0);
pub static NSTexturedRoundedBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::Toolbar.0);
pub static NSRoundRectBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::AccessoryBarAction.0);
pub static NSRecessedBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::AccessoryBar.0);
pub static NSRoundedDisclosureBezelStyle: NSBezelStyle =
NSBezelStyle(NSBezelStyle::PushDisclosure.0);
pub static NSInlineBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::Badge.0);
pub static NSSmallIconButtonBezelStyle: NSBezelStyle = NSBezelStyle(2);
pub static NSThickSquareBezelStyle: NSBezelStyle = NSBezelStyle(3);
pub static NSThickerSquareBezelStyle: NSBezelStyle = NSBezelStyle(4);
extern_methods!(
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
unsafe impl NSButtonCell {
#[deprecated = "The gradientType property is unused, and setting it has no effect."]
#[method(gradientType)]
pub unsafe fn gradientType(&self) -> NSGradientType;
#[deprecated = "The gradientType property is unused, and setting it has no effect."]
#[method(setGradientType:)]
pub unsafe fn setGradientType(&self, gradient_type: NSGradientType);
#[deprecated = "Mnemonics are not used on macOS. Set the title property directly instead."]
#[method(setTitleWithMnemonic:)]
pub unsafe fn setTitleWithMnemonic(&self, string_with_ampersand: Option<&NSString>);
#[deprecated = "Mnemonics are not used on macOS. Set the alternateTitle property directly instead."]
#[method(setAlternateTitleWithMnemonic:)]
pub unsafe fn setAlternateTitleWithMnemonic(
&self,
string_with_ampersand: Option<&NSString>,
);
#[deprecated = "Mnemonics are not used on macOS. Calling this method has no effect."]
#[method(setAlternateMnemonicLocation:)]
pub unsafe fn setAlternateMnemonicLocation(&self, location: NSUInteger);
#[deprecated = "Mnemonics are not used on macOS. This property always returns NSNotFound."]
#[method(alternateMnemonicLocation)]
pub unsafe fn alternateMnemonicLocation(&self) -> NSUInteger;
#[deprecated = "Mnemonics are not used on macOS. This property always returns an empty string."]
#[method_id(@__retain_semantics Other alternateMnemonic)]
pub unsafe 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."]
#[method_id(@__retain_semantics Other keyEquivalentFont)]
pub unsafe 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."]
#[method(setKeyEquivalentFont:)]
pub unsafe fn setKeyEquivalentFont(&self, key_equivalent_font: Option<&NSFont>);
#[deprecated = "The keyEquivalentFont property is no longer used. Setting it has no effect."]
#[method(setKeyEquivalentFont:size:)]
pub unsafe fn setKeyEquivalentFont_size(&self, font_name: &NSString, font_size: CGFloat);
}
);