Mercurial > projects > dstep
comparison 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 |
comparison
equal
deleted
inserted
replaced
15:7ff919f595d5 | 16:19885b43130e |
---|---|
1 /** | |
2 * Copyright: Copyright (c) 2009 Jacob Carlborg. | |
3 * Authors: Jacob Carlborg | |
4 * Version: Initial created: Sep 24, 2009 | |
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) | |
6 */ | |
7 module dstep.appkit.NSInputManager; | |
8 | |
9 import dstep.foundation.NSArray; | |
10 import dstep.appkit.NSAttributedString; | |
11 import dstep.appkit.NSEvent; | |
12 import dstep.appkit.NSImage; | |
13 import dstep.appkit.NSInputServer; | |
14 import dstep.foundation.NSAttributedString; | |
15 import dstep.foundation.NSGeometry; | |
16 import dstep.foundation.NSObjCRuntime; | |
17 import dstep.foundation.NSObject; | |
18 import dstep.foundation.NSRange; | |
19 import dstep.foundation.NSString; | |
20 import dstep.objc.bridge.Bridge; | |
21 import dstep.objc.objc; | |
22 | |
23 class NSInputManager : NSObject, INSTextInput | |
24 { | |
25 mixin (ObjcWrap); | |
26 | |
27 static NSInputManager currentInputManager () | |
28 { | |
29 return invokeObjcSelfClass!(NSInputManager, "currentInputManager"); | |
30 } | |
31 | |
32 static void cycleToNextInputLanguage (Object sender) | |
33 { | |
34 return invokeObjcSelfClass!(void, "cycleToNextInputLanguage:", Object)(sender); | |
35 } | |
36 | |
37 static void cycleToNextInputServerInLanguage (Object sender) | |
38 { | |
39 return invokeObjcSelfClass!(void, "cycleToNextInputServerInLanguage:", Object)(sender); | |
40 } | |
41 | |
42 NSInputManager initWithName (NSString inputServerName, NSString hostName) | |
43 { | |
44 id result = invokeObjcSelf!(id, "initWithName:host:", NSString, NSString)(inputServerName, hostName); | |
45 return result is this.objcObject ? this : (result !is null ? new NSInputManager(result) : null); | |
46 } | |
47 | |
48 this (NSString inputServerName, NSString hostName) | |
49 { | |
50 super(NSInputManager.alloc.initWithName(inputServerName, hostName).objcObject); | |
51 } | |
52 | |
53 NSString localizedInputManagerName () | |
54 { | |
55 return invokeObjcSelf!(NSString, "localizedInputManagerName"); | |
56 } | |
57 | |
58 void markedTextAbandoned (Object cli) | |
59 { | |
60 return invokeObjcSelf!(void, "markedTextAbandoned:", Object)(cli); | |
61 } | |
62 | |
63 void markedTextSelectionChanged (NSRange newSel, Object cli) | |
64 { | |
65 return invokeObjcSelf!(void, "markedTextSelectionChanged:client:", NSRange, Object)(newSel, cli); | |
66 } | |
67 | |
68 bool wantsToInterpretAllKeystrokes () | |
69 { | |
70 return invokeObjcSelf!(bool, "wantsToInterpretAllKeystrokes"); | |
71 } | |
72 | |
73 NSString language () | |
74 { | |
75 return invokeObjcSelf!(NSString, "language"); | |
76 } | |
77 | |
78 NSImage image () | |
79 { | |
80 return invokeObjcSelf!(NSImage, "image"); | |
81 } | |
82 | |
83 NSInputServer server () | |
84 { | |
85 return invokeObjcSelf!(NSInputServer, "server"); | |
86 } | |
87 | |
88 bool wantsToHandleMouseEvents () | |
89 { | |
90 return invokeObjcSelf!(bool, "wantsToHandleMouseEvents"); | |
91 } | |
92 | |
93 bool handleMouseEvent (NSEvent theMouseEvent) | |
94 { | |
95 return invokeObjcSelf!(bool, "handleMouseEvent:", NSEvent)(theMouseEvent); | |
96 } | |
97 | |
98 bool wantsToDelayTextChangeNotifications () | |
99 { | |
100 return invokeObjcSelf!(bool, "wantsToDelayTextChangeNotifications"); | |
101 } | |
102 | |
103 void insertText (Object aString) | |
104 { | |
105 return invokeObjcSelf!(void, "insertText:", Object)(aString); | |
106 } | |
107 | |
108 void doCommandBySelector (SEL aSelector) | |
109 { | |
110 return invokeObjcSelf!(void, "doCommandBySelector:", SEL)(aSelector); | |
111 } | |
112 | |
113 void setMarkedText (Object aString, NSRange selRange) | |
114 { | |
115 return invokeObjcSelf!(void, "setMarkedText:selectedRange:", Object, NSRange)(aString, selRange); | |
116 } | |
117 | |
118 void unmarkText () | |
119 { | |
120 return invokeObjcSelf!(void, "unmarkText"); | |
121 } | |
122 | |
123 bool hasMarkedText () | |
124 { | |
125 return invokeObjcSelf!(bool, "hasMarkedText"); | |
126 } | |
127 | |
128 NSInteger conversationIdentifier () | |
129 { | |
130 return invokeObjcSelf!(NSInteger, "conversationIdentifier"); | |
131 } | |
132 | |
133 NSAttributedString attributedSubstringFromRange (NSRange theRange) | |
134 { | |
135 return invokeObjcSelf!(NSAttributedString, "attributedSubstringFromRange:", NSRange)(theRange); | |
136 } | |
137 | |
138 NSRange markedRange () | |
139 { | |
140 return invokeObjcSelf!(NSRange, "markedRange"); | |
141 } | |
142 | |
143 NSRange selectedRange () | |
144 { | |
145 return invokeObjcSelf!(NSRange, "selectedRange"); | |
146 } | |
147 | |
148 NSRect firstRectForCharacterRange (NSRange theRange) | |
149 { | |
150 return invokeObjcSelf!(NSRect, "firstRectForCharacterRange:", NSRange)(theRange); | |
151 } | |
152 | |
153 NSUInteger characterIndexForPoint (NSPoint thePoint) | |
154 { | |
155 return invokeObjcSelf!(NSUInteger, "characterIndexForPoint:", NSPoint)(thePoint); | |
156 } | |
157 | |
158 NSArray validAttributesForMarkedText () | |
159 { | |
160 return invokeObjcSelf!(NSArray, "validAttributesForMarkedText"); | |
161 } | |
162 } | |
163 | |
164 interface INSTextInput | |
165 { | |
166 void insertText (Object aString); | |
167 void doCommandBySelector (SEL aSelector); | |
168 void setMarkedText (Object aString, NSRange selRange); | |
169 void unmarkText (); | |
170 bool hasMarkedText (); | |
171 NSInteger conversationIdentifier (); | |
172 NSAttributedString attributedSubstringFromRange (NSRange theRange); | |
173 NSRange markedRange (); | |
174 NSRange selectedRange (); | |
175 NSRect firstRectForCharacterRange (NSRange theRange); | |
176 NSUInteger characterIndexForPoint (NSPoint thePoint); | |
177 NSArray validAttributesForMarkedText (); | |
178 } |