objc2-contacts-ui 0.3.2

Bindings to the ContactsUI 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!(
    /// CNContactPicker is a popover-based contact picker for choosing a contact or a contact's value, such as a phone number or email address.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/contactsui/cncontactpicker?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct CNContactPicker;
);

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

impl CNContactPicker {
    extern_methods!(
        /// The CNContact keys to display when a contact is expanded.
        ///
        /// If no keys are provided, the picker will select contacts instead of values.
        #[unsafe(method(displayedKeys))]
        #[unsafe(method_family = none)]
        pub unsafe fn displayedKeys(&self) -> Retained<NSArray<NSString>>;

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

        #[cfg(feature = "CNContactPickerDelegate")]
        /// The picker delegate to be notified when the user chooses a contact or value.
        #[unsafe(method(delegate))]
        #[unsafe(method_family = none)]
        pub unsafe fn delegate(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn CNContactPickerDelegate>>>;

        #[cfg(feature = "CNContactPickerDelegate")]
        /// 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 CNContactPickerDelegate>>,
        );

        #[cfg(feature = "objc2-app-kit")]
        #[cfg(target_os = "macos")]
        /// Shows the picker popover relative to a positioning rect for a view with a preferred edge. See NSPopover for more information.
        #[unsafe(method(showRelativeToRect:ofView:preferredEdge:))]
        #[unsafe(method_family = none)]
        pub unsafe fn showRelativeToRect_ofView_preferredEdge(
            &self,
            positioning_rect: NSRect,
            positioning_view: &NSView,
            preferred_edge: NSRectEdge,
        );

        /// Closes the popover.
        #[unsafe(method(close))]
        #[unsafe(method_family = none)]
        pub unsafe fn close(&self);
    );
}

/// Methods declared on superclass `NSObject`.
impl CNContactPicker {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}