Skip to content
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

[AppKit] Xcode 14 Beta 1-5 #15778

Merged
merged 10 commits into from
Aug 31, 2022
17 changes: 17 additions & 0 deletions src/AppKit/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3244,4 +3244,21 @@ public enum NSImageSymbolScale : long
Medium = 2,
Large = 3,
}

[NoMacCatalyst, Mac (13,0)]
[Native]
public enum NSColorWellStyle : long
{
Default = 0,
Minimal,
Expanded,
}

[NoMacCatalyst, Mac (13,0)]
[Native]
public enum NSComboButtonStyle : long
{
Split = 0,
Unified = 1,
}
}
11 changes: 11 additions & 0 deletions src/AppKit/NSFont.cs
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,17 @@ public static NSFont SystemFontOfSize (nfloat fontSize, nfloat weight)
return ptr == IntPtr.Zero ? null : new NSFont (ptr);
}

#if NET
[SupportedOSPlatform ("macos13.0")]
[UnsupportedOSPlatform ("maccatalyst")]
#else
[Mac (13,0)]
#endif
public static NSFont SystemFontOfSize (nfloat fontSize, nfloat weight, nfloat width) {
var ptr = _SystemFontOfSize (fontSize, weight, width);
return ptr == IntPtr.Zero ? null : new NSFont (ptr);
}

