[AppKit/UIKit] Share the implementation of some classes between AppKit and UIKit. (#12161)

* [AppKit/UIKit] Merge the definitions of NSTextLayoutOrientationProvider.

It looks like this might be a breaking change for macOS, but the macOS
definition had only a [Model] attribute, which won't make the generator
generate any public API.

* [AppKit/UIKit] Merge the definitions of NSTextContainer.

* [AppKit/UIKit] Merge the definitions of NSExtendedStringDrawing.
This commit is contained in:
Rolf Bjarne Kvinge 2021-07-21 14:52:19 +02:00 коммит произвёл GitHub
Родитель b082e6b8aa
Коммит f521537e0a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
7 изменённых файлов: 124 добавлений и 182 удалений

Просмотреть файл

@ -9821,26 +9821,6 @@ namespace AppKit {
[Export ("drawInRect:")]
void DrawInRect (CGRect rect);
}
[ThreadSafe]
[Category, BaseType (typeof (NSString))]
interface NSExtendedStringDrawing {
[Mac (10,11)]
[Export ("drawWithRect:options:attributes:context:")]
void WeakDrawString (CGRect rect, NSStringDrawingOptions options, [NullAllowed] NSDictionary attributes, [NullAllowed] NSStringDrawingContext context);
[Mac (10,11)]
[Wrap ("WeakDrawString (This, rect, options, attributes.GetDictionary (), context)")]
void DrawString (CGRect rect, NSStringDrawingOptions options, [NullAllowed] NSStringAttributes attributes, [NullAllowed] NSStringDrawingContext context);
[Mac (10,11)]
[Export ("boundingRectWithSize:options:attributes:context:")]
CGRect WeakGetBoundingRect (CGSize size, NSStringDrawingOptions options, [NullAllowed] NSDictionary attributes, [NullAllowed] NSStringDrawingContext context);
[Mac (10,11)]
[Wrap ("WeakGetBoundingRect (This, size, options, attributes.GetDictionary (), context)")]
CGRect GetBoundingRect (CGSize size, NSStringDrawingOptions options, [NullAllowed] NSStringAttributes attributes, [NullAllowed] NSStringDrawingContext context);
}
// @interface NSExtendedStringDrawing (NSAttributedString)
[ThreadSafe]
@ -18213,73 +18193,6 @@ namespace AppKit {
bool HidesEmptyCells { get; set; }
}
[BaseType (typeof (NSObject))]
partial interface NSTextContainer : NSSecureCoding {
[Export ("initWithContainerSize:"), Internal]
[Sealed]
IntPtr InitWithContainerSize (CGSize size);
[Mac (10,11)]
[Export ("initWithSize:"), Internal]
[Sealed]
IntPtr InitWithSize (CGSize size);
[Export ("replaceLayoutManager:")]
void ReplaceLayoutManager (NSLayoutManager newLayoutManager);
// FIXME: Binding
//[Export ("lineFragmentRectForProposedRect:sweepDirection:movementDirection:remainingRect:")]
//CGRect LineFragmentRect (CGRect proposedRect, NSLineSweepDirection sweepDirection, NSLineMovementDirection movementDirection, NSRectPointer remainingRect);
[Export ("isSimpleRectangularTextContainer")]
bool IsSimpleRectangularTextContainer { get; }
[Deprecated (PlatformName.MacOSX, 10, 11)]
[Export ("containsPoint:")]
bool ContainsPoint (CGPoint point);
//Detected properties
[Export ("layoutManager")]
NSLayoutManager LayoutManager { get; set; }
[Export ("textView", ArgumentSemantic.Weak)]
NSTextView TextView { get; set; }
[Export ("widthTracksTextView")]
bool WidthTracksTextView { get; set; }
[Export ("heightTracksTextView")]
bool HeightTracksTextView { get; set; }
[Availability (Deprecated = Platform.Mac_10_11, Message = "Use Size instead.")]
[Export ("containerSize")]
CGSize ContainerSize { get; set; }
[Export ("lineFragmentPadding")]
nfloat LineFragmentPadding { get; set; }
[Mac (10,11)]
[Export ("size", ArgumentSemantic.Assign)]
CGSize Size { get; set; }
[Mac (10,11)]
[Export ("exclusionPaths", ArgumentSemantic.Copy)]
// [Verify (StronglyTypedNSArray)]
NSBezierPath[] ExclusionPaths { get; set; }
[Mac (10,11)]
[Export ("lineBreakMode", ArgumentSemantic.Assign)]
NSLineBreakMode LineBreakMode { get; set; }
[Mac (10,11)]
[Export ("maximumNumberOfLines", ArgumentSemantic.Assign)]
nuint MaximumNumberOfLines { get; set; }
[Mac (10,11)]
[Export ("lineFragmentRectForProposedRect:atIndex:writingDirection:remainingRect:")]
CGRect GetLineFragmentRect (CGRect proposedRect, nuint characterIndex, NSWritingDirection baseWritingDirection, ref CGRect remainingRect);
}
[Protocol]
interface NSTextInput
{
@ -22097,12 +22010,6 @@ namespace AppKit {
bool displayDocument, OpenDocumentCompletionHandler completionHandler);
}
[Model]
interface NSTextLayoutOrientationProvider {
[Export ("layoutOrientation")]
NSTextLayoutOrientation LayoutOrientation { get; }
}
partial interface NSLayoutManager {
// FIXME: This may need some generator work, or use IntPtr for glyphs?
//

Просмотреть файл

@ -371,69 +371,6 @@ namespace UIKit {
}
#endif // !WATCH
#if !WATCH
[Protocol]
// no [Model] since it's not exposed in any API
// only NSTextContainer conforms to it but it's only queried by iOS itself
interface NSTextLayoutOrientationProvider {
[Abstract]
[Export ("layoutOrientation")]
NSTextLayoutOrientation LayoutOrientation {
get;
#if !XAMCORE_3_0
[NotImplemented] set;
#endif
}
}
[iOS (7,0)]
[BaseType (typeof (NSObject))]
partial interface NSTextContainer : NSTextLayoutOrientationProvider, NSSecureCoding {
[DesignatedInitializer]
[Export ("initWithSize:")]
IntPtr Constructor (CGSize size);
[NullAllowed] // by default this property is null
[Export ("layoutManager", ArgumentSemantic.Assign)]
NSLayoutManager LayoutManager { get; set; }
[Export ("size")]
CGSize Size { get; set; }
[NullAllowed] // by default this property is null
[Export ("exclusionPaths", ArgumentSemantic.Copy)]
UIBezierPath [] ExclusionPaths { get; set; }
[Export ("lineBreakMode")]
UILineBreakMode LineBreakMode { get; set; }
[Export ("lineFragmentPadding")]
nfloat LineFragmentPadding { get; set; }
[Export ("maximumNumberOfLines")]
nuint MaximumNumberOfLines { get; set; }
[Export ("lineFragmentRectForProposedRect:atIndex:writingDirection:remainingRect:")]
CGRect GetLineFragmentRect (CGRect proposedRect, nuint characterIndex, NSWritingDirection baseWritingDirection, out CGRect remainingRect);
[Export ("widthTracksTextView")]
bool WidthTracksTextView { get; set; }
[Export ("heightTracksTextView")]
bool HeightTracksTextView { get; set; }
[iOS (9,0)]
[Export ("replaceLayoutManager:")]
void ReplaceLayoutManager (NSLayoutManager newLayoutManager);
[iOS (9,0)]
[Export ("simpleRectangularTextContainer")]
bool IsSimpleRectangularTextContainer { [Bind ("isSimpleRectangularTextContainer")] get; }
}
#endif // !WATCH
[Category]
[BaseType (typeof (NSCoder))]
interface NSCoder_UIGeometryKeyedCoding {
@ -16907,25 +16844,6 @@ namespace UIKit {
void DrawString (CGRect rect, UIStringAttributes attributes);
}
[Category, BaseType (typeof (NSString))]
interface NSExtendedStringDrawing {
[iOS (7,0)]
[Export ("drawWithRect:options:attributes:context:")]
void WeakDrawString (CGRect rect, NSStringDrawingOptions options, [NullAllowed] NSDictionary attributes, [NullAllowed] NSStringDrawingContext context);
[iOS (7,0)]
[Wrap ("WeakDrawString (This, rect, options, attributes.GetDictionary (), context)")]
void DrawString (CGRect rect, NSStringDrawingOptions options, UIStringAttributes attributes, [NullAllowed] NSStringDrawingContext context);
[iOS (7,0)]
[Export ("boundingRectWithSize:options:attributes:context:")]
CGRect WeakGetBoundingRect (CGSize size, NSStringDrawingOptions options, [NullAllowed] NSDictionary attributes, [NullAllowed] NSStringDrawingContext context);
[iOS (7,0)]
[Wrap ("WeakGetBoundingRect (This, size, options, attributes.GetDictionary (), context)")]
CGRect GetBoundingRect (CGSize size, NSStringDrawingOptions options, UIStringAttributes attributes, [NullAllowed] NSStringDrawingContext context);
}
#if !WATCH
[NoWatch]
[iOS (7,0)]

Просмотреть файл

@ -51,17 +51,21 @@ using UITraitCollection=System.Object;
#endif // !MONOMAC
#if MONOMAC
using BezierPath=AppKit.NSBezierPath;
using Image=AppKit.NSImage;
using TextAlignment=AppKit.NSTextAlignment;
using LineBreakMode=AppKit.NSLineBreakMode;
using CollectionLayoutSectionOrthogonalScrollingBehavior=AppKit.NSCollectionLayoutSectionOrthogonalScrollingBehavior;
using CollectionElementCategory=AppKit.NSCollectionElementCategory;
using StringAttributes=AppKit.NSStringAttributes;
#else
using BezierPath=UIKit.UIBezierPath;
using Image=UIKit.UIImage;
using TextAlignment=UIKit.UITextAlignment;
using LineBreakMode=UIKit.UILineBreakMode;
using CollectionLayoutSectionOrthogonalScrollingBehavior=UIKit.UICollectionLayoutSectionOrthogonalScrollingBehavior;
using CollectionElementCategory=UIKit.UICollectionElementCategory;
using StringAttributes=UIKit.UIStringAttributes;
#endif
#if MONOMAC
@ -2640,4 +2644,124 @@ namespace UIKit {
[Field ("NSTabColumnTerminatorsAttributeName")]
NSString ColumnTerminatorsAttributeName { get; }
}
[NoWatch]
[MacCatalyst (13,0)]
[Protocol]
// no [Model] since it's not exposed in any API
// only NSTextContainer conforms to it but it's only queried by iOS itself
interface NSTextLayoutOrientationProvider {
[Abstract]
[Export ("layoutOrientation")]
NSTextLayoutOrientation LayoutOrientation {
get;
#if !XAMCORE_3_0 && !MONOMAC
[NotImplemented] set;
#endif
}
}
[NoWatch]
[iOS (7,0)]
[BaseType (typeof (NSObject))]
partial interface NSTextContainer : NSTextLayoutOrientationProvider, NSSecureCoding {
[NoMac]
[DesignatedInitializer]
[Export ("initWithSize:")]
IntPtr Constructor (CGSize size);
[NoiOS][NoMacCatalyst][NoTV]
[Export ("initWithContainerSize:"), Internal]
[Sealed]
IntPtr InitWithContainerSize (CGSize size);
[NoiOS][NoMacCatalyst][NoTV]
[Mac (10,11)]
[Export ("initWithSize:"), Internal]
[Sealed]
IntPtr InitWithSize (CGSize size);
[NullAllowed] // by default this property is null
[Export ("layoutManager", ArgumentSemantic.Assign)]
NSLayoutManager LayoutManager { get; set; }
[Mac (10,11)]
[Export ("size")]
CGSize Size { get; set; }
[Mac (10,11)]
[Export ("exclusionPaths", ArgumentSemantic.Copy)]
BezierPath [] ExclusionPaths { get; set; }
[Mac (10,11)]
[Export ("lineBreakMode")]
LineBreakMode LineBreakMode { get; set; }
[Export ("lineFragmentPadding")]
nfloat LineFragmentPadding { get; set; }
[Mac (10,11)]
[Export ("maximumNumberOfLines")]
nuint MaximumNumberOfLines { get; set; }
[Mac (10,11)]
[Export ("lineFragmentRectForProposedRect:atIndex:writingDirection:remainingRect:")]
#if MONOMAC && !XAMCORE_4_0
CGRect GetLineFragmentRect (CGRect proposedRect, nuint characterIndex, NSWritingDirection baseWritingDirection, ref CGRect remainingRect);
#else
CGRect GetLineFragmentRect (CGRect proposedRect, nuint characterIndex, NSWritingDirection baseWritingDirection, out CGRect remainingRect);
#endif
[Export ("widthTracksTextView")]
bool WidthTracksTextView { get; set; }
[Export ("heightTracksTextView")]
bool HeightTracksTextView { get; set; }
[iOS (9,0)]
[Export ("replaceLayoutManager:")]
void ReplaceLayoutManager (NSLayoutManager newLayoutManager);
[iOS (9,0)]
[Export ("simpleRectangularTextContainer")]
bool IsSimpleRectangularTextContainer { [Bind ("isSimpleRectangularTextContainer")] get; }
[NoiOS][NoMacCatalyst][NoTV]
[Deprecated (PlatformName.MacOSX, 10, 11)]
[Export ("containsPoint:")]
bool ContainsPoint (CGPoint point);
[NoiOS][NoMacCatalyst][NoTV]
[Export ("textView", ArgumentSemantic.Weak)]
NSTextView TextView { get; set; }
[NoiOS][NoMacCatalyst][NoTV]
[Availability (Deprecated = Platform.Mac_10_11, Message = "Use Size instead.")]
[Export ("containerSize")]
CGSize ContainerSize { get; set; }
}
[ThreadSafe]
[Category, BaseType (typeof (NSString))]
interface NSExtendedStringDrawing {
[iOS (7,0)]
[Mac (10,11)]
[Export ("drawWithRect:options:attributes:context:")]
void WeakDrawString (CGRect rect, NSStringDrawingOptions options, [NullAllowed] NSDictionary attributes, [NullAllowed] NSStringDrawingContext context);
[iOS (7,0)]
[Mac (10,11)]
[Wrap ("WeakDrawString (This, rect, options, attributes.GetDictionary (), context)")]
void DrawString (CGRect rect, NSStringDrawingOptions options, StringAttributes attributes, [NullAllowed] NSStringDrawingContext context);
[iOS (7,0)]
[Mac (10,11)]
[Export ("boundingRectWithSize:options:attributes:context:")]
CGRect WeakGetBoundingRect (CGSize size, NSStringDrawingOptions options, [NullAllowed] NSDictionary attributes, [NullAllowed] NSStringDrawingContext context);
[iOS (7,0)]
[Mac (10,11)]
[Wrap ("WeakGetBoundingRect (This, size, options, attributes.GetDictionary (), context)")]
CGRect GetBoundingRect (CGSize size, NSStringDrawingOptions options, StringAttributes attributes, [NullAllowed] NSStringDrawingContext context);
}
}

Просмотреть файл

@ -6,7 +6,6 @@
!extra-null-allowed! 'System.IntPtr Foundation.NSAttributedString::InitWithFileURL(Foundation.NSUrl,Foundation.NSDictionary,Foundation.NSDictionary&,Foundation.NSError&)' has a extraneous [NullAllowed] on parameter #1
!extra-null-allowed! 'System.IntPtr Foundation.NSAttributedString::InitWithURL(Foundation.NSUrl,Foundation.NSDictionary,Foundation.NSDictionary&,Foundation.NSError&)' has a extraneous [NullAllowed] on parameter #1
!extra-null-allowed! 'System.Void Foundation.NSAttributedString::.ctor(Foundation.NSData,Foundation.NSDictionary,Foundation.NSDictionary&,Foundation.NSError&)' has a extraneous [NullAllowed] on parameter #1
!extra-null-allowed! 'System.Void UIKit.NSTextContainer::set_ExclusionPaths(UIKit.UIBezierPath[])' has a extraneous [NullAllowed] on parameter #0
!extra-null-allowed! 'System.Void UIKit.UIAccessibilityCustomAction::.ctor(Foundation.NSAttributedString,UIKit.UIAccessibilityCustomActionHandler)' has a extraneous [NullAllowed] on parameter #1
!extra-null-allowed! 'System.Void UIKit.UIAccessibilityCustomAction::.ctor(System.String,UIKit.UIAccessibilityCustomActionHandler)' has a extraneous [NullAllowed] on parameter #1
!extra-null-allowed! 'System.Void UIKit.UIAccessibilityCustomAction::set_Name(System.String)' has a extraneous [NullAllowed] on parameter #0

Просмотреть файл

@ -89,7 +89,6 @@
!extra-null-allowed! 'System.IntPtr Foundation.NSAttributedString::InitWithFileURL(Foundation.NSUrl,Foundation.NSDictionary,Foundation.NSDictionary&,Foundation.NSError&)' has a extraneous [NullAllowed] on parameter #1
!extra-null-allowed! 'System.IntPtr Foundation.NSAttributedString::InitWithURL(Foundation.NSUrl,Foundation.NSDictionary,Foundation.NSDictionary&,Foundation.NSError&)' has a extraneous [NullAllowed] on parameter #1
!extra-null-allowed! 'System.Void Foundation.NSAttributedString::.ctor(Foundation.NSData,Foundation.NSDictionary,Foundation.NSDictionary&,Foundation.NSError&)' has a extraneous [NullAllowed] on parameter #1
!extra-null-allowed! 'System.Void UIKit.NSTextContainer::set_ExclusionPaths(UIKit.UIBezierPath[])' has a extraneous [NullAllowed] on parameter #0
!extra-null-allowed! 'System.Void UIKit.UIAccessibilityCustomAction::.ctor(Foundation.NSAttributedString,UIKit.UIAccessibilityCustomActionHandler)' has a extraneous [NullAllowed] on parameter #1
!extra-null-allowed! 'System.Void UIKit.UIAccessibilityCustomAction::.ctor(System.String,UIKit.UIAccessibilityCustomActionHandler)' has a extraneous [NullAllowed] on parameter #1
!extra-null-allowed! 'System.Void UIKit.UIAccessibilityCustomAction::set_Name(System.String)' has a extraneous [NullAllowed] on parameter #0

Просмотреть файл

@ -622,7 +622,6 @@
!missing-protocol! NSInputServerMouseTracker not bound
!missing-protocol! NSInputServiceProvider not bound
!missing-protocol! NSTextAttachmentCell not bound
!missing-protocol! NSTextLayoutOrientationProvider not bound
!missing-protocol! NSUserInterfaceItemSearching not bound
!missing-protocol-conformance! NSCollectionViewItem should conform to NSCollectionViewElement
!missing-protocol-conformance! NSColorPicker should conform to NSColorPickingDefault
@ -637,8 +636,6 @@
!missing-protocol-conformance! NSText should conform to NSChangeSpelling
!missing-protocol-conformance! NSText should conform to NSIgnoreMisspelledWords
!missing-protocol-conformance! NSTextAttachmentCell should conform to NSTextAttachmentCell
!missing-protocol-conformance! NSTextContainer should conform to NSTextLayoutOrientationProvider
!missing-protocol-conformance! NSTextView should conform to NSTextLayoutOrientationProvider
!missing-protocol-conformance! NSTitlebarAccessoryViewController should conform to NSAnimatablePropertyContainer
!missing-protocol-conformance! NSView should conform to NSAnimatablePropertyContainer
!missing-protocol-conformance! NSWindow should conform to NSAnimatablePropertyContainer
@ -2114,7 +2111,6 @@
!missing-null-allowed! 'System.Void AppKit.NSTextBlock::set_BackgroundColor(AppKit.NSColor)' is missing an [NullAllowed] on parameter #0
!missing-null-allowed! 'System.Void AppKit.NSTextBlock::SetBorderColor(AppKit.NSColor)' is missing an [NullAllowed] on parameter #0
!missing-null-allowed! 'System.Void AppKit.NSTextBlock::SetBorderColor(AppKit.NSColor,AppKit.NSRectEdge)' is missing an [NullAllowed] on parameter #0
!missing-null-allowed! 'System.Void AppKit.NSTextContainer::set_LayoutManager(AppKit.NSLayoutManager)' is missing an [NullAllowed] on parameter #0
!missing-null-allowed! 'System.Void AppKit.NSTextContainer::set_TextView(AppKit.NSTextView)' is missing an [NullAllowed] on parameter #0
!missing-null-allowed! 'System.Void AppKit.NSTextField::SelectText(Foundation.NSObject)' is missing an [NullAllowed] on parameter #0
!missing-null-allowed! 'System.Void AppKit.NSTextField::set_BackgroundColor(AppKit.NSColor)' is missing an [NullAllowed] on parameter #0

Просмотреть файл

@ -119,7 +119,6 @@
!extra-null-allowed! 'System.Boolean UIKit.UIApplication::CanOpenUrl(Foundation.NSUrl)' has a extraneous [NullAllowed] on parameter #0
!extra-null-allowed! 'System.Void Foundation.NSAttributedString::.ctor(Foundation.NSData,Foundation.NSDictionary,Foundation.NSDictionary&,Foundation.NSError&)' has a extraneous [NullAllowed] on parameter #1
!extra-null-allowed! 'System.Void Foundation.NSAttributedString::.ctor(Foundation.NSUrl,Foundation.NSDictionary,Foundation.NSDictionary&,Foundation.NSError&)' has a extraneous [NullAllowed] on parameter #1
!extra-null-allowed! 'System.Void UIKit.NSTextContainer::set_ExclusionPaths(UIKit.UIBezierPath[])' has a extraneous [NullAllowed] on parameter #0
!extra-null-allowed! 'System.Void UIKit.UIAccessibilityCustomAction::.ctor(Foundation.NSAttributedString,UIKit.UIAccessibilityCustomActionHandler)' has a extraneous [NullAllowed] on parameter #1
!extra-null-allowed! 'System.Void UIKit.UIAccessibilityCustomAction::.ctor(System.String,UIKit.UIAccessibilityCustomActionHandler)' has a extraneous [NullAllowed] on parameter #1
!extra-null-allowed! 'System.Void UIKit.UIAccessibilityCustomAction::set_Name(System.String)' has a extraneous [NullAllowed] on parameter #0