objc2-ui-kit 0.3.2

Bindings to the UIKit 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::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
#[cfg(feature = "objc2-core-graphics")]
use objc2_core_graphics::*;
use objc2_foundation::*;

use crate::*;

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

extern_conformance!(
    unsafe impl NSCopying for UIGraphicsRendererFormat {}
);

unsafe impl CopyingHelper for UIGraphicsRendererFormat {
    type Result = Self;
}

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

impl UIGraphicsRendererFormat {
    extern_methods!(
        #[deprecated]
        #[unsafe(method(defaultFormat))]
        #[unsafe(method_family = none)]
        pub fn defaultFormat() -> Retained<Self>;

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

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(bounds))]
        #[unsafe(method_family = none)]
        pub fn bounds(&self) -> CGRect;
    );
}

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

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

impl DefaultRetained for UIGraphicsRendererFormat {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

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

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

impl UIGraphicsRendererContext {
    extern_methods!(
        #[cfg(feature = "objc2-core-graphics")]
        #[unsafe(method(CGContext))]
        #[unsafe(method_family = none)]
        pub fn CGContext(&self) -> Retained<CGContext>;

        #[unsafe(method(format))]
        #[unsafe(method_family = none)]
        pub fn format(&self) -> Retained<UIGraphicsRendererFormat>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(fillRect:))]
        #[unsafe(method_family = none)]
        pub fn fillRect(&self, rect: CGRect);

        #[cfg(all(feature = "objc2-core-foundation", feature = "objc2-core-graphics"))]
        #[unsafe(method(fillRect:blendMode:))]
        #[unsafe(method_family = none)]
        pub fn fillRect_blendMode(&self, rect: CGRect, blend_mode: CGBlendMode);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(strokeRect:))]
        #[unsafe(method_family = none)]
        pub fn strokeRect(&self, rect: CGRect);

        #[cfg(all(feature = "objc2-core-foundation", feature = "objc2-core-graphics"))]
        #[unsafe(method(strokeRect:blendMode:))]
        #[unsafe(method_family = none)]
        pub fn strokeRect_blendMode(&self, rect: CGRect, blend_mode: CGBlendMode);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(clipToRect:))]
        #[unsafe(method_family = none)]
        pub fn clipToRect(&self, rect: CGRect);
    );
}

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

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

impl DefaultRetained for UIGraphicsRendererContext {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

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

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

impl UIGraphicsRenderer {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(initWithBounds:))]
        #[unsafe(method_family = init)]
        pub fn initWithBounds(this: Allocated<Self>, bounds: CGRect) -> Retained<Self>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(initWithBounds:format:))]
        #[unsafe(method_family = init)]
        pub fn initWithBounds_format(
            this: Allocated<Self>,
            bounds: CGRect,
            format: &UIGraphicsRendererFormat,
        ) -> Retained<Self>;

        #[unsafe(method(format))]
        #[unsafe(method_family = none)]
        pub fn format(&self) -> Retained<UIGraphicsRendererFormat>;

        #[unsafe(method(allowsImageOutput))]
        #[unsafe(method_family = none)]
        pub fn allowsImageOutput(&self) -> bool;
    );
}

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

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

impl DefaultRetained for UIGraphicsRenderer {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}