#if NET
[SupportedOSPlatform ("macos10.11")]
[UnsupportedOSPlatform ("maccatalyst")]
Expand Down
2 changes: 1 addition & 1 deletion src/UIKit/UIFont.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ static nfloat GetFontWeight (UIFontWeight weight)
#else
[Watch (9,0), iOS (16,0), TV (16,0), MacCatalyst (16,0)]
#endif
static double GetFontWidth (UIFontWidth width)
static nfloat GetFontWidth (UIFontWidth width)
{
switch (width) {
case UIFontWidth.Condensed:
Expand Down
163 changes: 163 additions & 0 deletions src/appkit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4827,6 +4827,24 @@ interface NSColorWell {
[Export ("color", ArgumentSemantic.Copy)]
NSColor Color { get; set; }

[Mac (13, 0)]
[Export ("colorWellStyle", ArgumentSemantic.Assign)]
NSColorWellStyle ColorWellStyle { get; set; }

[Mac (13, 0)]
[Export ("image", ArgumentSemantic.Strong)]
[NullAllowed]
NSImage Image { get; set; }

[Mac (13, 0)]
[Export ("pulldownTarget", ArgumentSemantic.Weak)]
[NullAllowed]
NSObject PulldownTarget { get; set; }

[Mac (13, 0)]
[Export ("pulldownAction", ArgumentSemantic.Assign)]
[NullAllowed]
Selector PulldownAction { get; set; }
Comment on lines +4839 to +4847
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we can provide a better API in the future

}

[NoMacCatalyst]
Expand Down Expand Up @@ -6935,6 +6953,12 @@ partial interface NSFont : NSSecureCoding, NSCopying {
[Internal]
IntPtr _SystemFontOfSize (nfloat fontSize, nfloat weight);

[Mac (13,0)]
[Static]
[Export ("systemFontOfSize:weight:width:")]
[Internal]
IntPtr _SystemFontOfSize (nfloat fontSize, nfloat weight, nfloat width);

[Mac (10,11)]
[Static]
[Export ("monospacedDigitSystemFontOfSize:weight:")]
Expand Down Expand Up @@ -7427,6 +7451,25 @@ interface NSFontWeight {
nfloat Black { get; }
}

[Mac (10, 10)]
[NoMacCatalyst]
[Static]
interface NSFontWidth
{
[Mac (13, 0)]
[Field ("NSFontWidthCompressed")]
double Compressed { get; }

[Field ("NSFontWidthCondensed")]
double Condensed { get; }

[Field ("NSFontWidthStandard")]
double Standard { get; }

[Field ("NSFontWidthExpanded")]
double Expanded { get; }
}

[Deprecated (PlatformName.MacOSX, 10, 10)]
[NoMacCatalyst]
[BaseType (typeof (NSMatrix))]
Expand Down Expand Up @@ -9912,6 +9955,18 @@ partial interface NSImage : NSCopying, NSSecureCoding, NSPasteboardReading, NSPa
[NoMacCatalyst]
[Export ("symbolConfiguration", ArgumentSemantic.Copy)]
NSImageSymbolConfiguration SymbolConfiguration { get; }

[NoMacCatalyst, Mac (13,0)]
[Static]
[Export ("imageWithSymbolName:variableValue:")]
[return: NullAllowed]
NSImage GetImage (string symbolName, double variableValue);

[NoMacCatalyst, Mac (13,0)]
[Static]
[Export ("imageWithSystemSymbolName:variableValue:accessibilityDescription:")]
[return: NullAllowed]
NSImage GetImage (string systemSymbolName, double variableValue, [NullAllowed] string accessibilityDescription);
}

[MacCatalyst (13, 0)]
Expand Down Expand Up @@ -20021,6 +20076,14 @@ partial interface NSToolbar {
// [MacCatalyst (14,0)][NoMac]
// [Field ("NSToolbarSupplementarySidebarTrackingSeparatorItemIdentifier")]
// NSString SupplementarySidebarTrackingSeparatorItemIdentifier { get; }

[Mac (13, 0), MacCatalyst (16, 0)]
[Export ("centeredItemIdentifiers", ArgumentSemantic.Copy)]
NSSet<NSString> CenteredItemIdentifiers { get; set; }

[NoMacCatalyst][Mac (13, 0)]
[Field ("NSToolbarItemKey")]
NSString NSToolbarItemKey { get; }
}

[MacCatalyst (13, 0)]
Expand All @@ -20045,6 +20108,15 @@ interface NSToolbarDelegate {

[Export ("toolbarDidRemoveItem:"), EventArgs ("NSNotification")]
void DidRemoveItem (NSNotification notification);

[Mac (13,0), MacCatalyst (16,0), DelegateName ("NSToolbarImmovableItemIdentifiers"), DefaultValue (null)]
[Export ("toolbarImmovableItemIdentifiers:")]
NSSet<NSString> GetToolbarImmovableItemIdentifiers (NSToolbar toolbar);

[Mac (13,0), MacCatalyst (16,0)]
[Export ("toolbar:itemIdentifier:canBeInsertedAtIndex:"), DelegateName ("NSToolbarCanInsert"), DefaultValue (true)]
bool GetItemCanBeInsertedAt (NSToolbar toolbar, string itemIdentifier, nint index);

}

[NoMacCatalyst]
Expand Down Expand Up @@ -20172,6 +20244,10 @@ interface NSToolbarItem : NSCopying, NSMenuItemValidation, NSValidatedUserInterf
[Export ("itemMenuFormRepresentation", ArgumentSemantic.Copy)]
[NullAllowed]
UIMenuElement ItemMenuFormRepresentation { get; set; }

[Mac (13, 0)][NoMacCatalyst]
[Export ("possibleLabels", ArgumentSemantic.Copy)]
NSSet<NSString> PossibleLabels { get; set; }
}

[MacCatalyst (13,0)]
Expand Down Expand Up @@ -22682,6 +22758,7 @@ interface NSSharingService
[Export ("alternateImage", ArgumentSemantic.Strong)]
NSImage AlternateImage { get; }

[Deprecated (PlatformName.MacOSX, 13, 0, message: "Use 'NSSharingServicePicker.StandardShareMenuItem' instead.")]
[Export ("sharingServicesForItems:")][Static]
NSSharingService [] SharingServicesForItems (NSObject [] items);

Expand Down Expand Up @@ -22877,6 +22954,10 @@ interface NSSharingServicePicker

[Export ("showRelativeToRect:ofView:preferredEdge:")]
void ShowRelativeToRect (CGRect rect, NSView view, NSRectEdge preferredEdge);

[Mac (13, 0)]
[Export ("standardShareMenuItem")]
NSMenuItem StandardShareMenuItem { get; }
}

interface INSSharingServicePickerDelegate {}
Expand Down Expand Up @@ -28341,5 +28422,87 @@ interface NSImageSymbolConfiguration : NSCopying, NSSecureCoding
[Mac (12,0)]
[Export ("configurationByApplyingConfiguration:")]
NSImageSymbolConfiguration Create (NSImageSymbolConfiguration configuration);

[Mac (13,0)]
[Static]
[Export ("configurationPreferringMonochrome")]
NSImageSymbolConfiguration CreateConfigurationPreferringMonochrome ();

[Mac (13,0)]
[Static]
[Export ("configurationPreferringHierarchical")]
NSImageSymbolConfiguration CreateConfigurationPreferringHierarchical ();
}

