-
Notifications
You must be signed in to change notification settings - Fork 511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[mapkit] Add new bindings up to beta 3 #2334
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#if XAMCORE_2_0 || !MONOMAC | ||
using System; | ||
using XamCore.ObjCRuntime; | ||
|
||
namespace XamCore.MapKit { | ||
|
||
// .net does not allow float-based enumerations | ||
[TV (11,0)][NoWatch][iOS (11,0)][Mac (10,13, onlyOn64: true)] | ||
public static class MKFeatureDisplayPriority { | ||
public const float Required = 1000f; | ||
public const float DefaultHigh = 750f; | ||
public const float DefaultLow = 250f; | ||
} | ||
} | ||
|
||
#endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,9 +28,14 @@ | |
using UIEdgeInsets=XamCore.AppKit.NSEdgeInsets; | ||
using UIColor=XamCore.AppKit.NSColor; | ||
#endif | ||
#if WATCH | ||
// helper for [NoWatch] | ||
using MKMapView=XamCore.Foundation.NSObject; | ||
using MKAnnotationView=XamCore.Foundation.NSObject; | ||
#endif | ||
|
||
namespace XamCore.MapKit { | ||
|
||
[BaseType (typeof (NSObject))] | ||
[Model] | ||
[Protocol] | ||
|
@@ -175,7 +180,22 @@ interface MKAnnotationView { | |
[Export ("rightCalloutOffset")] | ||
CGPoint RightCallpoutOffset { get; set; } | ||
#endif | ||
|
||
[TV (11,0)][iOS (11,0)][Mac (10,13, onlyOn64: true)] | ||
[NullAllowed, Export ("clusteringIdentifier")] | ||
string ClusteringIdentifier { get; set; } | ||
|
||
[TV (11,0)][iOS (11,0)][Mac (10,13, onlyOn64: true)] | ||
[NullAllowed, Export ("clusterAnnotationView", ArgumentSemantic.Weak)] | ||
MKAnnotationView ClusterAnnotationView { get; } | ||
|
||
[TV (11,0)][iOS (11,0)][Mac (10,13, onlyOn64: true)] | ||
[Advice ("Pre-defined constants are available from 'MKFeatureDisplayPriority'.")] | ||
[Export ("displayPriority")] | ||
float DisplayPriority { get; set; } | ||
|
||
[TV (11,0)][iOS (11,0)][Mac (10,13, onlyOn64: true)] | ||
[Export ("collisionMode", ArgumentSemantic.Assign)] | ||
MKAnnotationViewCollisionMode CollisionMode { get; set; } | ||
} | ||
|
||
[ThreadSafe] | ||
|
@@ -258,7 +278,11 @@ interface MKDirectionsRequest { | |
[Since (6,0)] | ||
[TV (9,2)] | ||
[Mac (10,9, onlyOn64 : true)] | ||
interface MKMapItem { | ||
interface MKMapItem | ||
#if IOS_NOT_BOUND_YET // https://bugzilla.xamarin.com/show_bug.cgi?id=58203 | ||
: NSItemProviderReading, NSItemProviderWriting | ||
#endif | ||
{ | ||
[Export ("placemark", ArgumentSemantic.Retain)] | ||
MKPlacemark Placemark { get; } | ||
|
||
|
@@ -343,6 +367,10 @@ interface MKMapItem { | |
[iOS (9,0), Mac(10,11)] | ||
[NullAllowed] | ||
NSTimeZone TimeZone { get; set; } | ||
|
||
[iOS (11,0)][Mac (10,13)][Mac (10,13, onlyOn64 : true)][Watch (4,0)] | ||
[Field ("MKMapItemTypeIdentifier")] | ||
NSString TypeIdentifier { get; } | ||
} | ||
|
||
#if !WATCH | ||
|
@@ -452,8 +480,21 @@ interface MKMapView { | |
#endif | ||
|
||
[Export ("dequeueReusableAnnotationViewWithIdentifier:")] | ||
[return: NullAllowed] | ||
MKAnnotationView DequeueReusableAnnotation (string withViewIdentifier); | ||
|
||
[TV (11,0)][iOS (11,0)][Mac (10,13, onlyOn64: true)] | ||
[Export ("dequeueReusableAnnotationViewWithIdentifier:forAnnotation:")] | ||
MKAnnotationView DequeueReusableAnnotation (string identifier, IMKAnnotation annotation); | ||
|
||
[TV (11,0)][iOS (11,0)][Mac (10,13, onlyOn64: true)] | ||
[Export ("registerClass:forAnnotationViewWithReuseIdentifier:")] | ||
void Register ([NullAllowed] Class viewClass, string identifier); | ||
|
||
[TV (11,0)][iOS (11,0)][Mac (10,13, onlyOn64: true)] | ||
[Wrap ("Register (viewType == null ? null : new Class (viewType), identifier)")] | ||
void Register ([NullAllowed] Type viewType, string identifier); | ||
|
||
[Export ("selectAnnotation:animated:")] | ||
[PostGet ("SelectedAnnotations")] | ||
#if XAMCORE_2_0 | ||
|
@@ -664,6 +705,17 @@ interface MKMapView { | |
#endif | ||
} | ||
|
||
[Static] | ||
[TV (11,0)][iOS (11,0)][Mac (10,13, onlyOn64: true)] | ||
[NoWatch] | ||
interface MKMapViewDefault { | ||
[Field ("MKMapViewDefaultAnnotationViewReuseIdentifier")] | ||
NSString AnnotationViewReuseIdentifier { get; } | ||
|
||
[Field ("MKMapViewDefaultClusterAnnotationViewReuseIdentifier")] | ||
NSString ClusterAnnotationViewReuseIdentifier { get; } | ||
} | ||
|
||
[BaseType (typeof (NSObject))] | ||
[Model] | ||
[Protocol] | ||
|
@@ -764,6 +816,10 @@ interface MKMapViewDelegate { | |
|
||
[Since (7,0), Export ("mapViewDidFinishRenderingMap:fullyRendered:"), EventArgs ("MKDidFinishRenderingMap")] | ||
void DidFinishRenderingMap (MKMapView mapView, bool fullyRendered); | ||
|
||
[TV (11,0)][NoWatch][iOS (11,0)][Mac (10,13, onlyOn64: true)] | ||
[Export ("mapView:clusterAnnotationForMemberAnnotations:"), DelegateName ("MKCreateClusterAnnotation"), DefaultValue (null)] | ||
MKClusterAnnotation CreateClusterAnnotation (MKMapView mapView, IMKAnnotation[] memberAnnotations); | ||
} | ||
|
||
[BaseType (typeof (MKAnnotationView))] | ||
|
@@ -845,13 +901,14 @@ interface MKPlacemark : MKAnnotation, NSCopying { | |
#endif // !MONOMAC && !WATCH | ||
|
||
[Watch (3,0)][TV (10,0)][iOS (10,0)] | ||
[NoMac] | ||
[Mac (10,12, onlyOn64 : true)] | ||
[Export ("initWithCoordinate:")] | ||
IntPtr Constructor (CLLocationCoordinate2D coordinate); | ||
|
||
#if !TVOS && !MONOMAC && XAMCORE_2_0 | ||
#if !TVOS && XAMCORE_2_0 | ||
[Watch (3,0)][iOS (10,0)] | ||
[NoTV][NoMac] | ||
[Mac (10,12, onlyOn64 : true)] | ||
[NoTV] | ||
[Export ("initWithCoordinate:postalAddress:")] | ||
IntPtr Constructor (CLLocationCoordinate2D coordinate, CNPostalAddress postalAddress); | ||
#endif | ||
|
@@ -1828,5 +1885,108 @@ interface NSUserActivity_MKMapItem { | |
[Export ("setMapItem:")] | ||
void SetMapItem (MKMapItem item); | ||
} | ||
|
||
[TV (11,0)][NoWatch][iOS (11,0)][Mac (10,13, onlyOn64: true)] | ||
[BaseType (typeof (NSObject))] | ||
[DisableDefaultCtor] | ||
interface MKClusterAnnotation : MKAnnotation { | ||
[NullAllowed, Export ("title")] | ||
new string Title { get; set; } | ||
|
||
[NullAllowed, Export ("subtitle")] | ||
new string Subtitle { get; set; } | ||
|
||
[Export ("memberAnnotations")] | ||
IMKAnnotation[] MemberAnnotations { get; } | ||
|
||
[Export ("initWithMemberAnnotations:")] | ||
[DesignatedInitializer] | ||
IntPtr Constructor (IMKAnnotation[] memberAnnotations); | ||
} | ||
|
||
[NoTV][iOS (11,0)][NoMac][NoWatch] | ||
[BaseType (typeof (UIView))] | ||
[DisableDefaultCtor] | ||
interface MKCompassButton { | ||
[Static] | ||
[Export ("compassButtonWithMapView:")] | ||
MKCompassButton FromMapView ([NullAllowed] MKMapView mapView); | ||
|
||
[NullAllowed, Export ("mapView", ArgumentSemantic.Weak)] | ||
MKMapView MapView { get; set; } | ||
|
||
[Export ("compassVisibility", ArgumentSemantic.Assign)] | ||
MKFeatureVisibility CompassVisibility { get; set; } | ||
} | ||
|
||
[TV (11,0)][NoWatch][iOS (11,0)][NoMac] | ||
[BaseType (typeof (MKAnnotationView))] | ||
interface MKMarkerAnnotationView { | ||
|
||
// inlined from base type | ||
[Export ("initWithAnnotation:reuseIdentifier:")] | ||
[PostGet ("Annotation")] | ||
IntPtr Constructor (IMKAnnotation annotation, [NullAllowed] string reuseIdentifier); | ||
|
||
[Export ("titleVisibility", ArgumentSemantic.Assign)] | ||
MKFeatureVisibility TitleVisibility { get; set; } | ||
|
||
[Export ("subtitleVisibility", ArgumentSemantic.Assign)] | ||
MKFeatureVisibility SubtitleVisibility { get; set; } | ||
|
||
[Appearance] | ||
[NullAllowed, Export ("markerTintColor", ArgumentSemantic.Copy)] | ||
UIColor MarkerTintColor { get; set; } | ||
|
||
[Appearance] | ||
[NullAllowed, Export ("glyphTintColor", ArgumentSemantic.Copy)] | ||
UIColor GlyphTintColor { get; set; } | ||
|
||
[Appearance] | ||
[NullAllowed, Export ("glyphText")] | ||
string GlyphText { get; set; } | ||
|
||
[Appearance] | ||
[NullAllowed, Export ("glyphImage", ArgumentSemantic.Copy)] | ||
UIImage GlyphImage { get; set; } | ||
|
||
[Appearance] | ||
[NullAllowed, Export ("selectedGlyphImage", ArgumentSemantic.Copy)] | ||
UIImage SelectedGlyphImage { get; set; } | ||
|
||
[Export ("animatesWhenAdded")] | ||
bool AnimatesWhenAdded { get; set; } | ||
} | ||
|
||
[TV (11,0)][NoWatch][iOS (11,0)][NoMac] | ||
[BaseType (typeof (UIView))] | ||
[DisableDefaultCtor] | ||
interface MKScaleView { | ||
|
||
[Static] | ||
[Export ("scaleViewWithMapView:")] | ||
MKScaleView FromMapView ([NullAllowed] MKMapView mapView); | ||
|
||
[NullAllowed, Export ("mapView", ArgumentSemantic.Weak)] | ||
MKMapView MapView { get; set; } | ||
|
||
[Export ("scaleVisibility", ArgumentSemantic.Assign)] | ||
MKFeatureVisibility ScaleVisibility { get; set; } | ||
|
||
[Export ("legendAlignment", ArgumentSemantic.Assign)] | ||
MKScaleViewAlignment LegendAlignment { get; set; } | ||
} | ||
|
||
[NoTV][iOS (11,0)][NoWatch][NoMac] | ||
[BaseType (typeof (UIView))] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same, maybe DisableDefaultCtor here and inline There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Based on the API to create this UI item I do not think you're allowed to set the frame of that UI element. If I'm wrong this it's easy to add later. However good call on |
||
[DisableDefaultCtor] | ||
interface MKUserTrackingButton { | ||
[Static] | ||
[Export ("userTrackingButtonWithMapView:")] | ||
MKUserTrackingButton FromMapView ([NullAllowed] MKMapView mapView); | ||
|
||
[NullAllowed, Export ("mapView", ArgumentSemantic.Weak)] | ||
MKMapView MapView { get; set; } | ||
} | ||
} | ||
#endif // XAMCORE_2_0 || !MONOMAC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we need a DisableDefaultCtor here? also since this inherits from UIView, maybe we also need the
initWithFrame
ctorThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the API to create this UI item I do not think you're allowed to set the frame of that UI element. If I'm wrong this it's easy to add later. However good call on
[DisableDefaultCtor]
.