objc2_web_kit/generated/
WKSnapshotConfiguration.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12extern_class!(
13    /// [Apple's documentation](https://developer.apple.com/documentation/webkit/wksnapshotconfiguration?language=objc)
14    #[unsafe(super(NSObject))]
15    #[thread_kind = MainThreadOnly]
16    #[derive(Debug, PartialEq, Eq, Hash)]
17    pub struct WKSnapshotConfiguration;
18);
19
20unsafe impl NSCopying for WKSnapshotConfiguration {}
21
22unsafe impl CopyingHelper for WKSnapshotConfiguration {
23    type Result = Self;
24}
25
26unsafe impl NSObjectProtocol for WKSnapshotConfiguration {}
27
28impl WKSnapshotConfiguration {
29    extern_methods!(
30        #[cfg(feature = "objc2-core-foundation")]
31        /// The rect to snapshot in view coordinates.
32        ///
33        /// This rect should be contained within WKWebView's bounds. If the rect is set to the
34        /// null rect, the view's bounds will be used. The initial value is the null rect.
35        #[unsafe(method(rect))]
36        #[unsafe(method_family = none)]
37        pub unsafe fn rect(&self) -> CGRect;
38
39        #[cfg(feature = "objc2-core-foundation")]
40        /// Setter for [`rect`][Self::rect].
41        #[unsafe(method(setRect:))]
42        #[unsafe(method_family = none)]
43        pub unsafe fn setRect(&self, rect: CGRect);
44
45        /// Specify a custom width to control the size of image you get back. The height will be
46        /// computed to maintain the aspect ratio established by rect.
47        ///
48        /// snapshotWidth represents the width in points. If the snapshotWidth is nil, rect's
49        /// width will be used.
50        #[unsafe(method(snapshotWidth))]
51        #[unsafe(method_family = none)]
52        pub unsafe fn snapshotWidth(&self) -> Option<Retained<NSNumber>>;
53
54        /// Setter for [`snapshotWidth`][Self::snapshotWidth].
55        #[unsafe(method(setSnapshotWidth:))]
56        #[unsafe(method_family = none)]
57        pub unsafe fn setSnapshotWidth(&self, snapshot_width: Option<&NSNumber>);
58
59        /// A Boolean value that specifies whether the snapshot should be taken after recent
60        /// changes have been incorporated. The value NO will capture the screen in its current state,
61        /// which might not include recent changes.
62        ///
63        /// The default value is YES.
64        #[unsafe(method(afterScreenUpdates))]
65        #[unsafe(method_family = none)]
66        pub unsafe fn afterScreenUpdates(&self) -> bool;
67
68        /// Setter for [`afterScreenUpdates`][Self::afterScreenUpdates].
69        #[unsafe(method(setAfterScreenUpdates:))]
70        #[unsafe(method_family = none)]
71        pub unsafe fn setAfterScreenUpdates(&self, after_screen_updates: bool);
72    );
73}
74
75/// Methods declared on superclass `NSObject`.
76impl WKSnapshotConfiguration {
77    extern_methods!(
78        #[unsafe(method(init))]
79        #[unsafe(method_family = init)]
80        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
81
82        #[unsafe(method(new))]
83        #[unsafe(method_family = new)]
84        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
85    );
86}