1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
//! 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")]
use objc2_app_kit::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
/// A `CBIdentityPicker` object allows a user to select identities—for
/// example, user or group objects—that it wants one or more services or
/// shared resources to have access to. An identity picker can be displayed
/// either as an application-modal dialog or as a sheet attached to a
/// document window. An identity picker returns the selected records to be
/// added to access control lists using Collaboration. If a selected record
/// is not a user or group identity, then an identity picker prompts the
/// user for additional information—such as a password—to promote that
/// record to a sharing account.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/collaboration/cbidentitypicker?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct CBIdentityPicker;
);
extern_conformance!(
unsafe impl NSObjectProtocol for CBIdentityPicker {}
);
impl CBIdentityPicker {
extern_methods!(
/// The title of the identity picker.
///
/// The value of this property is the title text that appears at the top of the
/// panel. By default, the title is "Select a person to share with:".
#[unsafe(method(title))]
#[unsafe(method_family = none)]
pub unsafe fn title(&self) -> Option<Retained<NSString>>;
/// Setter for [`title`][Self::title].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setTitle:))]
#[unsafe(method_family = none)]
pub unsafe fn setTitle(&self, title: Option<&NSString>);
/// A Boolean value indicating whether the user is allowed to select multiple
/// identities.
///
/// The value of this property is
/// <doc
/// ://com.apple.documentation/documentation/objectivec/yes> if the user can
/// select multiple records; otherwise,
/// <doc
/// ://com.apple.documentation/documentation/objectivec/no>. The default
/// value is
/// <doc
/// ://com.apple.documentation/documentation/objectivec/no>.
#[unsafe(method(allowsMultipleSelection))]
#[unsafe(method_family = none)]
pub unsafe fn allowsMultipleSelection(&self) -> bool;
/// Setter for [`allowsMultipleSelection`][Self::allowsMultipleSelection].
#[unsafe(method(setAllowsMultipleSelection:))]
#[unsafe(method_family = none)]
pub unsafe fn setAllowsMultipleSelection(&self, allows_multiple_selection: bool);
/// Runs the receiver as an application-modal dialog.
///
/// The receiver may create identities for selected records if necessary.
///
/// - Returns: `NSOKButton` if the user selected OK; otherwise,
/// `NSCancelButton`.
#[unsafe(method(runModal))]
#[unsafe(method_family = none)]
pub unsafe fn runModal(&self) -> NSInteger;
#[cfg(feature = "objc2-app-kit")]
/// Runs the receiver modally as a sheet attached to a specified window.
///
/// The `didEndSelector` parameter is a selector that takes three arguments. The
/// corresponding method should have a declaration modeled on the following
/// example:
///
/// ```swift
/// - (void)identityPickerDidEnd:(CBIdentityPicker *)identityPicker returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo;
/// ```
///
/// where the `identityPicker` argument is the identity picker object, the
/// `returnCode` argument is the button the user clicked, and `contextInfo` is
/// the same `contextInfo` argument that was passed in the original message.
///
/// - Parameters:
/// - window: The parent window for the sheet.
///
/// - delegate: The delegate for the modal session.
///
/// - didEndSelector: A message sent to the delegate after the user responds but
/// before the sheet is dismissed.
///
/// - contextInfo: Contextual data passed to the delegate in the
/// `didEndSelector` message.
///
/// # Safety
///
/// - `delegate` should be of the correct type.
/// - `did_end_selector` must be a valid selector.
/// - `context_info` must be a valid pointer or null.
#[deprecated = "Use runModalForWindow:completionHandler: instead."]
#[unsafe(method(runModalForWindow:modalDelegate:didEndSelector:contextInfo:))]
#[unsafe(method_family = none)]
pub unsafe fn runModalForWindow_modalDelegate_didEndSelector_contextInfo(
&self,
window: &NSWindow,
delegate: Option<&AnyObject>,
did_end_selector: Option<Sel>,
context_info: *mut c_void,
);
#[cfg(all(feature = "block2", feature = "objc2-app-kit"))]
/// Runs the identity picker modally as a sheet attached to a specified window.
///
/// - Parameters:
/// - window: The parent window for the sheet.
///
/// - completionHandler: The handler to run after the return value is known, but
/// before the sheet is dismissed.
#[unsafe(method(runModalForWindow:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn runModalForWindow_completionHandler(
&self,
window: &NSWindow,
completion_handler: Option<&block2::DynBlock<dyn Fn(NSModalResponse)>>,
);
#[cfg(feature = "CBIdentity")]
/// The array of identities (represented by `CBIdentity` objects) selected using
/// the identity picker.
#[unsafe(method(identities))]
#[unsafe(method_family = none)]
pub unsafe fn identities(&self) -> Retained<NSArray<CBIdentity>>;
);
}
/// Methods declared on superclass `NSObject`.
impl CBIdentityPicker {
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>;
);
}