use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSColorPanelMode(pub NSInteger);
impl NSColorPanelMode {
#[doc(alias = "NSColorPanelModeNone")]
pub const None: Self = Self(-1);
#[doc(alias = "NSColorPanelModeGray")]
pub const Gray: Self = Self(0);
#[doc(alias = "NSColorPanelModeRGB")]
pub const RGB: Self = Self(1);
#[doc(alias = "NSColorPanelModeCMYK")]
pub const CMYK: Self = Self(2);
#[doc(alias = "NSColorPanelModeHSB")]
pub const HSB: Self = Self(3);
#[doc(alias = "NSColorPanelModeCustomPalette")]
pub const CustomPalette: Self = Self(4);
#[doc(alias = "NSColorPanelModeColorList")]
pub const ColorList: Self = Self(5);
#[doc(alias = "NSColorPanelModeWheel")]
pub const Wheel: Self = Self(6);
#[doc(alias = "NSColorPanelModeCrayon")]
pub const Crayon: Self = Self(7);
}
unsafe impl Encode for NSColorPanelMode {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSColorPanelMode {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSColorPanelOptions(pub NSUInteger);
impl NSColorPanelOptions {
pub const NSColorPanelGrayModeMask: Self = Self(0x00000001);
pub const NSColorPanelRGBModeMask: Self = Self(0x00000002);
pub const NSColorPanelCMYKModeMask: Self = Self(0x00000004);
pub const NSColorPanelHSBModeMask: Self = Self(0x00000008);
pub const NSColorPanelCustomPaletteModeMask: Self = Self(0x00000010);
pub const NSColorPanelColorListModeMask: Self = Self(0x00000020);
pub const NSColorPanelWheelModeMask: Self = Self(0x00000040);
pub const NSColorPanelCrayonModeMask: Self = Self(0x00000080);
pub const NSColorPanelAllModesMask: Self = Self(0x0000ffff);
}
unsafe impl Encode for NSColorPanelOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSColorPanelOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
pub struct NSColorPanel;
#[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
unsafe impl ClassType for NSColorPanel {
#[inherits(NSWindow, NSResponder, NSObject)]
type Super = NSPanel;
type Mutability = MainThreadOnly;
}
);
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSPanel",
feature = "NSResponder",
feature = "NSWindow"
))]
unsafe impl NSAccessibility for NSColorPanel {}
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSPanel",
feature = "NSResponder",
feature = "NSWindow"
))]
unsafe impl NSAccessibilityElementProtocol for NSColorPanel {}
#[cfg(all(
feature = "NSAnimation",
feature = "NSPanel",
feature = "NSResponder",
feature = "NSWindow"
))]
unsafe impl NSAnimatablePropertyContainer for NSColorPanel {}
#[cfg(all(
feature = "NSAppearance",
feature = "NSPanel",
feature = "NSResponder",
feature = "NSWindow"
))]
unsafe impl NSAppearanceCustomization for NSColorPanel {}
#[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
unsafe impl NSCoding for NSColorPanel {}
#[cfg(all(
feature = "NSMenu",
feature = "NSPanel",
feature = "NSResponder",
feature = "NSWindow"
))]
unsafe impl NSMenuItemValidation for NSColorPanel {}
#[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
unsafe impl NSObjectProtocol for NSColorPanel {}
#[cfg(all(
feature = "NSPanel",
feature = "NSResponder",
feature = "NSUserInterfaceItemIdentification",
feature = "NSWindow"
))]
unsafe impl NSUserInterfaceItemIdentification for NSColorPanel {}
#[cfg(all(
feature = "NSPanel",
feature = "NSResponder",
feature = "NSUserInterfaceValidation",
feature = "NSWindow"
))]
unsafe impl NSUserInterfaceValidations for NSColorPanel {}
extern_methods!(
#[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
unsafe impl NSColorPanel {
#[method_id(@__retain_semantics Other sharedColorPanel)]
pub unsafe fn sharedColorPanel(mtm: MainThreadMarker) -> Id<NSColorPanel>;
#[method(sharedColorPanelExists)]
pub unsafe fn sharedColorPanelExists(mtm: MainThreadMarker) -> bool;
#[cfg(all(feature = "NSColor", feature = "NSEvent", feature = "NSView"))]
#[method(dragColor:withEvent:fromView:)]
pub unsafe fn dragColor_withEvent_fromView(
color: &NSColor,
event: &NSEvent,
source_view: &NSView,
) -> bool;
#[method(setPickerMask:)]
pub unsafe fn setPickerMask(mask: NSColorPanelOptions, mtm: MainThreadMarker);
#[method(setPickerMode:)]
pub unsafe fn setPickerMode(mode: NSColorPanelMode, mtm: MainThreadMarker);
#[cfg(feature = "NSView")]
#[method_id(@__retain_semantics Other accessoryView)]
pub unsafe fn accessoryView(&self) -> Option<Id<NSView>>;
#[cfg(feature = "NSView")]
#[method(setAccessoryView:)]
pub unsafe fn setAccessoryView(&self, accessory_view: Option<&NSView>);
#[method(isContinuous)]
pub unsafe fn isContinuous(&self) -> bool;
#[method(setContinuous:)]
pub unsafe fn setContinuous(&self, continuous: bool);
#[method(showsAlpha)]
pub unsafe fn showsAlpha(&self) -> bool;
#[method(setShowsAlpha:)]
pub unsafe fn setShowsAlpha(&self, shows_alpha: bool);
#[method(mode)]
pub unsafe fn mode(&self) -> NSColorPanelMode;
#[method(setMode:)]
pub unsafe fn setMode(&self, mode: NSColorPanelMode);
#[cfg(feature = "NSColor")]
#[method_id(@__retain_semantics Other color)]
pub unsafe fn color(&self) -> Id<NSColor>;
#[cfg(feature = "NSColor")]
#[method(setColor:)]
pub unsafe fn setColor(&self, color: &NSColor);
#[method(alpha)]
pub unsafe fn alpha(&self) -> CGFloat;
#[method(setAction:)]
pub unsafe fn setAction(&self, selector: Option<Sel>);
#[method(setTarget:)]
pub unsafe fn setTarget(&self, target: Option<&AnyObject>);
#[cfg(feature = "NSColorList")]
#[method(attachColorList:)]
pub unsafe fn attachColorList(&self, color_list: &NSColorList);
#[cfg(feature = "NSColorList")]
#[method(detachColorList:)]
pub unsafe fn detachColorList(&self, color_list: &NSColorList);
}
);
extern_methods!(
#[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
unsafe impl NSColorPanel {
#[cfg(feature = "NSGraphics")]
#[method_id(@__retain_semantics Init initWithContentRect:styleMask:backing:defer:)]
pub unsafe fn initWithContentRect_styleMask_backing_defer(
this: Allocated<Self>,
content_rect: NSRect,
style: NSWindowStyleMask,
backing_store_type: NSBackingStoreType,
flag: bool,
) -> Id<Self>;
#[cfg(all(feature = "NSGraphics", feature = "NSScreen"))]
#[method_id(@__retain_semantics Init initWithContentRect:styleMask:backing:defer:screen:)]
pub unsafe fn initWithContentRect_styleMask_backing_defer_screen(
this: Allocated<Self>,
content_rect: NSRect,
style: NSWindowStyleMask,
backing_store_type: NSBackingStoreType,
flag: bool,
screen: Option<&NSScreen>,
) -> Id<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Id<Self>;
#[cfg(feature = "NSViewController")]
#[method_id(@__retain_semantics Other windowWithContentViewController:)]
pub unsafe fn windowWithContentViewController(
content_view_controller: &NSViewController,
) -> Id<Self>;
}
);
extern_methods!(
#[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
unsafe impl NSColorPanel {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
}
);
extern_methods!(
#[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
unsafe impl NSColorPanel {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Id<Self>;
}
);
extern_methods!(
#[cfg(all(feature = "NSApplication", feature = "NSResponder"))]
unsafe impl NSApplication {
#[method(orderFrontColorPanel:)]
pub unsafe fn orderFrontColorPanel(&self, sender: Option<&AnyObject>);
}
);
extern_protocol!(
pub unsafe trait NSColorChanging: NSObjectProtocol {
#[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
#[method(changeColor:)]
unsafe fn changeColor(&self, sender: Option<&NSColorPanel>);
}
unsafe impl ProtocolType for dyn NSColorChanging {}
);
extern "C" {
pub static NSColorPanelColorDidChangeNotification: &'static NSNotificationName;
}
pub static NSNoModeColorPanel: NSColorPanelMode = NSColorPanelMode(NSColorPanelMode::None.0);
pub static NSGrayModeColorPanel: NSColorPanelMode = NSColorPanelMode(NSColorPanelMode::Gray.0);
pub static NSRGBModeColorPanel: NSColorPanelMode = NSColorPanelMode(NSColorPanelMode::RGB.0);
pub static NSCMYKModeColorPanel: NSColorPanelMode = NSColorPanelMode(NSColorPanelMode::CMYK.0);
pub static NSHSBModeColorPanel: NSColorPanelMode = NSColorPanelMode(NSColorPanelMode::HSB.0);
pub static NSCustomPaletteModeColorPanel: NSColorPanelMode =
NSColorPanelMode(NSColorPanelMode::CustomPalette.0);
pub static NSColorListModeColorPanel: NSColorPanelMode =
NSColorPanelMode(NSColorPanelMode::ColorList.0);
pub static NSWheelModeColorPanel: NSColorPanelMode = NSColorPanelMode(NSColorPanelMode::Wheel.0);
pub static NSCrayonModeColorPanel: NSColorPanelMode = NSColorPanelMode(NSColorPanelMode::Crayon.0);