-
-
Save chamons/607dacc1bb33c19f5100 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using MonoMac.Foundation; | |
namespace SharpDocTest2 | |
{ | |
public partial class MyDocument : MonoMac.AppKit.NSDocument | |
{ | |
// Called when created from unmanaged code | |
public MyDocument (IntPtr handle) : base (handle) | |
{ | |
} | |
// Called when created directly from a XIB file | |
[Export ("initWithCoder:")] | |
public MyDocument (NSCoder coder) : base (coder) | |
{ | |
} | |
[Export ("autosavesInPlace")] | |
new public static bool AutosavesInPlace () { return true; } | |
public override NSData GetAsData (string documentType, out NSError outError) | |
{ | |
outError = null; | |
return new NSData (); | |
} | |
// | |
// Load support: | |
// Override one of ReadFromData, ReadFromFileWrapper or ReadFromUrl | |
// | |
public override bool ReadFromData (NSData data, string typeName, out NSError outError) | |
{ | |
outError = null; | |
return true; | |
} | |
// If this returns the name of a NIB file instead of null, a NSDocumentController | |
// is automatically created for you. | |
public override string WindowNibName { | |
get { | |
return "MyDocument"; | |
} | |
} | |
} | |
} | |
namespace Mecha.Mac | |
open System | |
open System.Collections.Generic | |
open MonoMac.ObjCRuntime | |
open MonoMac.Foundation | |
open MonoMac.AppKit | |
open MonoMac.SceneKit | |
[<Register("MyDocument")>] | |
type MyDocument = | |
inherit NSDocument | |
new (handle : IntPtr) = { inherit NSDocument (handle); } | |
[<Export ("initWithCoder:")>] | |
new (coder : NSCoder) = { inherit NSDocument (coder); } | |
[<Export ("autosavesInPlace")>] | |
static member GetAutosavesInPlace () = true | |
[<Export ("windowNibName")>] | |
member this.GetWindowNibName () = | |
"MyDocument" | |
override this.ReadFromData (data, typeName, outError) = | |
outError <- null | |
true | |
override this.GetAsData (typeName, outError) = | |
outError <- null | |
new NSData () |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment