objc2-web-kit 0.3.1

Bindings to the WebKit 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::*;
use objc2_foundation::*;

use crate::*;

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

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

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

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

impl WKSnapshotConfiguration {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        /// The rect to snapshot in view coordinates.
        ///
        /// This rect should be contained within WKWebView's bounds. If the rect is set to the
        /// null rect, the view's bounds will be used. The initial value is the null rect.
        #[unsafe(method(rect))]
        #[unsafe(method_family = none)]
        pub unsafe fn rect(&self) -> CGRect;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`rect`][Self::rect].
        #[unsafe(method(setRect:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setRect(&self, rect: CGRect);

        /// Specify a custom width to control the size of image you get back. The height will be
        /// computed to maintain the aspect ratio established by rect.
        ///
        /// snapshotWidth represents the width in points. If the snapshotWidth is nil, rect's
        /// width will be used.
        #[unsafe(method(snapshotWidth))]
        #[unsafe(method_family = none)]
        pub unsafe fn snapshotWidth(&self) -> Option<Retained<NSNumber>>;

        /// Setter for [`snapshotWidth`][Self::snapshotWidth].
        #[unsafe(method(setSnapshotWidth:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setSnapshotWidth(&self, snapshot_width: Option<&NSNumber>);

        /// A Boolean value that specifies whether the snapshot should be taken after recent
        /// changes have been incorporated. The value NO will capture the screen in its current state,
        /// which might not include recent changes.
        ///
        /// The default value is YES.
        #[unsafe(method(afterScreenUpdates))]
        #[unsafe(method_family = none)]
        pub unsafe fn afterScreenUpdates(&self) -> bool;

        /// Setter for [`afterScreenUpdates`][Self::afterScreenUpdates].
        #[unsafe(method(setAfterScreenUpdates:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAfterScreenUpdates(&self, after_screen_updates: bool);
    );
}

/// Methods declared on superclass `NSObject`.
impl WKSnapshotConfiguration {
    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(mtm: MainThreadMarker) -> Retained<Self>;
    );
}