objc2-screen-time 0.3.2

Bindings to the ScreenTime 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-app-kit")]
#[cfg(target_os = "macos")]
use objc2_app_kit::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/screentime/stwebpagecontroller?language=objc)
    #[unsafe(super(NSViewController, NSResponder, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "objc2-app-kit")]
    #[cfg(target_os = "macos")]
    pub struct STWebpageController;
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSCoding for STWebpageController {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSEditor for STWebpageController {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSObjectProtocol for STWebpageController {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSSeguePerforming for STWebpageController {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSUserInterfaceItemIdentification for STWebpageController {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl STWebpageController {
    extern_methods!(
        /// A Boolean that indicates whether the webpage controller is not recording web
        /// usage.
        ///
        /// Set to
        /// <doc
        /// ://com.apple.documentation/documentation/objectivec/yes> to stop recording and reporting web-usage data.
        #[unsafe(method(suppressUsageRecording))]
        #[unsafe(method_family = none)]
        pub unsafe fn suppressUsageRecording(&self) -> bool;

        /// Setter for [`suppressUsageRecording`][Self::suppressUsageRecording].
        #[unsafe(method(setSuppressUsageRecording:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setSuppressUsageRecording(&self, suppress_usage_recording: bool);

        /// The URL for the webpage.
        ///
        /// Set this value to the webpage’s URL when the user navigates to a new URL.
        #[unsafe(method(URL))]
        #[unsafe(method_family = none)]
        pub unsafe fn URL(&self) -> Option<Retained<NSURL>>;

        /// Setter for [`URL`][Self::URL].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setURL:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setURL(&self, url: Option<&NSURL>);

        /// A Boolean that indicates whether there are one or more videos currently
        /// playing in the webpage.
        ///
        /// The default value is
        /// <doc
        /// ://com.apple.documentation/documentation/objectivec/no>. Set this value when the webpage starts or
        /// stops playing video.
        ///
        /// - Important: Set this value to
        /// <doc
        /// ://com.apple.documentation/documentation/objectivec/no> prior to changing
        /// ``ScreenTime/STWebpageController/URL`` if the new webpage at that URL stops currently
        /// playing media and won’t immediately start playing new media.
        #[unsafe(method(URLIsPlayingVideo))]
        #[unsafe(method_family = none)]
        pub unsafe fn URLIsPlayingVideo(&self) -> bool;

        /// Setter for [`URLIsPlayingVideo`][Self::URLIsPlayingVideo].
        #[unsafe(method(setURLIsPlayingVideo:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setURLIsPlayingVideo(&self, url_is_playing_video: bool);

        /// A Boolean that indicates whether the webpage is currently displaying a
        /// floating picture in picture window.
        ///
        /// The default value is
        /// <doc
        /// ://com.apple.documentation/documentation/objectivec/no>. Set this value when the webpage starts or
        /// stops displaying a Picture in Picture window.
        ///
        /// - Important: Set this value to
        /// <doc
        /// ://com.apple.documentation/documentation/objectivec/no> prior to changing
        /// ``ScreenTime/STWebpageController/URL`` if the new webpage at that URL ends all
        /// currently displayed Picture in Picture windows, and won’t immediately
        /// display a new one.
        #[unsafe(method(URLIsPictureInPicture))]
        #[unsafe(method_family = none)]
        pub unsafe fn URLIsPictureInPicture(&self) -> bool;

        /// Setter for [`URLIsPictureInPicture`][Self::URLIsPictureInPicture].
        #[unsafe(method(setURLIsPictureInPicture:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setURLIsPictureInPicture(&self, url_is_picture_in_picture: bool);

        /// A Boolean that indicates whether a parent or guardian has blocked the URL.
        ///
        /// When a parent or guardian blocks the webpage’s URL, the webpage controller
        /// displays a blocking UI and then sets this property to
        /// <doc
        /// ://com.apple.documentation/documentation/objectivec/yes>.
        #[unsafe(method(URLIsBlocked))]
        #[unsafe(method_family = none)]
        pub unsafe fn URLIsBlocked(&self) -> bool;

        #[cfg(feature = "STWebHistory")]
        /// An optional identifier for the current browsing profile.
        ///
        /// The default value is `nil`. This identifier represents a profile and allows you to keep your browsing separate
        /// for topics like work, personal, or school. Using `nil` will report web history without a profile identifier.
        /// Web browsers with a "default" profile may want to use `nil` in order to match any web history reported prior
        /// to this API.
        #[unsafe(method(profileIdentifier))]
        #[unsafe(method_family = none)]
        pub unsafe fn profileIdentifier(&self) -> Option<Retained<STWebHistoryProfileIdentifier>>;

        #[cfg(feature = "STWebHistory")]
        /// Setter for [`profileIdentifier`][Self::profileIdentifier].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setProfileIdentifier:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setProfileIdentifier(
            &self,
            profile_identifier: Option<&STWebHistoryProfileIdentifier>,
        );

        /// Changes the bundle identifier used to report web usage.
        ///
        /// This is only supported for web browsers that have been properly registered with Screen Time.
        ///
        /// - Parameters:
        /// - bundleIdentifier: The bundle identifier that can be changed to facilitate web usage
        /// reporting for a parent web browser from one of its helper processes or extensions.
        /// - error: Any error that occurred while changing the bundle identifier.
        #[unsafe(method(setBundleIdentifier:error:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn setBundleIdentifier_error(
            &self,
            bundle_identifier: &NSString,
        ) -> Result<(), Retained<NSError>>;

        #[unsafe(method(initWithNibName:bundle:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithNibName_bundle(
            this: Allocated<Self>,
            nib_name_or_nil: Option<&NSString>,
            nib_bundle_or_nil: Option<&NSBundle>,
        ) -> Retained<Self>;

        /// # Safety
        ///
        /// `a_decoder` possibly has further requirements.
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            a_decoder: &NSCoder,
        ) -> Option<Retained<Self>>;
    );
}

/// Methods declared on superclass `NSResponder`.
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl STWebpageController {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl STWebpageController {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}