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/ncwidgetlistviewcontroller?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 NCWidgetListViewController;
);

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

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

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

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

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

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

        /// 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 NCWidgetListViewDelegate>>,
        );

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

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

        #[unsafe(method(minimumVisibleRowCount))]
        #[unsafe(method_family = none)]
        pub unsafe fn minimumVisibleRowCount(&self) -> NSUInteger;

        /// Setter for [`minimumVisibleRowCount`][Self::minimumVisibleRowCount].
        #[unsafe(method(setMinimumVisibleRowCount:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setMinimumVisibleRowCount(&self, minimum_visible_row_count: NSUInteger);

        #[unsafe(method(hasDividerLines))]
        #[unsafe(method_family = none)]
        pub unsafe fn hasDividerLines(&self) -> bool;

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

        #[unsafe(method(editing))]
        #[unsafe(method_family = none)]
        pub unsafe fn editing(&self) -> bool;

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

        #[unsafe(method(showsAddButtonWhenEditing))]
        #[unsafe(method_family = none)]
        pub unsafe fn showsAddButtonWhenEditing(&self) -> bool;

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

        #[unsafe(method(viewControllerAtRow:makeIfNecessary:))]
        #[unsafe(method_family = none)]
        pub unsafe fn viewControllerAtRow_makeIfNecessary(
            &self,
            row: NSUInteger,
            make_if_necesary: bool,
        ) -> Retained<NSViewController>;

        #[unsafe(method(rowForViewController:))]
        #[unsafe(method_family = none)]
        pub unsafe fn rowForViewController(&self, view_controller: &NSViewController)
            -> NSUInteger;
    );
}

/// Methods declared on superclass `NSViewController`.
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl NCWidgetListViewController {
    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 NCWidgetListViewController {
    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 NCWidgetListViewController {
    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/ncwidgetlistviewdelegate?language=objc)
    #[deprecated = "Use WidgetKit instead. Today View extensions have been deprecated."]
    pub unsafe trait NCWidgetListViewDelegate: NSObjectProtocol {
        #[cfg(feature = "objc2-app-kit")]
        #[cfg(target_os = "macos")]
        #[unsafe(method(widgetList:viewControllerForRow:))]
        #[unsafe(method_family = none)]
        unsafe fn widgetList_viewControllerForRow(
            &self,
            list: &NCWidgetListViewController,
            row: NSUInteger,
        ) -> Retained<NSViewController>;

        #[cfg(feature = "objc2-app-kit")]
        #[cfg(target_os = "macos")]
        #[optional]
        #[unsafe(method(widgetListPerformAddAction:))]
        #[unsafe(method_family = none)]
        unsafe fn widgetListPerformAddAction(&self, list: &NCWidgetListViewController);

        #[cfg(feature = "objc2-app-kit")]
        #[cfg(target_os = "macos")]
        #[optional]
        #[unsafe(method(widgetList:shouldReorderRow:))]
        #[unsafe(method_family = none)]
        unsafe fn widgetList_shouldReorderRow(
            &self,
            list: &NCWidgetListViewController,
            row: NSUInteger,
        ) -> bool;

        #[cfg(feature = "objc2-app-kit")]
        #[cfg(target_os = "macos")]
        #[optional]
        #[unsafe(method(widgetList:didReorderRow:toRow:))]
        #[unsafe(method_family = none)]
        unsafe fn widgetList_didReorderRow_toRow(
            &self,
            list: &NCWidgetListViewController,
            row: NSUInteger,
            new_index: NSUInteger,
        );

        #[cfg(feature = "objc2-app-kit")]
        #[cfg(target_os = "macos")]
        #[optional]
        #[unsafe(method(widgetList:shouldRemoveRow:))]
        #[unsafe(method_family = none)]
        unsafe fn widgetList_shouldRemoveRow(
            &self,
            list: &NCWidgetListViewController,
            row: NSUInteger,
        ) -> bool;

        #[cfg(feature = "objc2-app-kit")]
        #[cfg(target_os = "macos")]
        #[optional]
        #[unsafe(method(widgetList:didRemoveRow:))]
        #[unsafe(method_family = none)]
        unsafe fn widgetList_didRemoveRow(
            &self,
            list: &NCWidgetListViewController,
            row: NSUInteger,
        );
    }
);