Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 27 additions & 12 deletions src/appkit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -657,21 +657,24 @@ interface NSApplication : NSAccessibilityElementProtocol, NSUserInterfaceValidat
NSGraphicsContext Context { get; }

[Export ("hide:")]
void Hide (NSObject sender);
void Hide ([NullAllowed] NSObject sender);

[Export ("unhide:")]
void Unhide (NSObject sender);
void Unhide ([NullAllowed] NSObject sender);

[Export ("unhideWithoutActivation")]
void UnhideWithoutActivation ();

[Export ("windowWithWindowNumber:")]
[return: NullAllowed]
NSWindow WindowWithWindowNumber (nint windowNum);

[Export ("mainWindow")]
[NullAllowed]
NSWindow MainWindow { get; }

[Export ("keyWindow")]
[NullAllowed]
NSWindow KeyWindow { get; }

/// <summary>To be added.</summary>
Expand Down Expand Up @@ -700,10 +703,10 @@ interface NSApplication : NSAccessibilityElementProtocol, NSUserInterfaceValidat
void ActivateIgnoringOtherApps (bool flag);

[Export ("hideOtherApplications:")]
void HideOtherApplications (NSObject sender);
void HideOtherApplications ([NullAllowed] NSObject sender);

[Export ("unhideAllApplications:")]
void UnhideAllApplications (NSObject sender);
void UnhideAllApplications ([NullAllowed] NSObject sender);

[Export ("finishLaunching")]
void FinishLaunching ();
Expand All @@ -715,7 +718,7 @@ interface NSApplication : NSAccessibilityElementProtocol, NSUserInterfaceValidat
nint RunModalForWindow (NSWindow theWindow);

[Export ("stop:")]
void Stop (NSObject sender);
void Stop ([NullAllowed] NSObject sender);

[Export ("stopModal")]
void StopModal ();
Expand All @@ -727,6 +730,7 @@ interface NSApplication : NSAccessibilityElementProtocol, NSUserInterfaceValidat
void AbortModal ();

[Export ("modalWindow")]
[NullAllowed]
NSWindow ModalWindow { get; }

[Export ("beginModalSessionForWindow:")]
Expand Down Expand Up @@ -760,6 +764,7 @@ interface NSApplication : NSAccessibilityElementProtocol, NSUserInterfaceValidat
void EndSheet (NSWindow sheet, nint returnCode);

[Export ("nextEventMatchingMask:untilDate:inMode:dequeue:"), Protected]
[return: NullAllowed]
NSEvent NextEvent (NSEventMask mask, [NullAllowed] NSDate expiration, NSString runLoopMode, bool deqFlag);

// NSEventMask must be casted to nuint to preserve the NSEventMask.Any special value on 64 bit systems. NSEventMask is not [Native].
Expand All @@ -771,16 +776,18 @@ interface NSApplication : NSAccessibilityElementProtocol, NSUserInterfaceValidat
/// <returns>To be added.</returns>
/// <remarks>To be added.</remarks>
[Wrap ("NextEvent (mask, expiration, runLoopMode.GetConstant ()!, deqFlag)")]
[return: NullAllowed]
NSEvent NextEvent (NSEventMask mask, NSDate expiration, NSRunLoopMode runLoopMode, bool deqFlag);

[Export ("discardEventsMatchingMask:beforeEvent:"), Protected]
void DiscardEvents (nuint mask, NSEvent lastEvent);
void DiscardEvents (nuint mask, [NullAllowed] NSEvent lastEvent);

[ThreadSafe]
[Export ("postEvent:atStart:")]
void PostEvent (NSEvent theEvent, bool atStart);

[Export ("currentEvent")]
[NullAllowed]
NSEvent CurrentEvent { get; }

[Export ("sendEvent:")]
Expand All @@ -804,13 +811,15 @@ interface NSApplication : NSAccessibilityElementProtocol, NSUserInterfaceValidat
void UpdateWindows ();

[Export ("mainMenu", ArgumentSemantic.Retain)]
[NullAllowed]
NSMenu MainMenu { get; set; }

