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