objc2_contacts_ui/generated/
CNContactPicker.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-app-kit")]
7#[cfg(target_os = "macos")]
8use objc2_app_kit::*;
9use objc2_foundation::*;
10
11use crate::*;
12
13extern_class!(
14    /// CNContactPicker is a popover-based contact picker for choosing a contact or a contact's value, such as a phone number or email address.
15    ///
16    /// See also [Apple's documentation](https://developer.apple.com/documentation/contactsui/cncontactpicker?language=objc)
17    #[unsafe(super(NSObject))]
18    #[derive(Debug, PartialEq, Eq, Hash)]
19    pub struct CNContactPicker;
20);
21
22extern_conformance!(
23    unsafe impl NSObjectProtocol for CNContactPicker {}
24);
25
26impl CNContactPicker {
27    extern_methods!(
28        /// The CNContact keys to display when a contact is expanded.
29        ///
30        /// If no keys are provided, the picker will select contacts instead of values.
31        #[unsafe(method(displayedKeys))]
32        #[unsafe(method_family = none)]
33        pub unsafe fn displayedKeys(&self) -> Retained<NSArray<NSString>>;
34
35        /// Setter for [`displayedKeys`][Self::displayedKeys].
36        ///
37        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
38        #[unsafe(method(setDisplayedKeys:))]
39        #[unsafe(method_family = none)]
40        pub unsafe fn setDisplayedKeys(&self, displayed_keys: &NSArray<NSString>);
41
42        #[cfg(feature = "CNContactPickerDelegate")]
43        /// The picker delegate to be notified when the user chooses a contact or value.
44        #[unsafe(method(delegate))]
45        #[unsafe(method_family = none)]
46        pub unsafe fn delegate(
47            &self,
48        ) -> Option<Retained<ProtocolObject<dyn CNContactPickerDelegate>>>;
49
50        #[cfg(feature = "CNContactPickerDelegate")]
51        /// Setter for [`delegate`][Self::delegate].
52        ///
53        /// This is a [weak property][objc2::topics::weak_property].
54        #[unsafe(method(setDelegate:))]
55        #[unsafe(method_family = none)]
56        pub unsafe fn setDelegate(
57            &self,
58            delegate: Option<&ProtocolObject<dyn CNContactPickerDelegate>>,
59        );
60
61        #[cfg(feature = "objc2-app-kit")]
62        #[cfg(target_os = "macos")]
63        /// Shows the picker popover relative to a positioning rect for a view with a preferred edge. See NSPopover for more information.
64        #[unsafe(method(showRelativeToRect:ofView:preferredEdge:))]
65        #[unsafe(method_family = none)]
66        pub unsafe fn showRelativeToRect_ofView_preferredEdge(
67            &self,
68            positioning_rect: NSRect,
69            positioning_view: &NSView,
70            preferred_edge: NSRectEdge,
71        );
72
73        /// Closes the popover.
74        #[unsafe(method(close))]
75        #[unsafe(method_family = none)]
76        pub unsafe fn close(&self);
77    );
78}
79
80/// Methods declared on superclass `NSObject`.
81impl CNContactPicker {
82    extern_methods!(
83        #[unsafe(method(init))]
84        #[unsafe(method_family = init)]
85        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
86
87        #[unsafe(method(new))]
88        #[unsafe(method_family = new)]
89        pub unsafe fn new() -> Retained<Self>;
90    );
91}