[NoMacCatalyst, Mac (13,0)]
[BaseType (typeof (NSControl))]
interface NSComboButton
{
[DesignatedInitializer]
[Export ("initWithFrame:")]
NativeHandle Constructor (CGRect frameRect);

[Static]
[Export ("comboButtonWithTitle:menu:target:action:")]
NSComboButton Create (string title, [NullAllowed] NSMenu menu, [NullAllowed] NSObject target, [NullAllowed] Selector action);

[Static]
[Export ("comboButtonWithImage:menu:target:action:")]
NSComboButton Create (NSImage image, [NullAllowed] NSMenu menu, [NullAllowed] NSObject target, [NullAllowed] Selector action);

[Static]
[Export ("comboButtonWithTitle:image:menu:target:action:")]
NSComboButton Create (string title, NSImage image, [NullAllowed] NSMenu menu, [NullAllowed] NSObject target, [NullAllowed] Selector action);

[Export ("title")]
string Title { get; set; }

[NullAllowed, Export ("image", ArgumentSemantic.Strong)]
NSImage Image { get; set; }

[Export ("imageScaling", ArgumentSemantic.Assign)]
NSImageScaling ImageScaling { get; set; }

[Export ("menu", ArgumentSemantic.Strong)]
NSMenu Menu { get; set; }

[Export ("style", ArgumentSemantic.Assign)]
NSComboButtonStyle Style { get; set; }
}

interface INSPreviewRepresentableActivityItem { }

[NoMacCatalyst, Mac (13,0)]
[Protocol]
interface NSPreviewRepresentableActivityItem
{
[Abstract]
[Export ("item", ArgumentSemantic.Strong)]
NSObject Item { get; }

[NullAllowed, Export ("title")]
string Title { get; }

[NullAllowed, Export ("imageProvider", ArgumentSemantic.Strong)]
NSItemProvider ImageProvider { get; }

[NullAllowed, Export ("iconProvider", ArgumentSemantic.Strong)]
NSItemProvider IconProvider { get; }
}

[NoMacCatalyst, Mac (13,0)]
[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
interface NSPreviewRepresentingActivityItem : NSPreviewRepresentableActivityItem
{
[NoiOS]
[Export ("initWithItem:title:image:icon:")]
NativeHandle Constructor (NSObject item, [NullAllowed] string title, [NullAllowed] NSImage image, [NullAllowed] NSImage icon);

[NoiOS]
[Export ("initWithItem:title:imageProvider:iconProvider:")]
[DesignatedInitializer]
NativeHandle Constructor (NSObject item, [NullAllowed] string title, [NullAllowed] NSItemProvider imageProvider, [NullAllowed] NSItemProvider iconProvider);
}

}
10 changes: 5 additions & 5 deletions src/uikit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6223,7 +6223,7 @@ [Static] [Export ("fontNamesForFamilyName:")]
[Static]
[Internal]
[Export ("systemFontOfSize:weight:width:")]
IntPtr _SystemFontOfSize (nfloat fontSize, double weight, double width);
IntPtr _SystemFontOfSize (nfloat fontSize, nfloat weight, nfloat width);

}

Expand Down Expand Up @@ -25376,16 +25376,16 @@ interface UIPasteControl
[Watch (9,0), TV (16,0), iOS (16, 0), MacCatalyst (16,0)]
interface UIFontWidthConstants {
[Field ("UIFontWidthCondensed")]
double Condensed { get; }
nfloat Condensed { get; }

[Field ("UIFontWidthStandard")]
double Standard { get; }
nfloat Standard { get; }

[Field ("UIFontWidthExpanded")]
double Expanded { get; }
nfloat Expanded { get; }

[Field ("UIFontWidthCompressed")]
double Compressed { get; }
nfloat Compressed { get; }
}


Expand Down
11 changes: 4 additions & 7 deletions src/xkit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
using NSRulerView=System.Object;
using NSTextAttachmentCell=System.Object;
using NSTextBlock=System.Object;
using NSTextList=System.Object;
using NSTextTableBlock=System.Object;
using NSTextTabType=System.Object;
using NSTextStorageEditedFlags=System.Object;
Expand Down Expand Up @@ -4077,7 +4076,7 @@ interface NSTextContentStorage : NSTextStorageObserving
NSTextRange GetAdjustedRange (NSTextRange textRange, bool forEditingTextSelection);
}

