From 5af02441ddfdcc9f37e93e3384758a6709557116 Mon Sep 17 00:00:00 2001 From: Chris Hamons Date: Tue, 14 Jul 2020 16:11:10 -0500 Subject: [PATCH 1/7] [AppKit] Xcode 12.0 Beta 1 --- src/AppKit/Enums.cs | 54 ++- src/AppKit/NSWorkspace.cs | 4 + src/appkit.cs | 351 +++++++++++++++++- tests/introspection/Mac/MacApiProtocolTest.cs | 18 + tests/xtro-sharpie/macOS-AppKit.ignore | 1 - tests/xtro-sharpie/macOS-AppKit.todo | 110 ------ 6 files changed, 406 insertions(+), 132 deletions(-) delete mode 100644 tests/xtro-sharpie/macOS-AppKit.todo diff --git a/src/AppKit/Enums.cs b/src/AppKit/Enums.cs index 347ab28fc536..f8c12265e006 100644 --- a/src/AppKit/Enums.cs +++ b/src/AppKit/Enums.cs @@ -327,9 +327,11 @@ public enum NSControlTint : ulong { [Native] public enum NSControlSize : ulong { - Regular, - Small, - Mini + Regular = 0, + Small = 1, + Mini = 2, + [Mac (10,16)] + Large = 3 } [Native] @@ -1514,6 +1516,7 @@ public enum NSFontSymbolicTraits : int { // uint32_t NSFontSymbolicTraits TraitTightLeading = 1 << 15, [Mac (10,13)] TraitLooseLeading = 1 << 16, + TraitEmphasized = BoldTrait, UnknownClass = 0 << 28, OldStyleSerifsClass = 1 << 28, TransitionalSerifsClass = 2 << 28, @@ -1737,6 +1740,7 @@ public enum NSTokenStyle : ulong { [Flags] [Native] + [Deprecated (PlatformName.MacOSX, 10, 16)] public enum NSWorkspaceLaunchOptions : ulong { Print = 2, InhibitingBackgroundOnly = 0x80, @@ -3009,4 +3013,48 @@ public enum NSWorkspaceAuthorizationType : long { SetAttributes, ReplaceFile, } + + [Mac (10,16)] + [Native] + public enum NSTableViewStyle : long + { + Automatic, + FullWidth, + Inset, + SourceList + } + + [Mac (10,16)] + [Native] + public enum NSTitlebarSeparatorStyle : long + { + Automatic, + None, + Line, + Shadow + } + + [Mac (10,16)] + [Native] + public enum NSWindowToolbarStyle : long + { + Automatic, + Expanded, + Preference, + Unified, + UnifiedCompact + } + + [Flags, Mac (10,16)] + [Native] + public enum NSTableViewAnimationOptions : ulong + { + EffectNone = 0x0, + EffectFade = 0x1, + EffectGap = 0x2, + SlideUp = 0x10, + SlideDown = 0x20, + SlideLeft = 0x30, + SlideRight = 0x40 + } } diff --git a/src/AppKit/NSWorkspace.cs b/src/AppKit/NSWorkspace.cs index 8f5d4693ff9e..076e7702fcb0 100644 --- a/src/AppKit/NSWorkspace.cs +++ b/src/AppKit/NSWorkspace.cs @@ -9,17 +9,20 @@ namespace AppKit { public partial class NSWorkspace { + [Deprecated (PlatformName.MacOSX, 10, 16, message: "Use 'NSWorkspace.OpenUrls' with complection handler.")] public virtual bool OpenUrls (NSUrl[] urls, string bundleIdentifier, NSWorkspaceLaunchOptions options, NSAppleEventDescriptor descriptor, string[] identifiers) { // Ignore the passed in argument, because if you pass it in we will crash on cleanup. return _OpenUrls (urls, bundleIdentifier, options, descriptor, null); } + [Deprecated (PlatformName.MacOSX, 10, 16, message: "Use 'NSWorkspace.OpenUrls' with complection handler.")] public virtual bool OpenUrls (NSUrl[] urls, string bundleIdentifier, NSWorkspaceLaunchOptions options, NSAppleEventDescriptor descriptor) { return _OpenUrls (urls, bundleIdentifier, options, descriptor, null); } + [Advice ("Use 'NSWorkSpace.IconForContentType'.")] public virtual NSImage IconForFileType (string fileType) { var nsFileType = NSString.CreateNative (fileType); @@ -31,6 +34,7 @@ public virtual NSImage IconForFileType (string fileType) } } + [Advice ("Use 'NSWorkSpace.IconForContentType'.")] public virtual NSImage IconForFileType (HfsTypeCode typeCode) { var nsFileType = GetNSFileType ((uint) typeCode); diff --git a/src/appkit.cs b/src/appkit.cs index fe07826ddfef..7637a18577e2 100644 --- a/src/appkit.cs +++ b/src/appkit.cs @@ -42,6 +42,7 @@ using OpenGL; using CoreVideo; using CloudKit; +using UniformTypeIdentifiers; using CGGlyph = System.UInt16; @@ -999,6 +1000,7 @@ interface NSApplicationDelegate { [Export ("application:openURLs:")] void OpenUrls (NSApplication application, NSUrl[] urls); + [Deprecated (PlatformName.MacOSX, 10, 16, message: "Now optional on NSApplicationDelegate.")] [Export ("application:delegateHandlesKey:"), DelegateName ("NSApplicationHandlesKey"), NoDefaultValue] bool HandlesKey (NSApplication sender, string key); } @@ -1532,6 +1534,7 @@ interface NSBox { [Export ("borderType")] [Advice ("Only used with deprecated NSBoxOldStyle. Use 'Transparent' property for NSNoBorder.")] + [Deprecated (PlatformName.MacOSX, 10, 15, message: "Only used with deprecated NSBoxOldStyle. Use 'Transparent' property for NSNoBorder.")] NSBorderType BorderType { get; set; } [Export ("titlePosition")] @@ -2267,6 +2270,10 @@ interface NSButton : NSAccessibilityButton, NSUserInterfaceCompression, NSUserIn [Mac (10, 14)] [NullAllowed, Export ("contentTintColor", ArgumentSemantic.Copy)] NSColor ContentTintColor { get; set; } + + [NoiOS, Mac (10, 16)] + [Export ("hasDestructiveAction")] + bool HasDestructiveAction { get; set; } } [BaseType (typeof (NSImageRep))] @@ -3668,12 +3675,12 @@ partial interface NSColor : NSCoding, NSCopying, NSSecureCoding, NSPasteboardRea [Static] [Export ("controlShadowColor")] - [Advice ("Use a context specific color, 'SeparatorColor'")] + [Deprecated (PlatformName.MacOSX, 10, 16, message: "Use a context specific color such as 'SeparatorColor.`")] NSColor ControlShadow { get; } [Static] [Export ("controlDarkShadowColor")] - [Advice ("Use a context specific color, 'SeparatorColor'")] + [Deprecated (PlatformName.MacOSX, 10, 16, message: "Use a context specific color such as 'SeparatorColor.`")] NSColor ControlDarkShadow { get; } [Static] @@ -3682,12 +3689,12 @@ partial interface NSColor : NSCoding, NSCopying, NSSecureCoding, NSPasteboardRea [Static] [Export ("controlHighlightColor")] - [Advice ("Use a context specific color, 'SeparatorColor'")] + [Deprecated (PlatformName.MacOSX, 10, 16, message: "Use a context specific color such as 'SeparatorColor.`")] NSColor ControlHighlight { get; } [Static] [Export ("controlLightHighlightColor")] - [Advice ("Use a context specific color, 'SeparatorColor'")] + [Deprecated (PlatformName.MacOSX, 10, 16, message: "Use a context specific color such as 'SeparatorColor.`")] NSColor ControlLightHighlight { get; } [Static] @@ -3745,22 +3752,22 @@ partial interface NSColor : NSCoding, NSCopying, NSSecureCoding, NSPasteboardRea [Static] [Export ("scrollBarColor")] - [Advice ("Use 'NSScroller' instead")] + [Deprecated (PlatformName.MacOSX, 10, 16, message: "Use 'NSScroller' instead.")] NSColor ScrollBar { get; } [Static] [Export ("knobColor")] - [Advice ("Use 'NSScroller' instead")] + [Deprecated (PlatformName.MacOSX, 10, 16, message: "Use 'NSScroller' instead.")] NSColor Knob { get; } [Static] [Export ("selectedKnobColor")] - [Advice ("Use 'NSScroller' instead")] + [Deprecated (PlatformName.MacOSX, 10, 16, message: "Use 'NSScroller' instead")] NSColor SelectedKnob { get; } [Static] [Export ("windowFrameColor")] - [Advice ("Use 'NSVisualEffectMaterial.Title' instead")] + [Deprecated (PlatformName.MacOSX, 10, 16, message: "Use 'NSVisualEffectMaterial.Title' instead.")] NSColor WindowFrame { get; } [Static] @@ -3769,7 +3776,7 @@ partial interface NSColor : NSCoding, NSCopying, NSSecureCoding, NSPasteboardRea [Static] [Export ("selectedMenuItemColor")] - [Advice ("Use 'NSVisualEffectMaterial.Selection' instead")] + [Deprecated (PlatformName.MacOSX, 10, 16, message: "Use 'NSVisualEffectMaterial.Title' instead.")] NSColor SelectedMenuItem { get; } [Static] @@ -3786,7 +3793,7 @@ partial interface NSColor : NSCoding, NSCopying, NSSecureCoding, NSPasteboardRea [Static] [Export ("headerColor")] - [Advice ("Use 'NSVisualEffectMaterial.HeaderView' instead")] + [Deprecated (PlatformName.MacOSX, 10, 16, message: "Use 'NSVisualEffectMaterial.Title' instead.")] NSColor Header { get; } [Static] @@ -4177,6 +4184,7 @@ interface NSColorChanging { [Abstract] [Export ("changeColor:")] + [Deprecated (PlatformName.MacOSX, 10, 16, message: "Use 'NSColorChanging' instead.")] void ChangeColor ([NullAllowed] NSColorPanel sender); } @@ -4866,9 +4874,11 @@ interface NSEditorRegistration interface NSObject_NSEditorRegistration { [Export ("objectDidBeginEditing:")] + [Deprecated (PlatformName.MacOSX, 10, 16, message: "Use 'NSEditorRegistration' instead.")] void ObjectDidBeginEditing (INSEditor editor); [Export ("objectDidEndEditing:")] + [Deprecated (PlatformName.MacOSX, 10, 16, message: "Use 'NSEditorRegistration' instead.")] void ObjectDidEndEditing (INSEditor editor); } @@ -5914,7 +5924,7 @@ interface NSDraggingInfo { [Abstract] #endif [Export ("draggedImage")] - [Advice ("Use 'NSDraggingItem' objects instead.")] + [Deprecated (PlatformName.MacOSX, 10, 16, message: "Use 'NSDraggingItem' objects instead.")] NSImage DraggedImage { get; } #if XAMCORE_4_0 @@ -6169,6 +6179,7 @@ interface NSFontChanging [Export ("changeFont:")] void ChangeFont ([NullAllowed] NSFontManager sender); + [Deprecated (PlatformName.MacOSX, 10, 16, message: "Now optional method.")] [Export ("validModesForFontPanel:")] NSFontPanelModeMask GetValidModes (NSFontPanel fontPanel); } @@ -6495,6 +6506,11 @@ partial interface NSFont : NSSecureCoding, NSCopying { [Export ("monospacedSystemFontOfSize:weight:")] [Internal] IntPtr _MonospacedSystemFont (nfloat fontSize, nfloat weight); + + [Mac (10,16)] + [Static] + [Export ("preferredFontForTextStyle:options:")] + NSFont PreferredFontForTextStyle (string style, NSDictionary options); } interface NSFontCollectionChangedEventArgs { @@ -6722,6 +6738,11 @@ interface NSFontDescriptor : NSSecureCoding, NSCopying { [Export ("fontDescriptorWithDesign:")] [return: NullAllowed] NSFontDescriptor Create (NSFontDescriptorSystemDesign design); + + [Mac (10,16)] + [Static] + [Export ("preferredFontDescriptorForTextStyle:options:")] + NSFontDescriptor PreferredFontDescriptorForTextStyle (string style, NSDictionary options); } [BaseType (typeof (NSObject))] @@ -7919,7 +7940,7 @@ interface NSGestureRecognizerDelegate { [BaseType (typeof (NSObject))] [ThreadSafe] // Not documented anywhere, but their Finder extension sample uses it on non-ui thread - partial interface NSMenu : NSCoding, NSCopying, NSAccessibility, NSAccessibilityElement, NSUserInterfaceItemIdentification { + partial interface NSMenu : NSCoding, NSCopying, NSAccessibility, NSAccessibilityElement, NSAppearanceCustomization, NSUserInterfaceItemIdentification { [DesignatedInitializer] [Export ("initWithTitle:")] IntPtr Constructor (string aTitle); @@ -9002,6 +9023,11 @@ partial interface NSOutlineViewDelegate { [Export ("outlineView:didRemoveRowView:forRow:")] void DidRemoveRowView (NSOutlineView outlineView, NSTableRowView rowView, nint row); + + [Mac (10,16)] + [Export ("outlineView:tintConfigurationForItem:")] + [return: NullAllowed] + NSTintConfiguration OutlineView (NSOutlineView outlineView, NSObject item); } [BaseType (typeof (NSObject))] @@ -9123,10 +9149,6 @@ partial interface NSImage : NSCopying, NSSecureCoding, NSPasteboardReading, NSPa //[Export ("initByReferencingURL:")] //IntPtr Constructor (NSUrl url); - // FIXME: need IconRec - //[Export ("initWithIconRef:")] - //IntPtr Constructor (IconRef iconRef); - [Sealed, Export ("initWithContentsOfFile:"), Internal] IntPtr InitWithContentsOfFile (string fileName); @@ -9307,6 +9329,12 @@ partial interface NSImage : NSCopying, NSSecureCoding, NSPasteboardReading, NSPa [Export ("layerContentsForContentsScale:")] NSObject GetLayerContentsForContentsScale (nfloat layerContentsScale); + + [Mac (10,16)] + [Static] + [Export ("imageWithSystemSymbolName:accessibilityDescription:")] + [return: NullAllowed] + NSImage GetSystemSymbol (string symbolName, [NullAllowed] string description); } public enum NSImageName @@ -12967,8 +12995,13 @@ interface NSSavePanel { [Export ("directoryURL", ArgumentSemantic.Copy)] NSUrl DirectoryUrl { get; set; } + [Advice ("Use 'AllowedContentTypes' instead.")] [Export ("allowedFileTypes")] string [] AllowedFileTypes { get; set; } + + [Mac (10, 16)] + [Export ("allowedContentTypes", ArgumentSemantic.Copy)] + UTType[] AllowedContentTypes { get; set; } [Export ("allowsOtherFileTypes")] bool AllowsOtherFileTypes { get; set; } @@ -13434,14 +13467,17 @@ interface NSSearchField { bool SendsSearchStringImmediately { get; set; } [Mac (10,11)] + [Advice ("Use 'SearchTextBounds' instead.`")] [Export ("rectForSearchTextWhenCentered:")] CGRect GetRectForSearchText (bool isCentered); [Mac (10,11)] + [Advice ("Use 'SearchButtonBounds' instead.`")] [Export ("rectForSearchButtonWhenCentered:")] CGRect GetRectForSearchButton (bool isCentered); [Mac (10,11)] + [Advice ("Use 'CancelButtonBounds' instead.`")] [Export ("rectForCancelButtonWhenCentered:")] CGRect GetRectForCancelButton (bool isCentered); @@ -13454,8 +13490,21 @@ interface NSSearchField { NSObject WeakDelegate { get; set; } [Mac (10,11)] + [Advice ("No longer availabile, now a no-op")] [Export ("centersPlaceholder")] bool CentersPlaceholder { get; set; } + + [Mac (10, 16)] + [Export ("searchTextBounds")] + CGRect SearchTextBounds { get; } + + [Mac (10, 16)] + [Export ("searchButtonBounds")] + CGRect SearchButtonBounds { get; } + + [Mac (10, 16)] + [Export ("cancelButtonBounds")] + CGRect CancelButtonBounds { get; } } [BaseType (typeof (NSObject))] @@ -14587,6 +14636,14 @@ interface NSSplitViewItem : NSAnimatablePropertyContainer, NSCoding { [Mac (10,11)] [Field ("NSSplitViewItemUnspecifiedDimension")] nfloat UnspecifiedDimension { get; } + + [Mac (10, 16)] + [Export ("allowsFullHeightLayout")] + bool AllowsFullHeightLayout { get; set; } + + [Mac (10, 16)] + [Export ("titlebarSeparatorStyle", ArgumentSemantic.Assign)] + NSTitlebarSeparatorStyle TitlebarSeparatorStyle { get; set; } } [BaseType (typeof (NSObject))] @@ -16233,6 +16290,26 @@ partial interface NSView : NSDraggingDestination, NSAnimatablePropertyContainer, [Mac (10, 15)] [Export ("verticalContentSizeConstraintActive")] bool VerticalContentSizeConstraintActive { [Bind ("isVerticalContentSizeConstraintActive")] get; set; } + + [Mac (10, 16)] + [Export ("safeAreaInsets")] + NSEdgeInsets SafeAreaInsets { get; } + + [Mac (10, 16)] + [Export ("additionalSafeAreaInsets", ArgumentSemantic.Assign)] + NSEdgeInsets AdditionalSafeAreaInsets { get; set; } + + [Mac (10, 16)] + [Export ("safeAreaLayoutGuide", ArgumentSemantic.Strong)] + NSLayoutGuide SafeAreaLayoutGuide { get; } + + [Mac (10, 16)] + [Export ("safeAreaRect")] + CGRect SafeAreaRect { get; } + + [Mac (10, 16)] + [Export ("layoutMarginsGuide", ArgumentSemantic.Strong)] + NSLayoutGuide LayoutMarginsGuide { get; } } [BaseType (typeof (NSAnimation))] @@ -17078,6 +17155,14 @@ partial interface NSTableView : NSDraggingSource, NSAccessibilityTable { [Mac (10, 13)] [Export ("usesAutomaticRowHeights")] bool UsesAutomaticRowHeights { get; set; } + + [Mac (10, 16)] + [Export ("style", ArgumentSemantic.Assign)] + NSTableViewStyle Style { get; set; } + + [Mac (10, 16)] + [Export ("effectiveStyle")] + NSTableViewStyle EffectiveStyle { get; } } [BaseType (typeof (NSObject))] @@ -17997,7 +18082,7 @@ interface NSTextBlock : NSCoding, NSCopying, NSSecureCoding { } [BaseType (typeof (NSControl), Delegates=new string [] { "Delegate" }, Events=new Type [] { typeof (NSTextFieldDelegate)})] - partial interface NSTextField : NSAccessibilityNavigableStaticText, NSUserInterfaceValidations { + partial interface NSTextField : NSAccessibilityNavigableStaticText, NSUserInterfaceValidations, NSTextContent { [Export ("initWithFrame:")] IntPtr Constructor (CGRect frameRect); @@ -18098,6 +18183,14 @@ partial interface NSTextField : NSAccessibilityNavigableStaticText, NSUserInterf [Static] [Export ("textFieldWithString:")] NSTextField CreateTextField ([NullAllowed] string stringValue); + + [Mac (10, 16)] + NSTextContentType ContentType { + [Wrap ("NSTextContentTypeExtensions.GetValue (GetContentType ()!)")] + get; + [Wrap ("SetContentType (value.GetConstant()!)")] + set; + } } [Mac (10, 12, 1)] @@ -18729,7 +18822,7 @@ interface NSTextInput } [BaseType (typeof (NSText), Delegates=new string [] { "Delegate" }, Events=new Type [] { typeof (NSTextViewDelegate)})] - partial interface NSTextView : NSTextInputClient, NSTextLayoutOrientationProvider, NSDraggingSource, NSTextFinderClient, NSAccessibilityNavigableStaticText, NSCandidateListTouchBarItemDelegate, NSTouchBarDelegate, NSMenuItemValidation, NSUserInterfaceValidations, NSTextInput + partial interface NSTextView : NSTextInputClient, NSTextLayoutOrientationProvider, NSDraggingSource, NSTextFinderClient, NSAccessibilityNavigableStaticText, NSCandidateListTouchBarItemDelegate, NSTouchBarDelegate, NSMenuItemValidation, NSUserInterfaceValidations, NSTextInput, NSTextContent #if XAMCORE_4_0 , NSColorChanging, // ChangeColor has the wrong param type #endif @@ -19269,6 +19362,14 @@ partial interface NSTextView : NSTextInputClient, NSTextLayoutOrientationProvide [Static] [Export ("scrollablePlainDocumentContentTextView")] NSScrollView CreateScrollablePlainDocumentContentTextView (); + + [Mac (10, 16)] + NSTextContentType ContentType { + [Wrap ("NSTextContentTypeExtensions.GetValue (GetContentType ()!)")] + get; + [Wrap ("SetContentType (value.GetConstant()!)")] + set; + } } [BaseType (typeof (NSObject))] @@ -19554,6 +19655,7 @@ partial interface NSToolbar { bool AutosavesConfiguration { get; set; } [Field ("NSToolbarSeparatorItemIdentifier")] + [Deprecated (PlatformName.MacOSX, 10, 16, message: "Ignored by system.")] NSString NSToolbarSeparatorItemIdentifier { get; } [Field ("NSToolbarSpaceItemIdentifier")] @@ -19569,6 +19671,7 @@ partial interface NSToolbar { NSString NSToolbarShowFontsItemIdentifier { get; } [Field ("NSToolbarCustomizeToolbarItemIdentifier")] + [Deprecated (PlatformName.MacOSX, 10, 16, message: "Ignored by system.")] NSString NSToolbarCustomizeToolbarItemIdentifier { get; } [Field ("NSToolbarPrintItemIdentifier")] @@ -19589,6 +19692,10 @@ partial interface NSToolbar { [Mac (10, 14)] [NullAllowed, Export ("centeredItemIdentifier")] string CenteredItemIdentifier { get; set; } + + [Mac (10, 16)] + [Field ("NSToolbarSidebarTrackingSeparatorItemIdentifier")] + NSString NSToolbarSidebarTrackingSeparatorItemIdentifier { get; } } [BaseType (typeof (NSObject))] @@ -19685,9 +19792,11 @@ interface NSToolbarItem : NSCopying, NSMenuItemValidation, NSValidatedUserInterf NSView View { get; set; } [Export ("minSize")] + [Advice("Use system constraints instead.")] CGSize MinSize { get; set; } [Export ("maxSize")] + [Advice("Use system constraints instead.")] CGSize MaxSize { get; set; } [Export ("visibilityPriority")] @@ -19703,6 +19812,10 @@ interface NSToolbarItem : NSCopying, NSMenuItemValidation, NSValidatedUserInterf [Mac (10, 15)] [Export ("bordered")] bool Bordered { [Bind ("isBordered")] get; set; } + + [Mac (10, 16), iOS (14, 0)] + [Export ("navigational")] + bool Navigational { [Bind ("isNavigational")] get; set; } } [BaseType (typeof (NSToolbarItem))] @@ -20963,6 +21076,18 @@ partial interface NSWindow : NSAnimatablePropertyContainer, NSUserInterfaceItemI [Mac (10, 14)] [Export ("appearanceSource", ArgumentSemantic.Weak)] INSAppearanceCustomization AppearanceSource { get; set; } + + [Mac (10, 16)] + [Export ("subtitle")] + string Subtitle { get; set; } + + [Mac (10, 16)] + [Export ("toolbarStyle", ArgumentSemantic.Assign)] + NSWindowToolbarStyle ToolbarStyle { get; set; } + + [Mac (10, 16)] + [Export ("titlebarSeparatorStyle", ArgumentSemantic.Assign)] + NSTitlebarSeparatorStyle TitlebarSeparatorStyle { get; set; } } [Mac (10,10)] @@ -21358,6 +21483,7 @@ interface NSWorkspace : NSWorkspaceAccessibilityExtensions { void NoteFileSystemChanged (string path); [Export ("getInfoForFile:application:type:"), ThreadSafe] + [Advice ("Use 'NSWorkspace.UrlForApplication' or 'NSUrl.GetResourceValue' instead")] bool GetInfo (string fullPath, out string appName, out string fileType); [Export ("isFilePackageAtPath:"), ThreadSafe] @@ -21442,17 +21568,22 @@ interface NSWorkspace : NSWorkspaceAccessibilityExtensions { NSDictionary ActiveApplication { get; } [Export ("typeOfFile:error:"), ThreadSafe] + [Advice ("Use 'NSUrl.GetResourceValue' instead.")] string TypeOfFile (string absoluteFilePath, out NSError outError); + [Advice ("Use 'UTType.LocalizedDescription' instead.")] [Export ("localizedDescriptionForType:"), ThreadSafe] string LocalizedDescription (string typeName); + [Advice ("Use 'UTType.PreferredFilenameExtension' instead.")] [Export ("preferredFilenameExtensionForType:"), ThreadSafe] string PreferredFilenameExtension (string typeName); + [Advice ("Compare against 'UTType.GetTypes' instead.")] [Export ("filenameExtension:isValidForType:"), ThreadSafe] bool IsFilenameExtensionValid (string filenameExtension, string typeName); + [Advice ("Use 'UTType.ConformsToType' instead.")] [Export ("type:conformsToType:"), ThreadSafe] bool TypeConformsTo (string firstTypeName, string secondTypeName); @@ -21628,6 +21759,10 @@ interface NSWorkspace : NSWorkspaceAccessibilityExtensions { [Async] [Export ("openURLs:withApplicationAtURL:configuration:completionHandler:")] void OpenUrls (NSUrl[] urls, NSUrl applicationUrl, NSWorkspaceOpenConfiguration configuration, [NullAllowed] Action completionHandler); + + [Mac (10,16)] + [Export ("iconForContentType:")] + NSImage IconForContentType (UTType contentType); } [Mac (10,14)] @@ -27666,6 +27801,43 @@ public enum NSFontDescriptorSystemDesign Rounded, } + [Mac (10, 16)] + public enum NSFontTextStyle + { + [Field ("NSFontTextStyleLargeTitle")] + NSFontTextStyleLargeTitle, + + [Field ("NSFontTextStyleTitle1")] + NSFontTextStyleTitle1, + + [Field ("NSFontTextStyleTitle2")] + NSFontTextStyleTitle2, + + [Field ("NSFontTextStyleTitle3")] + NSFontTextStyleTitle3, + + [Field ("NSFontTextStyleHeadline")] + NSFontTextStyleHeadline, + + [Field ("NSFontTextStyleSubheadline")] + NSFontTextStyleSubheadline, + + [Field ("NSFontTextStyleBody")] + NSFontTextStyleBody, + + [Field ("NSFontTextStyleCallout")] + NSFontTextStyleCallout, + + [Field ("NSFontTextStyleFootnote")] + NSFontTextStyleFootnote, + + [Field ("NSFontTextStyleCaption1")] + NSFontTextStyleCaption1, + + [Field ("NSFontTextStyleCaption2")] + NSFontTextStyleCaption2, + } + [Mac (10,15), iOS (10,13)] [BaseType (typeof (NSToolbarItem))] interface NSSharingServicePickerToolbarItem @@ -27689,4 +27861,147 @@ interface NSSharingServicePickerToolbarItemDelegate [Export ("itemsForSharingServicePickerToolbarItem:")] NSObject[] GetItems (NSSharingServicePickerToolbarItem pickerToolbarItem); } + + [Unavailable (PlatformName.MacCatalyst)] + [Mac (10,16)] + [BaseType (typeof(NSToolbarItem))] + interface NSSearchToolbarItem + { + [DesignatedInitializer] + [Export ("initWithItemIdentifier:")] + IntPtr Constructor (string itemIdentifier); + + [Export ("searchField", ArgumentSemantic.Strong)] + NSSearchField SearchField { get; set; } + + [Export ("resignsFirstResponderWithCancel")] + bool ResignsFirstResponderWithCancel { get; set; } + + [Export ("minimumWidthForSearchFieldRepresentation")] + nfloat MinimumWidthForSearchFieldRepresentation { get; set; } + + [Export ("preferredWidthForSearchFieldRepresentation")] + nfloat PreferredWidthForSearchFieldRepresentation { get; set; } + } + + delegate NSView NSTableViewDiffableDataSourceCellProvider (NSTableView arg0, NSTableColumn arg1, nint arg2, NSObject arg3); + delegate NSTableRowView NSTableViewDiffableDataSourceRowProvider (NSTableView arg0, nint arg1, NSObject arg2); + delegate NSView NSTableViewDiffableDataSourceSectionHeaderViewProvider (NSTableView arg0, nint arg1, NSObject arg2); + + [Mac (10,16)] + [BaseType (typeof(NSObject))] + [DisableDefaultCtor] + interface NSTableViewDiffableDataSource : NSTableViewDataSource + { + [Export ("initWithTableView:cellProvider:")] + IntPtr Constructor (NSTableView tableView, NSTableViewDiffableDataSourceCellProvider cellProvider); + + [Export ("snapshot")] + NSDiffableDataSourceSnapshot Snapshot (); + + [Export ("applySnapshot:animatingDifferences:")] + void ApplySnapshot (NSDiffableDataSourceSnapshot snapshot, bool animatingDifferences); + + [Export ("applySnapshot:animatingDifferences:completion:")] + void ApplySnapshot (NSDiffableDataSourceSnapshot snapshot, bool animatingDifferences, [NullAllowed] Action completion); + + [Export ("itemIdentifierForRow:")] + [return: NullAllowed] + NSObject ItemIdentifierForRow (nint row); + + [Export ("rowForItemIdentifier:")] + nint RowForItemIdentifier (NSObject identifier); + + [Export ("sectionIdentifierForRow:")] + [return: NullAllowed] + NSObject SectionIdentifierForRow (nint row); + + [Export ("rowForSectionIdentifier:")] + nint RowForSectionIdentifier (NSObject identifier); + + [NullAllowed, Export ("rowViewProvider", ArgumentSemantic.Copy)] + NSTableViewDiffableDataSourceRowProvider RowViewProvider { get; set; } + + [NullAllowed, Export ("sectionHeaderViewProvider", ArgumentSemantic.Copy)] + NSTableViewDiffableDataSourceSectionHeaderViewProvider SectionHeaderViewProvider { get; set; } + + [Export ("defaultRowAnimation", ArgumentSemantic.Assign)] + NSTableViewAnimationOptions DefaultRowAnimation { get; set; } + } + + [Protocol] + interface NSTextContent + { + [Mac (10, 16)] + [Abstract] + [Export ("contentType")] + NSString GetContentType (); + + [Mac (10, 16)] + [Abstract] + [Export ("setContentType:")] + void SetContentType (NSString contentType); + } + + + [Mac (10, 16)] + enum NSTextContentType { + [Field ("NSTextContentTypeUsername")] + NSTextContentTypeUsername, + + [Field ("NSTextContentTypePassword")] + NSTextContentTypePassword, + + [Field ("NSTextContentTypeOneTimeCode")] + NSTextContentTypeOneTimeCode, + } + + [Mac (10,16)] + [BaseType (typeof(NSObject))] + interface NSTintConfiguration : NSCopying, NSSecureCoding + { + [Static] + [Export ("defaultTintConfiguration", ArgumentSemantic.Strong)] + NSTintConfiguration DefaultTintConfiguration { get; } + + [Static] + [Export ("monochromeTintConfiguration", ArgumentSemantic.Strong)] + NSTintConfiguration MonochromeTintConfiguration { get; } + + [Static] + [Export ("tintConfigurationWithPreferredColor:")] + NSTintConfiguration TintConfigurationWithPreferredColor (NSColor color); + + [Static] + [Export ("tintConfigurationWithFixedColor:")] + NSTintConfiguration TintConfigurationWithFixedColor (NSColor color); + + [NullAllowed, Export ("baseTintColor", ArgumentSemantic.Strong)] + NSColor BaseTintColor { get; } + + [NullAllowed, Export ("equivalentContentTintColor", ArgumentSemantic.Strong)] + NSColor EquivalentContentTintColor { get; } + + [Export ("adaptsToUserAccentColor")] + bool AdaptsToUserAccentColor { get; } + } + + [Mac (10,16)] + [BaseType (typeof(NSToolbarItem))] + interface NSTrackingSeparatorToolbarItem + { + [DesignatedInitializer] + [Export ("initWithItemIdentifier:")] + IntPtr Constructor (string itemIdentifier); + + [Static] + [Export ("trackingSeparatorToolbarItemWithIdentifier:splitView:dividerIndex:")] + NSTrackingSeparatorToolbarItem GetTrackingSeparatorToolbar (string identifier, NSSplitView splitView, nint dividerIndex); + + [Export ("splitView", ArgumentSemantic.Strong)] + NSSplitView SplitView { get; set; } + + [Export ("dividerIndex")] + nint DividerIndex { get; set; } + } } diff --git a/tests/introspection/Mac/MacApiProtocolTest.cs b/tests/introspection/Mac/MacApiProtocolTest.cs index da5063ccf203..243eb6ce33d6 100644 --- a/tests/introspection/Mac/MacApiProtocolTest.cs +++ b/tests/introspection/Mac/MacApiProtocolTest.cs @@ -246,6 +246,10 @@ protected override bool Skip (Type type, string protocolName) if (!Mac.CheckSystemVersion (10, 14)) // Was added in 10.14 return true; break; + case "NSMenu": + if (!Mac.CheckSystemVersion (10, 16)) + return true; + break; } break; case "NSUserInterfaceValidations": @@ -274,6 +278,20 @@ protected override bool Skip (Type type, string protocolName) break; } break; + case "NSTextContent": + switch (type.Name) { + case "NSTextField": + case "NSTextView": + case "NSTokenField": + case "NSComboBox": + case "NSSearchField": + case "NSSecureTextField": + if (!Mac.CheckSystemVersion (10, 16)) + return true; + break; + + } + break; } switch (type.Name) { diff --git a/tests/xtro-sharpie/macOS-AppKit.ignore b/tests/xtro-sharpie/macOS-AppKit.ignore index 204e21a70337..73c77f02946e 100644 --- a/tests/xtro-sharpie/macOS-AppKit.ignore +++ b/tests/xtro-sharpie/macOS-AppKit.ignore @@ -167,7 +167,6 @@ !missing-enum! NSPDFPanelOptions not bound !missing-enum! NSSplitViewItemCollapseBehavior not bound !missing-enum! NSTableColumnResizingOptions not bound -!missing-enum! NSTableViewAnimationOptions not bound !missing-enum! NSTableViewGridLineStyle not bound !missing-enum! NSWindowStyleMask not bound !missing-enum! NSWritingDirectionFormatType not bound diff --git a/tests/xtro-sharpie/macOS-AppKit.todo b/tests/xtro-sharpie/macOS-AppKit.todo deleted file mode 100644 index b9f99b78f4ee..000000000000 --- a/tests/xtro-sharpie/macOS-AppKit.todo +++ /dev/null @@ -1,110 +0,0 @@ -!deprecated-attribute-missing! NSSavePanel::allowedFileTypes missing a [Deprecated] attribute -!deprecated-attribute-missing! NSSavePanel::setAllowedFileTypes: missing a [Deprecated] attribute -!deprecated-attribute-missing! NSSearchField::centersPlaceholder missing a [Deprecated] attribute -!deprecated-attribute-missing! NSSearchField::rectForCancelButtonWhenCentered: missing a [Deprecated] attribute -!deprecated-attribute-missing! NSSearchField::rectForSearchButtonWhenCentered: missing a [Deprecated] attribute -!deprecated-attribute-missing! NSSearchField::rectForSearchTextWhenCentered: missing a [Deprecated] attribute -!deprecated-attribute-missing! NSSearchField::setCentersPlaceholder: missing a [Deprecated] attribute -!deprecated-attribute-missing! NSToolbarItem::maxSize missing a [Deprecated] attribute -!deprecated-attribute-missing! NSToolbarItem::minSize missing a [Deprecated] attribute -!deprecated-attribute-missing! NSToolbarItem::setMaxSize: missing a [Deprecated] attribute -!deprecated-attribute-missing! NSToolbarItem::setMinSize: missing a [Deprecated] attribute -!deprecated-attribute-missing! NSWorkspace::filenameExtension:isValidForType: missing a [Deprecated] attribute -!deprecated-attribute-missing! NSWorkspace::getInfoForFile:application:type: missing a [Deprecated] attribute -!deprecated-attribute-missing! NSWorkspace::localizedDescriptionForType: missing a [Deprecated] attribute -!deprecated-attribute-missing! NSWorkspace::preferredFilenameExtensionForType: missing a [Deprecated] attribute -!deprecated-attribute-missing! NSWorkspace::type:conformsToType: missing a [Deprecated] attribute -!deprecated-attribute-missing! NSWorkspace::typeOfFile:error: missing a [Deprecated] attribute -!missing-enum! NSTableViewStyle not bound -!missing-enum! NSTitlebarSeparatorStyle not bound -!missing-enum! NSWindowToolbarStyle not bound -!missing-field! NSFontTextStyleBody not bound -!missing-field! NSFontTextStyleCallout not bound -!missing-field! NSFontTextStyleCaption1 not bound -!missing-field! NSFontTextStyleCaption2 not bound -!missing-field! NSFontTextStyleFootnote not bound -!missing-field! NSFontTextStyleHeadline not bound -!missing-field! NSFontTextStyleLargeTitle not bound -!missing-field! NSFontTextStyleSubheadline not bound -!missing-field! NSFontTextStyleTitle1 not bound -!missing-field! NSFontTextStyleTitle2 not bound -!missing-field! NSFontTextStyleTitle3 not bound -!missing-field! NSTextContentTypeOneTimeCode not bound -!missing-field! NSTextContentTypePassword not bound -!missing-field! NSTextContentTypeUsername not bound -!missing-field! NSToolbarSidebarTrackingSeparatorItemIdentifier not bound -!missing-protocol! NSTextContent not bound -!missing-protocol-conformance! NSMenu should conform to NSAppearanceCustomization -!missing-protocol-conformance! NSTextField should conform to NSTextContent -!missing-protocol-conformance! NSTextView should conform to NSTextContent -!missing-protocol-member! NSOutlineViewDelegate::outlineView:tintConfigurationForItem: not found -!missing-selector! +NSFont::preferredFontForTextStyle:options: not bound -!missing-selector! +NSFontDescriptor::preferredFontDescriptorForTextStyle:options: not bound -!missing-selector! +NSImage::imageWithSystemSymbolName:accessibilityDescription: not bound -!missing-selector! +NSTintConfiguration::defaultTintConfiguration not bound -!missing-selector! +NSTintConfiguration::monochromeTintConfiguration not bound -!missing-selector! +NSTintConfiguration::tintConfigurationWithFixedColor: not bound -!missing-selector! +NSTintConfiguration::tintConfigurationWithPreferredColor: not bound -!missing-selector! +NSTrackingSeparatorToolbarItem::trackingSeparatorToolbarItemWithIdentifier:splitView:dividerIndex: not bound -!missing-selector! NSButton::hasDestructiveAction not bound -!missing-selector! NSButton::setHasDestructiveAction: not bound -!missing-selector! NSSavePanel::allowedContentTypes not bound -!missing-selector! NSSavePanel::setAllowedContentTypes: not bound -!missing-selector! NSSearchField::cancelButtonBounds not bound -!missing-selector! NSSearchField::searchButtonBounds not bound -!missing-selector! NSSearchField::searchTextBounds not bound -!missing-selector! NSSearchToolbarItem::minimumWidthForSearchFieldRepresentation not bound -!missing-selector! NSSearchToolbarItem::preferredWidthForSearchFieldRepresentation not bound -!missing-selector! NSSearchToolbarItem::resignsFirstResponderWithCancel not bound -!missing-selector! NSSearchToolbarItem::searchField not bound -!missing-selector! NSSearchToolbarItem::setMinimumWidthForSearchFieldRepresentation: not bound -!missing-selector! NSSearchToolbarItem::setPreferredWidthForSearchFieldRepresentation: not bound -!missing-selector! NSSearchToolbarItem::setResignsFirstResponderWithCancel: not bound -!missing-selector! NSSearchToolbarItem::setSearchField: not bound -!missing-selector! NSSplitViewItem::allowsFullHeightLayout not bound -!missing-selector! NSSplitViewItem::setAllowsFullHeightLayout: not bound -!missing-selector! NSSplitViewItem::setTitlebarSeparatorStyle: not bound -!missing-selector! NSSplitViewItem::titlebarSeparatorStyle not bound -!missing-selector! NSTableView::effectiveStyle not bound -!missing-selector! NSTableView::setStyle: not bound -!missing-selector! NSTableView::style not bound -!missing-selector! NSTableViewDiffableDataSource::applySnapshot:animatingDifferences: not bound -!missing-selector! NSTableViewDiffableDataSource::applySnapshot:animatingDifferences:completion: not bound -!missing-selector! NSTableViewDiffableDataSource::defaultRowAnimation not bound -!missing-selector! NSTableViewDiffableDataSource::initWithTableView:cellProvider: not bound -!missing-selector! NSTableViewDiffableDataSource::itemIdentifierForRow: not bound -!missing-selector! NSTableViewDiffableDataSource::rowForItemIdentifier: not bound -!missing-selector! NSTableViewDiffableDataSource::rowForSectionIdentifier: not bound -!missing-selector! NSTableViewDiffableDataSource::rowViewProvider not bound -!missing-selector! NSTableViewDiffableDataSource::sectionHeaderViewProvider not bound -!missing-selector! NSTableViewDiffableDataSource::sectionIdentifierForRow: not bound -!missing-selector! NSTableViewDiffableDataSource::setDefaultRowAnimation: not bound -!missing-selector! NSTableViewDiffableDataSource::setRowViewProvider: not bound -!missing-selector! NSTableViewDiffableDataSource::setSectionHeaderViewProvider: not bound -!missing-selector! NSTableViewDiffableDataSource::snapshot not bound -!missing-selector! NSTintConfiguration::adaptsToUserAccentColor not bound -!missing-selector! NSTintConfiguration::baseTintColor not bound -!missing-selector! NSTintConfiguration::equivalentContentTintColor not bound -!missing-selector! NSToolbarItem::isNavigational not bound -!missing-selector! NSToolbarItem::setNavigational: not bound -!missing-selector! NSTrackingSeparatorToolbarItem::dividerIndex not bound -!missing-selector! NSTrackingSeparatorToolbarItem::setDividerIndex: not bound -!missing-selector! NSTrackingSeparatorToolbarItem::setSplitView: not bound -!missing-selector! NSTrackingSeparatorToolbarItem::splitView not bound -!missing-selector! NSView::additionalSafeAreaInsets not bound -!missing-selector! NSView::layoutMarginsGuide not bound -!missing-selector! NSView::safeAreaInsets not bound -!missing-selector! NSView::safeAreaLayoutGuide not bound -!missing-selector! NSView::safeAreaRect not bound -!missing-selector! NSView::setAdditionalSafeAreaInsets: not bound -!missing-selector! NSWindow::setSubtitle: not bound -!missing-selector! NSWindow::setTitlebarSeparatorStyle: not bound -!missing-selector! NSWindow::setToolbarStyle: not bound -!missing-selector! NSWindow::subtitle not bound -!missing-selector! NSWindow::titlebarSeparatorStyle not bound -!missing-selector! NSWindow::toolbarStyle not bound -!missing-selector! NSWorkspace::iconForContentType: not bound -!missing-type! NSSearchToolbarItem not bound -!missing-type! NSTableViewDiffableDataSource not bound -!missing-type! NSTintConfiguration not bound -!missing-type! NSTrackingSeparatorToolbarItem not bound From 2296d72a63a3a79ccab2785194a8d4c103560f1e Mon Sep 17 00:00:00 2001 From: Chris Hamons Date: Thu, 16 Jul 2020 10:57:29 -0500 Subject: [PATCH 2/7] Apply suggestions from code review Co-authored-by: Rolf Bjarne Kvinge Co-authored-by: Alex Soto --- src/appkit.cs | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/appkit.cs b/src/appkit.cs index 7637a18577e2..729da34770fe 100644 --- a/src/appkit.cs +++ b/src/appkit.cs @@ -19792,11 +19792,11 @@ interface NSToolbarItem : NSCopying, NSMenuItemValidation, NSValidatedUserInterf NSView View { get; set; } [Export ("minSize")] - [Advice("Use system constraints instead.")] + [Advice ("Use system constraints instead.")] CGSize MinSize { get; set; } [Export ("maxSize")] - [Advice("Use system constraints instead.")] + [Advice ("Use system constraints instead.")] CGSize MaxSize { get; set; } [Export ("visibilityPriority")] @@ -21483,7 +21483,7 @@ interface NSWorkspace : NSWorkspaceAccessibilityExtensions { void NoteFileSystemChanged (string path); [Export ("getInfoForFile:application:type:"), ThreadSafe] - [Advice ("Use 'NSWorkspace.UrlForApplication' or 'NSUrl.GetResourceValue' instead")] + [Advice ("Use 'NSWorkspace.UrlForApplication' or 'NSUrl.GetResourceValue' instead.")] bool GetInfo (string fullPath, out string appName, out string fileType); [Export ("isFilePackageAtPath:"), ThreadSafe] @@ -21762,7 +21762,7 @@ interface NSWorkspace : NSWorkspaceAccessibilityExtensions { [Mac (10,16)] [Export ("iconForContentType:")] - NSImage IconForContentType (UTType contentType); + NSImage GetIcon (UTType contentType); } [Mac (10,14)] @@ -27805,37 +27805,37 @@ public enum NSFontDescriptorSystemDesign public enum NSFontTextStyle { [Field ("NSFontTextStyleLargeTitle")] - NSFontTextStyleLargeTitle, + LargeTitle, [Field ("NSFontTextStyleTitle1")] - NSFontTextStyleTitle1, + Title1, [Field ("NSFontTextStyleTitle2")] - NSFontTextStyleTitle2, + Title2, [Field ("NSFontTextStyleTitle3")] - NSFontTextStyleTitle3, + Title3, [Field ("NSFontTextStyleHeadline")] - NSFontTextStyleHeadline, + Headline, [Field ("NSFontTextStyleSubheadline")] - NSFontTextStyleSubheadline, + Subheadline, [Field ("NSFontTextStyleBody")] - NSFontTextStyleBody, + Body, [Field ("NSFontTextStyleCallout")] - NSFontTextStyleCallout, + Callout, [Field ("NSFontTextStyleFootnote")] - NSFontTextStyleFootnote, + Footnote, [Field ("NSFontTextStyleCaption1")] - NSFontTextStyleCaption1, + Caption1, [Field ("NSFontTextStyleCaption2")] - NSFontTextStyleCaption2, + Caption2, } [Mac (10,15), iOS (10,13)] @@ -27907,17 +27907,17 @@ interface NSTableViewDiffableDataSource : NSTableViewDataSource [Export ("itemIdentifierForRow:")] [return: NullAllowed] - NSObject ItemIdentifierForRow (nint row); + NSObject GetItemIdentifier (nint row); [Export ("rowForItemIdentifier:")] - nint RowForItemIdentifier (NSObject identifier); + nint GetRowForItemIdentifier (NSObject itemIdentifier); [Export ("sectionIdentifierForRow:")] [return: NullAllowed] - NSObject SectionIdentifierForRow (nint row); + NSObject GetSectionIdentifier (nint row); [Export ("rowForSectionIdentifier:")] - nint RowForSectionIdentifier (NSObject identifier); + nint GetRowForSectionIdentifier (NSObject sectionIdentifier); [NullAllowed, Export ("rowViewProvider", ArgumentSemantic.Copy)] NSTableViewDiffableDataSourceRowProvider RowViewProvider { get; set; } @@ -27947,13 +27947,13 @@ interface NSTextContent [Mac (10, 16)] enum NSTextContentType { [Field ("NSTextContentTypeUsername")] - NSTextContentTypeUsername, + Username, [Field ("NSTextContentTypePassword")] - NSTextContentTypePassword, + Password, [Field ("NSTextContentTypeOneTimeCode")] - NSTextContentTypeOneTimeCode, + OneTimeCode, } [Mac (10,16)] @@ -27970,11 +27970,11 @@ interface NSTintConfiguration : NSCopying, NSSecureCoding [Static] [Export ("tintConfigurationWithPreferredColor:")] - NSTintConfiguration TintConfigurationWithPreferredColor (NSColor color); + NSTintConfiguration CreateWithPreferredColor (NSColor color); [Static] [Export ("tintConfigurationWithFixedColor:")] - NSTintConfiguration TintConfigurationWithFixedColor (NSColor color); + NSTintConfiguration CreateWithFixedColor (NSColor color); [NullAllowed, Export ("baseTintColor", ArgumentSemantic.Strong)] NSColor BaseTintColor { get; } From f8fde5e6a96ef345ef176dd95f2500d173f3ba53 Mon Sep 17 00:00:00 2001 From: Chris Hamons Date: Thu, 16 Jul 2020 11:08:09 -0500 Subject: [PATCH 3/7] More code review changes --- src/AppKit/Enums.cs | 10 +++++----- src/AppKit/NSWorkspace.cs | 4 ++-- src/appkit.cs | 41 ++++++++++++++++++++------------------- 3 files changed, 28 insertions(+), 27 deletions(-) diff --git a/src/AppKit/Enums.cs b/src/AppKit/Enums.cs index f8c12265e006..37a6a3a1e997 100644 --- a/src/AppKit/Enums.cs +++ b/src/AppKit/Enums.cs @@ -3021,7 +3021,7 @@ public enum NSTableViewStyle : long Automatic, FullWidth, Inset, - SourceList + SourceList, } [Mac (10,16)] @@ -3031,7 +3031,7 @@ public enum NSTitlebarSeparatorStyle : long Automatic, None, Line, - Shadow + Shadow, } [Mac (10,16)] @@ -3042,10 +3042,10 @@ public enum NSWindowToolbarStyle : long Expanded, Preference, Unified, - UnifiedCompact + UnifiedCompact, } - [Flags, Mac (10,16)] + [Flags, Mac (10,7)] [Native] public enum NSTableViewAnimationOptions : ulong { @@ -3055,6 +3055,6 @@ public enum NSTableViewAnimationOptions : ulong SlideUp = 0x10, SlideDown = 0x20, SlideLeft = 0x30, - SlideRight = 0x40 + SlideRight = 0x40, } } diff --git a/src/AppKit/NSWorkspace.cs b/src/AppKit/NSWorkspace.cs index 076e7702fcb0..def27e791e12 100644 --- a/src/AppKit/NSWorkspace.cs +++ b/src/AppKit/NSWorkspace.cs @@ -22,7 +22,7 @@ public virtual bool OpenUrls (NSUrl[] urls, string bundleIdentifier, NSWorkspace return _OpenUrls (urls, bundleIdentifier, options, descriptor, null); } - [Advice ("Use 'NSWorkSpace.IconForContentType'.")] + [Advice ("Use 'NSWorkSpace.IconForContentType' instead.")] public virtual NSImage IconForFileType (string fileType) { var nsFileType = NSString.CreateNative (fileType); @@ -34,7 +34,7 @@ public virtual NSImage IconForFileType (string fileType) } } - [Advice ("Use 'NSWorkSpace.IconForContentType'.")] + [Advice ("Use 'NSWorkSpace.IconForContentType' instead.")] public virtual NSImage IconForFileType (HfsTypeCode typeCode) { var nsFileType = GetNSFileType ((uint) typeCode); diff --git a/src/appkit.cs b/src/appkit.cs index 729da34770fe..ef1601022871 100644 --- a/src/appkit.cs +++ b/src/appkit.cs @@ -2271,7 +2271,7 @@ interface NSButton : NSAccessibilityButton, NSUserInterfaceCompression, NSUserIn [NullAllowed, Export ("contentTintColor", ArgumentSemantic.Copy)] NSColor ContentTintColor { get; set; } - [NoiOS, Mac (10, 16)] + [Mac (10, 16)] [Export ("hasDestructiveAction")] bool HasDestructiveAction { get; set; } } @@ -3675,12 +3675,12 @@ partial interface NSColor : NSCoding, NSCopying, NSSecureCoding, NSPasteboardRea [Static] [Export ("controlShadowColor")] - [Deprecated (PlatformName.MacOSX, 10, 16, message: "Use a context specific color such as 'SeparatorColor.`")] + [Deprecated (PlatformName.MacOSX, 10, 16, message: "Use a context specific color such as 'SeparatorColor'.`")] NSColor ControlShadow { get; } [Static] [Export ("controlDarkShadowColor")] - [Deprecated (PlatformName.MacOSX, 10, 16, message: "Use a context specific color such as 'SeparatorColor.`")] + [Deprecated (PlatformName.MacOSX, 10, 16, message: "Use a context specific color such as 'SeparatorColor'.`")] NSColor ControlDarkShadow { get; } [Static] @@ -3689,12 +3689,12 @@ partial interface NSColor : NSCoding, NSCopying, NSSecureCoding, NSPasteboardRea [Static] [Export ("controlHighlightColor")] - [Deprecated (PlatformName.MacOSX, 10, 16, message: "Use a context specific color such as 'SeparatorColor.`")] + [Deprecated (PlatformName.MacOSX, 10, 16, message: "Use a context specific color such as 'SeparatorColor'.`")] NSColor ControlHighlight { get; } [Static] [Export ("controlLightHighlightColor")] - [Deprecated (PlatformName.MacOSX, 10, 16, message: "Use a context specific color such as 'SeparatorColor.`")] + [Deprecated (PlatformName.MacOSX, 10, 16, message: "Use a context specific color such as 'SeparatorColor'.`")] NSColor ControlLightHighlight { get; } [Static] @@ -3762,7 +3762,7 @@ partial interface NSColor : NSCoding, NSCopying, NSSecureCoding, NSPasteboardRea [Static] [Export ("selectedKnobColor")] - [Deprecated (PlatformName.MacOSX, 10, 16, message: "Use 'NSScroller' instead")] + [Deprecated (PlatformName.MacOSX, 10, 16, message: "Use 'NSScroller' instead.")] NSColor SelectedKnob { get; } [Static] @@ -6510,7 +6510,7 @@ partial interface NSFont : NSSecureCoding, NSCopying { [Mac (10,16)] [Static] [Export ("preferredFontForTextStyle:options:")] - NSFont PreferredFontForTextStyle (string style, NSDictionary options); + NSFont GetPreferredFont (string textStyle, NSDictionary options); } interface NSFontCollectionChangedEventArgs { @@ -6742,7 +6742,7 @@ interface NSFontDescriptor : NSSecureCoding, NSCopying { [Mac (10,16)] [Static] [Export ("preferredFontDescriptorForTextStyle:options:")] - NSFontDescriptor PreferredFontDescriptorForTextStyle (string style, NSDictionary options); + NSFontDescriptor GetPreferredFont (string textStyle, NSDictionary options); } [BaseType (typeof (NSObject))] @@ -9027,7 +9027,7 @@ partial interface NSOutlineViewDelegate { [Mac (10,16)] [Export ("outlineView:tintConfigurationForItem:")] [return: NullAllowed] - NSTintConfiguration OutlineView (NSOutlineView outlineView, NSObject item); + NSTintConfiguration GetTintConfiguration (NSOutlineView outlineView, NSObject item); } [BaseType (typeof (NSObject))] @@ -9334,7 +9334,7 @@ partial interface NSImage : NSCopying, NSSecureCoding, NSPasteboardReading, NSPa [Static] [Export ("imageWithSystemSymbolName:accessibilityDescription:")] [return: NullAllowed] - NSImage GetSystemSymbol (string symbolName, [NullAllowed] string description); + NSImage GetSystemSymbol (string symbolName, [NullAllowed] string accessibilityDescription); } public enum NSImageName @@ -13467,17 +13467,17 @@ interface NSSearchField { bool SendsSearchStringImmediately { get; set; } [Mac (10,11)] - [Advice ("Use 'SearchTextBounds' instead.`")] + [Advice ("Use 'SearchTextBounds' instead.'")] [Export ("rectForSearchTextWhenCentered:")] CGRect GetRectForSearchText (bool isCentered); [Mac (10,11)] - [Advice ("Use 'SearchButtonBounds' instead.`")] + [Advice ("Use 'SearchButtonBounds' instead.'")] [Export ("rectForSearchButtonWhenCentered:")] CGRect GetRectForSearchButton (bool isCentered); [Mac (10,11)] - [Advice ("Use 'CancelButtonBounds' instead.`")] + [Advice ("Use 'CancelButtonBounds' instead.'")] [Export ("rectForCancelButtonWhenCentered:")] CGRect GetRectForCancelButton (bool isCentered); @@ -13490,7 +13490,7 @@ interface NSSearchField { NSObject WeakDelegate { get; set; } [Mac (10,11)] - [Advice ("No longer availabile, now a no-op")] + [Advice ("No longer availabile, now a no-op.")] [Export ("centersPlaceholder")] bool CentersPlaceholder { get; set; } @@ -27884,9 +27884,9 @@ interface NSSearchToolbarItem nfloat PreferredWidthForSearchFieldRepresentation { get; set; } } - delegate NSView NSTableViewDiffableDataSourceCellProvider (NSTableView arg0, NSTableColumn arg1, nint arg2, NSObject arg3); - delegate NSTableRowView NSTableViewDiffableDataSourceRowProvider (NSTableView arg0, nint arg1, NSObject arg2); - delegate NSView NSTableViewDiffableDataSourceSectionHeaderViewProvider (NSTableView arg0, nint arg1, NSObject arg2); + delegate NSView NSTableViewDiffableDataSourceCellProvider (NSTableView tableView, NSTableColumn column, nint row, NSObject itemId); + delegate NSTableRowView NSTableViewDiffableDataSourceRowProvider (NSTableView tableView, nint row, NSObject identifier); + delegate NSView NSTableViewDiffableDataSourceSectionHeaderViewProvider (NSTableView tableView, nint row, NSObject sectionId); [Mac (10,16)] [BaseType (typeof(NSObject))] @@ -27903,6 +27903,7 @@ interface NSTableViewDiffableDataSource : NSTableViewDataSource void ApplySnapshot (NSDiffableDataSourceSnapshot snapshot, bool animatingDifferences); [Export ("applySnapshot:animatingDifferences:completion:")] + [Async] void ApplySnapshot (NSDiffableDataSourceSnapshot snapshot, bool animatingDifferences, [NullAllowed] Action completion); [Export ("itemIdentifierForRow:")] @@ -27929,21 +27930,19 @@ interface NSTableViewDiffableDataSource : NSTableViewDataSource NSTableViewAnimationOptions DefaultRowAnimation { get; set; } } + [Mac (10, 16)] [Protocol] interface NSTextContent { - [Mac (10, 16)] [Abstract] [Export ("contentType")] NSString GetContentType (); - [Mac (10, 16)] [Abstract] [Export ("setContentType:")] void SetContentType (NSString contentType); } - [Mac (10, 16)] enum NSTextContentType { [Field ("NSTextContentTypeUsername")] @@ -27958,6 +27957,7 @@ enum NSTextContentType { [Mac (10,16)] [BaseType (typeof(NSObject))] + [DisableDefaultCtor] interface NSTintConfiguration : NSCopying, NSSecureCoding { [Static] @@ -27988,6 +27988,7 @@ interface NSTintConfiguration : NSCopying, NSSecureCoding [Mac (10,16)] [BaseType (typeof(NSToolbarItem))] + [DisableDefaultCtor] interface NSTrackingSeparatorToolbarItem { [DesignatedInitializer] From e9dc224c438c121ba5e5f5e062023506116f5312 Mon Sep 17 00:00:00 2001 From: Chris Hamons Date: Thu, 16 Jul 2020 11:10:15 -0500 Subject: [PATCH 4/7] Apply suggestions from code review Co-authored-by: Alex Soto --- src/AppKit/Enums.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AppKit/Enums.cs b/src/AppKit/Enums.cs index 37a6a3a1e997..b0a34054e981 100644 --- a/src/AppKit/Enums.cs +++ b/src/AppKit/Enums.cs @@ -331,7 +331,7 @@ public enum NSControlSize : ulong { Small = 1, Mini = 2, [Mac (10,16)] - Large = 3 + Large = 3, } [Native] From b7499376be1742cfd642fb77502779b9ec2fe6f8 Mon Sep 17 00:00:00 2001 From: Chris Hamons Date: Thu, 16 Jul 2020 14:24:07 -0500 Subject: [PATCH 5/7] Code review changes --- src/appkit.cs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/appkit.cs b/src/appkit.cs index ef1601022871..c5e64e8d17f1 100644 --- a/src/appkit.cs +++ b/src/appkit.cs @@ -27865,6 +27865,7 @@ interface NSSharingServicePickerToolbarItemDelegate [Unavailable (PlatformName.MacCatalyst)] [Mac (10,16)] [BaseType (typeof(NSToolbarItem))] + [DisableDefaultCtor] interface NSSearchToolbarItem { [DesignatedInitializer] @@ -27891,34 +27892,35 @@ interface NSSearchToolbarItem [Mac (10,16)] [BaseType (typeof(NSObject))] [DisableDefaultCtor] - interface NSTableViewDiffableDataSource : NSTableViewDataSource - { + interface NSTableViewDiffableDataSource : NSTableViewDataSource + where SectionIdentifierType : NSObject + where ItemIdentifierType : NSObject { [Export ("initWithTableView:cellProvider:")] IntPtr Constructor (NSTableView tableView, NSTableViewDiffableDataSourceCellProvider cellProvider); [Export ("snapshot")] - NSDiffableDataSourceSnapshot Snapshot (); + NSDiffableDataSourceSnapshot Snapshot (); [Export ("applySnapshot:animatingDifferences:")] - void ApplySnapshot (NSDiffableDataSourceSnapshot snapshot, bool animatingDifferences); + void ApplySnapshot (NSDiffableDataSourceSnapshot snapshot, bool animatingDifferences); [Export ("applySnapshot:animatingDifferences:completion:")] [Async] - void ApplySnapshot (NSDiffableDataSourceSnapshot snapshot, bool animatingDifferences, [NullAllowed] Action completion); + void ApplySnapshot (NSDiffableDataSourceSnapshot snapshot, bool animatingDifferences, [NullAllowed] Action completion); [Export ("itemIdentifierForRow:")] [return: NullAllowed] - NSObject GetItemIdentifier (nint row); + ItemIdentifierType GetItemIdentifier (nint row); [Export ("rowForItemIdentifier:")] - nint GetRowForItemIdentifier (NSObject itemIdentifier); + nint GetRowForItemIdentifier (ItemIdentifierType itemIdentifier); [Export ("sectionIdentifierForRow:")] [return: NullAllowed] - NSObject GetSectionIdentifier (nint row); + SectionIdentifierType GetSectionIdentifier (nint row); [Export ("rowForSectionIdentifier:")] - nint GetRowForSectionIdentifier (NSObject sectionIdentifier); + nint GetRowForSectionIdentifier (SectionIdentifierType sectionIdentifier); [NullAllowed, Export ("rowViewProvider", ArgumentSemantic.Copy)] NSTableViewDiffableDataSourceRowProvider RowViewProvider { get; set; } From 51a6f042a5ae6414c1feac681492a00b02b1fbc9 Mon Sep 17 00:00:00 2001 From: Chris Hamons Date: Thu, 16 Jul 2020 15:52:44 -0500 Subject: [PATCH 6/7] Apply suggestions from code review Co-authored-by: Whitney Schmidt --- src/AppKit/NSWorkspace.cs | 4 ++-- src/appkit.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/AppKit/NSWorkspace.cs b/src/AppKit/NSWorkspace.cs index def27e791e12..d8aaad67e7d8 100644 --- a/src/AppKit/NSWorkspace.cs +++ b/src/AppKit/NSWorkspace.cs @@ -9,14 +9,14 @@ namespace AppKit { public partial class NSWorkspace { - [Deprecated (PlatformName.MacOSX, 10, 16, message: "Use 'NSWorkspace.OpenUrls' with complection handler.")] + [Deprecated (PlatformName.MacOSX, 10, 16, message: "Use 'NSWorkspace.OpenUrls' with completion handler.")] public virtual bool OpenUrls (NSUrl[] urls, string bundleIdentifier, NSWorkspaceLaunchOptions options, NSAppleEventDescriptor descriptor, string[] identifiers) { // Ignore the passed in argument, because if you pass it in we will crash on cleanup. return _OpenUrls (urls, bundleIdentifier, options, descriptor, null); } - [Deprecated (PlatformName.MacOSX, 10, 16, message: "Use 'NSWorkspace.OpenUrls' with complection handler.")] + [Deprecated (PlatformName.MacOSX, 10, 16, message: "Use 'NSWorkspace.OpenUrls' with completion handler.")] public virtual bool OpenUrls (NSUrl[] urls, string bundleIdentifier, NSWorkspaceLaunchOptions options, NSAppleEventDescriptor descriptor) { return _OpenUrls (urls, bundleIdentifier, options, descriptor, null); diff --git a/src/appkit.cs b/src/appkit.cs index c5e64e8d17f1..c8039f045ff7 100644 --- a/src/appkit.cs +++ b/src/appkit.cs @@ -7943,7 +7943,7 @@ interface NSGestureRecognizerDelegate { partial interface NSMenu : NSCoding, NSCopying, NSAccessibility, NSAccessibilityElement, NSAppearanceCustomization, NSUserInterfaceItemIdentification { [DesignatedInitializer] [Export ("initWithTitle:")] - IntPtr Constructor (string aTitle); + IntPtr Constructor (string title); [Static] [Export ("popUpContextMenu:withEvent:forView:")] From 0f412b40234e9d5c2058e143b9fa2cf47cf2486d Mon Sep 17 00:00:00 2001 From: Chris Hamons Date: Fri, 17 Jul 2020 09:02:59 -0500 Subject: [PATCH 7/7] Remove unnecessary 10.7 mac attribute --- src/AppKit/Enums.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AppKit/Enums.cs b/src/AppKit/Enums.cs index b0a34054e981..6c0bc2f43be8 100644 --- a/src/AppKit/Enums.cs +++ b/src/AppKit/Enums.cs @@ -3045,7 +3045,7 @@ public enum NSWindowToolbarStyle : long UnifiedCompact, } - [Flags, Mac (10,7)] + [Flags] [Native] public enum NSTableViewAnimationOptions : ulong {