objc2_map_kit/generated/
MKAnnotationView.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::*;
9#[cfg(feature = "objc2-core-foundation")]
10use objc2_core_foundation::*;
11use objc2_foundation::*;
12
13use crate::*;
14
15extern "C" {
16    /// [Apple's documentation](https://developer.apple.com/documentation/mapkit/mkannotationcalloutinfodidchangenotification?language=objc)
17    pub static MKAnnotationCalloutInfoDidChangeNotification: &'static NSString;
18}
19
20/// [Apple's documentation](https://developer.apple.com/documentation/mapkit/mkannotationviewdragstate?language=objc)
21// NS_ENUM
22#[repr(transparent)]
23#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
24pub struct MKAnnotationViewDragState(pub NSUInteger);
25impl MKAnnotationViewDragState {
26    #[doc(alias = "MKAnnotationViewDragStateNone")]
27    pub const None: Self = Self(0);
28    #[doc(alias = "MKAnnotationViewDragStateStarting")]
29    pub const Starting: Self = Self(1);
30    #[doc(alias = "MKAnnotationViewDragStateDragging")]
31    pub const Dragging: Self = Self(2);
32    #[doc(alias = "MKAnnotationViewDragStateCanceling")]
33    pub const Canceling: Self = Self(3);
34    #[doc(alias = "MKAnnotationViewDragStateEnding")]
35    pub const Ending: Self = Self(4);
36}
37
38unsafe impl Encode for MKAnnotationViewDragState {
39    const ENCODING: Encoding = NSUInteger::ENCODING;
40}
41
42unsafe impl RefEncode for MKAnnotationViewDragState {
43    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
44}
45
46/// [Apple's documentation](https://developer.apple.com/documentation/mapkit/mkfeaturedisplaypriority?language=objc)
47// NS_TYPED_EXTENSIBLE_ENUM
48pub type MKFeatureDisplayPriority = c_float;
49
50/// [Apple's documentation](https://developer.apple.com/documentation/mapkit/mkfeaturedisplaypriorityrequired?language=objc)
51pub static MKFeatureDisplayPriorityRequired: MKFeatureDisplayPriority = 1000 as _;
52
53/// [Apple's documentation](https://developer.apple.com/documentation/mapkit/mkfeaturedisplayprioritydefaulthigh?language=objc)
54pub static MKFeatureDisplayPriorityDefaultHigh: MKFeatureDisplayPriority = 750 as _;
55
56/// [Apple's documentation](https://developer.apple.com/documentation/mapkit/mkfeaturedisplayprioritydefaultlow?language=objc)
57pub static MKFeatureDisplayPriorityDefaultLow: MKFeatureDisplayPriority = 250 as _;
58
59/// [Apple's documentation](https://developer.apple.com/documentation/mapkit/mkannotationviewzpriority?language=objc)
60// NS_TYPED_EXTENSIBLE_ENUM
61pub type MKAnnotationViewZPriority = c_float;
62
63/// [Apple's documentation](https://developer.apple.com/documentation/mapkit/mkannotationviewzprioritymax?language=objc)
64pub static MKAnnotationViewZPriorityMax: MKAnnotationViewZPriority = 1000 as _;
65
66/// [Apple's documentation](https://developer.apple.com/documentation/mapkit/mkannotationviewzprioritydefaultselected?language=objc)
67pub static MKAnnotationViewZPriorityDefaultSelected: MKAnnotationViewZPriority = 1000 as _;
68
69/// [Apple's documentation](https://developer.apple.com/documentation/mapkit/mkannotationviewzprioritydefaultunselected?language=objc)
70pub static MKAnnotationViewZPriorityDefaultUnselected: MKAnnotationViewZPriority = 500 as _;
71
72/// [Apple's documentation](https://developer.apple.com/documentation/mapkit/mkannotationviewzprioritymin?language=objc)
73pub static MKAnnotationViewZPriorityMin: MKAnnotationViewZPriority = 0 as _;
74
75/// [Apple's documentation](https://developer.apple.com/documentation/mapkit/mkannotationviewcollisionmode?language=objc)
76// NS_ENUM
77#[repr(transparent)]
78#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
79pub struct MKAnnotationViewCollisionMode(pub NSInteger);
80impl MKAnnotationViewCollisionMode {
81    #[doc(alias = "MKAnnotationViewCollisionModeRectangle")]
82    pub const Rectangle: Self = Self(0);
83    #[doc(alias = "MKAnnotationViewCollisionModeCircle")]
84    pub const Circle: Self = Self(1);
85    #[doc(alias = "MKAnnotationViewCollisionModeNone")]
86    pub const None: Self = Self(2);
87}
88
89unsafe impl Encode for MKAnnotationViewCollisionMode {
90    const ENCODING: Encoding = NSInteger::ENCODING;
91}
92
93unsafe impl RefEncode for MKAnnotationViewCollisionMode {
94    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
95}
96
97extern_class!(
98    /// [Apple's documentation](https://developer.apple.com/documentation/mapkit/mkannotationview?language=objc)
99    #[unsafe(super(NSView, NSResponder, NSObject))]
100    #[derive(Debug, PartialEq, Eq, Hash)]
101    #[cfg(feature = "objc2-app-kit")]
102    #[cfg(target_os = "macos")]
103    pub struct MKAnnotationView;
104);
105
106#[cfg(feature = "objc2-app-kit")]
107#[cfg(target_os = "macos")]
108unsafe impl NSAccessibility for MKAnnotationView {}
109
110#[cfg(feature = "objc2-app-kit")]
111#[cfg(target_os = "macos")]
112unsafe impl NSAccessibilityElementProtocol for MKAnnotationView {}
113
114#[cfg(feature = "objc2-app-kit")]
115#[cfg(target_os = "macos")]
116unsafe impl NSAnimatablePropertyContainer for MKAnnotationView {}
117
118#[cfg(feature = "objc2-app-kit")]
119#[cfg(target_os = "macos")]
120unsafe impl NSAppearanceCustomization for MKAnnotationView {}
121
122#[cfg(feature = "objc2-app-kit")]
123#[cfg(target_os = "macos")]
124unsafe impl NSCoding for MKAnnotationView {}
125
126#[cfg(feature = "objc2-app-kit")]
127#[cfg(target_os = "macos")]
128unsafe impl NSDraggingDestination for MKAnnotationView {}
129
130#[cfg(feature = "objc2-app-kit")]
131#[cfg(target_os = "macos")]
132unsafe impl NSObjectProtocol for MKAnnotationView {}
133
134#[cfg(feature = "objc2-app-kit")]
135#[cfg(target_os = "macos")]
136unsafe impl NSUserInterfaceItemIdentification for MKAnnotationView {}
137
138#[cfg(feature = "objc2-app-kit")]
139#[cfg(target_os = "macos")]
140impl MKAnnotationView {
141    extern_methods!(
142        #[cfg(feature = "MKAnnotation")]
143        #[unsafe(method(initWithAnnotation:reuseIdentifier:))]
144        #[unsafe(method_family = init)]
145        pub unsafe fn initWithAnnotation_reuseIdentifier(
146            this: Allocated<Self>,
147            annotation: Option<&ProtocolObject<dyn MKAnnotation>>,
148            reuse_identifier: Option<&NSString>,
149        ) -> Retained<Self>;
150
151        #[unsafe(method(initWithCoder:))]
152        #[unsafe(method_family = init)]
153        pub unsafe fn initWithCoder(
154            this: Allocated<Self>,
155            a_decoder: &NSCoder,
156        ) -> Option<Retained<Self>>;
157
158        #[unsafe(method(reuseIdentifier))]
159        #[unsafe(method_family = none)]
160        pub unsafe fn reuseIdentifier(&self) -> Option<Retained<NSString>>;
161
162        #[unsafe(method(prepareForReuse))]
163        #[unsafe(method_family = none)]
164        pub unsafe fn prepareForReuse(&self);
165
166        #[unsafe(method(prepareForDisplay))]
167        #[unsafe(method_family = none)]
168        pub unsafe fn prepareForDisplay(&self);
169
170        #[cfg(feature = "MKAnnotation")]
171        #[unsafe(method(annotation))]
172        #[unsafe(method_family = none)]
173        pub unsafe fn annotation(&self) -> Option<Retained<ProtocolObject<dyn MKAnnotation>>>;
174
175        #[cfg(feature = "MKAnnotation")]
176        /// Setter for [`annotation`][Self::annotation].
177        #[unsafe(method(setAnnotation:))]
178        #[unsafe(method_family = none)]
179        pub unsafe fn setAnnotation(&self, annotation: Option<&ProtocolObject<dyn MKAnnotation>>);
180
181        #[unsafe(method(image))]
182        #[unsafe(method_family = none)]
183        pub unsafe fn image(&self) -> Option<Retained<NSImage>>;
184
185        /// Setter for [`image`][Self::image].
186        #[unsafe(method(setImage:))]
187        #[unsafe(method_family = none)]
188        pub unsafe fn setImage(&self, image: Option<&NSImage>);
189
190        #[cfg(feature = "objc2-core-foundation")]
191        #[unsafe(method(centerOffset))]
192        #[unsafe(method_family = none)]
193        pub unsafe fn centerOffset(&self) -> CGPoint;
194
195        #[cfg(feature = "objc2-core-foundation")]
196        /// Setter for [`centerOffset`][Self::centerOffset].
197        #[unsafe(method(setCenterOffset:))]
198        #[unsafe(method_family = none)]
199        pub unsafe fn setCenterOffset(&self, center_offset: CGPoint);
200
201        #[cfg(feature = "objc2-core-foundation")]
202        #[unsafe(method(accessoryOffset))]
203        #[unsafe(method_family = none)]
204        pub unsafe fn accessoryOffset(&self) -> CGPoint;
205
206        #[cfg(feature = "objc2-core-foundation")]
207        /// Setter for [`accessoryOffset`][Self::accessoryOffset].
208        #[unsafe(method(setAccessoryOffset:))]
209        #[unsafe(method_family = none)]
210        pub unsafe fn setAccessoryOffset(&self, accessory_offset: CGPoint);
211
212        #[cfg(feature = "objc2-core-foundation")]
213        #[unsafe(method(calloutOffset))]
214        #[unsafe(method_family = none)]
215        pub unsafe fn calloutOffset(&self) -> CGPoint;
216
217        #[cfg(feature = "objc2-core-foundation")]
218        /// Setter for [`calloutOffset`][Self::calloutOffset].
219        #[unsafe(method(setCalloutOffset:))]
220        #[unsafe(method_family = none)]
221        pub unsafe fn setCalloutOffset(&self, callout_offset: CGPoint);
222
223        #[cfg(feature = "objc2-core-foundation")]
224        #[unsafe(method(leftCalloutOffset))]
225        #[unsafe(method_family = none)]
226        pub unsafe fn leftCalloutOffset(&self) -> CGPoint;
227
228        #[cfg(feature = "objc2-core-foundation")]
229        /// Setter for [`leftCalloutOffset`][Self::leftCalloutOffset].
230        #[unsafe(method(setLeftCalloutOffset:))]
231        #[unsafe(method_family = none)]
232        pub unsafe fn setLeftCalloutOffset(&self, left_callout_offset: CGPoint);
233
234        #[cfg(feature = "objc2-core-foundation")]
235        #[unsafe(method(rightCalloutOffset))]
236        #[unsafe(method_family = none)]
237        pub unsafe fn rightCalloutOffset(&self) -> CGPoint;
238
239        #[cfg(feature = "objc2-core-foundation")]
240        /// Setter for [`rightCalloutOffset`][Self::rightCalloutOffset].
241        #[unsafe(method(setRightCalloutOffset:))]
242        #[unsafe(method_family = none)]
243        pub unsafe fn setRightCalloutOffset(&self, right_callout_offset: CGPoint);
244
245        #[unsafe(method(isEnabled))]
246        #[unsafe(method_family = none)]
247        pub unsafe fn isEnabled(&self) -> bool;
248
249        /// Setter for [`isEnabled`][Self::isEnabled].
250        #[unsafe(method(setEnabled:))]
251        #[unsafe(method_family = none)]
252        pub unsafe fn setEnabled(&self, enabled: bool);
253
254        #[unsafe(method(isHighlighted))]
255        #[unsafe(method_family = none)]
256        pub unsafe fn isHighlighted(&self) -> bool;
257
258        /// Setter for [`isHighlighted`][Self::isHighlighted].
259        #[unsafe(method(setHighlighted:))]
260        #[unsafe(method_family = none)]
261        pub unsafe fn setHighlighted(&self, highlighted: bool);
262
263        #[unsafe(method(isSelected))]
264        #[unsafe(method_family = none)]
265        pub unsafe fn isSelected(&self) -> bool;
266
267        /// Setter for [`isSelected`][Self::isSelected].
268        #[unsafe(method(setSelected:))]
269        #[unsafe(method_family = none)]
270        pub unsafe fn setSelected(&self, selected: bool);
271
272        #[unsafe(method(setSelected:animated:))]
273        #[unsafe(method_family = none)]
274        pub unsafe fn setSelected_animated(&self, selected: bool, animated: bool);
275
276        #[unsafe(method(canShowCallout))]
277        #[unsafe(method_family = none)]
278        pub unsafe fn canShowCallout(&self) -> bool;
279
280        /// Setter for [`canShowCallout`][Self::canShowCallout].
281        #[unsafe(method(setCanShowCallout:))]
282        #[unsafe(method_family = none)]
283        pub unsafe fn setCanShowCallout(&self, can_show_callout: bool);
284
285        #[unsafe(method(leftCalloutAccessoryView))]
286        #[unsafe(method_family = none)]
287        pub unsafe fn leftCalloutAccessoryView(&self) -> Option<Retained<NSView>>;
288
289        /// Setter for [`leftCalloutAccessoryView`][Self::leftCalloutAccessoryView].
290        #[unsafe(method(setLeftCalloutAccessoryView:))]
291        #[unsafe(method_family = none)]
292        pub unsafe fn setLeftCalloutAccessoryView(
293            &self,
294            left_callout_accessory_view: Option<&NSView>,
295        );
296
297        #[unsafe(method(rightCalloutAccessoryView))]
298        #[unsafe(method_family = none)]
299        pub unsafe fn rightCalloutAccessoryView(&self) -> Option<Retained<NSView>>;
300
301        /// Setter for [`rightCalloutAccessoryView`][Self::rightCalloutAccessoryView].
302        #[unsafe(method(setRightCalloutAccessoryView:))]
303        #[unsafe(method_family = none)]
304        pub unsafe fn setRightCalloutAccessoryView(
305            &self,
306            right_callout_accessory_view: Option<&NSView>,
307        );
308
309        #[unsafe(method(detailCalloutAccessoryView))]
310        #[unsafe(method_family = none)]
311        pub unsafe fn detailCalloutAccessoryView(&self) -> Option<Retained<NSView>>;
312
313        /// Setter for [`detailCalloutAccessoryView`][Self::detailCalloutAccessoryView].
314        #[unsafe(method(setDetailCalloutAccessoryView:))]
315        #[unsafe(method_family = none)]
316        pub unsafe fn setDetailCalloutAccessoryView(
317            &self,
318            detail_callout_accessory_view: Option<&NSView>,
319        );
320
321        #[unsafe(method(isDraggable))]
322        #[unsafe(method_family = none)]
323        pub unsafe fn isDraggable(&self) -> bool;
324
325        /// Setter for [`isDraggable`][Self::isDraggable].
326        #[unsafe(method(setDraggable:))]
327        #[unsafe(method_family = none)]
328        pub unsafe fn setDraggable(&self, draggable: bool);
329
330        #[unsafe(method(dragState))]
331        #[unsafe(method_family = none)]
332        pub unsafe fn dragState(&self) -> MKAnnotationViewDragState;
333
334        /// Setter for [`dragState`][Self::dragState].
335        #[unsafe(method(setDragState:))]
336        #[unsafe(method_family = none)]
337        pub unsafe fn setDragState(&self, drag_state: MKAnnotationViewDragState);
338
339        #[unsafe(method(setDragState:animated:))]
340        #[unsafe(method_family = none)]
341        pub unsafe fn setDragState_animated(
342            &self,
343            new_drag_state: MKAnnotationViewDragState,
344            animated: bool,
345        );
346
347        #[unsafe(method(clusteringIdentifier))]
348        #[unsafe(method_family = none)]
349        pub unsafe fn clusteringIdentifier(&self) -> Option<Retained<NSString>>;
350
351        /// Setter for [`clusteringIdentifier`][Self::clusteringIdentifier].
352        #[unsafe(method(setClusteringIdentifier:))]
353        #[unsafe(method_family = none)]
354        pub unsafe fn setClusteringIdentifier(&self, clustering_identifier: Option<&NSString>);
355
356        #[unsafe(method(clusterAnnotationView))]
357        #[unsafe(method_family = none)]
358        pub unsafe fn clusterAnnotationView(&self) -> Option<Retained<MKAnnotationView>>;
359
360        #[unsafe(method(displayPriority))]
361        #[unsafe(method_family = none)]
362        pub unsafe fn displayPriority(&self) -> MKFeatureDisplayPriority;
363
364        /// Setter for [`displayPriority`][Self::displayPriority].
365        #[unsafe(method(setDisplayPriority:))]
366        #[unsafe(method_family = none)]
367        pub unsafe fn setDisplayPriority(&self, display_priority: MKFeatureDisplayPriority);
368
369        #[unsafe(method(zPriority))]
370        #[unsafe(method_family = none)]
371        pub unsafe fn zPriority(&self) -> MKAnnotationViewZPriority;
372
373        /// Setter for [`zPriority`][Self::zPriority].
374        #[unsafe(method(setZPriority:))]
375        #[unsafe(method_family = none)]
376        pub unsafe fn setZPriority(&self, z_priority: MKAnnotationViewZPriority);
377
378        #[unsafe(method(selectedZPriority))]
379        #[unsafe(method_family = none)]
380        pub unsafe fn selectedZPriority(&self) -> MKAnnotationViewZPriority;
381
382        /// Setter for [`selectedZPriority`][Self::selectedZPriority].
383        #[unsafe(method(setSelectedZPriority:))]
384        #[unsafe(method_family = none)]
385        pub unsafe fn setSelectedZPriority(&self, selected_z_priority: MKAnnotationViewZPriority);
386
387        #[unsafe(method(collisionMode))]
388        #[unsafe(method_family = none)]
389        pub unsafe fn collisionMode(&self) -> MKAnnotationViewCollisionMode;
390
391        /// Setter for [`collisionMode`][Self::collisionMode].
392        #[unsafe(method(setCollisionMode:))]
393        #[unsafe(method_family = none)]
394        pub unsafe fn setCollisionMode(&self, collision_mode: MKAnnotationViewCollisionMode);
395    );
396}
397
398/// Methods declared on superclass `NSView`.
399#[cfg(feature = "objc2-app-kit")]
400#[cfg(target_os = "macos")]
401impl MKAnnotationView {
402    extern_methods!(
403        #[unsafe(method(initWithFrame:))]
404        #[unsafe(method_family = init)]
405        pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
406    );
407}
408
409/// Methods declared on superclass `NSResponder`.
410#[cfg(feature = "objc2-app-kit")]
411#[cfg(target_os = "macos")]
412impl MKAnnotationView {
413    extern_methods!(
414        #[unsafe(method(init))]
415        #[unsafe(method_family = init)]
416        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
417    );
418}
419
420/// Methods declared on superclass `NSObject`.
421#[cfg(feature = "objc2-app-kit")]
422#[cfg(target_os = "macos")]
423impl MKAnnotationView {
424    extern_methods!(
425        #[unsafe(method(new))]
426        #[unsafe(method_family = new)]
427        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
428    );
429}