objc2_app_kit/generated/
NSCandidateListTouchBarItem.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11 #[unsafe(super(NSTouchBarItem, NSObject))]
13 #[derive(Debug, PartialEq, Eq, Hash)]
14 #[cfg(feature = "NSTouchBarItem")]
15 pub struct NSCandidateListTouchBarItem<CandidateType: ?Sized = AnyObject>;
16);
17
18#[cfg(feature = "NSTouchBarItem")]
19impl<CandidateType: ?Sized + Message> NSCandidateListTouchBarItem<CandidateType> {
20 #[inline]
26 pub unsafe fn cast_unchecked<NewCandidateType: ?Sized + Message>(
27 &self,
28 ) -> &NSCandidateListTouchBarItem<NewCandidateType> {
29 unsafe { &*((self as *const Self).cast()) }
30 }
31}
32
33#[cfg(feature = "NSTouchBarItem")]
34extern_conformance!(
35 unsafe impl<CandidateType: ?Sized + NSCoding> NSCoding
36 for NSCandidateListTouchBarItem<CandidateType>
37 {
38 }
39);
40
41#[cfg(feature = "NSTouchBarItem")]
42extern_conformance!(
43 unsafe impl<CandidateType: ?Sized> NSObjectProtocol for NSCandidateListTouchBarItem<CandidateType> {}
44);
45
46#[cfg(feature = "NSTouchBarItem")]
47impl<CandidateType: Message> NSCandidateListTouchBarItem<CandidateType> {
48 extern_methods!(
49 #[cfg(all(
50 feature = "NSResponder",
51 feature = "NSTextInputClient",
52 feature = "NSView"
53 ))]
54 #[unsafe(method(client))]
55 #[unsafe(method_family = none)]
56 pub fn client(&self) -> Option<Retained<NSView>>;
57
58 #[cfg(all(
59 feature = "NSResponder",
60 feature = "NSTextInputClient",
61 feature = "NSView"
62 ))]
63 #[unsafe(method(setClient:))]
71 #[unsafe(method_family = none)]
72 pub unsafe fn setClient(&self, client: Option<&NSView>);
73
74 #[unsafe(method(delegate))]
75 #[unsafe(method_family = none)]
76 pub fn delegate(
77 &self,
78 ) -> Option<Retained<ProtocolObject<dyn NSCandidateListTouchBarItemDelegate>>>;
79
80 #[unsafe(method(setDelegate:))]
84 #[unsafe(method_family = none)]
85 pub fn setDelegate(
86 &self,
87 delegate: Option<&ProtocolObject<dyn NSCandidateListTouchBarItemDelegate>>,
88 );
89
90 #[unsafe(method(isCollapsed))]
91 #[unsafe(method_family = none)]
92 pub fn isCollapsed(&self) -> bool;
93
94 #[unsafe(method(setCollapsed:))]
96 #[unsafe(method_family = none)]
97 pub fn setCollapsed(&self, collapsed: bool);
98
99 #[unsafe(method(allowsCollapsing))]
100 #[unsafe(method_family = none)]
101 pub fn allowsCollapsing(&self) -> bool;
102
103 #[unsafe(method(setAllowsCollapsing:))]
105 #[unsafe(method_family = none)]
106 pub fn setAllowsCollapsing(&self, allows_collapsing: bool);
107
108 #[unsafe(method(isCandidateListVisible))]
109 #[unsafe(method_family = none)]
110 pub fn isCandidateListVisible(&self) -> bool;
111
112 #[unsafe(method(updateWithInsertionPointVisibility:))]
113 #[unsafe(method_family = none)]
114 pub fn updateWithInsertionPointVisibility(&self, is_visible: bool);
115
116 #[unsafe(method(allowsTextInputContextCandidates))]
117 #[unsafe(method_family = none)]
118 pub fn allowsTextInputContextCandidates(&self) -> bool;
119
120 #[unsafe(method(setAllowsTextInputContextCandidates:))]
122 #[unsafe(method_family = none)]
123 pub fn setAllowsTextInputContextCandidates(
124 &self,
125 allows_text_input_context_candidates: bool,
126 );
127
128 #[cfg(feature = "block2")]
129 #[unsafe(method(attributedStringForCandidate))]
133 #[unsafe(method_family = none)]
134 pub unsafe fn attributedStringForCandidate(
135 &self,
136 ) -> *mut block2::DynBlock<
137 dyn Fn(NonNull<CandidateType>, NSInteger) -> NonNull<NSAttributedString>,
138 >;
139
140 #[cfg(feature = "block2")]
141 #[unsafe(method(setAttributedStringForCandidate:))]
149 #[unsafe(method_family = none)]
150 pub unsafe fn setAttributedStringForCandidate(
151 &self,
152 attributed_string_for_candidate: Option<
153 &block2::DynBlock<
154 dyn Fn(NonNull<CandidateType>, NSInteger) -> NonNull<NSAttributedString>,
155 >,
156 >,
157 );
158
159 #[unsafe(method(candidates))]
160 #[unsafe(method_family = none)]
161 pub fn candidates(&self) -> Retained<NSArray<CandidateType>>;
162
163 #[unsafe(method(setCandidates:forSelectedRange:inString:))]
164 #[unsafe(method_family = none)]
165 pub fn setCandidates_forSelectedRange_inString(
166 &self,
167 candidates: &NSArray<CandidateType>,
168 selected_range: NSRange,
169 original_string: Option<&NSString>,
170 );
171
172 #[unsafe(method(customizationLabel))]
173 #[unsafe(method_family = none)]
174 pub fn customizationLabel(&self) -> Retained<NSString>;
175
176 #[unsafe(method(setCustomizationLabel:))]
180 #[unsafe(method_family = none)]
181 pub fn setCustomizationLabel(&self, customization_label: Option<&NSString>);
182 );
183}
184
185#[cfg(feature = "NSTouchBarItem")]
187impl<CandidateType: Message> NSCandidateListTouchBarItem<CandidateType> {
188 extern_methods!(
189 #[unsafe(method(initWithIdentifier:))]
190 #[unsafe(method_family = init)]
191 pub fn initWithIdentifier(
192 this: Allocated<Self>,
193 identifier: &NSTouchBarItemIdentifier,
194 ) -> Retained<Self>;
195
196 #[unsafe(method(initWithCoder:))]
200 #[unsafe(method_family = init)]
201 pub unsafe fn initWithCoder(
202 this: Allocated<Self>,
203 coder: &NSCoder,
204 ) -> Option<Retained<Self>>;
205
206 #[unsafe(method(init))]
207 #[unsafe(method_family = init)]
208 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
209 );
210}
211
212#[cfg(feature = "NSTouchBarItem")]
214impl<CandidateType: Message> NSCandidateListTouchBarItem<CandidateType> {
215 extern_methods!(
216 #[unsafe(method(new))]
217 #[unsafe(method_family = new)]
218 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
219 );
220}
221
222extern_protocol!(
223 pub unsafe trait NSCandidateListTouchBarItemDelegate:
225 NSObjectProtocol + MainThreadOnly
226 {
227 #[cfg(feature = "NSTouchBarItem")]
228 #[optional]
232 #[unsafe(method(candidateListTouchBarItem:beginSelectingCandidateAtIndex:))]
233 #[unsafe(method_family = none)]
234 unsafe fn candidateListTouchBarItem_beginSelectingCandidateAtIndex(
235 &self,
236 an_item: &NSCandidateListTouchBarItem,
237 index: NSInteger,
238 );
239
240 #[cfg(feature = "NSTouchBarItem")]
241 #[optional]
245 #[unsafe(method(candidateListTouchBarItem:changeSelectionFromCandidateAtIndex:toIndex:))]
246 #[unsafe(method_family = none)]
247 unsafe fn candidateListTouchBarItem_changeSelectionFromCandidateAtIndex_toIndex(
248 &self,
249 an_item: &NSCandidateListTouchBarItem,
250 previous_index: NSInteger,
251 index: NSInteger,
252 );
253
254 #[cfg(feature = "NSTouchBarItem")]
255 #[optional]
259 #[unsafe(method(candidateListTouchBarItem:endSelectingCandidateAtIndex:))]
260 #[unsafe(method_family = none)]
261 unsafe fn candidateListTouchBarItem_endSelectingCandidateAtIndex(
262 &self,
263 an_item: &NSCandidateListTouchBarItem,
264 index: NSInteger,
265 );
266
267 #[cfg(feature = "NSTouchBarItem")]
268 #[optional]
272 #[unsafe(method(candidateListTouchBarItem:changedCandidateListVisibility:))]
273 #[unsafe(method_family = none)]
274 unsafe fn candidateListTouchBarItem_changedCandidateListVisibility(
275 &self,
276 an_item: &NSCandidateListTouchBarItem,
277 is_visible: bool,
278 );
279 }
280);
281
282#[cfg(all(feature = "NSResponder", feature = "NSView"))]
284impl NSView {
285 extern_methods!(
286 #[cfg(feature = "NSTouchBarItem")]
287 #[unsafe(method(candidateListTouchBarItem))]
288 #[unsafe(method_family = none)]
289 pub fn candidateListTouchBarItem(&self) -> Option<Retained<NSCandidateListTouchBarItem>>;
290 );
291}
292
293extern "C" {
294 #[cfg(feature = "NSTouchBarItem")]
296 pub static NSTouchBarItemIdentifierCandidateList: &'static NSTouchBarItemIdentifier;
297}