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")]
19extern_conformance!(
20 unsafe impl<CandidateType: ?Sized + NSCoding> NSCoding
21 for NSCandidateListTouchBarItem<CandidateType>
22 {
23 }
24);
25
26#[cfg(feature = "NSTouchBarItem")]
27extern_conformance!(
28 unsafe impl<CandidateType: ?Sized> NSObjectProtocol for NSCandidateListTouchBarItem<CandidateType> {}
29);
30
31#[cfg(feature = "NSTouchBarItem")]
32impl<CandidateType: Message> NSCandidateListTouchBarItem<CandidateType> {
33 extern_methods!(
34 #[cfg(all(
35 feature = "NSResponder",
36 feature = "NSTextInputClient",
37 feature = "NSView"
38 ))]
39 #[unsafe(method(client))]
40 #[unsafe(method_family = none)]
41 pub unsafe fn client(&self) -> Option<Retained<NSView>>;
42
43 #[cfg(all(
44 feature = "NSResponder",
45 feature = "NSTextInputClient",
46 feature = "NSView"
47 ))]
48 #[unsafe(method(setClient:))]
51 #[unsafe(method_family = none)]
52 pub unsafe fn setClient(&self, client: Option<&NSView>);
53
54 #[unsafe(method(delegate))]
55 #[unsafe(method_family = none)]
56 pub unsafe fn delegate(
57 &self,
58 ) -> Option<Retained<ProtocolObject<dyn NSCandidateListTouchBarItemDelegate>>>;
59
60 #[unsafe(method(setDelegate:))]
63 #[unsafe(method_family = none)]
64 pub unsafe fn setDelegate(
65 &self,
66 delegate: Option<&ProtocolObject<dyn NSCandidateListTouchBarItemDelegate>>,
67 );
68
69 #[unsafe(method(isCollapsed))]
70 #[unsafe(method_family = none)]
71 pub unsafe fn isCollapsed(&self) -> bool;
72
73 #[unsafe(method(setCollapsed:))]
75 #[unsafe(method_family = none)]
76 pub unsafe fn setCollapsed(&self, collapsed: bool);
77
78 #[unsafe(method(allowsCollapsing))]
79 #[unsafe(method_family = none)]
80 pub unsafe fn allowsCollapsing(&self) -> bool;
81
82 #[unsafe(method(setAllowsCollapsing:))]
84 #[unsafe(method_family = none)]
85 pub unsafe fn setAllowsCollapsing(&self, allows_collapsing: bool);
86
87 #[unsafe(method(isCandidateListVisible))]
88 #[unsafe(method_family = none)]
89 pub unsafe fn isCandidateListVisible(&self) -> bool;
90
91 #[unsafe(method(updateWithInsertionPointVisibility:))]
92 #[unsafe(method_family = none)]
93 pub unsafe fn updateWithInsertionPointVisibility(&self, is_visible: bool);
94
95 #[unsafe(method(allowsTextInputContextCandidates))]
96 #[unsafe(method_family = none)]
97 pub unsafe fn allowsTextInputContextCandidates(&self) -> bool;
98
99 #[unsafe(method(setAllowsTextInputContextCandidates:))]
101 #[unsafe(method_family = none)]
102 pub unsafe fn setAllowsTextInputContextCandidates(
103 &self,
104 allows_text_input_context_candidates: bool,
105 );
106
107 #[cfg(feature = "block2")]
108 #[unsafe(method(attributedStringForCandidate))]
109 #[unsafe(method_family = none)]
110 pub unsafe fn attributedStringForCandidate(
111 &self,
112 ) -> *mut block2::DynBlock<
113 dyn Fn(NonNull<CandidateType>, NSInteger) -> NonNull<NSAttributedString>,
114 >;
115
116 #[cfg(feature = "block2")]
117 #[unsafe(method(setAttributedStringForCandidate:))]
119 #[unsafe(method_family = none)]
120 pub unsafe fn setAttributedStringForCandidate(
121 &self,
122 attributed_string_for_candidate: Option<
123 &block2::DynBlock<
124 dyn Fn(NonNull<CandidateType>, NSInteger) -> NonNull<NSAttributedString>,
125 >,
126 >,
127 );
128
129 #[unsafe(method(candidates))]
130 #[unsafe(method_family = none)]
131 pub unsafe fn candidates(&self) -> Retained<NSArray<CandidateType>>;
132
133 #[unsafe(method(setCandidates:forSelectedRange:inString:))]
134 #[unsafe(method_family = none)]
135 pub unsafe fn setCandidates_forSelectedRange_inString(
136 &self,
137 candidates: &NSArray<CandidateType>,
138 selected_range: NSRange,
139 original_string: Option<&NSString>,
140 );
141
142 #[unsafe(method(customizationLabel))]
143 #[unsafe(method_family = none)]
144 pub unsafe fn customizationLabel(&self) -> Retained<NSString>;
145
146 #[unsafe(method(setCustomizationLabel:))]
148 #[unsafe(method_family = none)]
149 pub unsafe fn setCustomizationLabel(&self, customization_label: Option<&NSString>);
150 );
151}
152
153#[cfg(feature = "NSTouchBarItem")]
155impl<CandidateType: Message> NSCandidateListTouchBarItem<CandidateType> {
156 extern_methods!(
157 #[unsafe(method(initWithIdentifier:))]
158 #[unsafe(method_family = init)]
159 pub unsafe fn initWithIdentifier(
160 this: Allocated<Self>,
161 identifier: &NSTouchBarItemIdentifier,
162 ) -> Retained<Self>;
163
164 #[unsafe(method(initWithCoder:))]
165 #[unsafe(method_family = init)]
166 pub unsafe fn initWithCoder(
167 this: Allocated<Self>,
168 coder: &NSCoder,
169 ) -> Option<Retained<Self>>;
170
171 #[unsafe(method(init))]
172 #[unsafe(method_family = init)]
173 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
174 );
175}
176
177#[cfg(feature = "NSTouchBarItem")]
179impl<CandidateType: Message> NSCandidateListTouchBarItem<CandidateType> {
180 extern_methods!(
181 #[unsafe(method(new))]
182 #[unsafe(method_family = new)]
183 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
184 );
185}
186
187extern_protocol!(
188 pub unsafe trait NSCandidateListTouchBarItemDelegate:
190 NSObjectProtocol + MainThreadOnly
191 {
192 #[cfg(feature = "NSTouchBarItem")]
193 #[optional]
194 #[unsafe(method(candidateListTouchBarItem:beginSelectingCandidateAtIndex:))]
195 #[unsafe(method_family = none)]
196 unsafe fn candidateListTouchBarItem_beginSelectingCandidateAtIndex(
197 &self,
198 an_item: &NSCandidateListTouchBarItem,
199 index: NSInteger,
200 );
201
202 #[cfg(feature = "NSTouchBarItem")]
203 #[optional]
204 #[unsafe(method(candidateListTouchBarItem:changeSelectionFromCandidateAtIndex:toIndex:))]
205 #[unsafe(method_family = none)]
206 unsafe fn candidateListTouchBarItem_changeSelectionFromCandidateAtIndex_toIndex(
207 &self,
208 an_item: &NSCandidateListTouchBarItem,
209 previous_index: NSInteger,
210 index: NSInteger,
211 );
212
213 #[cfg(feature = "NSTouchBarItem")]
214 #[optional]
215 #[unsafe(method(candidateListTouchBarItem:endSelectingCandidateAtIndex:))]
216 #[unsafe(method_family = none)]
217 unsafe fn candidateListTouchBarItem_endSelectingCandidateAtIndex(
218 &self,
219 an_item: &NSCandidateListTouchBarItem,
220 index: NSInteger,
221 );
222
223 #[cfg(feature = "NSTouchBarItem")]
224 #[optional]
225 #[unsafe(method(candidateListTouchBarItem:changedCandidateListVisibility:))]
226 #[unsafe(method_family = none)]
227 unsafe fn candidateListTouchBarItem_changedCandidateListVisibility(
228 &self,
229 an_item: &NSCandidateListTouchBarItem,
230 is_visible: bool,
231 );
232 }
233);
234
235#[cfg(all(feature = "NSResponder", feature = "NSView"))]
237impl NSView {
238 extern_methods!(
239 #[cfg(feature = "NSTouchBarItem")]
240 #[unsafe(method(candidateListTouchBarItem))]
241 #[unsafe(method_family = none)]
242 pub unsafe fn candidateListTouchBarItem(
243 &self,
244 ) -> Option<Retained<NSCandidateListTouchBarItem>>;
245 );
246}
247
248extern "C" {
249 #[cfg(feature = "NSTouchBarItem")]
251 pub static NSTouchBarItemIdentifierCandidateList: &'static NSTouchBarItemIdentifier;
252}