objc2_map_kit/generated/
MKMapView.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::*;
11#[cfg(feature = "objc2-core-location")]
12use objc2_core_location::*;
13use objc2_foundation::*;
14
15use crate::*;
16
17/// [Apple's documentation](https://developer.apple.com/documentation/mapkit/mkoverlaylevel?language=objc)
18// NS_ENUM
19#[repr(transparent)]
20#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
21pub struct MKOverlayLevel(pub NSInteger);
22impl MKOverlayLevel {
23    #[doc(alias = "MKOverlayLevelAboveRoads")]
24    pub const AboveRoads: Self = Self(0);
25    #[doc(alias = "MKOverlayLevelAboveLabels")]
26    pub const AboveLabels: Self = Self(1);
27}
28
29unsafe impl Encode for MKOverlayLevel {
30    const ENCODING: Encoding = NSInteger::ENCODING;
31}
32
33unsafe impl RefEncode for MKOverlayLevel {
34    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
35}
36
37/// [Apple's documentation](https://developer.apple.com/documentation/mapkit/mkusertrackingmode?language=objc)
38// NS_ENUM
39#[repr(transparent)]
40#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
41pub struct MKUserTrackingMode(pub NSInteger);
42impl MKUserTrackingMode {
43    #[doc(alias = "MKUserTrackingModeNone")]
44    pub const None: Self = Self(0);
45    #[doc(alias = "MKUserTrackingModeFollow")]
46    pub const Follow: Self = Self(1);
47    #[doc(alias = "MKUserTrackingModeFollowWithHeading")]
48    pub const FollowWithHeading: Self = Self(2);
49}
50
51unsafe impl Encode for MKUserTrackingMode {
52    const ENCODING: Encoding = NSInteger::ENCODING;
53}
54
55unsafe impl RefEncode for MKUserTrackingMode {
56    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
57}
58
59extern "C" {
60    /// [Apple's documentation](https://developer.apple.com/documentation/mapkit/mkmapviewdefaultannotationviewreuseidentifier?language=objc)
61    pub static MKMapViewDefaultAnnotationViewReuseIdentifier: &'static NSString;
62}
63
64extern "C" {
65    /// [Apple's documentation](https://developer.apple.com/documentation/mapkit/mkmapviewdefaultclusterannotationviewreuseidentifier?language=objc)
66    pub static MKMapViewDefaultClusterAnnotationViewReuseIdentifier: &'static NSString;
67}
68
69extern_class!(
70    /// [Apple's documentation](https://developer.apple.com/documentation/mapkit/mkmapview?language=objc)
71    #[unsafe(super(NSView, NSResponder, NSObject))]
72    #[derive(Debug, PartialEq, Eq, Hash)]
73    #[cfg(feature = "objc2-app-kit")]
74    #[cfg(target_os = "macos")]
75    pub struct MKMapView;
76);
77
78#[cfg(feature = "objc2-app-kit")]
79#[cfg(target_os = "macos")]
80extern_conformance!(
81    unsafe impl NSAccessibility for MKMapView {}
82);
83
84#[cfg(feature = "objc2-app-kit")]
85#[cfg(target_os = "macos")]
86extern_conformance!(
87    unsafe impl NSAccessibilityElementProtocol for MKMapView {}
88);
89
90#[cfg(feature = "objc2-app-kit")]
91#[cfg(target_os = "macos")]
92extern_conformance!(
93    unsafe impl NSAnimatablePropertyContainer for MKMapView {}
94);
95
96#[cfg(feature = "objc2-app-kit")]
97#[cfg(target_os = "macos")]
98extern_conformance!(
99    unsafe impl NSAppearanceCustomization for MKMapView {}
100);
101
102#[cfg(feature = "objc2-app-kit")]
103#[cfg(target_os = "macos")]
104extern_conformance!(
105    unsafe impl NSCoding for MKMapView {}
106);
107
108#[cfg(feature = "objc2-app-kit")]
109#[cfg(target_os = "macos")]
110extern_conformance!(
111    unsafe impl NSDraggingDestination for MKMapView {}
112);
113
114#[cfg(feature = "objc2-app-kit")]
115#[cfg(target_os = "macos")]
116extern_conformance!(
117    unsafe impl NSObjectProtocol for MKMapView {}
118);
119
120#[cfg(feature = "objc2-app-kit")]
121#[cfg(target_os = "macos")]
122extern_conformance!(
123    unsafe impl NSUserInterfaceItemIdentification for MKMapView {}
124);
125
126#[cfg(feature = "objc2-app-kit")]
127#[cfg(target_os = "macos")]
128impl MKMapView {
129    extern_methods!(
130        #[unsafe(method(delegate))]
131        #[unsafe(method_family = none)]
132        pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn MKMapViewDelegate>>>;
133
134        /// This is a [weak property][objc2::topics::weak_property].
135        /// Setter for [`delegate`][Self::delegate].
136        #[unsafe(method(setDelegate:))]
137        #[unsafe(method_family = none)]
138        pub unsafe fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn MKMapViewDelegate>>);
139
140        #[cfg(feature = "MKTypes")]
141        #[deprecated]
142        #[unsafe(method(mapType))]
143        #[unsafe(method_family = none)]
144        pub unsafe fn mapType(&self) -> MKMapType;
145
146        #[cfg(feature = "MKTypes")]
147        /// Setter for [`mapType`][Self::mapType].
148        #[deprecated]
149        #[unsafe(method(setMapType:))]
150        #[unsafe(method_family = none)]
151        pub unsafe fn setMapType(&self, map_type: MKMapType);
152
153        #[cfg(feature = "MKMapConfiguration")]
154        #[unsafe(method(preferredConfiguration))]
155        #[unsafe(method_family = none)]
156        pub unsafe fn preferredConfiguration(&self) -> Retained<MKMapConfiguration>;
157
158        #[cfg(feature = "MKMapConfiguration")]
159        /// Setter for [`preferredConfiguration`][Self::preferredConfiguration].
160        #[unsafe(method(setPreferredConfiguration:))]
161        #[unsafe(method_family = none)]
162        pub unsafe fn setPreferredConfiguration(
163            &self,
164            preferred_configuration: &MKMapConfiguration,
165        );
166
167        #[cfg(all(feature = "MKGeometry", feature = "objc2-core-location"))]
168        #[unsafe(method(region))]
169        #[unsafe(method_family = none)]
170        pub unsafe fn region(&self) -> MKCoordinateRegion;
171
172        #[cfg(all(feature = "MKGeometry", feature = "objc2-core-location"))]
173        /// Setter for [`region`][Self::region].
174        #[unsafe(method(setRegion:))]
175        #[unsafe(method_family = none)]
176        pub unsafe fn setRegion(&self, region: MKCoordinateRegion);
177
178        #[cfg(all(feature = "MKGeometry", feature = "objc2-core-location"))]
179        #[unsafe(method(setRegion:animated:))]
180        #[unsafe(method_family = none)]
181        pub unsafe fn setRegion_animated(&self, region: MKCoordinateRegion, animated: bool);
182
183        #[cfg(feature = "objc2-core-location")]
184        #[unsafe(method(centerCoordinate))]
185        #[unsafe(method_family = none)]
186        pub unsafe fn centerCoordinate(&self) -> CLLocationCoordinate2D;
187
188        #[cfg(feature = "objc2-core-location")]
189        /// Setter for [`centerCoordinate`][Self::centerCoordinate].
190        #[unsafe(method(setCenterCoordinate:))]
191        #[unsafe(method_family = none)]
192        pub unsafe fn setCenterCoordinate(&self, center_coordinate: CLLocationCoordinate2D);
193
194        #[cfg(feature = "objc2-core-location")]
195        #[unsafe(method(setCenterCoordinate:animated:))]
196        #[unsafe(method_family = none)]
197        pub unsafe fn setCenterCoordinate_animated(
198            &self,
199            coordinate: CLLocationCoordinate2D,
200            animated: bool,
201        );
202
203        #[cfg(all(feature = "MKGeometry", feature = "objc2-core-location"))]
204        #[unsafe(method(regionThatFits:))]
205        #[unsafe(method_family = none)]
206        pub unsafe fn regionThatFits(&self, region: MKCoordinateRegion) -> MKCoordinateRegion;
207
208        #[cfg(feature = "MKGeometry")]
209        #[unsafe(method(visibleMapRect))]
210        #[unsafe(method_family = none)]
211        pub unsafe fn visibleMapRect(&self) -> MKMapRect;
212
213        #[cfg(feature = "MKGeometry")]
214        /// Setter for [`visibleMapRect`][Self::visibleMapRect].
215        #[unsafe(method(setVisibleMapRect:))]
216        #[unsafe(method_family = none)]
217        pub unsafe fn setVisibleMapRect(&self, visible_map_rect: MKMapRect);
218
219        #[cfg(feature = "MKGeometry")]
220        #[unsafe(method(setVisibleMapRect:animated:))]
221        #[unsafe(method_family = none)]
222        pub unsafe fn setVisibleMapRect_animated(&self, map_rect: MKMapRect, animate: bool);
223
224        #[cfg(feature = "MKGeometry")]
225        #[unsafe(method(mapRectThatFits:))]
226        #[unsafe(method_family = none)]
227        pub unsafe fn mapRectThatFits(&self, map_rect: MKMapRect) -> MKMapRect;
228
229        #[cfg(feature = "MKGeometry")]
230        #[unsafe(method(setVisibleMapRect:edgePadding:animated:))]
231        #[unsafe(method_family = none)]
232        pub unsafe fn setVisibleMapRect_edgePadding_animated(
233            &self,
234            map_rect: MKMapRect,
235            insets: NSEdgeInsets,
236            animate: bool,
237        );
238
239        #[cfg(feature = "MKGeometry")]
240        #[unsafe(method(mapRectThatFits:edgePadding:))]
241        #[unsafe(method_family = none)]
242        pub unsafe fn mapRectThatFits_edgePadding(
243            &self,
244            map_rect: MKMapRect,
245            insets: NSEdgeInsets,
246        ) -> MKMapRect;
247
248        #[cfg(feature = "MKMapCamera")]
249        #[unsafe(method(camera))]
250        #[unsafe(method_family = none)]
251        pub unsafe fn camera(&self) -> Retained<MKMapCamera>;
252
253        #[cfg(feature = "MKMapCamera")]
254        /// Setter for [`camera`][Self::camera].
255        #[unsafe(method(setCamera:))]
256        #[unsafe(method_family = none)]
257        pub unsafe fn setCamera(&self, camera: &MKMapCamera);
258
259        #[cfg(feature = "MKMapCamera")]
260        #[unsafe(method(setCamera:animated:))]
261        #[unsafe(method_family = none)]
262        pub unsafe fn setCamera_animated(&self, camera: &MKMapCamera, animated: bool);
263
264        #[cfg(feature = "MKMapCameraZoomRange")]
265        #[unsafe(method(cameraZoomRange))]
266        #[unsafe(method_family = none)]
267        pub unsafe fn cameraZoomRange(&self) -> Retained<MKMapCameraZoomRange>;
268
269        #[cfg(feature = "MKMapCameraZoomRange")]
270        /// Setter for [`cameraZoomRange`][Self::cameraZoomRange].
271        #[unsafe(method(setCameraZoomRange:))]
272        #[unsafe(method_family = none)]
273        pub unsafe fn setCameraZoomRange(&self, camera_zoom_range: Option<&MKMapCameraZoomRange>);
274
275        #[cfg(feature = "MKMapCameraZoomRange")]
276        #[unsafe(method(setCameraZoomRange:animated:))]
277        #[unsafe(method_family = none)]
278        pub unsafe fn setCameraZoomRange_animated(
279            &self,
280            camera_zoom_range: Option<&MKMapCameraZoomRange>,
281            animated: bool,
282        );
283
284        #[cfg(feature = "MKMapCameraBoundary")]
285        #[unsafe(method(cameraBoundary))]
286        #[unsafe(method_family = none)]
287        pub unsafe fn cameraBoundary(&self) -> Option<Retained<MKMapCameraBoundary>>;
288
289        #[cfg(feature = "MKMapCameraBoundary")]
290        /// Setter for [`cameraBoundary`][Self::cameraBoundary].
291        #[unsafe(method(setCameraBoundary:))]
292        #[unsafe(method_family = none)]
293        pub unsafe fn setCameraBoundary(&self, camera_boundary: Option<&MKMapCameraBoundary>);
294
295        #[cfg(feature = "MKMapCameraBoundary")]
296        #[unsafe(method(setCameraBoundary:animated:))]
297        #[unsafe(method_family = none)]
298        pub unsafe fn setCameraBoundary_animated(
299            &self,
300            camera_boundary: Option<&MKMapCameraBoundary>,
301            animated: bool,
302        );
303
304        #[cfg(all(feature = "objc2-core-foundation", feature = "objc2-core-location"))]
305        #[unsafe(method(convertCoordinate:toPointToView:))]
306        #[unsafe(method_family = none)]
307        pub unsafe fn convertCoordinate_toPointToView(
308            &self,
309            coordinate: CLLocationCoordinate2D,
310            view: Option<&NSView>,
311        ) -> CGPoint;
312
313        #[cfg(all(feature = "objc2-core-foundation", feature = "objc2-core-location"))]
314        #[unsafe(method(convertPoint:toCoordinateFromView:))]
315        #[unsafe(method_family = none)]
316        pub unsafe fn convertPoint_toCoordinateFromView(
317            &self,
318            point: CGPoint,
319            view: Option<&NSView>,
320        ) -> CLLocationCoordinate2D;
321
322        #[cfg(all(
323            feature = "MKGeometry",
324            feature = "objc2-core-foundation",
325            feature = "objc2-core-location"
326        ))]
327        #[unsafe(method(convertRegion:toRectToView:))]
328        #[unsafe(method_family = none)]
329        pub unsafe fn convertRegion_toRectToView(
330            &self,
331            region: MKCoordinateRegion,
332            view: Option<&NSView>,
333        ) -> CGRect;
334
335        #[cfg(all(
336            feature = "MKGeometry",
337            feature = "objc2-core-foundation",
338            feature = "objc2-core-location"
339        ))]
340        #[unsafe(method(convertRect:toRegionFromView:))]
341        #[unsafe(method_family = none)]
342        pub unsafe fn convertRect_toRegionFromView(
343            &self,
344            rect: CGRect,
345            view: Option<&NSView>,
346        ) -> MKCoordinateRegion;
347
348        #[unsafe(method(isZoomEnabled))]
349        #[unsafe(method_family = none)]
350        pub unsafe fn isZoomEnabled(&self) -> bool;
351
352        /// Setter for [`isZoomEnabled`][Self::isZoomEnabled].
353        #[unsafe(method(setZoomEnabled:))]
354        #[unsafe(method_family = none)]
355        pub unsafe fn setZoomEnabled(&self, zoom_enabled: bool);
356
357        #[unsafe(method(isScrollEnabled))]
358        #[unsafe(method_family = none)]
359        pub unsafe fn isScrollEnabled(&self) -> bool;
360
361        /// Setter for [`isScrollEnabled`][Self::isScrollEnabled].
362        #[unsafe(method(setScrollEnabled:))]
363        #[unsafe(method_family = none)]
364        pub unsafe fn setScrollEnabled(&self, scroll_enabled: bool);
365
366        #[unsafe(method(isRotateEnabled))]
367        #[unsafe(method_family = none)]
368        pub unsafe fn isRotateEnabled(&self) -> bool;
369
370        /// Setter for [`isRotateEnabled`][Self::isRotateEnabled].
371        #[unsafe(method(setRotateEnabled:))]
372        #[unsafe(method_family = none)]
373        pub unsafe fn setRotateEnabled(&self, rotate_enabled: bool);
374
375        #[unsafe(method(isPitchEnabled))]
376        #[unsafe(method_family = none)]
377        pub unsafe fn isPitchEnabled(&self) -> bool;
378
379        /// Setter for [`isPitchEnabled`][Self::isPitchEnabled].
380        #[unsafe(method(setPitchEnabled:))]
381        #[unsafe(method_family = none)]
382        pub unsafe fn setPitchEnabled(&self, pitch_enabled: bool);
383
384        #[unsafe(method(showsUserTrackingButton))]
385        #[unsafe(method_family = none)]
386        pub unsafe fn showsUserTrackingButton(&self) -> bool;
387
388        /// Setter for [`showsUserTrackingButton`][Self::showsUserTrackingButton].
389        #[unsafe(method(setShowsUserTrackingButton:))]
390        #[unsafe(method_family = none)]
391        pub unsafe fn setShowsUserTrackingButton(&self, shows_user_tracking_button: bool);
392
393        #[cfg(feature = "MKTypes")]
394        #[unsafe(method(pitchButtonVisibility))]
395        #[unsafe(method_family = none)]
396        pub unsafe fn pitchButtonVisibility(&self) -> MKFeatureVisibility;
397
398        #[cfg(feature = "MKTypes")]
399        /// Setter for [`pitchButtonVisibility`][Self::pitchButtonVisibility].
400        #[unsafe(method(setPitchButtonVisibility:))]
401        #[unsafe(method_family = none)]
402        pub unsafe fn setPitchButtonVisibility(&self, pitch_button_visibility: MKFeatureVisibility);
403
404        #[unsafe(method(showsPitchControl))]
405        #[unsafe(method_family = none)]
406        pub unsafe fn showsPitchControl(&self) -> bool;
407
408        /// Setter for [`showsPitchControl`][Self::showsPitchControl].
409        #[unsafe(method(setShowsPitchControl:))]
410        #[unsafe(method_family = none)]
411        pub unsafe fn setShowsPitchControl(&self, shows_pitch_control: bool);
412
413        #[unsafe(method(showsZoomControls))]
414        #[unsafe(method_family = none)]
415        pub unsafe fn showsZoomControls(&self) -> bool;
416
417        /// Setter for [`showsZoomControls`][Self::showsZoomControls].
418        #[unsafe(method(setShowsZoomControls:))]
419        #[unsafe(method_family = none)]
420        pub unsafe fn setShowsZoomControls(&self, shows_zoom_controls: bool);
421
422        #[unsafe(method(showsCompass))]
423        #[unsafe(method_family = none)]
424        pub unsafe fn showsCompass(&self) -> bool;
425
426        /// Setter for [`showsCompass`][Self::showsCompass].
427        #[unsafe(method(setShowsCompass:))]
428        #[unsafe(method_family = none)]
429        pub unsafe fn setShowsCompass(&self, shows_compass: bool);
430
431        #[unsafe(method(showsScale))]
432        #[unsafe(method_family = none)]
433        pub unsafe fn showsScale(&self) -> bool;
434
435        /// Setter for [`showsScale`][Self::showsScale].
436        #[unsafe(method(setShowsScale:))]
437        #[unsafe(method_family = none)]
438        pub unsafe fn setShowsScale(&self, shows_scale: bool);
439
440        #[cfg(feature = "MKPointOfInterestFilter")]
441        #[deprecated]
442        #[unsafe(method(pointOfInterestFilter))]
443        #[unsafe(method_family = none)]
444        pub unsafe fn pointOfInterestFilter(&self) -> Option<Retained<MKPointOfInterestFilter>>;
445
446        #[cfg(feature = "MKPointOfInterestFilter")]
447        /// Setter for [`pointOfInterestFilter`][Self::pointOfInterestFilter].
448        #[deprecated]
449        #[unsafe(method(setPointOfInterestFilter:))]
450        #[unsafe(method_family = none)]
451        pub unsafe fn setPointOfInterestFilter(
452            &self,
453            point_of_interest_filter: Option<&MKPointOfInterestFilter>,
454        );
455
456        #[deprecated = "Use pointOfInterestFilter"]
457        #[unsafe(method(showsPointsOfInterest))]
458        #[unsafe(method_family = none)]
459        pub unsafe fn showsPointsOfInterest(&self) -> bool;
460
461        /// Setter for [`showsPointsOfInterest`][Self::showsPointsOfInterest].
462        #[deprecated = "Use pointOfInterestFilter"]
463        #[unsafe(method(setShowsPointsOfInterest:))]
464        #[unsafe(method_family = none)]
465        pub unsafe fn setShowsPointsOfInterest(&self, shows_points_of_interest: bool);
466
467        #[deprecated = "None"]
468        #[unsafe(method(showsBuildings))]
469        #[unsafe(method_family = none)]
470        pub unsafe fn showsBuildings(&self) -> bool;
471
472        /// Setter for [`showsBuildings`][Self::showsBuildings].
473        #[deprecated = "None"]
474        #[unsafe(method(setShowsBuildings:))]
475        #[unsafe(method_family = none)]
476        pub unsafe fn setShowsBuildings(&self, shows_buildings: bool);
477
478        #[deprecated]
479        #[unsafe(method(showsTraffic))]
480        #[unsafe(method_family = none)]
481        pub unsafe fn showsTraffic(&self) -> bool;
482
483        /// Setter for [`showsTraffic`][Self::showsTraffic].
484        #[deprecated]
485        #[unsafe(method(setShowsTraffic:))]
486        #[unsafe(method_family = none)]
487        pub unsafe fn setShowsTraffic(&self, shows_traffic: bool);
488
489        #[unsafe(method(showsUserLocation))]
490        #[unsafe(method_family = none)]
491        pub unsafe fn showsUserLocation(&self) -> bool;
492
493        /// Setter for [`showsUserLocation`][Self::showsUserLocation].
494        #[unsafe(method(setShowsUserLocation:))]
495        #[unsafe(method_family = none)]
496        pub unsafe fn setShowsUserLocation(&self, shows_user_location: bool);
497
498        #[cfg(feature = "MKUserLocation")]
499        #[unsafe(method(userLocation))]
500        #[unsafe(method_family = none)]
501        pub unsafe fn userLocation(&self) -> Retained<MKUserLocation>;
502
503        #[unsafe(method(userTrackingMode))]
504        #[unsafe(method_family = none)]
505        pub unsafe fn userTrackingMode(&self) -> MKUserTrackingMode;
506
507        /// Setter for [`userTrackingMode`][Self::userTrackingMode].
508        #[unsafe(method(setUserTrackingMode:))]
509        #[unsafe(method_family = none)]
510        pub unsafe fn setUserTrackingMode(&self, user_tracking_mode: MKUserTrackingMode);
511
512        #[unsafe(method(setUserTrackingMode:animated:))]
513        #[unsafe(method_family = none)]
514        pub unsafe fn setUserTrackingMode_animated(&self, mode: MKUserTrackingMode, animated: bool);
515
516        #[unsafe(method(isUserLocationVisible))]
517        #[unsafe(method_family = none)]
518        pub unsafe fn isUserLocationVisible(&self) -> bool;
519
520        #[cfg(feature = "MKAnnotation")]
521        #[unsafe(method(addAnnotation:))]
522        #[unsafe(method_family = none)]
523        pub unsafe fn addAnnotation(&self, annotation: &ProtocolObject<dyn MKAnnotation>);
524
525        #[cfg(feature = "MKAnnotation")]
526        #[unsafe(method(addAnnotations:))]
527        #[unsafe(method_family = none)]
528        pub unsafe fn addAnnotations(
529            &self,
530            annotations: &NSArray<ProtocolObject<dyn MKAnnotation>>,
531        );
532
533        #[cfg(feature = "MKAnnotation")]
534        #[unsafe(method(removeAnnotation:))]
535        #[unsafe(method_family = none)]
536        pub unsafe fn removeAnnotation(&self, annotation: &ProtocolObject<dyn MKAnnotation>);
537
538        #[cfg(feature = "MKAnnotation")]
539        #[unsafe(method(removeAnnotations:))]
540        #[unsafe(method_family = none)]
541        pub unsafe fn removeAnnotations(
542            &self,
543            annotations: &NSArray<ProtocolObject<dyn MKAnnotation>>,
544        );
545
546        #[cfg(feature = "MKAnnotation")]
547        #[unsafe(method(annotations))]
548        #[unsafe(method_family = none)]
549        pub unsafe fn annotations(&self) -> Retained<NSArray<ProtocolObject<dyn MKAnnotation>>>;
550
551        #[cfg(all(feature = "MKAnnotation", feature = "MKGeometry"))]
552        #[unsafe(method(annotationsInMapRect:))]
553        #[unsafe(method_family = none)]
554        pub unsafe fn annotationsInMapRect(
555            &self,
556            map_rect: MKMapRect,
557        ) -> Retained<NSSet<ProtocolObject<dyn MKAnnotation>>>;
558
559        #[cfg(all(feature = "MKAnnotation", feature = "MKAnnotationView"))]
560        #[unsafe(method(viewForAnnotation:))]
561        #[unsafe(method_family = none)]
562        pub unsafe fn viewForAnnotation(
563            &self,
564            annotation: &ProtocolObject<dyn MKAnnotation>,
565        ) -> Option<Retained<MKAnnotationView>>;
566
567        #[cfg(feature = "MKAnnotationView")]
568        #[unsafe(method(dequeueReusableAnnotationViewWithIdentifier:))]
569        #[unsafe(method_family = none)]
570        pub unsafe fn dequeueReusableAnnotationViewWithIdentifier(
571            &self,
572            identifier: &NSString,
573        ) -> Option<Retained<MKAnnotationView>>;
574
575        #[cfg(all(feature = "MKAnnotation", feature = "MKAnnotationView"))]
576        #[unsafe(method(dequeueReusableAnnotationViewWithIdentifier:forAnnotation:))]
577        #[unsafe(method_family = none)]
578        pub unsafe fn dequeueReusableAnnotationViewWithIdentifier_forAnnotation(
579            &self,
580            identifier: &NSString,
581            annotation: &ProtocolObject<dyn MKAnnotation>,
582        ) -> Retained<MKAnnotationView>;
583
584        #[unsafe(method(registerClass:forAnnotationViewWithReuseIdentifier:))]
585        #[unsafe(method_family = none)]
586        pub unsafe fn registerClass_forAnnotationViewWithReuseIdentifier(
587            &self,
588            view_class: Option<&AnyClass>,
589            identifier: &NSString,
590        );
591
592        #[cfg(feature = "MKAnnotation")]
593        #[unsafe(method(selectAnnotation:animated:))]
594        #[unsafe(method_family = none)]
595        pub unsafe fn selectAnnotation_animated(
596            &self,
597            annotation: &ProtocolObject<dyn MKAnnotation>,
598            animated: bool,
599        );
600
601        #[cfg(feature = "MKAnnotation")]
602        #[unsafe(method(deselectAnnotation:animated:))]
603        #[unsafe(method_family = none)]
604        pub unsafe fn deselectAnnotation_animated(
605            &self,
606            annotation: Option<&ProtocolObject<dyn MKAnnotation>>,
607            animated: bool,
608        );
609
610        #[cfg(feature = "MKAnnotation")]
611        #[unsafe(method(selectedAnnotations))]
612        #[unsafe(method_family = none)]
613        pub unsafe fn selectedAnnotations(
614            &self,
615        ) -> Retained<NSArray<ProtocolObject<dyn MKAnnotation>>>;
616
617        #[cfg(feature = "MKAnnotation")]
618        /// Setter for [`selectedAnnotations`][Self::selectedAnnotations].
619        #[unsafe(method(setSelectedAnnotations:))]
620        #[unsafe(method_family = none)]
621        pub unsafe fn setSelectedAnnotations(
622            &self,
623            selected_annotations: &NSArray<ProtocolObject<dyn MKAnnotation>>,
624        );
625
626        #[cfg(feature = "objc2-core-foundation")]
627        #[unsafe(method(annotationVisibleRect))]
628        #[unsafe(method_family = none)]
629        pub unsafe fn annotationVisibleRect(&self) -> CGRect;
630
631        #[cfg(feature = "MKAnnotation")]
632        #[unsafe(method(showAnnotations:animated:))]
633        #[unsafe(method_family = none)]
634        pub unsafe fn showAnnotations_animated(
635            &self,
636            annotations: &NSArray<ProtocolObject<dyn MKAnnotation>>,
637            animated: bool,
638        );
639    );
640}
641
642/// Methods declared on superclass `NSView`.
643#[cfg(feature = "objc2-app-kit")]
644#[cfg(target_os = "macos")]
645impl MKMapView {
646    extern_methods!(
647        #[unsafe(method(initWithFrame:))]
648        #[unsafe(method_family = init)]
649        pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
650
651        #[unsafe(method(initWithCoder:))]
652        #[unsafe(method_family = init)]
653        pub unsafe fn initWithCoder(
654            this: Allocated<Self>,
655            coder: &NSCoder,
656        ) -> Option<Retained<Self>>;
657    );
658}
659
660/// Methods declared on superclass `NSResponder`.
661#[cfg(feature = "objc2-app-kit")]
662#[cfg(target_os = "macos")]
663impl MKMapView {
664    extern_methods!(
665        #[unsafe(method(init))]
666        #[unsafe(method_family = init)]
667        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
668    );
669}
670
671/// Methods declared on superclass `NSObject`.
672#[cfg(feature = "objc2-app-kit")]
673#[cfg(target_os = "macos")]
674impl MKMapView {
675    extern_methods!(
676        #[unsafe(method(new))]
677        #[unsafe(method_family = new)]
678        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
679    );
680}
681
682/// OverlaysAPI.
683#[cfg(feature = "objc2-app-kit")]
684#[cfg(target_os = "macos")]
685impl MKMapView {
686    extern_methods!(
687        #[cfg(all(feature = "MKAnnotation", feature = "MKOverlay"))]
688        #[unsafe(method(addOverlay:level:))]
689        #[unsafe(method_family = none)]
690        pub unsafe fn addOverlay_level(
691            &self,
692            overlay: &ProtocolObject<dyn MKOverlay>,
693            level: MKOverlayLevel,
694        );
695
696        #[cfg(all(feature = "MKAnnotation", feature = "MKOverlay"))]
697        #[unsafe(method(addOverlays:level:))]
698        #[unsafe(method_family = none)]
699        pub unsafe fn addOverlays_level(
700            &self,
701            overlays: &NSArray<ProtocolObject<dyn MKOverlay>>,
702            level: MKOverlayLevel,
703        );
704
705        #[cfg(all(feature = "MKAnnotation", feature = "MKOverlay"))]
706        #[unsafe(method(removeOverlay:))]
707        #[unsafe(method_family = none)]
708        pub unsafe fn removeOverlay(&self, overlay: &ProtocolObject<dyn MKOverlay>);
709
710        #[cfg(all(feature = "MKAnnotation", feature = "MKOverlay"))]
711        #[unsafe(method(removeOverlays:))]
712        #[unsafe(method_family = none)]
713        pub unsafe fn removeOverlays(&self, overlays: &NSArray<ProtocolObject<dyn MKOverlay>>);
714
715        #[cfg(all(feature = "MKAnnotation", feature = "MKOverlay"))]
716        #[unsafe(method(insertOverlay:atIndex:level:))]
717        #[unsafe(method_family = none)]
718        pub unsafe fn insertOverlay_atIndex_level(
719            &self,
720            overlay: &ProtocolObject<dyn MKOverlay>,
721            index: NSUInteger,
722            level: MKOverlayLevel,
723        );
724
725        #[cfg(all(feature = "MKAnnotation", feature = "MKOverlay"))]
726        #[unsafe(method(insertOverlay:aboveOverlay:))]
727        #[unsafe(method_family = none)]
728        pub unsafe fn insertOverlay_aboveOverlay(
729            &self,
730            overlay: &ProtocolObject<dyn MKOverlay>,
731            sibling: &ProtocolObject<dyn MKOverlay>,
732        );
733
734        #[cfg(all(feature = "MKAnnotation", feature = "MKOverlay"))]
735        #[unsafe(method(insertOverlay:belowOverlay:))]
736        #[unsafe(method_family = none)]
737        pub unsafe fn insertOverlay_belowOverlay(
738            &self,
739            overlay: &ProtocolObject<dyn MKOverlay>,
740            sibling: &ProtocolObject<dyn MKOverlay>,
741        );
742
743        #[cfg(all(feature = "MKAnnotation", feature = "MKOverlay"))]
744        #[unsafe(method(exchangeOverlay:withOverlay:))]
745        #[unsafe(method_family = none)]
746        pub unsafe fn exchangeOverlay_withOverlay(
747            &self,
748            overlay1: &ProtocolObject<dyn MKOverlay>,
749            overlay2: &ProtocolObject<dyn MKOverlay>,
750        );
751
752        #[cfg(all(feature = "MKAnnotation", feature = "MKOverlay"))]
753        #[unsafe(method(overlays))]
754        #[unsafe(method_family = none)]
755        pub unsafe fn overlays(&self) -> Retained<NSArray<ProtocolObject<dyn MKOverlay>>>;
756
757        #[cfg(all(feature = "MKAnnotation", feature = "MKOverlay"))]
758        #[unsafe(method(overlaysInLevel:))]
759        #[unsafe(method_family = none)]
760        pub unsafe fn overlaysInLevel(
761            &self,
762            level: MKOverlayLevel,
763        ) -> Retained<NSArray<ProtocolObject<dyn MKOverlay>>>;
764
765        #[cfg(all(
766            feature = "MKAnnotation",
767            feature = "MKOverlay",
768            feature = "MKOverlayRenderer"
769        ))]
770        #[unsafe(method(rendererForOverlay:))]
771        #[unsafe(method_family = none)]
772        pub unsafe fn rendererForOverlay(
773            &self,
774            overlay: &ProtocolObject<dyn MKOverlay>,
775        ) -> Option<Retained<MKOverlayRenderer>>;
776
777        #[cfg(all(feature = "MKAnnotation", feature = "MKOverlay"))]
778        #[unsafe(method(addOverlay:))]
779        #[unsafe(method_family = none)]
780        pub unsafe fn addOverlay(&self, overlay: &ProtocolObject<dyn MKOverlay>);
781
782        #[cfg(all(feature = "MKAnnotation", feature = "MKOverlay"))]
783        #[unsafe(method(addOverlays:))]
784        #[unsafe(method_family = none)]
785        pub unsafe fn addOverlays(&self, overlays: &NSArray<ProtocolObject<dyn MKOverlay>>);
786
787        #[cfg(all(feature = "MKAnnotation", feature = "MKOverlay"))]
788        #[unsafe(method(insertOverlay:atIndex:))]
789        #[unsafe(method_family = none)]
790        pub unsafe fn insertOverlay_atIndex(
791            &self,
792            overlay: &ProtocolObject<dyn MKOverlay>,
793            index: NSUInteger,
794        );
795
796        #[unsafe(method(exchangeOverlayAtIndex:withOverlayAtIndex:))]
797        #[unsafe(method_family = none)]
798        pub unsafe fn exchangeOverlayAtIndex_withOverlayAtIndex(
799            &self,
800            index1: NSUInteger,
801            index2: NSUInteger,
802        );
803    );
804}
805
806extern_protocol!(
807    /// [Apple's documentation](https://developer.apple.com/documentation/mapkit/mkmapviewdelegate?language=objc)
808    pub unsafe trait MKMapViewDelegate: NSObjectProtocol + MainThreadOnly {
809        #[cfg(feature = "objc2-app-kit")]
810        #[cfg(target_os = "macos")]
811        #[optional]
812        #[unsafe(method(mapView:regionWillChangeAnimated:))]
813        #[unsafe(method_family = none)]
814        unsafe fn mapView_regionWillChangeAnimated(&self, map_view: &MKMapView, animated: bool);
815
816        #[cfg(feature = "objc2-app-kit")]
817        #[cfg(target_os = "macos")]
818        #[optional]
819        #[unsafe(method(mapView:regionDidChangeAnimated:))]
820        #[unsafe(method_family = none)]
821        unsafe fn mapView_regionDidChangeAnimated(&self, map_view: &MKMapView, animated: bool);
822
823        #[cfg(feature = "objc2-app-kit")]
824        #[cfg(target_os = "macos")]
825        #[optional]
826        #[unsafe(method(mapViewDidChangeVisibleRegion:))]
827        #[unsafe(method_family = none)]
828        unsafe fn mapViewDidChangeVisibleRegion(&self, map_view: &MKMapView);
829
830        #[cfg(feature = "objc2-app-kit")]
831        #[cfg(target_os = "macos")]
832        #[optional]
833        #[unsafe(method(mapViewWillStartLoadingMap:))]
834        #[unsafe(method_family = none)]
835        unsafe fn mapViewWillStartLoadingMap(&self, map_view: &MKMapView);
836
837        #[cfg(feature = "objc2-app-kit")]
838        #[cfg(target_os = "macos")]
839        #[optional]
840        #[unsafe(method(mapViewDidFinishLoadingMap:))]
841        #[unsafe(method_family = none)]
842        unsafe fn mapViewDidFinishLoadingMap(&self, map_view: &MKMapView);
843
844        #[cfg(feature = "objc2-app-kit")]
845        #[cfg(target_os = "macos")]
846        #[optional]
847        #[unsafe(method(mapViewDidFailLoadingMap:withError:))]
848        #[unsafe(method_family = none)]
849        unsafe fn mapViewDidFailLoadingMap_withError(&self, map_view: &MKMapView, error: &NSError);
850
851        #[cfg(feature = "objc2-app-kit")]
852        #[cfg(target_os = "macos")]
853        #[optional]
854        #[unsafe(method(mapViewWillStartRenderingMap:))]
855        #[unsafe(method_family = none)]
856        unsafe fn mapViewWillStartRenderingMap(&self, map_view: &MKMapView);
857
858        #[cfg(feature = "objc2-app-kit")]
859        #[cfg(target_os = "macos")]
860        #[optional]
861        #[unsafe(method(mapViewDidFinishRenderingMap:fullyRendered:))]
862        #[unsafe(method_family = none)]
863        unsafe fn mapViewDidFinishRenderingMap_fullyRendered(
864            &self,
865            map_view: &MKMapView,
866            fully_rendered: bool,
867        );
868
869        #[cfg(all(
870            feature = "MKAnnotation",
871            feature = "MKAnnotationView",
872            feature = "objc2-app-kit"
873        ))]
874        #[cfg(target_os = "macos")]
875        #[optional]
876        #[unsafe(method(mapView:viewForAnnotation:))]
877        #[unsafe(method_family = none)]
878        unsafe fn mapView_viewForAnnotation(
879            &self,
880            map_view: &MKMapView,
881            annotation: &ProtocolObject<dyn MKAnnotation>,
882        ) -> Option<Retained<MKAnnotationView>>;
883
884        #[cfg(all(feature = "MKAnnotationView", feature = "objc2-app-kit"))]
885        #[cfg(target_os = "macos")]
886        #[optional]
887        #[unsafe(method(mapView:didAddAnnotationViews:))]
888        #[unsafe(method_family = none)]
889        unsafe fn mapView_didAddAnnotationViews(
890            &self,
891            map_view: &MKMapView,
892            views: &NSArray<MKAnnotationView>,
893        );
894
895        #[cfg(all(feature = "MKAnnotationView", feature = "objc2-app-kit"))]
896        #[cfg(target_os = "macos")]
897        #[optional]
898        #[unsafe(method(mapView:didSelectAnnotationView:))]
899        #[unsafe(method_family = none)]
900        unsafe fn mapView_didSelectAnnotationView(
901            &self,
902            map_view: &MKMapView,
903            view: &MKAnnotationView,
904        );
905
906        #[cfg(all(feature = "MKAnnotationView", feature = "objc2-app-kit"))]
907        #[cfg(target_os = "macos")]
908        #[optional]
909        #[unsafe(method(mapView:didDeselectAnnotationView:))]
910        #[unsafe(method_family = none)]
911        unsafe fn mapView_didDeselectAnnotationView(
912            &self,
913            map_view: &MKMapView,
914            view: &MKAnnotationView,
915        );
916
917        #[cfg(all(feature = "MKAnnotation", feature = "objc2-app-kit"))]
918        #[cfg(target_os = "macos")]
919        #[optional]
920        #[unsafe(method(mapView:didSelectAnnotation:))]
921        #[unsafe(method_family = none)]
922        unsafe fn mapView_didSelectAnnotation(
923            &self,
924            map_view: &MKMapView,
925            annotation: &ProtocolObject<dyn MKAnnotation>,
926        );
927
928        #[cfg(all(feature = "MKAnnotation", feature = "objc2-app-kit"))]
929        #[cfg(target_os = "macos")]
930        #[optional]
931        #[unsafe(method(mapView:didDeselectAnnotation:))]
932        #[unsafe(method_family = none)]
933        unsafe fn mapView_didDeselectAnnotation(
934            &self,
935            map_view: &MKMapView,
936            annotation: &ProtocolObject<dyn MKAnnotation>,
937        );
938
939        #[cfg(all(
940            feature = "MKAnnotation",
941            feature = "MKSelectionAccessory",
942            feature = "objc2-app-kit"
943        ))]
944        #[cfg(target_os = "macos")]
945        #[optional]
946        #[unsafe(method(mapView:selectionAccessoryForAnnotation:))]
947        #[unsafe(method_family = none)]
948        unsafe fn mapView_selectionAccessoryForAnnotation(
949            &self,
950            map_view: &MKMapView,
951            annotation: &ProtocolObject<dyn MKAnnotation>,
952        ) -> Option<Retained<MKSelectionAccessory>>;
953
954        #[cfg(feature = "objc2-app-kit")]
955        #[cfg(target_os = "macos")]
956        #[optional]
957        #[unsafe(method(mapViewWillStartLocatingUser:))]
958        #[unsafe(method_family = none)]
959        unsafe fn mapViewWillStartLocatingUser(&self, map_view: &MKMapView);
960
961        #[cfg(feature = "objc2-app-kit")]
962        #[cfg(target_os = "macos")]
963        #[optional]
964        #[unsafe(method(mapViewDidStopLocatingUser:))]
965        #[unsafe(method_family = none)]
966        unsafe fn mapViewDidStopLocatingUser(&self, map_view: &MKMapView);
967
968        #[cfg(all(feature = "MKUserLocation", feature = "objc2-app-kit"))]
969        #[cfg(target_os = "macos")]
970        #[optional]
971        #[unsafe(method(mapView:didUpdateUserLocation:))]
972        #[unsafe(method_family = none)]
973        unsafe fn mapView_didUpdateUserLocation(
974            &self,
975            map_view: &MKMapView,
976            user_location: &MKUserLocation,
977        );
978
979        #[cfg(feature = "objc2-app-kit")]
980        #[cfg(target_os = "macos")]
981        #[optional]
982        #[unsafe(method(mapView:didFailToLocateUserWithError:))]
983        #[unsafe(method_family = none)]
984        unsafe fn mapView_didFailToLocateUserWithError(
985            &self,
986            map_view: &MKMapView,
987            error: &NSError,
988        );
989
990        #[cfg(all(feature = "MKAnnotationView", feature = "objc2-app-kit"))]
991        #[cfg(target_os = "macos")]
992        #[optional]
993        #[unsafe(method(mapView:annotationView:didChangeDragState:fromOldState:))]
994        #[unsafe(method_family = none)]
995        unsafe fn mapView_annotationView_didChangeDragState_fromOldState(
996            &self,
997            map_view: &MKMapView,
998            view: &MKAnnotationView,
999            new_state: MKAnnotationViewDragState,
1000            old_state: MKAnnotationViewDragState,
1001        );
1002
1003        #[cfg(feature = "objc2-app-kit")]
1004        #[cfg(target_os = "macos")]
1005        #[optional]
1006        #[unsafe(method(mapView:didChangeUserTrackingMode:animated:))]
1007        #[unsafe(method_family = none)]
1008        unsafe fn mapView_didChangeUserTrackingMode_animated(
1009            &self,
1010            map_view: &MKMapView,
1011            mode: MKUserTrackingMode,
1012            animated: bool,
1013        );
1014
1015        #[cfg(all(
1016            feature = "MKAnnotation",
1017            feature = "MKOverlay",
1018            feature = "MKOverlayRenderer",
1019            feature = "objc2-app-kit"
1020        ))]
1021        #[cfg(target_os = "macos")]
1022        #[optional]
1023        #[unsafe(method(mapView:rendererForOverlay:))]
1024        #[unsafe(method_family = none)]
1025        unsafe fn mapView_rendererForOverlay(
1026            &self,
1027            map_view: &MKMapView,
1028            overlay: &ProtocolObject<dyn MKOverlay>,
1029        ) -> Retained<MKOverlayRenderer>;
1030
1031        #[cfg(all(feature = "MKOverlayRenderer", feature = "objc2-app-kit"))]
1032        #[cfg(target_os = "macos")]
1033        #[optional]
1034        #[unsafe(method(mapView:didAddOverlayRenderers:))]
1035        #[unsafe(method_family = none)]
1036        unsafe fn mapView_didAddOverlayRenderers(
1037            &self,
1038            map_view: &MKMapView,
1039            renderers: &NSArray<MKOverlayRenderer>,
1040        );
1041
1042        #[cfg(all(
1043            feature = "MKAnnotation",
1044            feature = "MKClusterAnnotation",
1045            feature = "objc2-app-kit"
1046        ))]
1047        #[cfg(target_os = "macos")]
1048        #[optional]
1049        #[unsafe(method(mapView:clusterAnnotationForMemberAnnotations:))]
1050        #[unsafe(method_family = none)]
1051        unsafe fn mapView_clusterAnnotationForMemberAnnotations(
1052            &self,
1053            map_view: &MKMapView,
1054            member_annotations: &NSArray<ProtocolObject<dyn MKAnnotation>>,
1055        ) -> Retained<MKClusterAnnotation>;
1056    }
1057);