[Export ("helpMenu", ArgumentSemantic.Retain)]
[NullAllowed]
NSMenu HelpMenu { get; set; }

[Export ("applicationIconImage", ArgumentSemantic.Retain)]
[NullAllowed]
Comment thread
rolfbjarne marked this conversation as resolved.
NSImage ApplicationIconImage { get; set; }

[Export ("activationPolicy"), Protected]
Expand All @@ -826,24 +835,26 @@ interface NSApplication : NSAccessibilityElementProtocol, NSUserInterfaceValidat
bool SendAction (Selector theAction, [NullAllowed] NSObject theTarget, [NullAllowed] NSObject sender);

[Export ("targetForAction:")]
[return: NullAllowed]
NSObject TargetForAction (Selector theAction);

[Export ("targetForAction:to:from:")]
[return: NullAllowed]
NSObject TargetForAction (Selector theAction, [NullAllowed] NSObject theTarget, [NullAllowed] NSObject sender);

[Export ("tryToPerform:with:")]
bool TryToPerform (Selector anAction, [NullAllowed] NSObject target);

[Export ("validRequestorForSendType:returnType:")]
[return: NullAllowed]
NSObject ValidRequestor (string sendType, string returnType);
NSObject ValidRequestor ([NullAllowed] string sendType, [NullAllowed] string returnType);

[Export ("reportException:")]
void ReportException (NSException theException);

[Static]
[Export ("detachDrawingThread:toTarget:withObject:")]
void DetachDrawingThread (Selector selector, NSObject target, NSObject argument);
void DetachDrawingThread (Selector selector, NSObject target, [NullAllowed] NSObject argument);

[Export ("replyToApplicationShouldTerminate:")]
void ReplyToApplicationShouldTerminate (bool shouldTerminate);
Expand All @@ -852,7 +863,7 @@ interface NSApplication : NSAccessibilityElementProtocol, NSUserInterfaceValidat
void ReplyToOpenOrPrint (NSApplicationDelegateReply reply);

[Export ("orderFrontCharacterPalette:")]
void OrderFrontCharacterPalette (NSObject sender);
void OrderFrontCharacterPalette ([NullAllowed] NSObject sender);

[Export ("presentationOptions")]
NSApplicationPresentationOptions PresentationOptions { get; set; }
Expand All @@ -861,10 +872,11 @@ interface NSApplication : NSAccessibilityElementProtocol, NSUserInterfaceValidat
NSApplicationPresentationOptions CurrentSystemPresentationOptions { get; }

[Export ("windowsMenu")]
[NullAllowed]
NSMenu WindowsMenu { get; set; }

[Export ("arrangeInFront:")]
void ArrangeInFront (NSObject sender);
void ArrangeInFront ([NullAllowed] NSObject sender);

[Export ("removeWindowsItem:")]
void RemoveWindowsItem (NSWindow win);
Expand All @@ -879,7 +891,7 @@ interface NSApplication : NSAccessibilityElementProtocol, NSUserInterfaceValidat
void UpdateWindowsItem (NSWindow win);

[Export ("miniaturizeAll:")]
void MiniaturizeAll (NSObject sender);
void MiniaturizeAll ([NullAllowed] NSObject sender);

/// <summary>To be added.</summary>
/// <value>To be added.</value>
Expand All @@ -888,17 +900,19 @@ interface NSApplication : NSAccessibilityElementProtocol, NSUserInterfaceValidat
bool FullKeyboardAccessEnabled { get; }

[Export ("servicesProvider")]
[NullAllowed]
NSObject ServicesProvider { get; set; }

[Export ("userInterfaceLayoutDirection")]
NSUserInterfaceLayoutDirection UserInterfaceLayoutDirection { get; }

[Export ("servicesMenu")]
[NullAllowed]
NSMenu ServicesMenu { get; set; }

// From NSColorPanel
[Export ("orderFrontColorPanel:")]
void OrderFrontColorPanel (NSObject sender);
void OrderFrontColorPanel ([NullAllowed] NSObject sender);

