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