objc2-notification-center 0.3.2

Bindings to the NotificationCenter 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/notificationcenter/ncwidgetsearchviewcontroller?language=objc)
    #[unsafe(super(NSViewController, NSResponder, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "objc2-app-kit")]
    #[cfg(target_os = "macos")]
    #[deprecated = "Use WidgetKit instead. Today View extensions have been deprecated."]
    pub struct NCWidgetSearchViewController;
);

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

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

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

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

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

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl NCWidgetSearchViewController {
    extern_methods!(
        #[unsafe(method(delegate))]
        #[unsafe(method_family = none)]
        pub unsafe fn delegate(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn NCWidgetSearchViewDelegate>>>;

        /// Setter for [`delegate`][Self::delegate].
        ///
        /// This is a [weak property][objc2::topics::weak_property].
        #[unsafe(method(setDelegate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDelegate(
            &self,
            delegate: Option<&ProtocolObject<dyn NCWidgetSearchViewDelegate>>,
        );

        #[unsafe(method(searchResults))]
        #[unsafe(method_family = none)]
        pub unsafe fn searchResults(&self) -> Option<Retained<NSArray<AnyObject>>>;

        /// Setter for [`searchResults`][Self::searchResults].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        ///
        /// # Safety
        ///
        /// `search_results` generic should be of the correct type.
        #[unsafe(method(setSearchResults:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setSearchResults(&self, search_results: Option<&NSArray<AnyObject>>);

        #[unsafe(method(searchDescription))]
        #[unsafe(method_family = none)]
        pub unsafe fn searchDescription(&self) -> Option<Retained<NSString>>;

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

        #[unsafe(method(searchResultsPlaceholderString))]
        #[unsafe(method_family = none)]
        pub unsafe fn searchResultsPlaceholderString(&self) -> Option<Retained<NSString>>;

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

        #[unsafe(method(searchResultKeyPath))]
        #[unsafe(method_family = none)]
        pub unsafe fn searchResultKeyPath(&self) -> Option<Retained<NSString>>;

        /// Setter for [`searchResultKeyPath`][Self::searchResultKeyPath].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setSearchResultKeyPath:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setSearchResultKeyPath(&self, search_result_key_path: Option<&NSString>);
    );
}

/// Methods declared on superclass `NSViewController`.
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl NCWidgetSearchViewController {
    extern_methods!(
        #[unsafe(method(initWithNibName:bundle:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithNibName_bundle(
            this: Allocated<Self>,
            nib_name_or_nil: Option<&NSNibName>,
            nib_bundle_or_nil: Option<&NSBundle>,
        ) -> Retained<Self>;

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

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

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/notificationcenter/ncwidgetsearchviewdelegate?language=objc)
    #[deprecated = "Use WidgetKit instead. Today View extensions have been deprecated."]
    pub unsafe trait NCWidgetSearchViewDelegate: NSObjectProtocol {
        #[cfg(feature = "objc2-app-kit")]
        #[cfg(target_os = "macos")]
        #[unsafe(method(widgetSearch:searchForTerm:maxResults:))]
        #[unsafe(method_family = none)]
        unsafe fn widgetSearch_searchForTerm_maxResults(
            &self,
            controller: &NCWidgetSearchViewController,
            search_term: &NSString,
            max: NSUInteger,
        );

        #[cfg(feature = "objc2-app-kit")]
        #[cfg(target_os = "macos")]
        #[unsafe(method(widgetSearchTermCleared:))]
        #[unsafe(method_family = none)]
        unsafe fn widgetSearchTermCleared(&self, controller: &NCWidgetSearchViewController);

        #[cfg(feature = "objc2-app-kit")]
        #[cfg(target_os = "macos")]
        /// # Safety
        ///
        /// `object` should be of the correct type.
        #[unsafe(method(widgetSearch:resultSelected:))]
        #[unsafe(method_family = none)]
        unsafe fn widgetSearch_resultSelected(
            &self,
            controller: &NCWidgetSearchViewController,
            object: &AnyObject,
        );
    }
);