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
20extern_conformance!(
21    unsafe impl NSCopying for WKSnapshotConfiguration {}
22);
23
24unsafe impl CopyingHelper for WKSnapshotConfiguration {
25    type Result = Self;
26}
27
28extern_conformance!(
29    unsafe impl NSObjectProtocol for WKSnapshotConfiguration {}
30);
31
32impl WKSnapshotConfiguration {
33    extern_methods!(
34        #[cfg(feature = "objc2-core-foundation")]
35        /// The rect to snapshot in view coordinates.
36        ///
37        /// This rect should be contained within WKWebView's bounds. If the rect is set to the
38        /// null rect, the view's bounds will be used. The initial value is the null rect.
39        #[unsafe(method(rect))]
40        #[unsafe(method_family = none)]
41        pub unsafe fn rect(&self) -> CGRect;
42
43        #[cfg(feature = "objc2-core-foundation")]
44        /// Setter for [`rect`][Self::rect].
45        #[unsafe(method(setRect:))]
46        #[unsafe(method_family = none)]
47        pub unsafe fn setRect(&self, rect: CGRect);
48
49        /// Specify a custom width to control the size of image you get back. The height will be
50        /// computed to maintain the aspect ratio established by rect.
51        ///
52        /// snapshotWidth represents the width in points. If the snapshotWidth is nil, rect's
53        /// width will be used.
54        #[unsafe(method(snapshotWidth))]
55        #[unsafe(method_family = none)]
56        pub unsafe fn snapshotWidth(&self) -> Option<Retained<NSNumber>>;
57
58        /// Setter for [`snapshotWidth`][Self::snapshotWidth].
59        #[unsafe(method(setSnapshotWidth:))]
60        #[unsafe(method_family = none)]
61        pub unsafe fn setSnapshotWidth(&self, snapshot_width: Option<&NSNumber>);
62
63        /// A Boolean value that specifies whether the snapshot should be taken after recent
64        /// changes have been incorporated. The value NO will capture the screen in its current state,
65        /// which might not include recent changes.
66        ///
67        /// The default value is YES.
68        #[unsafe(method(afterScreenUpdates))]
69        #[unsafe(method_family = none)]
70        pub unsafe fn afterScreenUpdates(&self) -> bool;
71
72        /// Setter for [`afterScreenUpdates`][Self::afterScreenUpdates].
73        #[unsafe(method(setAfterScreenUpdates:))]
74        #[unsafe(method_family = none)]
75        pub unsafe fn setAfterScreenUpdates(&self, after_screen_updates: bool);
76    );
77}
78
79/// Methods declared on superclass `NSObject`.
80impl WKSnapshotConfiguration {
81    extern_methods!(
82        #[unsafe(method(init))]
83        #[unsafe(method_family = init)]
84        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
85
86        #[unsafe(method(new))]
87        #[unsafe(method_family = new)]
88        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
89    );
90}