use crate::common::*;
use crate::AppKit::*;
use crate::CoreData::*;
use crate::Foundation::*;
ns_enum!(
#[underlying(NSUInteger)]
pub enum NSButtonType {
NSButtonTypeMomentaryLight = 0,
NSButtonTypePushOnPushOff = 1,
NSButtonTypeToggle = 2,
NSButtonTypeSwitch = 3,
NSButtonTypeRadio = 4,
NSButtonTypeMomentaryChange = 5,
NSButtonTypeOnOff = 6,
NSButtonTypeMomentaryPushIn = 7,
NSButtonTypeAccelerator = 8,
NSButtonTypeMultiLevelAccelerator = 9,
}
);
ns_enum!(
#[underlying(NSUInteger)]
pub enum NSBezelStyle {
NSBezelStyleAutomatic = 0,
NSBezelStylePush = 1,
NSBezelStyleFlexiblePush = 2,
NSBezelStyleDisclosure = 5,
NSBezelStyleCircular = 7,
NSBezelStyleHelpButton = 9,
NSBezelStyleSmallSquare = 10,
NSBezelStyleToolbar = 11,
NSBezelStyleAccessoryBarAction = 12,
NSBezelStyleAccessoryBar = 13,
NSBezelStylePushDisclosure = 14,
NSBezelStyleBadge = 15,
#[deprecated]
NSBezelStyleShadowlessSquare = 6,
#[deprecated]
NSBezelStyleTexturedSquare = 8,
#[deprecated]
NSBezelStyleRounded = NSBezelStylePush,
#[deprecated]
NSBezelStyleRegularSquare = NSBezelStyleFlexiblePush,
#[deprecated]
NSBezelStyleTexturedRounded = NSBezelStyleToolbar,
#[deprecated]
NSBezelStyleRoundRect = NSBezelStyleAccessoryBarAction,
#[deprecated]
NSBezelStyleRecessed = NSBezelStyleAccessoryBar,
#[deprecated]
NSBezelStyleRoundedDisclosure = NSBezelStylePushDisclosure,
#[deprecated]
NSBezelStyleInline = NSBezelStyleBadge,
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "AppKit_NSButtonCell")]
pub struct NSButtonCell;
#[cfg(feature = "AppKit_NSButtonCell")]
unsafe impl ClassType for NSButtonCell {
#[inherits(NSCell, NSObject)]
type Super = NSActionCell;
type Mutability = MainThreadOnly;
}
);
#[cfg(feature = "AppKit_NSButtonCell")]
unsafe impl NSAccessibility for NSButtonCell {}
#[cfg(feature = "AppKit_NSButtonCell")]
unsafe impl NSAccessibilityElementProtocol for NSButtonCell {}
#[cfg(feature = "AppKit_NSButtonCell")]
unsafe impl NSCoding for NSButtonCell {}
#[cfg(feature = "AppKit_NSButtonCell")]
unsafe impl NSCopying for NSButtonCell {}
#[cfg(feature = "AppKit_NSButtonCell")]
unsafe impl NSObjectProtocol for NSButtonCell {}
#[cfg(feature = "AppKit_NSButtonCell")]
unsafe impl NSUserInterfaceItemIdentification for NSButtonCell {}
extern_methods!(
#[cfg(feature = "AppKit_NSButtonCell")]
unsafe impl NSButtonCell {
#[cfg(feature = "Foundation_NSString")]
#[method_id(@__retain_semantics Init initTextCell:)]
pub unsafe fn initTextCell(this: Allocated<Self>, string: &NSString) -> Id<Self>;
#[cfg(feature = "AppKit_NSImage")]
#[method_id(@__retain_semantics Init initImageCell:)]
pub unsafe fn initImageCell(this: Allocated<Self>, image: Option<&NSImage>) -> Id<Self>;
#[cfg(feature = "Foundation_NSCoder")]
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Id<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);
#[cfg(feature = "Foundation_NSString")]
#[method_id(@__retain_semantics Other title)]
pub unsafe fn title(&self) -> Id<NSString>;
#[cfg(feature = "Foundation_NSString")]
#[method(setTitle:)]
pub unsafe fn setTitle(&self, title: Option<&NSString>);
#[cfg(feature = "Foundation_NSAttributedString")]
#[method_id(@__retain_semantics Other attributedTitle)]
pub unsafe fn attributedTitle(&self) -> Id<NSAttributedString>;
#[cfg(feature = "Foundation_NSAttributedString")]
#[method(setAttributedTitle:)]
pub unsafe fn setAttributedTitle(&self, attributed_title: &NSAttributedString);
#[cfg(feature = "Foundation_NSString")]
#[method_id(@__retain_semantics Other alternateTitle)]
pub unsafe fn alternateTitle(&self) -> Id<NSString>;
#[cfg(feature = "Foundation_NSString")]
#[method(setAlternateTitle:)]
pub unsafe fn setAlternateTitle(&self, alternate_title: &NSString);
#[cfg(feature = "Foundation_NSAttributedString")]
#[method_id(@__retain_semantics Other attributedAlternateTitle)]
pub unsafe fn attributedAlternateTitle(&self) -> Id<NSAttributedString>;
#[cfg(feature = "Foundation_NSAttributedString")]
#[method(setAttributedAlternateTitle:)]
pub unsafe fn setAttributedAlternateTitle(
&self,
attributed_alternate_title: &NSAttributedString,
);
#[cfg(feature = "AppKit_NSImage")]
#[method_id(@__retain_semantics Other alternateImage)]
pub unsafe fn alternateImage(&self) -> Option<Id<NSImage>>;
#[cfg(feature = "AppKit_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);
#[cfg(feature = "Foundation_NSString")]
#[method_id(@__retain_semantics Other keyEquivalent)]
pub unsafe fn keyEquivalent(&self) -> Id<NSString>;
#[cfg(feature = "Foundation_NSString")]
#[method(setKeyEquivalent:)]
pub unsafe fn setKeyEquivalent(&self, key_equivalent: &NSString);
#[method(keyEquivalentModifierMask)]
pub unsafe fn keyEquivalentModifierMask(&self) -> NSEventModifierFlags;
#[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 = "AppKit_NSSound")]
#[method_id(@__retain_semantics Other sound)]
pub unsafe fn sound(&self) -> Option<Id<NSSound>>;
#[cfg(feature = "AppKit_NSSound")]
#[method(setSound:)]
pub unsafe fn setSound(&self, sound: Option<&NSSound>);
#[cfg(feature = "AppKit_NSColor")]
#[method_id(@__retain_semantics Other backgroundColor)]
pub unsafe fn backgroundColor(&self) -> Option<Id<NSColor>>;
#[cfg(feature = "AppKit_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 = "AppKit_NSEvent")]
#[method(mouseEntered:)]
pub unsafe fn mouseEntered(&self, event: &NSEvent);
#[cfg(feature = "AppKit_NSEvent")]
#[method(mouseExited:)]
pub unsafe fn mouseExited(&self, event: &NSEvent);
#[cfg(feature = "AppKit_NSView")]
#[method(drawBezelWithFrame:inView:)]
pub unsafe fn drawBezelWithFrame_inView(&self, frame: NSRect, control_view: &NSView);
#[cfg(all(feature = "AppKit_NSImage", feature = "AppKit_NSView"))]
#[method(drawImage:withFrame:inView:)]
pub unsafe fn drawImage_withFrame_inView(
&self,
image: &NSImage,
frame: NSRect,
control_view: &NSView,
);
#[cfg(all(feature = "AppKit_NSView", feature = "Foundation_NSAttributedString"))]
#[method(drawTitle:withFrame:inView:)]
pub unsafe fn drawTitle_withFrame_inView(
&self,
title: &NSAttributedString,
frame: NSRect,
control_view: &NSView,
) -> NSRect;
}
);
extern_methods!(
#[cfg(feature = "AppKit_NSButtonCell")]
unsafe impl NSButtonCell {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
}
);
extern_methods!(
#[cfg(feature = "AppKit_NSButtonCell")]
unsafe impl NSButtonCell {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Id<Self>;
}
);
ns_enum!(
#[underlying(NSUInteger)]
#[deprecated]
pub enum NSGradientType {
NSGradientNone = 0,
NSGradientConcaveWeak = 1,
NSGradientConcaveStrong = 2,
NSGradientConvexWeak = 3,
NSGradientConvexStrong = 4,
}
);
extern_static!(NSMomentaryLightButton: NSButtonType = NSButtonTypeMomentaryLight);
extern_static!(NSPushOnPushOffButton: NSButtonType = NSButtonTypePushOnPushOff);
extern_static!(NSToggleButton: NSButtonType = NSButtonTypeToggle);
extern_static!(NSSwitchButton: NSButtonType = NSButtonTypeSwitch);
extern_static!(NSRadioButton: NSButtonType = NSButtonTypeRadio);
extern_static!(NSMomentaryChangeButton: NSButtonType = NSButtonTypeMomentaryChange);
extern_static!(NSOnOffButton: NSButtonType = NSButtonTypeOnOff);
extern_static!(NSMomentaryPushInButton: NSButtonType = NSButtonTypeMomentaryPushIn);
extern_static!(NSAcceleratorButton: NSButtonType = NSButtonTypeAccelerator);
extern_static!(NSMultiLevelAcceleratorButton: NSButtonType = NSButtonTypeMultiLevelAccelerator);
extern_static!(NSMomentaryPushButton: NSButtonType = NSButtonTypeMomentaryLight);
extern_static!(NSMomentaryLight: NSButtonType = NSButtonTypeMomentaryPushIn);
extern_static!(NSRoundedBezelStyle: NSBezelStyle = NSBezelStylePush);
extern_static!(NSRegularSquareBezelStyle: NSBezelStyle = NSBezelStyleFlexiblePush);
extern_static!(NSDisclosureBezelStyle: NSBezelStyle = NSBezelStyleDisclosure);
extern_static!(NSShadowlessSquareBezelStyle: NSBezelStyle = NSBezelStyleShadowlessSquare);
extern_static!(NSCircularBezelStyle: NSBezelStyle = NSBezelStyleCircular);
extern_static!(NSTexturedSquareBezelStyle: NSBezelStyle = NSBezelStyleTexturedSquare);
extern_static!(NSHelpButtonBezelStyle: NSBezelStyle = NSBezelStyleHelpButton);
extern_static!(NSSmallSquareBezelStyle: NSBezelStyle = NSBezelStyleSmallSquare);
extern_static!(NSTexturedRoundedBezelStyle: NSBezelStyle = NSBezelStyleToolbar);
extern_static!(NSRoundRectBezelStyle: NSBezelStyle = NSBezelStyleAccessoryBarAction);
extern_static!(NSRecessedBezelStyle: NSBezelStyle = NSBezelStyleAccessoryBar);
extern_static!(NSRoundedDisclosureBezelStyle: NSBezelStyle = NSBezelStylePushDisclosure);
extern_static!(NSInlineBezelStyle: NSBezelStyle = NSBezelStyleBadge);
extern_static!(NSSmallIconButtonBezelStyle: NSBezelStyle = 2);
extern_static!(NSThickSquareBezelStyle: NSBezelStyle = 3);
extern_static!(NSThickerSquareBezelStyle: NSBezelStyle = 4);
extern_methods!(
#[cfg(feature = "AppKit_NSButtonCell")]
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);
#[cfg(feature = "Foundation_NSString")]
#[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>);
#[cfg(feature = "Foundation_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;
#[cfg(feature = "Foundation_NSString")]
#[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<Id<NSString>>;
#[cfg(feature = "AppKit_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<Id<NSFont>>;
#[cfg(feature = "AppKit_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>);
#[cfg(feature = "Foundation_NSString")]
#[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);
}
);