objc2-screen-saver 0.3.2

Bindings to the ScreenSaver framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// A class that defines a set of methods for saving and restoring user defaults
    /// for screen savers.
    ///
    /// ``ScreenSaverDefaults`` gives you access to preference values you need to
    /// configure your screen saver. Because multiple apps can load a screen saver,
    /// you can’t use the standard
    /// <doc
    /// ://com.apple.documentation/documentation/foundation/nsuserdefaults>
    /// object to store preferences. Instead, instantiate this class using the
    /// ``ScreenSaverDefaults/defaultsForModuleWithName:`` method, which takes your
    /// screen saver’s bundle identifier as a parameter. The resulting object gives
    /// you a way to store your preference values and associate them only with your
    /// screen saver. Use the inherited
    /// <doc
    /// ://com.apple.documentation/documentation/foundation/nsuserdefaults>
    /// methods to load, store, or modify values.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/screensaver/screensaverdefaults?language=objc)
    #[unsafe(super(NSUserDefaults, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct ScreenSaverDefaults;
);

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

impl ScreenSaverDefaults {
    extern_methods!(
        /// Returns a screen saver defaults instance that reads and writes defaults for the specified
        /// module.
        ///
        /// - Parameters:
        /// - inModuleName: The bundle identifier for the module.
        #[unsafe(method(defaultsForModuleWithName:))]
        #[unsafe(method_family = none)]
        pub unsafe fn defaultsForModuleWithName(
            in_module_name: &NSString,
        ) -> Option<Retained<Self>>;
    );
}

/// Methods declared on superclass `NSUserDefaults`.
impl ScreenSaverDefaults {
    extern_methods!(
        /// -init is equivalent to -initWithSuiteName:nil
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        /// -initWithSuiteName: initializes an instance of NSUserDefaults that searches the shared preferences search list for the domain 'suitename'. For example, using the identifier of an application group will cause the receiver to search the preferences for that group. Passing the current application's bundle identifier, NSGlobalDomain, or the corresponding CFPreferences constants is an error. Passing nil will search the default search list.
        #[unsafe(method(initWithSuiteName:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithSuiteName(
            this: Allocated<Self>,
            suitename: Option<&NSString>,
        ) -> Option<Retained<Self>>;

        /// -initWithUser: is equivalent to -init
        #[deprecated = "Use -init instead"]
        #[unsafe(method(initWithUser:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithUser(
            this: Allocated<Self>,
            username: &NSString,
        ) -> Option<Retained<Self>>;
    );
}

/// Methods declared on superclass `NSObject`.
impl ScreenSaverDefaults {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}