[autoformat] Add the AppKit framework. (#16359)

This commit is contained in:
Rolf Bjarne Kvinge 2022-10-17 17:54:19 +02:00 коммит произвёл GitHub
Родитель 06945fb238
Коммит 746cefd228
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
60 изменённых файлов: 1191 добавлений и 1258 удалений

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

@ -29,8 +29,7 @@ using System;
using ObjCRuntime;
using Foundation;
namespace AppKit
{
namespace AppKit {
[Register ("__monomac_internal_ActionDispatcher")]
internal class ActionDispatcher : NSObject
#if !__MACCATALYST__
@ -62,7 +61,7 @@ namespace AppKit
if (handler != null)
handler (sender, EventArgs.Empty);
}
public ActionDispatcher (EventHandler handler)
{
IsDirectBinding = false;
@ -77,7 +76,7 @@ namespace AppKit
public static NSObject SetupAction (NSObject target, EventHandler handler)
{
ActionDispatcher ctarget = target as ActionDispatcher;
if (ctarget == null){
if (ctarget == null) {
ctarget = new ActionDispatcher ();
}
ctarget.Activated += handler;
@ -91,11 +90,11 @@ namespace AppKit
return;
ctarget.Activated -= handler;
}
public static NSObject SetupDoubleAction (NSObject target, EventHandler doubleHandler)
{
ActionDispatcher ctarget = target as ActionDispatcher;
if (ctarget == null){
if (ctarget == null) {
ctarget = new ActionDispatcher ();
}
ctarget.DoubleActivated += doubleHandler;

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

@ -1,15 +1,13 @@
using System;
using System.Runtime.Versioning;
namespace AppKit
{
namespace AppKit {
#if NET
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
#endif
public class AppKitThreadAccessException : Exception
{
public AppKitThreadAccessException() : base("AppKit Consistency error: you are calling a method that can only be invoked from the UI thread.")
public class AppKitThreadAccessException : Exception {
public AppKitThreadAccessException () : base ("AppKit Consistency error: you are calling a method that can only be invoked from the UI thread.")
{
}
}

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

@ -38,7 +38,7 @@ namespace AppKit {
{
BeginSheet (sheet, docWindow, null, null, IntPtr.Zero);
}
public void BeginSheet (NSWindow sheet, NSWindow docWindow, Action onEnded)
{
var obj = new NSAsyncActionDispatcher (onEnded);
@ -47,12 +47,12 @@ namespace AppKit {
}
public partial class NSOpenPanel {
public void BeginSheet (string directory, string fileName, string []fileTypes, NSWindow modalForWindow)
public void BeginSheet (string directory, string fileName, string [] fileTypes, NSWindow modalForWindow)
{
BeginSheet (directory, fileName, fileTypes, modalForWindow, null, null, IntPtr.Zero);
}
public void BeginSheet (string directory, string fileName, string []fileTypes, NSWindow modalForWindow, Action onEnded)
public void BeginSheet (string directory, string fileName, string [] fileTypes, NSWindow modalForWindow, Action onEnded)
{
var obj = new NSAsyncActionDispatcher (onEnded);
BeginSheet (directory, fileName, fileTypes, modalForWindow, obj, NSActionDispatcher.Selector, IntPtr.Zero);
@ -64,7 +64,7 @@ namespace AppKit {
{
BeginSheet (printInfo, docWindow, null, null, IntPtr.Zero);
}
public void BeginSheet (NSPrintInfo printInfo, NSWindow docWindow, Action onEnded)
{
var obj = new NSAsyncActionDispatcher (onEnded);

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

@ -11,7 +11,7 @@ namespace AppKit {
[Obsolete ("Use the 'TextBlocks' property instead.", false)]
[EditorBrowsable (EditorBrowsableState.Never)]
[BindingImpl (BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
public virtual void SetTextBlocks (NSTextBlock[] array)
public virtual void SetTextBlocks (NSTextBlock [] array)
{
if (array == null)
throw new ArgumentNullException (nameof (array));
@ -27,7 +27,7 @@ namespace AppKit {
[Obsolete ("Use the 'TextLists' property instead.", false)]
[EditorBrowsable (EditorBrowsableState.Never)]
[BindingImpl (BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
public virtual void SetTextLists (NSTextList[] array)
public virtual void SetTextLists (NSTextList [] array)
{
if (array == null)
throw new ArgumentNullException (nameof (array));
@ -41,8 +41,7 @@ namespace AppKit {
}
}
public static class NSFileTypeForHFSTypeCode
{
public static class NSFileTypeForHFSTypeCode {
public static readonly string ComputerIcon = "root";
public static readonly string DesktopIcon = "desk";
public static readonly string FinderIcon = "FNDR";

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

@ -89,7 +89,7 @@ namespace AppKit {
}
}
}
public partial class NSTableView {
public event EventHandler DoubleClick {
add {

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -31,18 +31,15 @@
using Foundation;
namespace AppKit
{
public enum NSFontCollectionAction
{
namespace AppKit {
public enum NSFontCollectionAction {
Unknown,
Shown,
Hidden,
Renamed
}
public partial class NSFontCollectionChangedEventArgs
{
public partial class NSFontCollectionChangedEventArgs {
public NSFontCollectionAction Action {
get {
if (_Action == NSFontCollection.ActionWasShown) {
@ -58,19 +55,17 @@ namespace AppKit
}
public NSFontCollectionVisibility Visibility {
get { return (NSFontCollectionVisibility)(int)_Visibility; }
get { return (NSFontCollectionVisibility) (int) _Visibility; }
}
}
public enum NSPopoverCloseReason
{
public enum NSPopoverCloseReason {
Unknown,
Standard,
DetachToWindow
}
public partial class NSPopoverCloseEventArgs
{
public partial class NSPopoverCloseEventArgs {
public NSPopoverCloseReason Reason {
get {
if (_Reason == NSPopover.CloseReasonStandard) {

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

@ -17,22 +17,20 @@ using CoreGraphics;
using Foundation;
using ObjCRuntime;
namespace AppKit
{
public partial interface INSAccessibility {}
namespace AppKit {
public partial interface INSAccessibility { }
#if NET
[SupportedOSPlatform ("macos10.9")]
#else
[Mac (10,9)] // but the field/notifications are in 10.9
[Mac (10, 9)] // but the field/notifications are in 10.9
#endif
public partial class NSAccessibility
{
public partial class NSAccessibility {
#if !COREBUILD
#if NET
[SupportedOSPlatform ("macos10.10")]
#else
[Mac (10,10)]
[Mac (10, 10)]
#endif
[DllImport (Constants.AppKitLibrary)]
static extern CGRect NSAccessibilityFrameInView (NSView parentView, CGRect frame);
@ -45,7 +43,7 @@ namespace AppKit
#if NET
[SupportedOSPlatform ("macos10.10")]
#else
[Mac (10,10)]
[Mac (10, 10)]
#endif
[DllImport (Constants.AppKitLibrary)]
static extern CGPoint NSAccessibilityPointInView (NSView parentView, CGPoint point);
@ -159,7 +157,7 @@ namespace AppKit
[DllImport (Constants.AppKitLibrary)]
static extern IntPtr NSAccessibilityUnignoredChildren (IntPtr originalChildren);
public static NSObject[] GetUnignoredChildren (NSArray originalChildren)
public static NSObject [] GetUnignoredChildren (NSArray originalChildren)
{
if (originalChildren == null)
throw new ArgumentNullException ("originalChildren");
@ -172,7 +170,7 @@ namespace AppKit
[DllImport (Constants.AppKitLibrary)]
static extern IntPtr NSAccessibilityUnignoredChildrenForOnlyChild (IntPtr originalChild);
public static NSObject[] GetUnignoredChildren (NSObject originalChild)
public static NSObject [] GetUnignoredChildren (NSObject originalChild)
{
if (originalChild == null)
throw new ArgumentNullException ("originalChild");

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

@ -35,11 +35,9 @@ using System.Runtime.Versioning;
using Foundation;
using ObjCRuntime;
namespace AppKit
{
namespace AppKit {
[Register ("__MonoMac_NSAlertDidEndDispatcher")]
internal class NSAlertDidEndDispatcher : NSObject
{
internal class NSAlertDidEndDispatcher : NSObject {
const string selector = "alertDidEnd:returnCode:contextInfo:";
public static readonly Selector Selector = new Selector (selector);
@ -66,8 +64,7 @@ namespace AppKit
}
}
public partial class NSAlert
{
public partial class NSAlert {
public void BeginSheet (NSWindow window)
{
BeginSheet (window, null, null, IntPtr.Zero);

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

@ -66,7 +66,7 @@ namespace AppKit {
// and call NSApplicationMain externally prior to this Init, so only
// initialize the context if it hasn't been set externally. Alternatively,
// AppKitSynchronizationContext could be made public.
if(SynchronizationContext.Current == null)
if (SynchronizationContext.Current == null)
SynchronizationContext.SetSynchronizationContext (new AppKitSynchronizationContext ());
// Establish the main thread at the time of Init to support hosts
@ -106,7 +106,7 @@ namespace AppKit {
public static void Main (string [] args)
{
// Switch to an AppKitSynchronizationContext if Main is invoked
if(SynchronizationContext.Current == null || !typeof(AppKitSynchronizationContext).IsAssignableFrom(SynchronizationContext.Current.GetType()))
if (SynchronizationContext.Current == null || !typeof (AppKitSynchronizationContext).IsAssignableFrom (SynchronizationContext.Current.GetType ()))
SynchronizationContext.SetSynchronizationContext (new AppKitSynchronizationContext ());
// Init where this is set the first time is generally paired
@ -116,29 +116,29 @@ namespace AppKit {
NSApplicationMain (args.Length, args);
}
public static void EnsureUIThread()
public static void EnsureUIThread ()
{
if (NSApplication.CheckForIllegalCrossThreadCalls && NSApplication.mainThread != Thread.CurrentThread)
throw new AppKitThreadAccessException();
throw new AppKitThreadAccessException ();
}
public static void EnsureEventAndDelegateAreNotMismatched (object del, Type expectedType)
{
if (NSApplication.CheckForEventAndDelegateMismatches && !(expectedType.IsAssignableFrom (del.GetType ())))
throw new InvalidOperationException (string.Format("Event registration is overwriting existing delegate. Either just use events or your own delegate: {0} {1}", del.GetType (), expectedType));
throw new InvalidOperationException (string.Format ("Event registration is overwriting existing delegate. Either just use events or your own delegate: {0} {1}", del.GetType (), expectedType));
}
public static void EnsureDelegateAssignIsNotOverwritingInternalDelegate (object currentDelegateValue, object newDelegateValue, Type internalDelegateType)
{
if (NSApplication.CheckForEventAndDelegateMismatches && currentDelegateValue != null && newDelegateValue != null
&& currentDelegateValue.GetType().IsAssignableFrom (internalDelegateType)
&& !newDelegateValue.GetType().IsAssignableFrom (internalDelegateType))
throw new InvalidOperationException (string.Format("Event registration is overwriting existing delegate. Either just use events or your own delegate: {0} {1}", newDelegateValue.GetType(), internalDelegateType));
&& currentDelegateValue.GetType ().IsAssignableFrom (internalDelegateType)
&& !newDelegateValue.GetType ().IsAssignableFrom (internalDelegateType))
throw new InvalidOperationException (string.Format ("Event registration is overwriting existing delegate. Either just use events or your own delegate: {0} {1}", newDelegateValue.GetType (), internalDelegateType));
}
public void DiscardEvents (NSEventMask mask, NSEvent lastEvent)
{
DiscardEvents ((nuint)(ulong) mask, lastEvent);
DiscardEvents ((nuint) (ulong) mask, lastEvent);
}
#if !NET
@ -149,7 +149,7 @@ namespace AppKit {
#endif
// note: if needed override the protected Get|Set methods
public NSApplicationActivationPolicy ActivationPolicy {
public NSApplicationActivationPolicy ActivationPolicy {
get { return GetActivationPolicy (); }
// ignore return value (bool)
set { SetActivationPolicy (value); }

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

@ -32,21 +32,21 @@ namespace AppKit {
public partial class NSArrayController {
// note: if needed override the protected Get|Set methods
public NSIndexSet SelectionIndexes {
public NSIndexSet SelectionIndexes {
get { return GetSelectionIndexes (); }
// ignore return value (bool)
set { SetSelectionIndexes (value); }
}
// note: if needed override the protected Get|Set methods
public ulong SelectionIndex {
public ulong SelectionIndex {
get { return (ulong) GetSelectionIndex (); }
// ignore return value (bool)
set { SetSelectionIndex ((nuint) value); }
}
// note: if needed override the protected Get|Set methods
public NSObject [] SelectedObjects {
public NSObject [] SelectedObjects {
get { return GetSelectedObjects (); }
// ignore return value (bool)
set { SetSelectedObjects (value); }

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

@ -59,7 +59,7 @@ namespace AppKit {
_SetLineDash ((IntPtr) ptr, pattern.Length, phase);
}
public unsafe NSBezierPathElement ElementAt (nint index, out CGPoint[] points)
public unsafe NSBezierPathElement ElementAt (nint index, out CGPoint [] points)
{
NSBezierPathElement bpe;
@ -78,19 +78,19 @@ namespace AppKit {
return bpe;
}
public unsafe void SetAssociatedPointsAtIndex (CGPoint[] points, nint index)
public unsafe void SetAssociatedPointsAtIndex (CGPoint [] points, nint index)
{
if (points == null)
throw new ArgumentNullException ("points");
if (points == null)
throw new ArgumentNullException ("points");
if (points.Length < 1)
throw new ArgumentException ("points array is empty");
fixed (CGPoint* ptr = &points [0])
_SetAssociatedPointsAtIndex ((IntPtr)ptr, index);
_SetAssociatedPointsAtIndex ((IntPtr) ptr, index);
}
public unsafe void Append (CGPoint[] points)
public unsafe void Append (CGPoint [] points)
{
if (points == null)
throw new ArgumentNullException ("points");
@ -98,18 +98,18 @@ namespace AppKit {
throw new ArgumentException ("points array is empty");
fixed (CGPoint* ptr = &points [0])
_AppendPathWithPoints ((IntPtr)ptr, points.Length);
_AppendPathWithPoints ((IntPtr) ptr, points.Length);
}
#if !NET
[Obsolete ("Use 'Append (CGPoint[])' instead.")]
public unsafe void AppendPathWithPoints (CGPoint[] points)
public unsafe void AppendPathWithPoints (CGPoint [] points)
{
Append (points);
}
[Obsolete ("Use 'Append (uint[], NSFont)' instead.")]
public unsafe void AppendPathWithGlyphs (uint[] glyphs, NSFont font)
public unsafe void AppendPathWithGlyphs (uint [] glyphs, NSFont font)
{
if (glyphs == null)
throw new ArgumentNullException ("glyphs");
@ -117,7 +117,7 @@ namespace AppKit {
throw new ArgumentException ("glyphs array is empty");
fixed (uint* ptr = &glyphs [0])
_AppendPathWithGlyphs ((IntPtr)ptr, glyphs.Length, font);
_AppendPathWithGlyphs ((IntPtr) ptr, glyphs.Length, font);
}
#endif
@ -125,9 +125,9 @@ namespace AppKit {
[SupportedOSPlatform ("macos10.13")]
[UnsupportedOSPlatform ("maccatalyst")]
#else
[Mac (10,13)]
[Mac (10, 13)]
#endif
public unsafe void Append (uint[] glyphs, NSFont font)
public unsafe void Append (uint [] glyphs, NSFont font)
{
if (glyphs == null)
throw new ArgumentNullException ("glyphs");
@ -135,7 +135,7 @@ namespace AppKit {
throw new ArgumentException ("glyphs array is empty");
fixed (uint* ptr = &glyphs [0])
_AppendBezierPathWithCGGlyphs ((IntPtr)ptr, glyphs.Length, font);
_AppendBezierPathWithCGGlyphs ((IntPtr) ptr, glyphs.Length, font);
}
}
}

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

@ -26,11 +26,11 @@
using System;
namespace AppKit {
public partial class NSBrowser {
// note: if needed override the protected Get|Set methods
public string Path {
public string Path {
get { return GetPath (); }
// ignore return value (bool)
set { SetPath (value); }

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

@ -38,7 +38,7 @@ namespace AppKit {
NSActionDispatcher dispatcher;
public new NSButtonCell Cell {
get { return (NSButtonCell)base.Cell; }
get { return (NSButtonCell) base.Cell; }
set { base.Cell = value; }
}
@ -46,7 +46,7 @@ namespace AppKit {
[SupportedOSPlatform ("macos10.12")]
[UnsupportedOSPlatform ("maccatalyst")]
#else
[Mac (10,12)]
[Mac (10, 12)]
#endif
public static NSButton CreateButton (string title, NSImage image, Action action)
{
@ -60,7 +60,7 @@ namespace AppKit {
[SupportedOSPlatform ("macos10.12")]
[UnsupportedOSPlatform ("maccatalyst")]
#else
[Mac (10,12)]
[Mac (10, 12)]
#endif
public static NSButton CreateButton (string title, Action action)
{
@ -74,7 +74,7 @@ namespace AppKit {
[SupportedOSPlatform ("macos10.12")]
[UnsupportedOSPlatform ("maccatalyst")]
#else
[Mac (10,12)]
[Mac (10, 12)]
#endif
public static NSButton CreateButton (NSImage image, Action action)
{
@ -88,7 +88,7 @@ namespace AppKit {
[SupportedOSPlatform ("macos10.12")]
[UnsupportedOSPlatform ("maccatalyst")]
#else
[Mac (10,12)]
[Mac (10, 12)]
#endif
public static NSButton CreateCheckbox (string title, Action action)
{
@ -102,7 +102,7 @@ namespace AppKit {
[SupportedOSPlatform ("macos10.12")]
[UnsupportedOSPlatform ("maccatalyst")]
#else
[Mac (10,12)]
[Mac (10, 12)]
#endif
public static NSButton CreateRadioButton (string title, Action action)
{

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

@ -40,7 +40,7 @@ namespace AppKit {
extern static void NSDrawThreePartImage (CGRect rect,
IntPtr /* NSImage* */ startCap, IntPtr /* NSImage* */ centerFill, IntPtr /* NSImage* */ endCap,
[MarshalAs (UnmanagedType.I1)] bool vertial, nint op, nfloat alphaFraction, [MarshalAs (UnmanagedType.I1)] bool flipped);
public void DrawThreePartImage (CGRect frame,
NSImage startCap, NSImage centerFill, NSImage endCap,
bool vertical, NSCompositingOperation op, nfloat alphaFraction, bool flipped)
@ -76,7 +76,7 @@ namespace AppKit {
bottomEdgeFill != null ? bottomEdgeFill.Handle : IntPtr.Zero,
bottomRightCorner != null ? bottomRightCorner.Handle : IntPtr.Zero,
(nint) (long) op, alphaFraction, flipped);
}
}
}
}
#endif // !__MACCATALYST__

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

@ -20,12 +20,11 @@ namespace AppKit {
public partial class NSCollectionLayoutAnchor {
public static NSCollectionLayoutAnchor Create (NSDirectionalRectEdge edges, NSCollectionLayoutAnchorOffsetType offsetType, CGPoint offset) =>
offsetType switch
{
NSCollectionLayoutAnchorOffsetType.Absolute => CreateFromAbsoluteOffset (edges, offset),
NSCollectionLayoutAnchorOffsetType.Fractional => CreateFromFractionalOffset (edges, offset),
_ => throw new ArgumentException (message: "Invalid enum value", paramName: nameof (offsetType)),
};
offsetType switch {
NSCollectionLayoutAnchorOffsetType.Absolute => CreateFromAbsoluteOffset (edges, offset),
NSCollectionLayoutAnchorOffsetType.Fractional => CreateFromFractionalOffset (edges, offset),
_ => throw new ArgumentException (message: "Invalid enum value", paramName: nameof (offsetType)),
};
}
}
#endif // !__MACCATALYST__

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

@ -3,10 +3,8 @@ using System;
using Foundation;
using ObjCRuntime;
namespace AppKit
{
public partial class NSCollectionViewDelegate
{
namespace AppKit {
public partial class NSCollectionViewDelegate {
[Mac (10, 11)]
[Obsolete ("Use 'ValidateDropOperation (NSCollectionView collectionView, NSDraggingInfo draggingInfo, ref NSIndexPath proposedDropIndexPath, ref NSCollectionViewDropOperation proposedDropOperation)' instead.")]
public virtual NSDragOperation ValidateDrop (NSCollectionView collectionView, NSDraggingInfo draggingInfo, out NSIndexPath proposedDropIndexPath, out NSCollectionViewDropOperation proposedDropOperation)
@ -17,8 +15,7 @@ namespace AppKit
}
}
public partial class NSCollectionViewDelegateFlowLayout
{
public partial class NSCollectionViewDelegateFlowLayout {
[Mac (10, 11)]
[Obsolete ("Use 'ValidateDropOperation (NSCollectionView collectionView, NSDraggingInfo draggingInfo, ref NSIndexPath proposedDropIndexPath, ref NSCollectionViewDropOperation proposedDropOperation)' instead.")]
public virtual NSDragOperation ValidateDrop (NSCollectionView collectionView, NSDraggingInfo draggingInfo, out NSIndexPath proposedDropIndexPath, out NSCollectionViewDropOperation proposedDropOperation)

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

@ -15,7 +15,7 @@ namespace AppKit {
public static NSColor FromRgb (byte red, byte green, byte blue)
{
return FromRgba (red/255.0f, green/255.0f, blue/255.0f, 1.0f);
return FromRgba (red / 255.0f, green / 255.0f, blue / 255.0f, 1.0f);
}
public static NSColor FromRgb (int red, int green, int blue)
@ -25,7 +25,7 @@ namespace AppKit {
public static NSColor FromRgba (byte red, byte green, byte blue, byte alpha)
{
return FromRgba (red/255.0f, green/255.0f, blue/255.0f, alpha/255.0f);
return FromRgba (red / 255.0f, green / 255.0f, blue / 255.0f, alpha / 255.0f);
}
public static NSColor FromRgba (int red, int green, int blue, int alpha)
@ -65,7 +65,7 @@ namespace AppKit {
public static NSColor FromDeviceRgb (byte red, byte green, byte blue)
{
return FromDeviceRgba (red/255.0f, green/255.0f, blue/255.0f, 1.0f);
return FromDeviceRgba (red / 255.0f, green / 255.0f, blue / 255.0f, 1.0f);
}
public static NSColor FromDeviceRgb (int red, int green, int blue)
@ -75,7 +75,7 @@ namespace AppKit {
public static NSColor FromDeviceRgba (byte red, byte green, byte blue, byte alpha)
{
return FromDeviceRgba (red/255.0f, green/255.0f, blue/255.0f, alpha/255.0f);
return FromDeviceRgba (red / 255.0f, green / 255.0f, blue / 255.0f, alpha / 255.0f);
}
public static NSColor FromDeviceRgba (int red, int green, int blue, int alpha)
@ -140,7 +140,7 @@ namespace AppKit {
public static NSColor FromCalibratedRgb (byte red, byte green, byte blue)
{
return FromCalibratedRgba (red/255.0f, green/255.0f, blue/255.0f, 1.0f);
return FromCalibratedRgba (red / 255.0f, green / 255.0f, blue / 255.0f, 1.0f);
}
public static NSColor FromCalibratedRgb (int red, int green, int blue)
@ -150,7 +150,7 @@ namespace AppKit {
public static NSColor FromCalibratedRgba (byte red, byte green, byte blue, byte alpha)
{
return FromCalibratedRgba (red/255.0f, green/255.0f, blue/255.0f, alpha/255.0f);
return FromCalibratedRgba (red / 255.0f, green / 255.0f, blue / 255.0f, alpha / 255.0f);
}
public static NSColor FromCalibratedRgba (int red, int green, int blue, int alpha)
@ -209,19 +209,19 @@ namespace AppKit {
try {
string name = this.ColorSpaceName;
if (name == "NSNamedColorSpace")
return this.LocalizedCatalogNameComponent +"/" + this.LocalizedColorNameComponent;
return this.LocalizedCatalogNameComponent + "/" + this.LocalizedColorNameComponent;
if (name == "NSPatternColorSpace")
return "Pattern Color: " + this.PatternImage.Name;
StringBuilder sb = new StringBuilder (this.ColorSpace.LocalizedName);
nfloat[] components;
nfloat [] components;
this.GetComponents (out components);
if (components.Length > 0)
sb.Append ("(" + components [0]);
for (int i = 1; i < components.Length; i++)
sb.Append ("," + components [i]);
sb.Append (")");
return sb.ToString ();
} catch {
//fallback to base method if we have an unexpected condition.

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

@ -14,7 +14,7 @@ namespace AppKit {
}
#endif
public NSObject this [nint index] {
public NSObject this [nint index] {
get {
return GetItemObject (index);
}

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

@ -6,21 +6,21 @@ using Foundation;
using ObjCRuntime;
namespace AppKit {
public partial class NSDocument {
public delegate void DuplicateCallback (NSDocument document, bool didDuplicate);
[Register ("__NSDocumentDuplicateCallback")]
internal class Callback : NSObject {
DuplicateCallback callback;
public Callback (DuplicateCallback callback)
{
this.callback = callback;
IsDirectBinding = false;
DangerousRetain ();
}
[Export ("document:didDuplicate:contextInfo:")]
void SelectorCallback (NSDocument source, bool didDuplicate, IntPtr contextInfo)
{
@ -31,7 +31,7 @@ namespace AppKit {
}
}
}
public void DuplicateDocument (DuplicateCallback callback)
{
if (callback == null) {

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

@ -9,7 +9,8 @@ using ObjCRuntime;
namespace AppKit {
#if !NET
public partial class NSDraggingItem {
public NSDraggingItem (NSPasteboardWriting pasteboardWriter) : this ((INSPasteboardWriting)pasteboardWriter) {
public NSDraggingItem (NSPasteboardWriting pasteboardWriter) : this ((INSPasteboardWriting) pasteboardWriter)
{
}
}
#endif

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

@ -8,12 +8,12 @@ using ObjCRuntime;
namespace AppKit {
[DebuggerTypeProxy (typeof(NSEvent.NSEventDebuggerProxy))]
[DebuggerTypeProxy (typeof (NSEvent.NSEventDebuggerProxy))]
public partial class NSEvent {
class NSEventDebuggerProxy {
NSEvent target;
public NSEventDebuggerProxy (NSEvent target)
{
this.target = target;
@ -33,7 +33,7 @@ namespace AppKit {
return target.LocationInWindow;
}
}
public NSEventModifierMask ModifierFlags {
get {
return target.ModifierFlags;
@ -57,7 +57,7 @@ namespace AppKit {
return target.Window;
}
}
public nint WindowNumber {
get {
return target.WindowNumber;
@ -98,21 +98,21 @@ namespace AppKit {
return target.Characters;
}
}
public string CharactersIgnoringModifiers {
get {
CheckKeyEvent ();
return target.CharactersIgnoringModifiers;
}
}
public bool IsARepeat {
get {
CheckKeyEvent ();
return target.IsARepeat;
}
}
public ushort KeyCode {
get {
CheckKeyEvent ();
@ -161,21 +161,21 @@ namespace AppKit {
return;
throw new InvalidOperationException ("Not a tablet pointing event.");
}
public nint AbsoluteX {
get {
CheckTabletPointingEvent ();
return target.AbsoluteX;
}
}
public nint AbsoluteY {
get {
CheckTabletPointingEvent ();
return target.AbsoluteY;
}
}
public nint AbsoluteZ {
get {
CheckTabletPointingEvent ();
@ -235,7 +235,7 @@ namespace AppKit {
return target.ButtonNumber;
}
}
public nint ClickCount {
get {
CheckMouseEvent ();
@ -266,7 +266,7 @@ namespace AppKit {
return;
throw new InvalidOperationException ("Not a mouse tracking event.");
}
internal nint EventNumber {
get {
CheckMouseTrackingEvent ();
@ -353,14 +353,14 @@ namespace AppKit {
return false;
}
}
void CheckScrollWheelEvent ()
{
if (IsScrollWheelEvent ())
return;
throw new InvalidOperationException ("Not a scroll wheel event.");
}
public float DeltaX {
get {
CheckScrollWheelEvent ();
@ -434,7 +434,7 @@ namespace AppKit {
return target.PointingDeviceID ();
}
}
public NSPointingDeviceType PointingDeviceType {
get {
CheckTabletProximityEvent ();
@ -486,7 +486,7 @@ namespace AppKit {
// FIXME
return false;
}
void CheckTouchOrGestureEvent ()
{
if (IsTouchOrGestureEvent ())
@ -511,21 +511,21 @@ namespace AppKit {
return true;
return false;
}
void CheckScrollWheelOrFlickEvent ()
{
if (IsScrollWheelOrFlickEvent ())
return;
throw new InvalidOperationException ("Not a scroll wheel or flick event.");
}
public bool HasPreciseScrollingDeltas {
get {
CheckScrollWheelOrFlickEvent ();
return target.HasPreciseScrollingDeltas;
}
}
public nfloat ScrollingDeltaX {
get {
CheckScrollWheelOrFlickEvent ();
@ -560,9 +560,9 @@ namespace AppKit {
return target.IsDirectionInvertedFromDevice;
}
}
#endregion
#endregion
}
}
}
#endif // !__MACCATALYST__

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

@ -11,8 +11,7 @@ using CoreText;
using CGGlyph = System.UInt16;
namespace AppKit {
public partial class NSFont
{
public partial class NSFont {
public static NSFont FromCTFont (CTFont font)
{
if (font == null)
@ -24,7 +23,7 @@ namespace AppKit {
[SupportedOSPlatform ("macos10.13")]
[UnsupportedOSPlatform ("maccatalyst")]
#else
[Mac (10,13)]
[Mac (10, 13)]
#endif
public unsafe CGRect [] GetBoundingRects (CGGlyph [] glyphs)
{
@ -33,10 +32,10 @@ namespace AppKit {
if (glyphs.Length < 1)
throw new ArgumentException ("glyphs array is empty");
CGRect [] bounds = new CGRect [glyphs.Length];
CGRect [] bounds = new CGRect [glyphs.Length];
fixed (CGRect* boundsPtr = &bounds [0]) {
fixed (CGGlyph* glyphsPtr = &glyphs [0]) {
_GetBoundingRects ((IntPtr)boundsPtr, (IntPtr)glyphsPtr, (nuint)glyphs.Length);
_GetBoundingRects ((IntPtr) boundsPtr, (IntPtr) glyphsPtr, (nuint) glyphs.Length);
}
}
return bounds;
@ -46,7 +45,7 @@ namespace AppKit {
[SupportedOSPlatform ("macos10.13")]
[UnsupportedOSPlatform ("maccatalyst")]
#else
[Mac (10,13)]
[Mac (10, 13)]
#endif
public unsafe CGSize [] GetAdvancements (CGGlyph [] glyphs)
{
@ -55,10 +54,10 @@ namespace AppKit {
if (glyphs.Length < 1)
throw new ArgumentException ("glyphs array is empty");
CGSize [] advancements = new CGSize [glyphs.Length];
CGSize [] advancements = new CGSize [glyphs.Length];
fixed (CGSize* advancementsPtr = &advancements [0]) {
fixed (CGGlyph* glyphsPtr = &glyphs [0]) {
_GetAdvancements ((IntPtr)advancementsPtr, (IntPtr)glyphsPtr, (nuint)glyphs.Length);
_GetAdvancements ((IntPtr) advancementsPtr, (IntPtr) glyphsPtr, (nuint) glyphs.Length);
}
}
return advancements;
@ -69,85 +68,85 @@ namespace AppKit {
var ptr = _FromFontName (fontName, fontSize);
return ptr == IntPtr.Zero ? null : new NSFont (ptr);
}
public static NSFont FromDescription (NSFontDescriptor fontDescriptor, nfloat fontSize)
{
var ptr = _FromDescription (fontDescriptor, fontSize);
return ptr == IntPtr.Zero ? null : new NSFont (ptr);
}
public static NSFont FromDescription (NSFontDescriptor fontDescriptor, NSAffineTransform textTransform)
{
var ptr = _FromDescription (fontDescriptor, textTransform);
return ptr == IntPtr.Zero ? null : new NSFont (ptr);
}
public static NSFont UserFontOfSize (nfloat fontSize)
{
var ptr = _UserFontOfSize (fontSize);
return ptr == IntPtr.Zero ? null : new NSFont (ptr);
}
public static NSFont UserFixedPitchFontOfSize (nfloat fontSize)
{
var ptr = _UserFixedPitchFontOfSize (fontSize);
return ptr == IntPtr.Zero ? null : new NSFont (ptr);
}
public static NSFont SystemFontOfSize (nfloat fontSize)
{
var ptr = _SystemFontOfSize (fontSize);
return ptr == IntPtr.Zero ? null : new NSFont (ptr);
}
public static NSFont BoldSystemFontOfSize (nfloat fontSize)
{
var ptr = _BoldSystemFontOfSize (fontSize);
return ptr == IntPtr.Zero ? null : new NSFont (ptr);
}
public static NSFont LabelFontOfSize (nfloat fontSize)
{
var ptr = _LabelFontOfSize (fontSize);
return ptr == IntPtr.Zero ? null : new NSFont (ptr);
}
public static NSFont TitleBarFontOfSize (nfloat fontSize)
{
var ptr = _TitleBarFontOfSize (fontSize);
return ptr == IntPtr.Zero ? null : new NSFont (ptr);
}
public static NSFont MenuFontOfSize (nfloat fontSize)
{
var ptr = _MenuFontOfSize (fontSize);
return ptr == IntPtr.Zero ? null : new NSFont (ptr);
}
public static NSFont MenuBarFontOfSize (nfloat fontSize)
{
var ptr = _MenuBarFontOfSize (fontSize);
return ptr == IntPtr.Zero ? null : new NSFont (ptr);
}
public static NSFont MessageFontOfSize (nfloat fontSize)
{
var ptr = _MessageFontOfSize (fontSize);
return ptr == IntPtr.Zero ? null : new NSFont (ptr);
}
public static NSFont PaletteFontOfSize (nfloat fontSize)
{
var ptr = _PaletteFontOfSize (fontSize);
return ptr == IntPtr.Zero ? null : new NSFont (ptr);
}
public static NSFont ToolTipsFontOfSize (nfloat fontSize)
{
var ptr = _ToolTipsFontOfSize (fontSize);
return ptr == IntPtr.Zero ? null : new NSFont (ptr);
}
public static NSFont ControlContentFontOfSize (nfloat fontSize)
{
var ptr = _ControlContentFontOfSize (fontSize);
@ -164,7 +163,7 @@ namespace AppKit {
#else
[Deprecated (PlatformName.MacOSX, 10, 13)]
#endif
public virtual NSFont PrinterFont {
public virtual NSFont PrinterFont {
get {
var ptr = _PrinterFont;
return ptr == IntPtr.Zero ? null : new NSFont (ptr);
@ -203,7 +202,7 @@ namespace AppKit {
var ptr = _ScreenFontWithRenderingMode (renderingMode);
return ptr == IntPtr.Zero ? null : new NSFont (ptr);
}
public virtual NSFont GetVerticalFont ()
{
var ptr = _GetVerticalFont ();
@ -214,7 +213,7 @@ namespace AppKit {
[SupportedOSPlatform ("macos10.11")]
[UnsupportedOSPlatform ("maccatalyst")]
#else
[Mac (10,11)]
[Mac (10, 11)]
#endif
public static NSFont SystemFontOfSize (nfloat fontSize, nfloat weight)
{
@ -226,7 +225,7 @@ namespace AppKit {
[SupportedOSPlatform ("macos10.11")]
[UnsupportedOSPlatform ("maccatalyst")]
#else
[Mac (10,11)]
[Mac (10, 11)]
#endif
public static NSFont MonospacedDigitSystemFontOfSize (nfloat fontSize, nfloat weight)
{
@ -238,7 +237,7 @@ namespace AppKit {
[SupportedOSPlatform ("macos10.15")]
[UnsupportedOSPlatform ("maccatalyst")]
#else
[Mac (10,15)]
[Mac (10, 15)]
#endif
public static NSFont MonospacedSystemFont (nfloat fontSize, nfloat weight)
{

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

@ -11,7 +11,7 @@
using System;
using System.Collections;
using Foundation;
using Foundation;
using ObjCRuntime;
using System.Runtime.Versioning;
@ -93,8 +93,8 @@ namespace AppKit {
}
public partial class NSClickGestureRecognizer : NSGestureRecognizer {
public NSClickGestureRecognizer (Action action) : base (action) {}
public NSClickGestureRecognizer (Action<NSClickGestureRecognizer> action) : base (NSGestureRecognizer.ParametrizedSelector, new Callback (action)) {}
public NSClickGestureRecognizer (Action action) : base (action) { }
public NSClickGestureRecognizer (Action<NSClickGestureRecognizer> action) : base (NSGestureRecognizer.ParametrizedSelector, new Callback (action)) { }
[Register ("__NSClickGestureRecognizer")]
[Preserve (Conditional = true)]
@ -116,8 +116,8 @@ namespace AppKit {
}
public partial class NSMagnificationGestureRecognizer : NSGestureRecognizer {
public NSMagnificationGestureRecognizer (Action action) : base (action) {}
public NSMagnificationGestureRecognizer (Action<NSMagnificationGestureRecognizer> action) : base (NSGestureRecognizer.ParametrizedSelector, new Callback (action)) {}
public NSMagnificationGestureRecognizer (Action action) : base (action) { }
public NSMagnificationGestureRecognizer (Action<NSMagnificationGestureRecognizer> action) : base (NSGestureRecognizer.ParametrizedSelector, new Callback (action)) { }
[Register ("__NSMagnificationGestureRecognizer")]
[Preserve (Conditional = true)]
@ -139,8 +139,8 @@ namespace AppKit {
}
public partial class NSPanGestureRecognizer : NSGestureRecognizer {
public NSPanGestureRecognizer (Action action) : base (action) {}
public NSPanGestureRecognizer (Action<NSPanGestureRecognizer> action) : base (NSGestureRecognizer.ParametrizedSelector, new Callback (action)) {}
public NSPanGestureRecognizer (Action action) : base (action) { }
public NSPanGestureRecognizer (Action<NSPanGestureRecognizer> action) : base (NSGestureRecognizer.ParametrizedSelector, new Callback (action)) { }
[Register ("__NSPanGestureRecognizer")]
[Preserve (Conditional = true)]
@ -162,8 +162,8 @@ namespace AppKit {
}
public partial class NSPressGestureRecognizer : NSGestureRecognizer {
public NSPressGestureRecognizer (Action action) : base (action) {}
public NSPressGestureRecognizer (Action<NSPressGestureRecognizer> action) : base (NSGestureRecognizer.ParametrizedSelector, new Callback (action)) {}
public NSPressGestureRecognizer (Action action) : base (action) { }
public NSPressGestureRecognizer (Action<NSPressGestureRecognizer> action) : base (NSGestureRecognizer.ParametrizedSelector, new Callback (action)) { }
[Register ("__NSPressGestureRecognizer")]
[Preserve (Conditional = true)]
@ -185,8 +185,8 @@ namespace AppKit {
}
public partial class NSRotationGestureRecognizer : NSGestureRecognizer {
public NSRotationGestureRecognizer (Action action) : base (action) {}
public NSRotationGestureRecognizer (Action<NSRotationGestureRecognizer> action) : base (NSGestureRecognizer.ParametrizedSelector, new Callback (action)) {}
public NSRotationGestureRecognizer (Action action) : base (action) { }
public NSRotationGestureRecognizer (Action<NSRotationGestureRecognizer> action) : base (NSGestureRecognizer.ParametrizedSelector, new Callback (action)) { }
[Register ("__NSRotationGestureRecognizer")]
[Preserve (Conditional = true)]

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

@ -13,10 +13,9 @@ using ObjCRuntime;
using System.Runtime.InteropServices;
namespace AppKit {
public partial class NSGradient : NSObject
{
public partial class NSGradient : NSObject {
static IntPtr selInitWithColorsAtLocationsColorSpace = Selector.GetHandle ("initWithColors:atLocations:colorSpace:");
// The signature of this ObjC method is
// - (id)initWithColorsAndLocations:(NSColor *)firstColor, ... NS_REQUIRES_NIL_TERMINATION;
// where colors and locations (as CGFloats between 0.0 and 1.0) alternate until nil
@ -32,36 +31,36 @@ namespace AppKit {
// Per NSGradient.h, this initializer calls the designated initializer (below) with a
// color space of NSColorSpace.GenericRGBColorSpace, so we will do the same.
public NSGradient (NSColor[] colors, float[] locations) :
this(colors, locations, NSColorSpace.GenericRGBColorSpace)
public NSGradient (NSColor [] colors, float [] locations) :
this (colors, locations, NSColorSpace.GenericRGBColorSpace)
{
}
public NSGradient (NSColor[] colors, double[] locations) :
this(colors, locations, NSColorSpace.GenericRGBColorSpace)
public NSGradient (NSColor [] colors, double [] locations) :
this (colors, locations, NSColorSpace.GenericRGBColorSpace)
{
}
public NSGradient (NSColor[] colors, float[] locations, NSColorSpace colorSpace)
public NSGradient (NSColor [] colors, float [] locations, NSColorSpace colorSpace)
{
unsafe {
double[] converted = Array.ConvertAll<float, double> (locations, new Converter<float, double> (a => (double)a));
fixed (void * locationPtr = converted) {
double [] converted = Array.ConvertAll<float, double> (locations, new Converter<float, double> (a => (double) a));
fixed (void* locationPtr = converted) {
Initialize (colors, locationPtr, colorSpace);
}
}
}
public NSGradient (NSColor[] colors, double[] locations, NSColorSpace colorSpace) : base (NSObjectFlag.Empty)
public NSGradient (NSColor [] colors, double [] locations, NSColorSpace colorSpace) : base (NSObjectFlag.Empty)
{
unsafe {
fixed (void * locationPtr = locations) {
fixed (void* locationPtr = locations) {
Initialize (colors, locationPtr, colorSpace);
}
}
}
unsafe void Initialize (NSColor[] colors, void * locationPtr, NSColorSpace colorSpace)
unsafe void Initialize (NSColor [] colors, void* locationPtr, NSColorSpace colorSpace)
{
if (colors == null)
throw new ArgumentNullException ("colors");
@ -71,7 +70,7 @@ namespace AppKit {
throw new ArgumentNullException ("colorSpace");
var nsa_colorArray = NSArray.FromNSObjects (colors);
IntPtr locations = new IntPtr (locationPtr);
#if NET
if (IsDirectBinding) {

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

@ -37,24 +37,24 @@ namespace AppKit {
public static class NSGraphics {
public static readonly float White = 1;
public static readonly float Black = 0;
public static readonly float LightGray = (float) 2/3.0f;
public static readonly float DarkGray = (float) 1/3.0f;
public static readonly float LightGray = (float) 2 / 3.0f;
public static readonly float DarkGray = (float) 1 / 3.0f;
[DllImport (Constants.AppKitLibrary)]
extern static NSWindowDepth NSBestDepth (IntPtr colorspaceHandle, nint bitsPerSample, nint bitsPerPixel, [MarshalAs (UnmanagedType.I1)] bool planar, [MarshalAs (UnmanagedType.I1)] ref bool exactMatch);
public static NSWindowDepth BestDepth (NSString colorspace, nint bitsPerSample, nint bitsPerPixel, [MarshalAs (UnmanagedType.I1)] bool planar, [MarshalAs (UnmanagedType.I1)] ref bool exactMatch)
{
if (colorspace == null)
throw new ArgumentNullException ("colorspace");
return NSBestDepth (colorspace.Handle, bitsPerSample, bitsPerPixel, planar, ref exactMatch);
}
[DllImport (Constants.AppKitLibrary)]
[return: MarshalAs (UnmanagedType.I1)]
extern static bool NSPlanarFromDepth (NSWindowDepth depth);
public static bool PlanarFromDepth (NSWindowDepth depth)
{
return NSPlanarFromDepth (depth);
@ -106,55 +106,55 @@ namespace AppKit {
}
}
[DllImport (Constants.AppKitLibrary, EntryPoint="NSRectFill")]
[DllImport (Constants.AppKitLibrary, EntryPoint = "NSRectFill")]
public extern static void RectFill (CGRect rect);
[DllImport (Constants.AppKitLibrary)]
extern static void NSRectFillUsingOperation (CGRect rect, nuint op);
public static void RectFill (CGRect rect, NSCompositingOperation op)
public static void RectFill (CGRect rect, NSCompositingOperation op)
{
NSRectFillUsingOperation (rect, (nuint)(ulong)op);
NSRectFillUsingOperation (rect, (nuint) (ulong) op);
}
[DllImport (Constants.AppKitLibrary, EntryPoint="NSRectFillList")]
unsafe extern static void RectFillList (CGRect *rects, nint count);
[DllImport (Constants.AppKitLibrary, EntryPoint = "NSRectFillList")]
unsafe extern static void RectFillList (CGRect* rects, nint count);
public static void RectFill (CGRect [] rects)
{
if (rects == null)
throw new ArgumentNullException ("rects");
unsafe {
fixed (CGRect *ptr = &rects [0])
fixed (CGRect* ptr = &rects [0])
RectFillList (ptr, rects.Length);
}
}
[DllImport (Constants.AppKitLibrary, EntryPoint="NSRectClip")]
[DllImport (Constants.AppKitLibrary, EntryPoint = "NSRectClip")]
public extern static void RectClip (CGRect rect);
[DllImport (Constants.AppKitLibrary, EntryPoint="NSFrameRect")]
public extern static void FrameRect (CGRect rect);
[DllImport (Constants.AppKitLibrary, EntryPoint="NSFrameRectWithWidth")]
public extern static void FrameRect (CGRect rect, nfloat frameWidth);
[DllImport (Constants.AppKitLibrary, EntryPoint = "NSFrameRect")]
public extern static void FrameRect (CGRect rect);
[DllImport (Constants.AppKitLibrary, EntryPoint = "NSFrameRectWithWidth")]
public extern static void FrameRect (CGRect rect, nfloat frameWidth);
// Bad naming, added the overload above
[DllImport (Constants.AppKitLibrary, EntryPoint="NSFrameRectWithWidth")]
public extern static void FrameRectWithWidth (CGRect rect, nfloat frameWidth);
[DllImport (Constants.AppKitLibrary, EntryPoint = "NSFrameRectWithWidth")]
public extern static void FrameRectWithWidth (CGRect rect, nfloat frameWidth);
[DllImport (Constants.AppKitLibrary)]
extern static void NSFrameRectWithWidthUsingOperation (CGRect rect, nfloat frameWidth, nuint operation);
public static void FrameRect (CGRect rect, nfloat frameWidth, NSCompositingOperation operation)
{
NSFrameRectWithWidthUsingOperation (rect, frameWidth, (nuint)(ulong)operation);
NSFrameRectWithWidthUsingOperation (rect, frameWidth, (nuint) (ulong) operation);
}
[DllImport (Constants.AppKitLibrary, EntryPoint="NSShowAnimationEffect")]
[DllImport (Constants.AppKitLibrary, EntryPoint = "NSShowAnimationEffect")]
extern static void NSShowAnimationEffect (nuint animationEffect, CGPoint centerLocation, CGSize size, NSObject animationDelegate, Selector didEndSelector, IntPtr contextInfo);
public static void ShowAnimationEffect (NSAnimationEffect animationEffect, CGPoint centerLocation, CGSize size, NSObject animationDelegate, Selector didEndSelector, IntPtr contextInfo)
{
NSShowAnimationEffect ((nuint)(ulong)animationEffect, centerLocation, size, animationDelegate, didEndSelector, contextInfo);
NSShowAnimationEffect ((nuint) (ulong) animationEffect, centerLocation, size, animationDelegate, didEndSelector, contextInfo);
}
public static void ShowAnimationEffect (NSAnimationEffect animationEffect, CGPoint centerLocation, CGSize size, Action endedCallback)
@ -166,31 +166,31 @@ namespace AppKit {
public static void SetFocusRingStyle (NSFocusRingPlacement placement)
{
SetFocusRingStyle ((nuint)(ulong)placement);
SetFocusRingStyle ((nuint) (ulong) placement);
}
[DllImport (Constants.AppKitLibrary, EntryPoint="NSSetFocusRingStyle")]
[DllImport (Constants.AppKitLibrary, EntryPoint = "NSSetFocusRingStyle")]
extern static void SetFocusRingStyle (nuint placement);
[DllImport (Constants.AppKitLibrary, EntryPoint="NSDrawWhiteBezel")]
[DllImport (Constants.AppKitLibrary, EntryPoint = "NSDrawWhiteBezel")]
public extern static void DrawWhiteBezel (CGRect aRect, CGRect clipRect);
[DllImport (Constants.AppKitLibrary, EntryPoint="NSDrawLightBezel")]
[DllImport (Constants.AppKitLibrary, EntryPoint = "NSDrawLightBezel")]
public extern static void DrawLightBezel (CGRect aRect, CGRect clipRect);
[DllImport (Constants.AppKitLibrary, EntryPoint="NSDrawGrayBezel")]
[DllImport (Constants.AppKitLibrary, EntryPoint = "NSDrawGrayBezel")]
public extern static void DrawGrayBezel (CGRect aRect, CGRect clipRect);
[DllImport (Constants.AppKitLibrary, EntryPoint="NSDrawDarkBezel")]
[DllImport (Constants.AppKitLibrary, EntryPoint = "NSDrawDarkBezel")]
public extern static void DrawDarkBezel (CGRect aRect, CGRect clipRect);
[DllImport (Constants.AppKitLibrary, EntryPoint="NSDrawGroove")]
[DllImport (Constants.AppKitLibrary, EntryPoint = "NSDrawGroove")]
public extern static void DrawGroove (CGRect aRect, CGRect clipRect);
[DllImport (Constants.AppKitLibrary, EntryPoint="NSDrawTiledRects")]
[DllImport (Constants.AppKitLibrary, EntryPoint = "NSDrawTiledRects")]
unsafe extern static CGRect DrawTiledRects (CGRect aRect, CGRect clipRect, NSRectEdge* sides, nfloat* grays, nint count);
public static CGRect DrawTiledRects (CGRect aRect, CGRect clipRect, NSRectEdge[] sides, nfloat[] grays)
public static CGRect DrawTiledRects (CGRect aRect, CGRect clipRect, NSRectEdge [] sides, nfloat [] grays)
{
if (sides == null)
throw new ArgumentNullException ("sides");
@ -199,15 +199,15 @@ namespace AppKit {
if (sides.Length != grays.Length)
throw new ArgumentOutOfRangeException ("grays", "Both array parameters must have the same length");
unsafe {
fixed (NSRectEdge *ptr = &sides [0])
fixed (nfloat *ptr2 = &grays [0])
fixed (NSRectEdge* ptr = &sides [0])
fixed (nfloat* ptr2 = &grays [0])
return DrawTiledRects (aRect, clipRect, ptr, ptr2, sides.Length);
}
}
[DllImport (Constants.AppKitLibrary, EntryPoint="NSDrawWindowBackground")]
[DllImport (Constants.AppKitLibrary, EntryPoint = "NSDrawWindowBackground")]
public extern static void DrawWindowBackground (CGRect aRect);
#if NET
[SupportedOSPlatform ("macos")]
[UnsupportedOSPlatform ("macos10.11")]
@ -215,11 +215,11 @@ namespace AppKit {
[Obsolete ("Starting with macos10.11 not usually necessary, 'NSAnimationContext.RunAnimation' can be used instead and not suffer from performance issues.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#endif
#else
[Deprecated (PlatformName.MacOSX, 10, 11, message : "Not usually necessary, 'NSAnimationContext.RunAnimation' can be used instead and not suffer from performance issues.")]
[Deprecated (PlatformName.MacOSX, 10, 11, message: "Not usually necessary, 'NSAnimationContext.RunAnimation' can be used instead and not suffer from performance issues.")]
#endif
[DllImport (Constants.AppKitLibrary, EntryPoint="NSDisableScreenUpdates")]
[DllImport (Constants.AppKitLibrary, EntryPoint = "NSDisableScreenUpdates")]
public extern static void DisableScreenUpdates ();
#if NET
[SupportedOSPlatform ("macos")]
[UnsupportedOSPlatform ("macos10.11")]
@ -227,11 +227,11 @@ namespace AppKit {
[Obsolete ("Starting with macos10.11 not usually necessary, 'NSAnimationContext.RunAnimation' can be used instead and not suffer from performance issues.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#endif
#else
[Deprecated (PlatformName.MacOSX, 10, 11, message : "Not usually necessary, 'NSAnimationContext.RunAnimation' can be used instead and not suffer from performance issues.")]
[Deprecated (PlatformName.MacOSX, 10, 11, message: "Not usually necessary, 'NSAnimationContext.RunAnimation' can be used instead and not suffer from performance issues.")]
#endif
[DllImport (Constants.AppKitLibrary, EntryPoint="NSEnableScreenUpdates")]
[DllImport (Constants.AppKitLibrary, EntryPoint = "NSEnableScreenUpdates")]
public extern static void EnableScreenUpdates ();
}
}
#endif // !__MACCATALYST__

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

@ -64,7 +64,7 @@ namespace AppKit {
}
// note: if needed override the protected Get|Set methods
public string Name {
public string Name {
get { return GetName (); }
// ignore return value (bool)
set { SetName (value); }
@ -72,7 +72,7 @@ namespace AppKit {
public static NSImage ImageNamed (NSImageName name)
{
return ImageNamed (name.GetConstant ());
return ImageNamed (name.GetConstant ());
}
}

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

@ -2,7 +2,7 @@
#if !WATCH
#if !MONOMAC
using NSFont=UIKit.UIFont;
using NSFont = UIKit.UIFont;
#endif
using System;

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

@ -15,7 +15,7 @@ namespace AppKit {
public partial class NSLevelIndicator {
public new NSLevelIndicatorCell Cell {
get { return (NSLevelIndicatorCell)base.Cell; }
get { return (NSLevelIndicatorCell) base.Cell; }
set { base.Cell = value; }
}
}

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

@ -33,6 +33,6 @@ namespace AppKit {
}
}
}
}
#endif // !__MACCATALYST__

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

@ -42,13 +42,13 @@ namespace AppKit {
public NSMenuItem (string title, EventHandler handler) : this (title, "", handler)
{
}
public NSMenuItem (string title, string charCode, EventHandler handler) : this (title, null, charCode)
{
Activated += handler;
}
public NSMenuItem (string title, string charCode, EventHandler handler, Func <NSMenuItem, bool> validator) : this (title, null, charCode)
public NSMenuItem (string title, string charCode, EventHandler handler, Func<NSMenuItem, bool> validator) : this (title, null, charCode)
{
Activated += handler;
ValidateMenuItem = validator;
@ -61,7 +61,7 @@ namespace AppKit {
public NSMenuItem (string title) : this (title, null, "")
{
}
public event EventHandler Activated {
add {
target = ActionDispatcher.SetupAction (Target, value);
@ -80,7 +80,7 @@ namespace AppKit {
}
[Advice ("The 'Activated' event must be set before setting 'ValidateMenuItem'.")]
public Func <NSMenuItem, bool> ValidateMenuItem {
public Func<NSMenuItem, bool> ValidateMenuItem {
get {
return (target as ActionDispatcher)?.ValidateMenuItemFunc;
}

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

@ -10,11 +10,9 @@
using System;
namespace AppKit
{
namespace AppKit {
#if !NET
public partial class NSMutableFontCollection
{
public partial class NSMutableFontCollection {
[Obsolete ("macOS 10.12 does not allow creation via this constructor")]
public NSMutableFontCollection ()
{

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

@ -8,20 +8,20 @@ using ObjCRuntime;
using Foundation;
namespace AppKit {
public partial class NSOpenGLContext {
unsafe void SetValue (int /* GLint */ val, NSOpenGLContextParameter par)
{
int *p = &val;
int* p = &val;
SetValues ((IntPtr) p, par);
}
unsafe int /* GLint */ GetValue (NSOpenGLContextParameter par)
{
int ret;
int *p = &ret;
GetValues ((IntPtr)p, par);
int* p = &ret;
GetValues ((IntPtr) p, par);
return ret;
}
@ -68,7 +68,7 @@ namespace AppKit {
public NSSurfaceOrder SurfaceOrder {
get {
switch (GetValue (NSOpenGLContextParameter.SurfaceOrder)){
switch (GetValue (NSOpenGLContextParameter.SurfaceOrder)) {
case -1:
return NSSurfaceOrder.BelowWindow;
default:

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

@ -36,23 +36,23 @@ namespace AppKit {
public partial class NSOpenGLPixelFormat {
static IntPtr selInitWithAttributes = Selector.GetHandle ("initWithAttributes:");
public NSOpenGLPixelFormat (NSOpenGLPixelFormatAttribute[] attribs) : base (NSObjectFlag.Empty)
public NSOpenGLPixelFormat (NSOpenGLPixelFormatAttribute [] attribs) : base (NSObjectFlag.Empty)
{
if (attribs == null)
throw new ArgumentNullException ("attribs");
unsafe {
NSOpenGLPixelFormatAttribute [] copy = new NSOpenGLPixelFormatAttribute [attribs.Length+1];
NSOpenGLPixelFormatAttribute [] copy = new NSOpenGLPixelFormatAttribute [attribs.Length + 1];
Array.Copy (attribs, 0, copy, 0, attribs.Length);
fixed (NSOpenGLPixelFormatAttribute* pArray = copy){
fixed (NSOpenGLPixelFormatAttribute* pArray = copy) {
if (IsDirectBinding) {
Handle = ObjCRuntime.Messaging.IntPtr_objc_msgSend_IntPtr (this.Handle, selInitWithAttributes, new IntPtr((void*)pArray ));
Handle = ObjCRuntime.Messaging.IntPtr_objc_msgSend_IntPtr (this.Handle, selInitWithAttributes, new IntPtr ((void*) pArray));
} else {
Handle = ObjCRuntime.Messaging.IntPtr_objc_msgSendSuper_IntPtr (this.SuperHandle, selInitWithAttributes, new IntPtr((void*)pArray));
Handle = ObjCRuntime.Messaging.IntPtr_objc_msgSendSuper_IntPtr (this.SuperHandle, selInitWithAttributes, new IntPtr ((void*) pArray));
}
}
}
}
@ -61,16 +61,15 @@ namespace AppKit {
if (attribs == null)
throw new ArgumentNullException ("attribs");
unsafe
{
unsafe {
uint [] copy = new uint [attribs.Length + 1];
Array.Copy (attribs, 0, copy, 0, attribs.Length);
fixed (uint* pArray = copy) {
if (IsDirectBinding) {
InitializeHandle (ObjCRuntime.Messaging.IntPtr_objc_msgSend_IntPtr (this.Handle, selInitWithAttributes, new IntPtr ((void*)pArray)));
InitializeHandle (ObjCRuntime.Messaging.IntPtr_objc_msgSend_IntPtr (this.Handle, selInitWithAttributes, new IntPtr ((void*) pArray)));
} else {
InitializeHandle (ObjCRuntime.Messaging.IntPtr_objc_msgSendSuper_IntPtr (this.SuperHandle, selInitWithAttributes, new IntPtr ((void*)pArray)));
InitializeHandle (ObjCRuntime.Messaging.IntPtr_objc_msgSendSuper_IntPtr (this.SuperHandle, selInitWithAttributes, new IntPtr ((void*) pArray)));
}
}
@ -79,11 +78,11 @@ namespace AppKit {
static uint [] ConvertToAttributes (object [] args)
{
var list = new List<uint> ();
for (int i = 0; i < args.Length; i++){
for (int i = 0; i < args.Length; i++) {
if (args [i] is NSOpenGLPixelFormatAttribute) {
NSOpenGLPixelFormatAttribute v = (NSOpenGLPixelFormatAttribute)args [i];
NSOpenGLPixelFormatAttribute v = (NSOpenGLPixelFormatAttribute) args [i];
switch (v) {
case NSOpenGLPixelFormatAttribute.AllRenderers:
case NSOpenGLPixelFormatAttribute.DoubleBuffer:
@ -137,18 +136,18 @@ namespace AppKit {
list.Add ((uint) (int) args [i]);
break;
}
} else if (args [i] is int && (int) args [i] == 0 && i == args.Length - 1)
} else if (args [i] is int && (int) args [i] == 0 && i == args.Length - 1)
list.Add (0);
else
throw new ArgumentException ($"The specified attribute is not of type NSOpenGLPixelFormatAttribute: {args [i]}");
}
if (args.Length == 0 || !(args[args.Length - 1] is int) || ((int)args [args.Length - 1]) != 0)
if (args.Length == 0 || !(args [args.Length - 1] is int) || ((int) args [args.Length - 1]) != 0)
list.Add (0);
return list.ToArray ();
}
public NSOpenGLPixelFormat (params object [] attribs) : this (ConvertToAttributes (attribs))
{
if (attribs == null)
@ -165,14 +164,14 @@ namespace AppKit {
}
}
fixed (NSOpenGLPixelFormatAttribute* pArray = copy){
fixed (NSOpenGLPixelFormatAttribute* pArray = copy) {
if (IsDirectBinding) {
Handle = ObjCRuntime.Messaging.IntPtr_objc_msgSend_IntPtr (this.Handle, selInitWithAttributes, new IntPtr((void*)pArray ));
Handle = ObjCRuntime.Messaging.IntPtr_objc_msgSend_IntPtr (this.Handle, selInitWithAttributes, new IntPtr ((void*) pArray));
} else {
Handle = ObjCRuntime.Messaging.IntPtr_objc_msgSendSuper_IntPtr (this.SuperHandle, selInitWithAttributes, new IntPtr((void*)pArray));
Handle = ObjCRuntime.Messaging.IntPtr_objc_msgSendSuper_IntPtr (this.SuperHandle, selInitWithAttributes, new IntPtr ((void*) pArray));
}
}
}
}
}

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

@ -15,7 +15,7 @@ namespace AppKit {
nsa_pasteboardReading.Dispose ();
return result;
}
#if !NET
public bool WriteObjects (NSPasteboardWriting [] objects)
{

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

@ -3,10 +3,10 @@ using System;
using Foundation;
namespace AppKit {
public partial class NSPathControlItem
public partial class NSPathControlItem
#if !XAMCORE_3_0
: INSCoding
#endif
#endif
{
#if !XAMCORE_3_0
public NSPathControlItem (NSCoder coder) : this ()

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

@ -36,7 +36,7 @@ namespace AppKit {
public partial class NSPopUpButton {
public new NSPopUpButtonCell Cell {
get { return (NSPopUpButtonCell)base.Cell; }
get { return (NSPopUpButtonCell) base.Cell; }
set { base.Cell = value; }
}
}

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

@ -9,9 +9,9 @@ namespace AppKit {
}
}
public NSMenuItem this [string title]{
public NSMenuItem this [string title] {
get {
return ItemWithTitle (title);
return ItemWithTitle (title);
}
}
}

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

@ -16,12 +16,10 @@ using System.Collections.Generic;
using Foundation;
using CoreData;
namespace AppKit
{
public partial class NSPredicateEditorRowTemplate
{
namespace AppKit {
public partial class NSPredicateEditorRowTemplate {
public NSPredicateEditorRowTemplate (params NSCompoundPredicateType [] compoundTypes)
: this (Array.ConvertAll (compoundTypes, t => NSNumber.FromUInt32 ((uint)t)))
: this (Array.ConvertAll (compoundTypes, t => NSNumber.FromUInt32 ((uint) t)))
{
}
@ -35,7 +33,7 @@ namespace AppKit
leftExpressions.ToArray (),
rightExpressions.ToArray (),
modifier,
operators.Select (o => NSNumber.FromUInt32 ((uint)o)).ToArray (),
operators.Select (o => NSNumber.FromUInt32 ((uint) o)).ToArray (),
options)
{
}
@ -95,7 +93,7 @@ namespace AppKit
leftExpressions.ToArray (),
attributeType,
modifier,
operators.Select (o => NSNumber.FromUInt32 ((uint)o)).ToArray (),
operators.Select (o => NSNumber.FromUInt32 ((uint) o)).ToArray (),
options)
{
}

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

@ -28,10 +28,10 @@ using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace AppKit {
public partial class NSScreen {
public NSWindowDepth[] SupportedWindowDepths {
public NSWindowDepth [] SupportedWindowDepths {
get {
List<NSWindowDepth> list = new List<NSWindowDepth> ();
IntPtr p = GetSupportedWindowDepths ();
@ -40,7 +40,7 @@ namespace AppKit {
int value = Marshal.ReadInt32 (p);
while (value != 0) {
list.Add ((NSWindowDepth) value);
p = (IntPtr) (p.ToInt64 () + sizeof(int));
p = (IntPtr) (p.ToInt64 () + sizeof (int));
value = Marshal.ReadInt32 (p);
}
}

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

@ -15,7 +15,7 @@ namespace AppKit {
public partial class NSSegmentedControl {
NSActionDispatcher dispatcher;
public new NSSegmentedCell Cell {
get { return (NSSegmentedCell) base.Cell; }
set { base.Cell = value; }
@ -25,9 +25,9 @@ namespace AppKit {
[SupportedOSPlatform ("macos10.12")]
[UnsupportedOSPlatform ("maccatalyst")]
#else
[Mac (10,12)]
[Mac (10, 12)]
#endif
public static NSSegmentedControl FromLabels (string[] labels, NSSegmentSwitchTracking trackingMode, Action action)
public static NSSegmentedControl FromLabels (string [] labels, NSSegmentSwitchTracking trackingMode, Action action)
{
var dispatcher = new NSActionDispatcher (action);
var control = _FromLabels (labels, trackingMode, dispatcher, NSActionDispatcher.Selector);
@ -39,9 +39,9 @@ namespace AppKit {
[SupportedOSPlatform ("macos10.12")]
[UnsupportedOSPlatform ("maccatalyst")]
#else
[Mac (10,12)]
[Mac (10, 12)]
#endif
public static NSSegmentedControl FromImages (NSImage[] images, NSSegmentSwitchTracking trackingMode, Action action)
public static NSSegmentedControl FromImages (NSImage [] images, NSSegmentSwitchTracking trackingMode, Action action)
{
var dispatcher = new NSActionDispatcher (action);
var control = _FromImages (images, trackingMode, dispatcher, NSActionDispatcher.Selector);
@ -49,12 +49,12 @@ namespace AppKit {
return control;
}
public void UnselectAllSegments()
public void UnselectAllSegments ()
{
NSSegmentSwitchTracking current = this.Cell.TrackingMode;
this.Cell.TrackingMode = NSSegmentSwitchTracking.Momentary;
for (nint i = 0; i < this.SegmentCount; i ++)
for (nint i = 0; i < this.SegmentCount; i++)
SetSelected (false, i);
this.Cell.TrackingMode = current;

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

@ -3,10 +3,8 @@ using System;
using Foundation;
using ObjCRuntime;
namespace AppKit
{
public partial class NSSharingService
{
namespace AppKit {
public partial class NSSharingService {
public static NSSharingService GetSharingService (NSSharingServiceName service)
{
var constant = service.GetConstant ();

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

@ -11,12 +11,12 @@ namespace AppKit {
public partial class NSSharingServiceDelegate {
CGRect SourceFrameOnScreenForShareItem (NSSharingService sharingService, NSPasteboardWriting item)
{
return SourceFrameOnScreenForShareItem (sharingService, (INSPasteboardWriting)item);
return SourceFrameOnScreenForShareItem (sharingService, (INSPasteboardWriting) item);
}
NSImage TransitionImageForShareItem (NSSharingService sharingService, NSPasteboardWriting item, CGRect contentRect)
{
return TransitionImageForShareItem (sharingService, (INSPasteboardWriting)item, contentRect);
return TransitionImageForShareItem (sharingService, (INSPasteboardWriting) item, contentRect);
}
}
#endif

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

@ -41,7 +41,7 @@ namespace AppKit {
[SupportedOSPlatform ("macos10.12")]
[UnsupportedOSPlatform ("maccatalyst")]
#else
[Mac (10,12)]
[Mac (10, 12)]
#endif
public static NSSlider FromTarget (Action action)
{
@ -55,7 +55,7 @@ namespace AppKit {
[SupportedOSPlatform ("macos10.12")]
[UnsupportedOSPlatform ("maccatalyst")]
#else
[Mac (10,12)]
[Mac (10, 12)]
#endif
public static NSSlider FromValue (double value, double minValue, double maxValue, Action action)
{

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

@ -26,11 +26,11 @@
using System;
namespace AppKit {
public partial class NSSound {
// note: if needed override the protected Get|Set methods
public string Name {
public string Name {
get { return GetName (); }
// ignore return value (bool)
set { SetName (value); }

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

@ -26,11 +26,11 @@
using System;
namespace AppKit {
public partial class NSSpeechSynthesizer {
// note: if needed override the protected Get|Set methods
public string Voice {
public string Voice {
get { return GetVoice (); }
// ignore return value (bool)
set { SetVoice (value); }

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

@ -26,11 +26,11 @@
using System;
namespace AppKit {
public partial class NSSpellChecker {
// note: if needed override the protected Get|Set methods
public string Language {
public string Language {
get { return GetLanguage (); }
// ignore return value (bool)
set { SetLanguage (value); }

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

@ -11,19 +11,16 @@
using System;
namespace AppKit
{
public enum NSStatusItemLength
{
namespace AppKit {
public enum NSStatusItemLength {
Variable = -1,
Square = -2
}
public partial class NSStatusBar
{
public partial class NSStatusBar {
public NSStatusItem CreateStatusItem (NSStatusItemLength length)
{
return CreateStatusItem ((float)length);
return CreateStatusItem ((float) length);
}
}
}

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

@ -14,10 +14,8 @@ using ObjCRuntime;
using CoreFoundation;
using Foundation;
namespace AppKit
{
public partial class NSStringAttributes : DictionaryContainer
{
namespace AppKit {
public partial class NSStringAttributes : DictionaryContainer {
static internal NSDictionary ToDictionary (
NSFont font,
NSColor foregroundColor,
@ -50,7 +48,7 @@ namespace AppKit
{
var attr = new NSStringAttributes ();
if (font != null){
if (font != null) {
attr.Font = font;
}
@ -63,7 +61,7 @@ namespace AppKit
}
if (underlineStyle != NSUnderlineStyle.None) {
attr.UnderlineStyle = (int?)underlineStyle;
attr.UnderlineStyle = (int?) underlineStyle;
}
if (superscript) {
@ -107,7 +105,7 @@ namespace AppKit
}
if (strikethroughStyle != NSUnderlineStyle.None) {
attr.StrikethroughStyle = (int?)strikethroughStyle;
attr.StrikethroughStyle = (int?) strikethroughStyle;
}
if (strikethroughColor != null) {
@ -192,18 +190,18 @@ namespace AppKit
bool? GetBool (NSString key)
{
var value = GetInt32Value (key);
return value == null ? null : (bool?)(value.Value != 0);
return value == null ? null : (bool?) (value.Value != 0);
}
void Set (NSString key, bool? value)
{
SetNumberValue (key, value == null ? null : (int?)(value.Value ? 1 : 0));
SetNumberValue (key, value == null ? null : (int?) (value.Value ? 1 : 0));
}
int SetUnderlineStyle (NSString attr, NSUnderlineStyle style,
NSUnderlinePattern pattern, bool byWord)
{
var value = (int)style | (int)pattern;
var value = (int) style | (int) pattern;
if (byWord) {
value |= (int) NSAttributedString.UnderlineByWordMaskAttributeName;
}
@ -264,8 +262,8 @@ namespace AppKit
}
public NSLigatureType? Ligature {
get { return (NSLigatureType?)GetInt32Value (NSStringAttributeKey.Ligature); }
set { SetNumberValue (NSStringAttributeKey.Ligature, (int?)value); }
get { return (NSLigatureType?) GetInt32Value (NSStringAttributeKey.Ligature); }
set { SetNumberValue (NSStringAttributeKey.Ligature, (int?) value); }
}
public float? BaselineOffset {
@ -364,8 +362,8 @@ namespace AppKit
}
public NSTextLayoutOrientation? VerticalGlyphForm {
get { return (NSTextLayoutOrientation?)GetInt32Value (NSStringAttributeKey.VerticalGlyphForm); }
set { SetNumberValue (NSStringAttributeKey.VerticalGlyphForm, (int?)value); }
get { return (NSTextLayoutOrientation?) GetInt32Value (NSStringAttributeKey.VerticalGlyphForm); }
set { SetNumberValue (NSStringAttributeKey.VerticalGlyphForm, (int?) value); }
}
public NSTextAlternatives TextAlternatives {
@ -374,8 +372,8 @@ namespace AppKit
}
public NSSpellingState? SpellingState {
get { return (NSSpellingState?)GetInt32Value (NSStringAttributeKey.SpellingState); }
set { SetNumberValue (NSStringAttributeKey.SpellingState, (int?)value); }
get { return (NSSpellingState?) GetInt32Value (NSStringAttributeKey.SpellingState); }
set { SetNumberValue (NSStringAttributeKey.SpellingState, (int?) value); }
}
}
}

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

@ -14,7 +14,7 @@ namespace AppKit {
[SupportedOSPlatform ("tvos")]
#endif
// Manual bindings, easier than make the generator support extension methods on non-NSObject-derived types (string in this case).
public unsafe static partial class NSStringDrawing {
public unsafe static partial class NSStringDrawing {
public static void DrawAtPoint (this string This, CGPoint point, NSDictionary attributes)
{
using (var self = ((NSString) This))

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

@ -35,7 +35,7 @@ namespace AppKit {
public partial class NSTableView {
public NSTableViewSource Source {
get {
var d = WeakDelegate as NSTableViewSource;
var d = WeakDelegate as NSTableViewSource;
if (d != null)
return d;
return null;

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

@ -3,12 +3,10 @@ using System;
using CoreGraphics;
using ObjCRuntime;
namespace AppKit
{
public partial class NSTextContainer
{
namespace AppKit {
public partial class NSTextContainer {
#if !NET
[Obsoleted (PlatformName.MacOSX, 10, 11, message : "Use NSTextContainer.FromSize instead.")]
[Obsoleted (PlatformName.MacOSX, 10, 11, message: "Use NSTextContainer.FromSize instead.")]
public NSTextContainer (CGSize size)
{
Handle = InitWithContainerSize (size);
@ -29,7 +27,7 @@ namespace AppKit
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("tvos")]
#else
[Mac (10,11)]
[Mac (10, 11)]
#endif
public static NSTextContainer FromSize (CGSize size)
{
@ -46,7 +44,7 @@ namespace AppKit
[Obsolete ("Starting with macos10.11 use NSTextContainer.FromSize instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#endif
#else
[Deprecated (PlatformName.MacOSX, 10, 11, message : "Use NSTextContainer.FromSize instead.")]
[Deprecated (PlatformName.MacOSX, 10, 11, message: "Use NSTextContainer.FromSize instead.")]
#endif
public static NSTextContainer FromContainerSize (CGSize containerSize)
{

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

@ -12,7 +12,7 @@ namespace AppKit {
public partial class NSTextField {
public new NSTextFieldCell Cell {
get { return (NSTextFieldCell)base.Cell; }
get { return (NSTextFieldCell) base.Cell; }
set { base.Cell = value; }
}
}

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

@ -4,13 +4,16 @@ using Foundation;
namespace AppKit {
public partial class NSTextStorage {
public NSTextStorage (string str, NSDictionary attributes) : base (str, attributes) {
public NSTextStorage (string str, NSDictionary attributes) : base (str, attributes)
{
}
public NSTextStorage (NSAttributedString other) : base (other) {
public NSTextStorage (NSAttributedString other) : base (other)
{
}
public NSTextStorage (string str, CTStringAttributes attributes) : base (str, attributes) {
public NSTextStorage (string str, CTStringAttributes attributes) : base (str, attributes)
{
}
}
}

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

@ -10,11 +10,9 @@
using System;
namespace AppKit
{
namespace AppKit {
#if !NET
public partial class NSTextTableBlock
{
public partial class NSTextTableBlock {
[Obsolete ("macOS 10.12 does not allow creation via this constructor")]
public NSTextTableBlock ()
{

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

@ -28,18 +28,18 @@ using System;
using Foundation;
namespace AppKit {
public partial class NSTreeController {
// note: if needed override the protected Get|Set methods
public NSIndexPath SelectionIndexPath {
public NSIndexPath SelectionIndexPath {
get { return GetSelectionIndexPath (); }
// ignore return value (bool)
set { SetSelectionIndexPath(value); }
set { SetSelectionIndexPath (value); }
}
// note: if needed override the protected Get|Set methods
public NSIndexPath [] SelectionIndexPaths {
public NSIndexPath [] SelectionIndexPaths {
get { return GetSelectionIndexPaths (); }
// ignore return value (bool)
set { SetSelectionIndexPaths (value); }

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

@ -19,8 +19,7 @@ namespace AppKit {
static view_compare_func view_comparer = view_compare;
#endif
sealed class SortData
{
sealed class SortData {
public Exception Exception;
public Func<NSView, NSView, NSComparisonResult> Comparer;
}

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

@ -64,7 +64,7 @@ namespace AppKit {
//
// If that is the case, we take a reference first, and to keep the behavior
// we call Dispose after that.
if (WindowController == null){
if (WindowController == null) {
bool released_when_closed = ReleasedWhenClosed;
if (released_when_closed)
CFObject.CFRetain (Handle);
@ -76,7 +76,7 @@ namespace AppKit {
}
// note: if needed override the protected Get|Set methods
public string FrameAutosaveName {
public string FrameAutosaveName {
get { return GetFrameAutosaveName (); }
// ignore return value (bool)
set { SetFrameAutosaveName (value); }
@ -86,7 +86,7 @@ namespace AppKit {
{
return NextEventMatchingMask ((uint) mask);
}
public NSEvent NextEventMatchingMask (NSEventMask mask, NSDate expiration, string mode, bool deqFlag)
{
return NextEventMatchingMask ((uint) mask, expiration, mode, deqFlag);
@ -97,27 +97,27 @@ namespace AppKit {
DiscardEventsMatchingMask ((uint) mask, beforeLastEvent);
}
// NSString NSWindowDidBecomeKeyNotification;
// NSString NSWindowDidBecomeMainNotification;
// NSString NSWindowDidChangeScreenNotification;
// NSString NSWindowDidDeminiaturizeNotification;
// NSString NSWindowDidExposeNotification;
// NSString NSWindowDidMiniaturizeNotification;
// NSString NSWindowDidMoveNotification;
// NSString NSWindowDidResignKeyNotification;
// NSString NSWindowDidResignMainNotification;
// NSString NSWindowDidResizeNotification;
// NSString NSWindowDidUpdateNotification;
// NSString NSWindowWillCloseNotification;
// NSString NSWindowWillMiniaturizeNotification;
// NSString NSWindowWillMoveNotification;
// NSString NSWindowWillBeginSheetNotification;
// NSString NSWindowDidEndSheetNotification;
// NSString NSWindowDidChangeScreenProfileNotification
// NSString NSWindowWillStartLiveResizeNotification
// NSString NSWindowDidEndLiveResizeNotification
// NSString NSWindowDidBecomeKeyNotification;
// NSString NSWindowDidBecomeMainNotification;
// NSString NSWindowDidChangeScreenNotification;
// NSString NSWindowDidDeminiaturizeNotification;
// NSString NSWindowDidExposeNotification;
// NSString NSWindowDidMiniaturizeNotification;
// NSString NSWindowDidMoveNotification;
// NSString NSWindowDidResignKeyNotification;
// NSString NSWindowDidResignMainNotification;
// NSString NSWindowDidResizeNotification;
// NSString NSWindowDidUpdateNotification;
// NSString NSWindowWillCloseNotification;
// NSString NSWindowWillMiniaturizeNotification;
// NSString NSWindowWillMoveNotification;
// NSString NSWindowWillBeginSheetNotification;
// NSString NSWindowDidEndSheetNotification;
// NSString NSWindowDidChangeScreenProfileNotification
// NSString NSWindowWillStartLiveResizeNotification
// NSString NSWindowDidEndLiveResizeNotification
}
}
#endif // !__MACCATALYST__

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

@ -20,7 +20,7 @@ namespace AppKit {
#else
[Deprecated (PlatformName.MacOSX, 11, 0, message: "Use 'NSWorkspace.OpenUrls' with completion handler.")]
#endif
public virtual bool OpenUrls (NSUrl[] urls, string bundleIdentifier, NSWorkspaceLaunchOptions options, NSAppleEventDescriptor descriptor, string[] identifiers)
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);
@ -36,7 +36,7 @@ namespace AppKit {
#else
[Deprecated (PlatformName.MacOSX, 11, 0, message: "Use 'NSWorkspace.OpenUrls' with completion handler.")]
#endif
public virtual bool OpenUrls (NSUrl[] urls, string bundleIdentifier, NSWorkspaceLaunchOptions options, NSAppleEventDescriptor descriptor)
public virtual bool OpenUrls (NSUrl [] urls, string bundleIdentifier, NSWorkspaceLaunchOptions options, NSAppleEventDescriptor descriptor)
{
return _OpenUrls (urls, bundleIdentifier, options, descriptor, null);
}
@ -47,8 +47,7 @@ namespace AppKit {
var nsFileType = NSString.CreateNative (fileType);
try {
return IconForFileType (nsFileType);
}
finally {
} finally {
NSString.ReleaseNative (nsFileType);
}
}

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

@ -33,6 +33,7 @@ dotnet format whitespace --folder "$SRC_DIR/src/Accounts"
dotnet format whitespace --folder "$SRC_DIR/src/AddressBook"
dotnet format whitespace --folder "$SRC_DIR/src/AddressBookUI"
dotnet format whitespace --folder "$SRC_DIR/src/AdSupport/"
dotnet format whitespace --folder "$SRC_DIR/src/AppKit/"
dotnet format whitespace --folder "$SRC_DIR/src/ARKit/"
dotnet format whitespace --folder "$SRC_DIR/src/AssetsLibrary/"
dotnet format whitespace --folder "$SRC_DIR/src/AudioToolbox/"