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