diff --git a/CODEOWNERS b/CODEOWNERS index 0f225610ab6a..1ba392552541 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -14,7 +14,7 @@ /mk @rolfbjarne -/msbuild @emaf @mauroa @rolfbjarne +/msbuild @mauroa @rolfbjarne /runtime @rolfbjarne diff --git a/macios/Localize/loc/cs/macios/tools/mtouch/Errors.resx.lcl b/macios/Localize/loc/cs/macios/tools/mtouch/Errors.resx.lcl index 4bbef6188c0e..d66a13518d03 100644 --- a/macios/Localize/loc/cs/macios/tools/mtouch/Errors.resx.lcl +++ b/macios/Localize/loc/cs/macios/tools/mtouch/Errors.resx.lcl @@ -4417,9 +4417,18 @@ - + - + + + + + + + + + + diff --git a/macios/Localize/loc/de/macios/tools/mtouch/Errors.resx.lcl b/macios/Localize/loc/de/macios/tools/mtouch/Errors.resx.lcl index 7fa75bbc512d..fc5a683a52d9 100644 --- a/macios/Localize/loc/de/macios/tools/mtouch/Errors.resx.lcl +++ b/macios/Localize/loc/de/macios/tools/mtouch/Errors.resx.lcl @@ -4417,9 +4417,18 @@ - + - + + + + + + + + + + diff --git a/macios/Localize/loc/fr/macios/tools/mtouch/Errors.resx.lcl b/macios/Localize/loc/fr/macios/tools/mtouch/Errors.resx.lcl index e16fe78e08de..d3a69c437805 100644 --- a/macios/Localize/loc/fr/macios/tools/mtouch/Errors.resx.lcl +++ b/macios/Localize/loc/fr/macios/tools/mtouch/Errors.resx.lcl @@ -4417,11 +4417,20 @@ - + - + - + + + + + + + + + + diff --git a/macios/Localize/loc/it/macios/tools/mtouch/Errors.resx.lcl b/macios/Localize/loc/it/macios/tools/mtouch/Errors.resx.lcl index b427bb107223..ae92e92ba6f7 100644 --- a/macios/Localize/loc/it/macios/tools/mtouch/Errors.resx.lcl +++ b/macios/Localize/loc/it/macios/tools/mtouch/Errors.resx.lcl @@ -4417,11 +4417,20 @@ - + - + - + + + + + + + + + + diff --git a/macios/Localize/loc/ja/macios/tools/mtouch/Errors.resx.lcl b/macios/Localize/loc/ja/macios/tools/mtouch/Errors.resx.lcl index f75011a92715..ac518a9e3efd 100644 --- a/macios/Localize/loc/ja/macios/tools/mtouch/Errors.resx.lcl +++ b/macios/Localize/loc/ja/macios/tools/mtouch/Errors.resx.lcl @@ -4417,11 +4417,20 @@ - + - + - + + + + + + + + + + diff --git a/macios/Localize/loc/ko/macios/tools/mtouch/Errors.resx.lcl b/macios/Localize/loc/ko/macios/tools/mtouch/Errors.resx.lcl index d6a496a59bea..bc908620c830 100644 --- a/macios/Localize/loc/ko/macios/tools/mtouch/Errors.resx.lcl +++ b/macios/Localize/loc/ko/macios/tools/mtouch/Errors.resx.lcl @@ -4417,9 +4417,18 @@ - + - + + + + + + + + + + diff --git a/macios/Localize/loc/pl/macios/tools/mtouch/Errors.resx.lcl b/macios/Localize/loc/pl/macios/tools/mtouch/Errors.resx.lcl index 24fcc9f61b92..b51dc49757b8 100644 --- a/macios/Localize/loc/pl/macios/tools/mtouch/Errors.resx.lcl +++ b/macios/Localize/loc/pl/macios/tools/mtouch/Errors.resx.lcl @@ -4417,9 +4417,18 @@ - + - + + + + + + + + + + diff --git a/macios/Localize/loc/pt-BR/macios/tools/mtouch/Errors.resx.lcl b/macios/Localize/loc/pt-BR/macios/tools/mtouch/Errors.resx.lcl index a50f2d08d36e..d893a87b4e74 100644 --- a/macios/Localize/loc/pt-BR/macios/tools/mtouch/Errors.resx.lcl +++ b/macios/Localize/loc/pt-BR/macios/tools/mtouch/Errors.resx.lcl @@ -4417,11 +4417,20 @@ - + - + - + + + + + + + + + + diff --git a/macios/Localize/loc/ru/macios/tools/mtouch/Errors.resx.lcl b/macios/Localize/loc/ru/macios/tools/mtouch/Errors.resx.lcl index 1f73cbeee191..80205c40569f 100644 --- a/macios/Localize/loc/ru/macios/tools/mtouch/Errors.resx.lcl +++ b/macios/Localize/loc/ru/macios/tools/mtouch/Errors.resx.lcl @@ -4417,9 +4417,18 @@ - + - + + + + + + + + + + diff --git a/macios/Localize/loc/tr/macios/tools/mtouch/Errors.resx.lcl b/macios/Localize/loc/tr/macios/tools/mtouch/Errors.resx.lcl index 471857de2385..0b6e0841f004 100644 --- a/macios/Localize/loc/tr/macios/tools/mtouch/Errors.resx.lcl +++ b/macios/Localize/loc/tr/macios/tools/mtouch/Errors.resx.lcl @@ -4417,9 +4417,18 @@ - + - + + + + + + + + + + diff --git a/macios/Localize/loc/zh-Hans/macios/tools/mtouch/Errors.resx.lcl b/macios/Localize/loc/zh-Hans/macios/tools/mtouch/Errors.resx.lcl index d39b1adaf679..08b62dea5624 100644 --- a/macios/Localize/loc/zh-Hans/macios/tools/mtouch/Errors.resx.lcl +++ b/macios/Localize/loc/zh-Hans/macios/tools/mtouch/Errors.resx.lcl @@ -4417,9 +4417,18 @@ - + - + + + + + + + + + + diff --git a/macios/Localize/loc/zh-Hant/macios/tools/mtouch/Errors.resx.lcl b/macios/Localize/loc/zh-Hant/macios/tools/mtouch/Errors.resx.lcl index a108e5060b56..0063007365b0 100644 --- a/macios/Localize/loc/zh-Hant/macios/tools/mtouch/Errors.resx.lcl +++ b/macios/Localize/loc/zh-Hant/macios/tools/mtouch/Errors.resx.lcl @@ -4417,9 +4417,18 @@ - + - + + + + + + + + + + diff --git a/src/PdfKit/PdfViewAnnotationHitEventArgs.cs b/src/PdfKit/PdfViewAnnotationHitEventArgs.cs new file mode 100644 index 000000000000..7a7a500c0d04 --- /dev/null +++ b/src/PdfKit/PdfViewAnnotationHitEventArgs.cs @@ -0,0 +1,18 @@ +namespace PdfKit; + +partial class PdfViewAnnotationHitEventArgs : NSNotificationEventArgs { + // This property needs a manual binding, because it's not using a constant string value, + // it's using a literal string value (as per Apple's documentation). + [BindingImpl (BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)] + public PdfKit.PdfAnnotation? AnnotationHit { + get { + var userinfo = Notification.UserInfo; + if (userinfo is null) + return null; + + using var key = new TransientCFString ("PDFAnnotationHit"); + var value = userinfo.LowlevelObjectForKey (key); + return Runtime.GetNSObject (value); + } + } +} diff --git a/src/frameworks.sources b/src/frameworks.sources index 820afb289014..6573e8e10f1b 100644 --- a/src/frameworks.sources +++ b/src/frameworks.sources @@ -1444,6 +1444,7 @@ PDFKIT_API_SOURCES = \ PDFKIT_SOURCES = \ PdfKit/PdfAnnotation.cs \ PdfKit/PdfKit.cs \ + PdfKit/PdfViewAnnotationHitEventArgs.cs \ # Phase diff --git a/src/pdfkit.cs b/src/pdfkit.cs index 506c3979d2a4..def55b79c0ba 100644 --- a/src/pdfkit.cs +++ b/src/pdfkit.cs @@ -3685,11 +3685,7 @@ interface PdfView : [NoTV] [NoMacCatalyst] interface PdfViewAnnotationHitEventArgs { - /// Gets the annotation that was hit. - /// To be added. - /// To be added. - [Export ("PDFAnnotationHit")] - PdfAnnotation AnnotationHit { get; } + // The 'AnnotationHit' property has manual bindings. } interface IPdfViewDelegate { } diff --git a/tests/monotouch-test/PdfKit/PdfAnnotationTest.cs b/tests/monotouch-test/PdfKit/PdfAnnotationTest.cs index 3d24269dc431..e0251c50e46f 100644 --- a/tests/monotouch-test/PdfKit/PdfAnnotationTest.cs +++ b/tests/monotouch-test/PdfKit/PdfAnnotationTest.cs @@ -10,6 +10,7 @@ #if __IOS__ || MONOMAC using CoreGraphics; +using Foundation; using PdfKit; namespace MonoTouchFixtures.PdfKit { @@ -47,6 +48,36 @@ public void QuadrilateralPoints () Assert.AreEqual (0, obj.QuadrilateralPoints.Length, "Q3b"); } } + + [Test] + public void AnnotationHitEventArgs () + { + using (var annotation = new PdfAnnotation ()) + using (var key = new NSString ("PDFAnnotationHit")) + using (var userInfo = new NSMutableDictionary ()) { + userInfo.Add (key, annotation); + + using (var notification = NSNotification.FromName (PdfView.AnnotationHitNotification, null, userInfo)) { + var args = new PdfViewAnnotationHitEventArgs (notification); + var actual = args.AnnotationHit; + + Assert.That (actual, Is.Not.Null, "AnnotationHit"); + if (actual is null) + return; + + Assert.That (actual.Handle, Is.EqualTo (annotation.Handle), "Handle"); + } + } + } + + [Test] + public void AnnotationHitEventArgsNoUserInfo () + { + using (var notification = NSNotification.FromName (PdfView.AnnotationHitNotification, null)) { + var args = new PdfViewAnnotationHitEventArgs (notification); + Assert.That (args.AnnotationHit, Is.Null, "AnnotationHit"); + } + } } } diff --git a/tests/xtro-sharpie/api-annotations-dotnet/common-PDFKit.ignore b/tests/xtro-sharpie/api-annotations-dotnet/common-PDFKit.ignore deleted file mode 100644 index 0dccdd989811..000000000000 --- a/tests/xtro-sharpie/api-annotations-dotnet/common-PDFKit.ignore +++ /dev/null @@ -1,2 +0,0 @@ -# Field used in an EventArg based structure that are in documentation but not in headers -!unknown-field! PDFAnnotationHit bound