[Export ("disableRelaunchOnLogin"), ThreadSafe]
void DisableRelaunchOnLogin ();
Expand Down Expand Up @@ -6590,6 +6604,7 @@ interface NSDockTile {

//Detected properties
[Export ("contentView", ArgumentSemantic.Retain)]
[NullAllowed]
NSView ContentView { get; set; }

[Export ("showsApplicationBadge")]
Expand Down
12 changes: 12 additions & 0 deletions tests/monotouch-test/AppKit/NSApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ public void NSApplication_SendActionNullTest ()
{
NSApplication.SharedApplication.SendAction (new Selector ("undo:"), null, new NSObject ());
}

[Test]
public void NSApplication_ApplicationIconImageNullTest ()
{
Assert.DoesNotThrow (() => NSApplication.SharedApplication.ApplicationIconImage = null);
}

[Test]
public void NSApplication_DockTileContentViewNullTest ()
{
Assert.DoesNotThrow (() => NSApplication.SharedApplication.DockTile.ContentView = null);
}
}
}
#endif // __MACOS__
27 changes: 0 additions & 27 deletions tests/xtro-sharpie/api-annotations-dotnet/macOS-AppKit.ignore
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,6 @@
!missing-null-allowed! 'AppKit.NSDocument AppKit.NSDocumentController::DuplicateDocumentWithContentsOfUrl(Foundation.NSUrl,System.Boolean,System.String,Foundation.NSError&)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'AppKit.NSDocument AppKit.NSDocumentController::get_CurrentDocument()' is missing an [NullAllowed] on return type
!missing-null-allowed! 'AppKit.NSDraggingImageComponent[] AppKit.NSDraggingItem::get_ImageComponents()' is missing an [NullAllowed] on return type
!missing-null-allowed! 'AppKit.NSEvent AppKit.NSApplication::get_CurrentEvent()' is missing an [NullAllowed] on return type
!missing-null-allowed! 'AppKit.NSEvent AppKit.NSApplication::NextEvent(AppKit.NSEventMask,Foundation.NSDate,Foundation.NSString,System.Boolean)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'AppKit.NSEvent AppKit.NSEvent::EnterExitEvent(AppKit.NSEventType,CoreGraphics.CGPoint,AppKit.NSEventModifierMask,System.Double,System.IntPtr,AppKit.NSGraphicsContext,System.IntPtr,System.IntPtr,System.IntPtr)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'AppKit.NSEvent AppKit.NSEvent::EventWithCGEvent(System.IntPtr)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'AppKit.NSEvent AppKit.NSEvent::EventWithEventRef(System.IntPtr)' is missing an [NullAllowed] on return type
Expand Down Expand Up @@ -372,10 +370,6 @@
!missing-null-allowed! 'AppKit.NSViewController AppKit.NSViewController::get_ParentViewController()' is missing an [NullAllowed] on return type
!missing-null-allowed! 'AppKit.NSViewController AppKit.NSViewController::get_PresentingViewController()' is missing an [NullAllowed] on return type
!missing-null-allowed! 'AppKit.NSViewController[] AppKit.NSViewController::get_PresentedViewControllers()' is missing an [NullAllowed] on return type
!missing-null-allowed! 'AppKit.NSWindow AppKit.NSApplication::get_KeyWindow()' is missing an [NullAllowed] on return type
!missing-null-allowed! 'AppKit.NSWindow AppKit.NSApplication::get_MainWindow()' is missing an [NullAllowed] on return type
!missing-null-allowed! 'AppKit.NSWindow AppKit.NSApplication::get_ModalWindow()' is missing an [NullAllowed] on return type
!missing-null-allowed! 'AppKit.NSWindow AppKit.NSApplication::WindowWithWindowNumber(System.IntPtr)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'AppKit.NSWindow AppKit.NSDocument::get_WindowForSheet()' is missing an [NullAllowed] on return type
!missing-null-allowed! 'AppKit.NSWindow AppKit.NSEvent::get_Window()' is missing an [NullAllowed] on return type
!missing-null-allowed! 'AppKit.NSWindow AppKit.NSPopoverDelegate::GetDetachableWindowForPopover(AppKit.NSPopover)' is missing an [NullAllowed] on return type
Expand Down Expand Up @@ -424,10 +418,6 @@
!missing-null-allowed! 'Foundation.NSIndexPath AppKit.NSTreeController::GetSelectionIndexPath()' is missing an [NullAllowed] on return type
!missing-null-allowed! 'Foundation.NSIndexSet AppKit.NSBrowser::SelectedRowIndexes(System.IntPtr)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'Foundation.NSNumber[] AppKit.NSPredicateEditorRowTemplate::get_CompoundTypes()' is missing an [NullAllowed] on return type
!missing-null-allowed! 'Foundation.NSObject AppKit.NSApplication::TargetForAction(ObjCRuntime.Selector)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'Foundation.NSObject AppKit.NSApplication::TargetForAction(ObjCRuntime.Selector,Foundation.NSObject,Foundation.NSObject)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'Foundation.NSObject AppKit.NSApplication::ValidRequestor(System.String,System.String)' is missing an [NullAllowed] on parameter #0
!missing-null-allowed! 'Foundation.NSObject AppKit.NSApplication::ValidRequestor(System.String,System.String)' is missing an [NullAllowed] on parameter #1
!missing-null-allowed! 'Foundation.NSObject AppKit.NSBrowser::GetItem(System.IntPtr,System.IntPtr)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'Foundation.NSObject AppKit.NSBrowser::ItemAtIndexPath(Foundation.NSIndexPath)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'Foundation.NSObject AppKit.NSBrowser::ParentForItems(System.IntPtr)' is missing an [NullAllowed] on return type
Expand Down Expand Up @@ -599,21 +589,6 @@
!missing-null-allowed! 'System.Void AppKit.NSAlert::set_Icon(AppKit.NSImage)' is missing an [NullAllowed] on parameter #0
!missing-null-allowed! 'System.Void AppKit.NSAnimationContext::set_CompletionHandler(System.Action)' is missing an [NullAllowed] on parameter #0
!missing-null-allowed! 'System.Void AppKit.NSAnimationContext::set_TimingFunction(CoreAnimation.CAMediaTimingFunction)' is missing an [NullAllowed] on parameter #0
!missing-null-allowed! 'System.Void AppKit.NSApplication::ArrangeInFront(Foundation.NSObject)' is missing an [NullAllowed] on parameter #0
!missing-null-allowed! 'System.Void AppKit.NSApplication::DetachDrawingThread(ObjCRuntime.Selector,Foundation.NSObject,Foundation.NSObject)' is missing an [NullAllowed] on parameter #2
!missing-null-allowed! 'System.Void AppKit.NSApplication::Hide(Foundation.NSObject)' is missing an [NullAllowed] on parameter #0
!missing-null-allowed! 'System.Void AppKit.NSApplication::HideOtherApplications(Foundation.NSObject)' is missing an [NullAllowed] on parameter #0
!missing-null-allowed! 'System.Void AppKit.NSApplication::MiniaturizeAll(Foundation.NSObject)' is missing an [NullAllowed] on parameter #0
!missing-null-allowed! 'System.Void AppKit.NSApplication::OrderFrontCharacterPalette(Foundation.NSObject)' is missing an [NullAllowed] on parameter #0
!missing-null-allowed! 'System.Void AppKit.NSApplication::OrderFrontColorPanel(Foundation.NSObject)' is missing an [NullAllowed] on parameter #0
!missing-null-allowed! 'System.Void AppKit.NSApplication::set_ApplicationIconImage(AppKit.NSImage)' is missing an [NullAllowed] on parameter #0
!missing-null-allowed! 'System.Void AppKit.NSApplication::set_MainMenu(AppKit.NSMenu)' is missing an [NullAllowed] on parameter #0
!missing-null-allowed! 'System.Void AppKit.NSApplication::set_ServicesMenu(AppKit.NSMenu)' is missing an [NullAllowed] on parameter #0
!missing-null-allowed! 'System.Void AppKit.NSApplication::set_ServicesProvider(Foundation.NSObject)' is missing an [NullAllowed] on parameter #0
!missing-null-allowed! 'System.Void AppKit.NSApplication::set_WindowsMenu(AppKit.NSMenu)' is missing an [NullAllowed] on parameter #0
!missing-null-allowed! 'System.Void AppKit.NSApplication::Stop(Foundation.NSObject)' is missing an [NullAllowed] on parameter #0
!missing-null-allowed! 'System.Void AppKit.NSApplication::Unhide(Foundation.NSObject)' is missing an [NullAllowed] on parameter #0
!missing-null-allowed! 'System.Void AppKit.NSApplication::UnhideAllApplications(Foundation.NSObject)' is missing an [NullAllowed] on parameter #0
!missing-null-allowed! 'System.Void AppKit.NSArrayController::Add(Foundation.NSObject)' is missing an [NullAllowed] on parameter #0
!missing-null-allowed! 'System.Void AppKit.NSArrayController::Insert(Foundation.NSObject)' is missing an [NullAllowed] on parameter #0
!missing-null-allowed! 'System.Void AppKit.NSArrayController::RemoveOp(Foundation.NSObject)' is missing an [NullAllowed] on parameter #0
Expand Down Expand Up @@ -683,7 +658,6 @@
!missing-null-allowed! 'System.Void AppKit.NSDatePickerCell::set_MaxDate(Foundation.NSDate)' is missing an [NullAllowed] on parameter #0
!missing-null-allowed! 'System.Void AppKit.NSDatePickerCell::set_MinDate(Foundation.NSDate)' is missing an [NullAllowed] on parameter #0
!missing-null-allowed! 'System.Void AppKit.NSDatePickerCell::set_TimeZone(Foundation.NSTimeZone)' is missing an [NullAllowed] on parameter #0
!missing-null-allowed! 'System.Void AppKit.NSDockTile::set_ContentView(AppKit.NSView)' is missing an [NullAllowed] on parameter #0
!missing-null-allowed! 'System.Void AppKit.NSDockTilePlugIn::SetDockTile(AppKit.NSDockTile)' is missing an [NullAllowed] on parameter #0
!missing-null-allowed! 'System.Void AppKit.NSDocument::BrowseDocumentVersions(Foundation.NSObject)' is missing an [NullAllowed] on parameter #0
!missing-null-allowed! 'System.Void AppKit.NSDocument::LockDocument(Foundation.NSObject)' is missing an [NullAllowed] on parameter #0
Expand Down Expand Up @@ -963,7 +937,6 @@
!missing-null-allowed! 'System.String AppKit.NSSpellChecker::GetLanguage(Foundation.NSRange,System.String,Foundation.NSOrthography)' is missing an [NullAllowed] on parameter #2
!missing-null-allowed! 'System.String[] AppKit.NSSpellChecker::CompletionsForPartialWordRange(Foundation.NSRange,System.String,System.String,System.IntPtr)' is missing an [NullAllowed] on parameter #2
!missing-null-allowed! 'System.String[] AppKit.NSSpellChecker::GuessesForWordRange(Foundation.NSRange,System.String,System.String,System.IntPtr)' is missing an [NullAllowed] on parameter #2
!missing-null-allowed! 'System.Void AppKit.NSApplication::DiscardEvents(System.UIntPtr,AppKit.NSEvent)' is missing an [NullAllowed] on parameter #1
!missing-null-allowed! 'System.Void AppKit.NSCell::EditWithFrame(CoreGraphics.CGRect,AppKit.NSView,AppKit.NSText,Foundation.NSObject,AppKit.NSEvent)' is missing an [NullAllowed] on parameter #4
!missing-null-allowed! 'System.Void AppKit.NSDocumentController::ReviewUnsavedDocuments(System.String,System.Boolean,Foundation.NSObject,ObjCRuntime.Selector,System.IntPtr)' is missing an [NullAllowed] on parameter #2
!missing-null-allowed! 'System.Void AppKit.NSDocumentController::ReviewUnsavedDocuments(System.String,System.Boolean,Foundation.NSObject,ObjCRuntime.Selector,System.IntPtr)' is missing an [NullAllowed] on parameter #3
Expand Down
Loading