icrate 0.0.1

Bindings to Apple's frameworks
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use crate::common::*;
use crate::AppKit::*;
use crate::CoreData::*;
use crate::Foundation::*;

ns_enum!(
    #[underlying(NSInteger)]
    pub enum NSColorPanelMode {
        NSColorPanelModeNone = -1,
        NSColorPanelModeGray = 0,
        NSColorPanelModeRGB = 1,
        NSColorPanelModeCMYK = 2,
        NSColorPanelModeHSB = 3,
        NSColorPanelModeCustomPalette = 4,
        NSColorPanelModeColorList = 5,
        NSColorPanelModeWheel = 6,
        NSColorPanelModeCrayon = 7,
    }
);

ns_options!(
    #[underlying(NSUInteger)]
    pub enum NSColorPanelOptions {
        NSColorPanelGrayModeMask = 0x00000001,
        NSColorPanelRGBModeMask = 0x00000002,
        NSColorPanelCMYKModeMask = 0x00000004,
        NSColorPanelHSBModeMask = 0x00000008,
        NSColorPanelCustomPaletteModeMask = 0x00000010,
        NSColorPanelColorListModeMask = 0x00000020,
        NSColorPanelWheelModeMask = 0x00000040,
        NSColorPanelCrayonModeMask = 0x00000080,
        NSColorPanelAllModesMask = 0x0000ffff,
    }
);

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSColorPanel;

    unsafe impl ClassType for NSColorPanel {
        #[inherits(NSWindow, NSResponder, NSObject)]
        type Super = NSPanel;
    }
);

extern_methods!(
    unsafe impl NSColorPanel {
        #[method_id(@__retain_semantics Other sharedColorPanel)]
        pub unsafe fn sharedColorPanel() -> Id<NSColorPanel, Shared>;

        #[method(sharedColorPanelExists)]
        pub unsafe fn sharedColorPanelExists() -> bool;

        #[method(dragColor:withEvent:fromView:)]
        pub unsafe fn dragColor_withEvent_fromView(
            color: &NSColor,
            event: &NSEvent,
            sourceView: &NSView,
        ) -> bool;

        #[method(setPickerMask:)]
        pub unsafe fn setPickerMask(mask: NSColorPanelOptions);

        #[method(setPickerMode:)]
        pub unsafe fn setPickerMode(mode: NSColorPanelMode);

        #[method_id(@__retain_semantics Other accessoryView)]
        pub unsafe fn accessoryView(&self) -> Option<Id<NSView, Shared>>;

        #[method(setAccessoryView:)]
        pub unsafe fn setAccessoryView(&self, accessoryView: 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, showsAlpha: bool);

        #[method(mode)]
        pub unsafe fn mode(&self) -> NSColorPanelMode;

        #[method(setMode:)]
        pub unsafe fn setMode(&self, mode: NSColorPanelMode);

        #[method_id(@__retain_semantics Other color)]
        pub unsafe fn color(&self) -> Id<NSColor, Shared>;

        #[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<&Object>);

        #[method(attachColorList:)]
        pub unsafe fn attachColorList(&self, colorList: &NSColorList);

        #[method(detachColorList:)]
        pub unsafe fn detachColorList(&self, colorList: &NSColorList);
    }
);

extern_methods!(
    /// NSColorPanel
    unsafe impl NSApplication {
        #[method(orderFrontColorPanel:)]
        pub unsafe fn orderFrontColorPanel(&self, sender: Option<&Object>);
    }
);

extern_protocol!(
    pub struct NSColorChanging;

    unsafe impl ProtocolType for NSColorChanging {
        #[method(changeColor:)]
        pub unsafe fn changeColor(&self, sender: Option<&NSColorPanel>);
    }
);

extern_static!(NSColorPanelColorDidChangeNotification: &'static NSNotificationName);

extern_static!(NSNoModeColorPanel: NSColorPanelMode = NSColorPanelModeNone);

extern_static!(NSGrayModeColorPanel: NSColorPanelMode = NSColorPanelModeGray);

extern_static!(NSRGBModeColorPanel: NSColorPanelMode = NSColorPanelModeRGB);

extern_static!(NSCMYKModeColorPanel: NSColorPanelMode = NSColorPanelModeCMYK);

extern_static!(NSHSBModeColorPanel: NSColorPanelMode = NSColorPanelModeHSB);

extern_static!(NSCustomPaletteModeColorPanel: NSColorPanelMode = NSColorPanelModeCustomPalette);

extern_static!(NSColorListModeColorPanel: NSColorPanelMode = NSColorPanelModeColorList);

extern_static!(NSWheelModeColorPanel: NSColorPanelMode = NSColorPanelModeWheel);

extern_static!(NSCrayonModeColorPanel: NSColorPanelMode = NSColorPanelModeCrayon);

extern_methods!(
    /// Methods declared on superclass `NSWindow`
    unsafe impl NSColorPanel {
        #[method_id(@__retain_semantics Init initWithContentRect:styleMask:backing:defer:)]
        pub unsafe fn initWithContentRect_styleMask_backing_defer(
            this: Option<Allocated<Self>>,
            contentRect: NSRect,
            style: NSWindowStyleMask,
            backingStoreType: NSBackingStoreType,
            flag: bool,
        ) -> Id<Self, Shared>;

        #[method_id(@__retain_semantics Init initWithContentRect:styleMask:backing:defer:screen:)]
        pub unsafe fn initWithContentRect_styleMask_backing_defer_screen(
            this: Option<Allocated<Self>>,
            contentRect: NSRect,
            style: NSWindowStyleMask,
            backingStoreType: NSBackingStoreType,
            flag: bool,
            screen: Option<&NSScreen>,
        ) -> Id<Self, Shared>;

        #[method_id(@__retain_semantics Other windowWithContentViewController:)]
        pub unsafe fn windowWithContentViewController(
            contentViewController: &NSViewController,
        ) -> Id<Self, Shared>;
    }
);