objc2-quartz 0.3.2

Bindings to the Quartz framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_app_kit::*;
#[cfg(feature = "objc2-core-graphics")]
use objc2_core_graphics::*;
use objc2_foundation::*;

use crate::*;

extern_protocol!(
    /// The data source of IKImageEditPanel must conform to IKImageEditPanelDataSource protocol.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/quartz/ikimageeditpaneldatasource?language=objc)
    pub unsafe trait IKImageEditPanelDataSource {
        #[cfg(feature = "objc2-core-graphics")]
        /// Returns an image.
        #[unsafe(method(image))]
        #[unsafe(method_family = none)]
        unsafe fn image(&self) -> Option<Retained<CGImage>>;

        #[cfg(feature = "objc2-core-graphics")]
        /// Sets an image with the specifies properties.
        ///
        /// # Safety
        ///
        /// - `image` might not allow `None`.
        /// - `meta_data` generic should be of the correct type.
        /// - `meta_data` might not allow `None`.
        #[unsafe(method(setImage:imageProperties:))]
        #[unsafe(method_family = none)]
        unsafe fn setImage_imageProperties(
            &self,
            image: Option<&CGImage>,
            meta_data: Option<&NSDictionary>,
        );

        #[cfg(feature = "objc2-core-graphics")]
        /// Returns a thumbnail image whose size is no larger than the specified size.
        #[optional]
        #[unsafe(method(thumbnailWithMaximumSize:))]
        #[unsafe(method_family = none)]
        unsafe fn thumbnailWithMaximumSize(&self, size: NSSize) -> Option<Retained<CGImage>>;

        /// Returns a dictionary of the image properties associated with the image in the image edit panel.
        #[optional]
        #[unsafe(method(imageProperties))]
        #[unsafe(method_family = none)]
        unsafe fn imageProperties(&self) -> Retained<NSDictionary>;

        /// Show the adjust view tab
        #[optional]
        #[unsafe(method(hasAdjustMode))]
        #[unsafe(method_family = none)]
        unsafe fn hasAdjustMode(&self) -> bool;

        /// Show the effects view tab
        #[optional]
        #[unsafe(method(hasEffectsMode))]
        #[unsafe(method_family = none)]
        unsafe fn hasEffectsMode(&self) -> bool;

        /// Show the details view tab
        #[optional]
        #[unsafe(method(hasDetailsMode))]
        #[unsafe(method_family = none)]
        unsafe fn hasDetailsMode(&self) -> bool;
    }
);

extern_class!(
    /// The IKImageEditPanel class provides a panel, that is, a utility window that floats on top of document windows, optimized for image editing.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/quartz/ikimageeditpanel?language=objc)
    #[unsafe(super(NSPanel, NSWindow, NSResponder, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct IKImageEditPanel;
);

extern_conformance!(
    unsafe impl NSAccessibility for IKImageEditPanel {}
);

extern_conformance!(
    unsafe impl NSAccessibilityElementProtocol for IKImageEditPanel {}
);

extern_conformance!(
    unsafe impl NSAnimatablePropertyContainer for IKImageEditPanel {}
);

extern_conformance!(
    unsafe impl NSAppearanceCustomization for IKImageEditPanel {}
);

extern_conformance!(
    unsafe impl NSCoding for IKImageEditPanel {}
);

extern_conformance!(
    unsafe impl NSMenuItemValidation for IKImageEditPanel {}
);

extern_conformance!(
    unsafe impl NSObjectProtocol for IKImageEditPanel {}
);

extern_conformance!(
    unsafe impl NSUserInterfaceItemIdentification for IKImageEditPanel {}
);

extern_conformance!(
    unsafe impl NSUserInterfaceValidations for IKImageEditPanel {}
);

impl IKImageEditPanel {
    extern_methods!(
        /// Data source associated with an image editing panel
        ///
        /// # Safety
        ///
        /// This is not retained internally, you must ensure the object is still alive.
        #[unsafe(method(dataSource))]
        #[unsafe(method_family = none)]
        pub unsafe fn dataSource(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn IKImageEditPanelDataSource>>>;

        /// Setter for [`dataSource`][Self::dataSource].
        ///
        /// # Safety
        ///
        /// - `data_source` might not allow `None`.
        /// - This is unretained, you must ensure the object is kept alive while in use.
        #[unsafe(method(setDataSource:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDataSource(
            &self,
            data_source: Option<&ProtocolObject<dyn IKImageEditPanelDataSource>>,
        );

        /// Array of filters reflecting the current user adjustments in the adjust or effects tab.
        #[unsafe(method(filterArray))]
        #[unsafe(method_family = none)]
        pub unsafe fn filterArray(&self) -> Option<Retained<NSArray>>;

        /// Creates a shared instance of an image editing panel.
        #[unsafe(method(sharedImageEditPanel))]
        #[unsafe(method_family = none)]
        pub unsafe fn sharedImageEditPanel(
            mtm: MainThreadMarker,
        ) -> Option<Retained<IKImageEditPanel>>;

        /// Reloads the data from the data associated with an image editing panel.
        #[unsafe(method(reloadData))]
        #[unsafe(method_family = none)]
        pub unsafe fn reloadData(&self);
    );
}

/// Methods declared on superclass `NSWindow`.
impl IKImageEditPanel {
    extern_methods!(
        #[unsafe(method(initWithContentRect:styleMask:backing:defer:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithContentRect_styleMask_backing_defer(
            this: Allocated<Self>,
            content_rect: NSRect,
            style: NSWindowStyleMask,
            backing_store_type: NSBackingStoreType,
            flag: bool,
        ) -> Retained<Self>;

        #[unsafe(method(initWithContentRect:styleMask:backing:defer:screen:))]
        #[unsafe(method_family = init)]
        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>,
        ) -> Retained<Self>;

        /// # Safety
        ///
        /// `coder` possibly has further requirements.
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;

        /// Convenience method for creating an autoreleased titled window with the given contentViewController. A basic NSWindow with the following attributes is made: titled, closable, resizable, miniaturizable. The window's title is automatically bound to the contentViewController's title. The size of the window can easily be controlled by utilizing autolayout and applying size constraints to the view (or its subviews). The window has isReleasedWhenClosed set to NO, and it must be explicitly retained to keep the window instance alive. To have it automatically be freed when it is closed, do the following: [window retain] and [window setReleasedWhenClosed:YES].
        #[unsafe(method(windowWithContentViewController:))]
        #[unsafe(method_family = none)]
        pub unsafe fn windowWithContentViewController(
            content_view_controller: &NSViewController,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSResponder`.
impl IKImageEditPanel {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
impl IKImageEditPanel {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}