diff dstep/appkit/NSInputManager.d @ 16:19885b43130e

Huge update, the bridge actually works now
author Jacob Carlborg <doob@me.com>
date Sun, 03 Jan 2010 22:06:11 +0100
parents
children b9de51448c6b
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dstep/appkit/NSInputManager.d	Sun Jan 03 22:06:11 2010 +0100
@@ -0,0 +1,178 @@
+/**
+ * Copyright: Copyright (c) 2009 Jacob Carlborg.
+ * Authors: Jacob Carlborg
+ * Version: Initial created: Sep 24, 2009 
+ * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
+ */
+module dstep.appkit.NSInputManager;
+
+import dstep.foundation.NSArray;
+import dstep.appkit.NSAttributedString;
+import dstep.appkit.NSEvent;
+import dstep.appkit.NSImage;
+import dstep.appkit.NSInputServer;
+import dstep.foundation.NSAttributedString;
+import dstep.foundation.NSGeometry;
+import dstep.foundation.NSObjCRuntime;
+import dstep.foundation.NSObject;
+import dstep.foundation.NSRange;
+import dstep.foundation.NSString;
+import dstep.objc.bridge.Bridge;
+import dstep.objc.objc;
+
+class NSInputManager : NSObject, INSTextInput
+{
+	mixin (ObjcWrap);
+
+	static NSInputManager currentInputManager ()
+	{
+		return invokeObjcSelfClass!(NSInputManager, "currentInputManager");
+	}
+
+	static void cycleToNextInputLanguage (Object sender)
+	{
+		return invokeObjcSelfClass!(void, "cycleToNextInputLanguage:", Object)(sender);
+	}
+
+	static void cycleToNextInputServerInLanguage (Object sender)
+	{
+		return invokeObjcSelfClass!(void, "cycleToNextInputServerInLanguage:", Object)(sender);
+	}
+
+	NSInputManager initWithName (NSString inputServerName, NSString hostName)
+	{
+		id result = invokeObjcSelf!(id, "initWithName:host:", NSString, NSString)(inputServerName, hostName);
+		return result is this.objcObject ? this : (result !is null ? new NSInputManager(result) : null);
+	}
+
+	this (NSString inputServerName, NSString hostName)
+	{
+		super(NSInputManager.alloc.initWithName(inputServerName, hostName).objcObject);
+	}
+
+	NSString localizedInputManagerName ()
+	{
+		return invokeObjcSelf!(NSString, "localizedInputManagerName");
+	}
+
+	void markedTextAbandoned (Object cli)
+	{
+		return invokeObjcSelf!(void, "markedTextAbandoned:", Object)(cli);
+	}
+
+	void markedTextSelectionChanged (NSRange newSel, Object cli)
+	{
+		return invokeObjcSelf!(void, "markedTextSelectionChanged:client:", NSRange, Object)(newSel, cli);
+	}
+
+	bool wantsToInterpretAllKeystrokes ()
+	{
+		return invokeObjcSelf!(bool, "wantsToInterpretAllKeystrokes");
+	}
+
+	NSString language ()
+	{
+		return invokeObjcSelf!(NSString, "language");
+	}
+
+	NSImage image ()
+	{
+		return invokeObjcSelf!(NSImage, "image");
+	}
+
+	NSInputServer server ()
+	{
+		return invokeObjcSelf!(NSInputServer, "server");
+	}
+
+	bool wantsToHandleMouseEvents ()
+	{
+		return invokeObjcSelf!(bool, "wantsToHandleMouseEvents");
+	}
+
+	bool handleMouseEvent (NSEvent theMouseEvent)
+	{
+		return invokeObjcSelf!(bool, "handleMouseEvent:", NSEvent)(theMouseEvent);
+	}
+
+	bool wantsToDelayTextChangeNotifications ()
+	{
+		return invokeObjcSelf!(bool, "wantsToDelayTextChangeNotifications");
+	}
+
+	void insertText (Object aString)
+	{
+		return invokeObjcSelf!(void, "insertText:", Object)(aString);
+	}
+
+	void doCommandBySelector (SEL aSelector)
+	{
+		return invokeObjcSelf!(void, "doCommandBySelector:", SEL)(aSelector);
+	}
+
+	void setMarkedText (Object aString, NSRange selRange)
+	{
+		return invokeObjcSelf!(void, "setMarkedText:selectedRange:", Object, NSRange)(aString, selRange);
+	}
+
+	void unmarkText ()
+	{
+		return invokeObjcSelf!(void, "unmarkText");
+	}
+
+	bool hasMarkedText ()
+	{
+		return invokeObjcSelf!(bool, "hasMarkedText");
+	}
+
+	NSInteger conversationIdentifier ()
+	{
+		return invokeObjcSelf!(NSInteger, "conversationIdentifier");
+	}
+
+	NSAttributedString attributedSubstringFromRange (NSRange theRange)
+	{
+		return invokeObjcSelf!(NSAttributedString, "attributedSubstringFromRange:", NSRange)(theRange);
+	}
+
+	NSRange markedRange ()
+	{
+		return invokeObjcSelf!(NSRange, "markedRange");
+	}
+
+	NSRange selectedRange ()
+	{
+		return invokeObjcSelf!(NSRange, "selectedRange");
+	}
+
+	NSRect firstRectForCharacterRange (NSRange theRange)
+	{
+		return invokeObjcSelf!(NSRect, "firstRectForCharacterRange:", NSRange)(theRange);
+	}
+
+	NSUInteger characterIndexForPoint (NSPoint thePoint)
+	{
+		return invokeObjcSelf!(NSUInteger, "characterIndexForPoint:", NSPoint)(thePoint);
+	}
+
+	NSArray validAttributesForMarkedText ()
+	{
+		return invokeObjcSelf!(NSArray, "validAttributesForMarkedText");
+	}
+}
+
+interface INSTextInput
+{
+	void insertText (Object aString);
+	void doCommandBySelector (SEL aSelector);
+	void setMarkedText (Object aString, NSRange selRange);
+	void unmarkText ();
+	bool hasMarkedText ();
+	NSInteger conversationIdentifier ();
+	NSAttributedString attributedSubstringFromRange (NSRange theRange);
+	NSRange markedRange ();
+	NSRange selectedRange ();
+	NSRect firstRectForCharacterRange (NSRange theRange);
+	NSUInteger characterIndexForPoint (NSPoint thePoint);
+	NSArray validAttributesForMarkedText ();
+}
\ No newline at end of file