Skip to content

Commit

Permalink
[AppKit] Add missing Accessibility protocols.
Browse files Browse the repository at this point in the history
This commit adds a few protocols that were missing. It is interesting to
mention that there are two of the protocols that are decorated with
NS_PROTOCOL_REQUIRES_EXPLICIT_IMPLEMENTATION, as per Apple documentation
this means that:

'Unlike normal protocols, when you adopt one of the role-specific protocols,
 Xcode may ask you to reimplement methods that have already been implemented
 by one of your ancestors.

 In order to ensure that your control returns accurate and useful information,
 some methods are tagged with the NS_PROTOCOL_REQUIRES_EXPLICIT_IMPLEMENTATION
 attribute. For these methods, you need to override your superclass’s
 implementation with your own.
'

In this case, we need to add the methods from all the parent classes and
set them to be [Abstract] since they are required. Not all methods have
to be added ONLY the required ones.

fixes: #7079
  • Loading branch information
mandel-macaque committed Sep 25, 2019
1 parent 21f7ef9 commit 00c4170
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 4 deletions.
41 changes: 41 additions & 0 deletions src/appkit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25336,6 +25336,15 @@ interface NSAccessibilityRadioButton : NSAccessibilityButton {
NSNumber AccessibilityValue { get; }
}

[Mac (10,10)]
[Protocol]
interface NSAccessibilityCheckBox : NSAccessibilityButton
{
[Abstract]
[NullAllowed, Export ("accessibilityValue")]
NSNumber AccessibilityValue { get; }
}

[Mac (10,10)]
[Protocol]
interface NSAccessibilityStaticText : NSAccessibilityElementProtocol {
Expand Down Expand Up @@ -25489,11 +25498,43 @@ interface NSAccessibilityTable : NSAccessibilityGroup {
}

[Mac (10,10)]
[Protocol]
interface NSAccessibilityOutline : NSAccessibilityTable {
[Abstract]
[NullAllowed, Export ("accessibilityLabel")]
new string AccessibilityLabel { get; }

[Abstract]
[NullAllowed, Export ("accessibilityRows")]
new INSAccessibilityRow[] AccessibilityRows { get; }

[Abstract]
[Export ("accessibilityFrame")]
new CGRect AccessibilityFrame { get; }

[Abstract]
[NullAllowed, Export ("accessibilityParent")]
new NSObject AccessibilityParent { get; }
}

[Mac (10,10)]
[Protocol]
interface NSAccessibilityList : NSAccessibilityTable {
[Abstract]
[NullAllowed, Export ("accessibilityLabel")]
new string AccessibilityLabel { get; }

[Abstract]
[NullAllowed, Export ("accessibilityRows")]
new INSAccessibilityRow[] AccessibilityRows { get; }

[Abstract]
[Export ("accessibilityFrame")]
new CGRect AccessibilityFrame { get; }

[Abstract]
[NullAllowed, Export ("accessibilityParent")]
new NSObject AccessibilityParent { get; }
}

[Mac (10,10)]
Expand Down
31 changes: 27 additions & 4 deletions tests/xtro-sharpie/macOS-AppKit.ignore
Original file line number Diff line number Diff line change
Expand Up @@ -617,9 +617,6 @@
!missing-pinvoke! NSUpdateDynamicServices is not bound
!missing-pinvoke! NSWindowList is not bound
!missing-pinvoke! NSWindowListForContext is not bound
!missing-protocol! NSAccessibilityCheckBox not bound
!missing-protocol! NSAccessibilityList not bound
!missing-protocol! NSAccessibilityOutline not bound
!missing-protocol! NSAnimatablePropertyContainer not bound
!missing-protocol! NSChangeSpelling not bound
!missing-protocol! NSColorPickingCustom not bound
Expand All @@ -637,7 +634,6 @@
!missing-protocol-conformance! NSMenu should conform to NSAccessibilityElement
!missing-protocol-conformance! NSMenuItem should conform to NSAccessibilityElement
!missing-protocol-conformance! NSOpenGLContext should conform to NSLocking
!missing-protocol-conformance! NSOutlineView should conform to NSAccessibilityOutline
!missing-protocol-conformance! NSPageController should conform to NSAnimatablePropertyContainer
!missing-protocol-conformance! NSPathCell should conform to NSOpenSavePanelDelegate
!missing-protocol-conformance! NSSplitViewItem should conform to NSAnimatablePropertyContainer
Expand Down Expand Up @@ -1194,3 +1190,30 @@

!missing-release-attribute-on-return-value! AppKit.NSDictionaryControllerKeyValuePair AppKit.NSDictionaryController::get_NewObject()'s selector's ('newObject') Objective-C method family ('new') indicates that the native method returns a retained object, and as such a '[return: Release]' attribute is required.
!missing-release-attribute-on-return-value! Foundation.NSObject AppKit.NSObjectController::get_NewObject()'s selector's ('newObject') Objective-C method family ('new') indicates that the native method returns a retained object, and as such a '[return: Release]' attribute is required.

## this protocols are decorated with NS_PROTOCOL_REQUIRES_EXPLICIT_IMPLEMENTATION as per apple documentation:
## Unlike normal protocols, when you adopt one of the role-specific protocols, Xcode may ask you to reimplement
## methods that have already been implemented by one of your ancestors.
##
## In order to ensure that your control returns accurate and useful information, some methods are tagged with
## the NS_PROTOCOL_REQUIRES_EXPLICIT_IMPLEMENTATION attribute. For these methods, you need to override your
## superclass’s implementation with your own.
##
## To see which methods require explicit implementations, see the specific protocols reference document.
## In both cases we have:
##
## This protocol requires an explicit implementation of all the required methods that it declares (including
## all the explicitly required methods of any protocol it inherits from). Any class adopting this protocol must
## implement all of these methods. You can inherit these methods only from ancestors that also adopt a protocol
## that explicitly requires them.
##
## In practice, this means that the compiler may force you to override some of the methods that your ancestors
## have already implemented. Simply follow the compiler’s warnings, and reimplement these methods as needed.
!extra-protocol-member! unexpected selector NSAccessibilityList::accessibilityFrame found
!extra-protocol-member! unexpected selector NSAccessibilityList::accessibilityLabel found
!extra-protocol-member! unexpected selector NSAccessibilityList::accessibilityParent found
!extra-protocol-member! unexpected selector NSAccessibilityList::accessibilityRows found
!extra-protocol-member! unexpected selector NSAccessibilityOutline::accessibilityFrame found
!extra-protocol-member! unexpected selector NSAccessibilityOutline::accessibilityLabel found
!extra-protocol-member! unexpected selector NSAccessibilityOutline::accessibilityParent found
!extra-protocol-member! unexpected selector NSAccessibilityOutline::accessibilityRows found

1 comment on commit 00c4170

@xamarin-release-manager
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build was (probably) aborted

🔥 Jenkins job (on internal Jenkins) failed in stage(s) 'Build' 🔥 : hudson.AbortException: script returned exit code 2

🔥 Build failed 🔥

Please sign in to comment.