[NoWatch, TV (16,0), iOS (16,0), MacCatalyst (16,0)]
[TV (9,0), NoWatch, Mac (10,0), iOS (7,0), MacCatalyst (13,0)]
[BaseType (typeof (NSObject))]
interface NSTextList : NSCoding, NSCopying, NSSecureCoding {
[Export ("initWithMarkerFormat:options:")]
Expand Down Expand Up @@ -4127,7 +4126,6 @@ interface NSTextList : NSCoding, NSCopying, NSSecureCoding {
[BaseType (typeof (NSTextParagraph))]
interface NSTextListElement
{

[Export ("initWithAttributedString:")]
[DesignatedInitializer]
NativeHandle Constructor ([NullAllowed] NSAttributedString attributedString);
Expand All @@ -4138,11 +4136,11 @@ interface NSTextListElement

[Export ("initWithParentElement:textList:contents:markerAttributes:childElements:")]
[DesignatedInitializer]
NativeHandle Constructor ([NullAllowed] NSTextListElement parent, NSTextList textList, [NullAllowed] NSAttributedString contents, [NullAllowed] NSDictionary<NSString, NSObject> markerAttributes, [NullAllowed] NSTextListElement[] children);
NativeHandle Constructor ([NullAllowed] NSTextListElement parent, NSTextList textList, [NullAllowed] NSAttributedString contents, [NullAllowed] NSDictionary markerAttributes, [NullAllowed] NSTextListElement[] children);

[Static]
[Export ("textListElementWithContents:markerAttributes:textList:childElements:")]
NSTextListElement Create (NSAttributedString contents, [NullAllowed] NSDictionary<NSString, NSObject> markerAttributes, NSTextList textList, [NullAllowed] NSTextListElement[] children);
NSTextListElement Create (NSAttributedString contents, [NullAllowed] NSDictionary markerAttributes, NSTextList textList, [NullAllowed] NSTextListElement[] children);

[Static]
[Export ("textListElementWithChildElements:textList:nestingLevel:")]
Expand All @@ -4156,7 +4154,7 @@ interface NSTextListElement
NSAttributedString Contents { get; }

[NullAllowed, Export ("markerAttributes", ArgumentSemantic.Strong)]
NSDictionary<NSString, NSObject> MarkerAttributes { get; }
NSDictionary WeakMarkerAttributes { get; }

[Export ("attributedString", ArgumentSemantic.Strong)]
NSAttributedString AttributedString { get; }
Expand All @@ -4168,5 +4166,4 @@ interface NSTextListElement
NSTextListElement ParentElement { get; }
}


}
5 changes: 5 additions & 0 deletions tests/introspection/Mac/MacApiCtorInitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,11 @@ protected override void CheckToString (NSObject obj)
if (TestRuntime.CheckXcodeVersion (12, 0))
return;
break;
// crash with xcode 14 Beta 6
case "IOSurface.IOSurface":
if (TestRuntime.CheckXcodeVersion (14, 0))
return;
break;
default:
base.CheckToString (obj);
break;
Expand Down
13 changes: 13 additions & 0 deletions tests/xtro-sharpie/api-annotations-dotnet/macOS-AppKit.ignore
Original file line number Diff line number Diff line change
Expand Up @@ -1197,3 +1197,16 @@
# bound as `const` not enums
!extra-enum-value! Managed value 3 for NSBezelStyle.ThickSquare not found in native headers
!extra-enum-value! Managed value 4 for NSBezelStyle.ThickerSquare not found in native headers

# Will be deprecated in a future release
!deprecated-attribute-missing! NSColorWell::isBordered missing a [Deprecated] attribute
!deprecated-attribute-missing! NSColorWell::setBordered: missing a [Deprecated] attribute
!deprecated-attribute-missing! NSImage::lockFocus missing a [Deprecated] attribute
!deprecated-attribute-missing! NSImage::lockFocusFlipped: missing a [Deprecated] attribute
!deprecated-attribute-missing! NSImage::unlockFocus missing a [Deprecated] attribute
!deprecated-attribute-missing! NSToolbar::centeredItemIdentifier missing a [Deprecated] attribute
!deprecated-attribute-missing! NSToolbar::setCenteredItemIdentifier: missing a [Deprecated] attribute
!deprecated-attribute-missing! NSToolbar::setSizeMode: missing a [Deprecated] attribute
!deprecated-attribute-missing! NSToolbar::sizeMode missing a [Deprecated] attribute
!deprecated-attribute-missing! NSWindow::setShowsToolbarButton: missing a [Deprecated] attribute
!deprecated-attribute-missing! NSWindow::showsToolbarButton missing a [Deprecated] attribute
Copy link
Member

Choose a reason for hiding this comment

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

👀

Loading