objc2_web_kit/generated/
WKWebExtensionTabConfiguration.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9extern_class!(
10    /// A ``WKWebExtensionTabConfiguration`` object encapsulates configuration options for a tab in an extension.
11    ///
12    /// This class holds various options that influence the behavior and initial state of a tab.
13    /// The app retains the discretion to disregard any or all of these options, or even opt not to create a tab.
14    ///
15    /// See also [Apple's documentation](https://developer.apple.com/documentation/webkit/wkwebextensiontabconfiguration?language=objc)
16    #[unsafe(super(NSObject))]
17    #[thread_kind = MainThreadOnly]
18    #[derive(Debug, PartialEq, Eq, Hash)]
19    pub struct WKWebExtensionTabConfiguration;
20);
21
22extern_conformance!(
23    unsafe impl NSObjectProtocol for WKWebExtensionTabConfiguration {}
24);
25
26impl WKWebExtensionTabConfiguration {
27    extern_methods!(
28        #[unsafe(method(new))]
29        #[unsafe(method_family = new)]
30        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
31
32        #[unsafe(method(init))]
33        #[unsafe(method_family = init)]
34        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
35
36        #[cfg(feature = "WKWebExtensionWindow")]
37        /// Indicates the window where the tab should be opened.
38        ///
39        /// If this property is `nil`, no window was specified.
40        #[unsafe(method(window))]
41        #[unsafe(method_family = none)]
42        pub unsafe fn window(&self) -> Option<Retained<ProtocolObject<dyn WKWebExtensionWindow>>>;
43
44        /// Indicates the position where the tab should be opened within the window.
45        #[unsafe(method(index))]
46        #[unsafe(method_family = none)]
47        pub unsafe fn index(&self) -> NSUInteger;
48
49        #[cfg(feature = "WKWebExtensionTab")]
50        /// Indicates the parent tab with which the tab should be related.
51        ///
52        /// If this property is `nil`, no parent tab was specified.
53        #[unsafe(method(parentTab))]
54        #[unsafe(method_family = none)]
55        pub unsafe fn parentTab(&self) -> Option<Retained<ProtocolObject<dyn WKWebExtensionTab>>>;
56
57        /// Indicates the initial URL for the tab.
58        ///
59        /// If this property is `nil`, the app's default "start page" should appear in the tab.
60        #[unsafe(method(url))]
61        #[unsafe(method_family = none)]
62        pub unsafe fn url(&self) -> Option<Retained<NSURL>>;
63
64        /// Indicates whether the tab should be the active tab.
65        ///
66        /// If this property is `YES`, the tab should be made active in the window, ensuring it is
67        /// the frontmost tab. Being active implies the tab is also selected. If this property is `NO`, the tab shouldn't
68        /// affect the currently active tab.
69        #[unsafe(method(shouldBeActive))]
70        #[unsafe(method_family = none)]
71        pub unsafe fn shouldBeActive(&self) -> bool;
72
73        /// Indicates whether the tab should be added to the current tab selection.
74        ///
75        /// If this property is `YES`, the tab should be part of the current selection, but not necessarily
76        /// become the active tab unless ``shouldBeActive`` is also `YES`. If this property is `NO`, the tab shouldn't
77        /// be part of the current selection.
78        #[unsafe(method(shouldAddToSelection))]
79        #[unsafe(method_family = none)]
80        pub unsafe fn shouldAddToSelection(&self) -> bool;
81
82        /// Indicates whether the tab should be pinned.
83        #[unsafe(method(shouldBePinned))]
84        #[unsafe(method_family = none)]
85        pub unsafe fn shouldBePinned(&self) -> bool;
86
87        /// Indicates whether the tab should be muted.
88        #[unsafe(method(shouldBeMuted))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn shouldBeMuted(&self) -> bool;
91
92        /// Indicates whether reader mode in the tab should be active.
93        #[unsafe(method(shouldReaderModeBeActive))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn shouldReaderModeBeActive(&self) -> bool;
96    );
97}