Skip to content
This repository has been archived by the owner on Jan 14, 2021. It is now read-only.

Commit

Permalink
Bind NSConnection and friends
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Corrado authored and abock committed Jul 25, 2013
1 parent ee46a56 commit a7b515e
Showing 1 changed file with 161 additions and 0 deletions.
161 changes: 161 additions & 0 deletions src/foundation-desktop.cs
Expand Up @@ -37,6 +37,8 @@
// These two are both four char codes i.e. defined on a uint with constant like 'xxxx'
using AEKeyword = System.UInt32;
using OSType = System.UInt32;
// typedef double NSTimeInterval;
using NSTimeInterval = System.Double;

namespace MonoMac.Foundation {

Expand Down Expand Up @@ -87,6 +89,165 @@ public interface NSAffineTransform {
[Export ("transformStruct")]
CGAffineTransform TransformStruct { get; set; }
}

[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
public interface NSConnection {
[Static, Export ("connectionWithReceivePort:sendPort:")]
NSConnection Create ([NullAllowed] NSPort receivePort, [NullAllowed] NSPort sendPort);

[Export ("runInNewThread")]
void RunInNewThread ();

// enableMultipleThreads, multipleThreadsEnabled - no-op in 10.5+ (always enabled)

[Export ("addRunLoop:")]
void AddRunLoop (NSRunLoop runLoop);

[Export ("removeRunLoop:")]
void RemoveRunLoop (NSRunLoop runLoop);

[Static, Export ("serviceConnectionWithName:rootObject:usingNameServer:")]
NSConnection CreateService (string name, NSObject root, NSPortNameServer server);

[Static, Export ("serviceConnectionWithName:rootObject:")]
NSConnection CreateService (string name, NSObject root);

[Export ("registerName:")]
bool RegisterName (string name);

[Export ("registerName:withNameServer:")]
bool RegisterName (string name, NSPortNameServer server);

[Export ("rootObject")]
NSObject RootObject { get; set; }

[Static, Export ("connectionWithRegisteredName:host:")]
NSConnection LookupService (string name, [NullAllowed] string hostName);

[Static, Export ("connectionWithRegisteredName:host:usingNameServer:")]
NSConnection LookupService (string name, [NullAllowed] string hostName, NSPortNameServer server);

[Export ("rootProxy")]
NSObject GetRootProxy ();

[Static, Export ("rootProxyForConnectionWithRegisteredName:host:")]
NSObject GetRootProxy (string name, [NullAllowed] string hostName);

[Static, Export ("rootProxyForConnectionWithRegisteredName:host:usingNameServer:")]
NSObject GetRootProxy (string name, [NullAllowed] string hostName, NSPortNameServer server);

[Export ("remoteObjects")]
NSObject [] RemoteObjects { get; }

[Export ("localObjects")]
NSObject [] LocalObjects { get; }

[Static, Export ("currentConversation")]
NSObject CurrentConversation { get; }

[Static, Export ("allConnections")]
NSConnection [] AllConnections { get; }

[Export ("requestTimeout")]
NSTimeInterval RequestTimeout { get; set; }

[Export ("replyTimeout")]
NSTimeInterval ReplyTimeout { get; set; }

[Export ("independentConversationQueueing")]
bool IndependentConversationQueueing { get; set; }

[Export ("addRequestMode:")]
void AddRequestMode (NSString runLoopMode);

[Export ("removeRequestMode:")]
void RemoveRequestMode (NSString runLoopMode);

[Export ("requestModes")]
NSString [] RequestModes { get; }

[Export ("invalidate")]
void Invalidate ();

[Export ("isValid")]
bool IsValid { get; }

[Export ("receivePort")]
NSPort ReceivePort { get; }

[Export ("sendPort")]
NSPort SendPort { get; }

[Export ("dispatchWithComponents:")]
void Dispatch (NSArray components);

[Export ("statistics")]
NSDictionary Statistics { get; }

[Export ("delegate"), NullAllowed]
NSObject WeakDelegate { get; set; }

[Wrap ("WeakDelegate")]
NSConnectionDelegate Delegate { get; set; }
}

[BaseType (typeof (NSObject))]
[Model]
public interface NSConnectionDelegate {
[Export ("authenticateComponents:withData:")]
bool AuthenticateComponents (NSArray components, NSData authenticationData);

[Export ("authenticationDataForComponents:")]
NSData GetAuthenticationData (NSArray components);

[Export ("connection:shouldMakeNewConnection:")]
bool ShouldMakeNewConnection (NSConnection parentConnection, NSConnection newConnection);

[Export ("connection:handleRequest:")]
bool HandleRequest (NSConnection connection, NSDistantObjectRequest request);

[Export ("createConversationForConnection:")]
NSObject CreateConversation (NSConnection connection);

[Export ("makeNewConnection:sender:")]
bool AllowNewConnection (NSConnection newConnection, NSConnection parentConnection);
}

[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
public interface NSDistantObjectRequest {
[Export ("connection")]
NSConnection Connection { get; }

[Export ("conversation")]
NSObject Conversation { get; }

[Export ("invocation")]
NSInvocation Invocation { get; }

[Export ("replyWithException:")]
void Reply ([NullAllowed] NSException exception);
}

[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
public interface NSPortNameServer {
[Static, Export ("systemDefaultPortNameServer")]
NSPortNameServer SystemDefault { get; }

[Export ("portForName:")]
NSPort GetPort (string portName);

[Export ("portForName:host:")]
NSPort GetPort (string portName, string hostName);

[Export ("registerPort:name:")]
bool RegisterPort (NSPort port, string portName);

[Export ("removePortForName:")]
bool RemovePort (string portName);
}

// FAK Left off until I understand how to do structs
//struct NSAffineTransformStruct {
Expand Down

0 comments on commit a7b515e

Please sign in to comment.