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-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-quartz-core")]
use objc2_quartz_core::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/quartz/ikimagebrowsercellstate?language=objc)
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct IKImageBrowserCellState(pub c_uint);
impl IKImageBrowserCellState {
    #[doc(alias = "IKImageStateNoImage")]
    pub const StateNoImage: Self = Self(0);
    #[doc(alias = "IKImageStateInvalid")]
    pub const StateInvalid: Self = Self(1);
    #[doc(alias = "IKImageStateReady")]
    pub const StateReady: Self = Self(2);
}

unsafe impl Encode for IKImageBrowserCellState {
    const ENCODING: Encoding = c_uint::ENCODING;
}

unsafe impl RefEncode for IKImageBrowserCellState {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/quartz/ikimagebrowsercellbackgroundlayer?language=objc)
    pub static IKImageBrowserCellBackgroundLayer: Option<&'static NSString>;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/quartz/ikimagebrowsercellforegroundlayer?language=objc)
    pub static IKImageBrowserCellForegroundLayer: Option<&'static NSString>;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/quartz/ikimagebrowsercellselectionlayer?language=objc)
    pub static IKImageBrowserCellSelectionLayer: Option<&'static NSString>;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/quartz/ikimagebrowsercellplaceholderlayer?language=objc)
    pub static IKImageBrowserCellPlaceHolderLayer: Option<&'static NSString>;
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/quartz/ikimagebrowsercell?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct IKImageBrowserCell;
);

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

impl IKImageBrowserCell {
    extern_methods!(
        #[cfg(feature = "IKImageBrowserView")]
        /// Returns the view the receiver uses to display its represented object.
        ///
        /// Subclasses should not override this method.
        #[unsafe(method(imageBrowserView))]
        #[unsafe(method_family = none)]
        pub unsafe fn imageBrowserView(
            &self,
            mtm: MainThreadMarker,
        ) -> Option<Retained<IKImageBrowserView>>;

        /// Returns the receiver�s represented object.
        ///
        /// Subclasses should not override this method.
        #[unsafe(method(representedItem))]
        #[unsafe(method_family = none)]
        pub unsafe fn representedItem(&self) -> Option<Retained<AnyObject>>;

        /// Returns the index of the receiver�s represented object in the datasource.
        ///
        /// Subclasses should not override this method.
        #[unsafe(method(indexOfRepresentedItem))]
        #[unsafe(method_family = none)]
        pub unsafe fn indexOfRepresentedItem(&self) -> NSUInteger;

        /// Returns the receiver�s frame rectangle, which defines its position in its IKImageBrowserView.
        ///
        /// The coordinates of this frame are in view's coordinate space. Subclasses should not override this method.
        #[unsafe(method(frame))]
        #[unsafe(method_family = none)]
        pub unsafe fn frame(&self) -> NSRect;

        /// Returns the receiver�s image container frame rectangle, which defines the position of the container of the thumbnail in its IKImageBrowserView.
        ///
        /// The coordinates of this frame are in view's coordinate space. Subclasses can override this method to customize the position of the thumbnail container. The image frame is computed automatically from the image container frame by taking in account the image alignment and the image aspect ratio.
        #[unsafe(method(imageContainerFrame))]
        #[unsafe(method_family = none)]
        pub unsafe fn imageContainerFrame(&self) -> NSRect;

        /// Returns the receiver�s image frame rectangle, which defines the position of the thumbnail in its IKImageBrowserView.
        ///
        /// The coordinates of this frame are in view's coordinate space. Subclasses can override this method to customize the position of the thumbnail.
        #[unsafe(method(imageFrame))]
        #[unsafe(method_family = none)]
        pub unsafe fn imageFrame(&self) -> NSRect;

        /// Returns the receiver�s selection frame rectangle, which defines the position of the selection rectangle in its IKImageBrowserView.
        ///
        /// The coordinates of this frame are in view's coordinate space. Subclasses can override this method to customize the position of the selection frame.
        #[unsafe(method(selectionFrame))]
        #[unsafe(method_family = none)]
        pub unsafe fn selectionFrame(&self) -> NSRect;

        /// Returns the receiver�s title frame rectangle, which defines the position of the title in its IKImageBrowserView.
        ///
        /// The coordinates of this frame are in view's coordinate space. Subclasses can override this method to customize the position of the title.
        #[unsafe(method(titleFrame))]
        #[unsafe(method_family = none)]
        pub unsafe fn titleFrame(&self) -> NSRect;

        /// Returns the receiver�s subtitle frame rectangle, which defines the position of the subtitle in its IKImageBrowserView.
        ///
        /// The coordinates of this frame are in view's coordinate space. Subclasses can override this method to customize the position of the subtitle.
        #[unsafe(method(subtitleFrame))]
        #[unsafe(method_family = none)]
        pub unsafe fn subtitleFrame(&self) -> NSRect;

        /// Returns the position of the cell�s image in the frame. The default is NSImageAlignCenter.
        ///
        /// Subclasses can override this method to customize the image alignment. For the list of possible alignments, see [NSImageView setImageAlignment:].
        /// The image frame will be computed automatically from the image container frame by taking in account the image alignment and the image aspect ratio.
        #[unsafe(method(imageAlignment))]
        #[unsafe(method_family = none)]
        pub unsafe fn imageAlignment(&self) -> NSImageAlignment;

        /// Returns the selection state of the receiver.
        ///
        /// Returns YES if the receiver is selected, otherwise NO. Subclasses should not override this method.
        #[unsafe(method(isSelected))]
        #[unsafe(method_family = none)]
        pub unsafe fn isSelected(&self) -> bool;

        /// Returns the current cell state of the receiver.
        ///
        /// Returns IKImageStateReady if the receiver�s represented object has been set and the cell is ready to display. The IKImageBrowserView creates thumbnails asynchronously; This method returns IKImageStateNoImage until a thumbnail has been created from the represented object.
        #[unsafe(method(cellState))]
        #[unsafe(method_family = none)]
        pub unsafe fn cellState(&self) -> IKImageBrowserCellState;

        #[cfg(feature = "objc2-core-foundation")]
        /// Determines the opacity of the receiver.
        ///
        /// Possible values are between 0.0 (transparent) and 1.0 (opaque). Subclasses can override this method to customize the opacity of the cell.
        #[unsafe(method(opacity))]
        #[unsafe(method_family = none)]
        pub unsafe fn opacity(&self) -> CGFloat;

        #[cfg(feature = "objc2-quartz-core")]
        /// Provides the receiver�s layer for the given type. The default is nil.
        ///
        /// Subclasses can override this method to add a layer in the background, foreground... of the cell (see possible types above).
        ///
        /// # Safety
        ///
        /// `type` might not allow `None`.
        #[unsafe(method(layerForType:))]
        #[unsafe(method_family = none)]
        pub unsafe fn layerForType(&self, r#type: Option<&NSString>) -> Option<Retained<CALayer>>;
    );
}

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

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}