Mercurial > projects > dstep
comparison dstep/appkit/NSTextField.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.NSTextField; | |
8 | |
9 import dstep.appkit.NSColor; | |
10 import dstep.appkit.NSControl; | |
11 import dstep.appkit.NSText; | |
12 import dstep.appkit.NSTextFieldCell; | |
13 import dstep.appkit.NSUserInterfaceValidation; | |
14 import dstep.foundation.NSNotification; | |
15 import dstep.objc.bridge.Bridge; | |
16 import dstep.objc.objc; | |
17 | |
18 const TNSTextFieldAttributedStringMethods = ` | |
19 | |
20 bool allowsEditingTextAttributes () | |
21 { | |
22 return invokeObjcSelf!(bool, "allowsEditingTextAttributes"); | |
23 } | |
24 | |
25 void setAllowsEditingTextAttributes (bool flag) | |
26 { | |
27 return invokeObjcSelf!(void, "setAllowsEditingTextAttributes:", bool)(flag); | |
28 } | |
29 | |
30 bool importsGraphics () | |
31 { | |
32 return invokeObjcSelf!(bool, "importsGraphics"); | |
33 } | |
34 | |
35 void setImportsGraphics (bool flag) | |
36 { | |
37 return invokeObjcSelf!(void, "setImportsGraphics:", bool)(flag); | |
38 } | |
39 | |
40 //mixin ObjcBindMethod!(allowsEditingTextAttributes, "allowsEditingTextAttributes"); | |
41 //mixin ObjcBindMethod!(setAllowsEditingTextAttributes, "setAllowsEditingTextAttributes:"); | |
42 //mixin ObjcBindMethod!(importsGraphics, "importsGraphics"); | |
43 //mixin ObjcBindMethod!(setImportsGraphics, "setImportsGraphics:"); | |
44 | |
45 `; | |
46 | |
47 class NSTextField : NSControl, INSUserInterfaceValidations | |
48 { | |
49 mixin (ObjcWrap); | |
50 | |
51 void setBackgroundColor (NSColor color) | |
52 { | |
53 return invokeObjcSelf!(void, "setBackgroundColor:", NSColor)(color); | |
54 } | |
55 | |
56 NSColor backgroundColor () | |
57 { | |
58 return invokeObjcSelf!(NSColor, "backgroundColor"); | |
59 } | |
60 | |
61 void setDrawsBackground (bool flag) | |
62 { | |
63 return invokeObjcSelf!(void, "setDrawsBackground:", bool)(flag); | |
64 } | |
65 | |
66 bool drawsBackground () | |
67 { | |
68 return invokeObjcSelf!(bool, "drawsBackground"); | |
69 } | |
70 | |
71 void setTextColor (NSColor color) | |
72 { | |
73 return invokeObjcSelf!(void, "setTextColor:", NSColor)(color); | |
74 } | |
75 | |
76 NSColor textColor () | |
77 { | |
78 return invokeObjcSelf!(NSColor, "textColor"); | |
79 } | |
80 | |
81 bool isBordered () | |
82 { | |
83 return invokeObjcSelf!(bool, "isBordered"); | |
84 } | |
85 | |
86 void setBordered (bool flag) | |
87 { | |
88 return invokeObjcSelf!(void, "setBordered:", bool)(flag); | |
89 } | |
90 | |
91 bool isBezeled () | |
92 { | |
93 return invokeObjcSelf!(bool, "isBezeled"); | |
94 } | |
95 | |
96 void setBezeled (bool flag) | |
97 { | |
98 return invokeObjcSelf!(void, "setBezeled:", bool)(flag); | |
99 } | |
100 | |
101 bool isEditable () | |
102 { | |
103 return invokeObjcSelf!(bool, "isEditable"); | |
104 } | |
105 | |
106 void setEditable (bool flag) | |
107 { | |
108 return invokeObjcSelf!(void, "setEditable:", bool)(flag); | |
109 } | |
110 | |
111 bool isSelectable () | |
112 { | |
113 return invokeObjcSelf!(bool, "isSelectable"); | |
114 } | |
115 | |
116 void setSelectable (bool flag) | |
117 { | |
118 return invokeObjcSelf!(void, "setSelectable:", bool)(flag); | |
119 } | |
120 | |
121 void selectText (Object sender) | |
122 { | |
123 return invokeObjcSelf!(void, "selectText:", Object)(sender); | |
124 } | |
125 | |
126 Object delegate_ () | |
127 { | |
128 return invokeObjcSelf!(Object, "delegate"); | |
129 } | |
130 | |
131 void setDelegate (Object anObject) | |
132 { | |
133 return invokeObjcSelf!(void, "setDelegate:", Object)(anObject); | |
134 } | |
135 | |
136 bool textShouldBeginEditing (NSText textObject) | |
137 { | |
138 return invokeObjcSelf!(bool, "textShouldBeginEditing:", NSText)(textObject); | |
139 } | |
140 | |
141 bool textShouldEndEditing (NSText textObject) | |
142 { | |
143 return invokeObjcSelf!(bool, "textShouldEndEditing:", NSText)(textObject); | |
144 } | |
145 | |
146 void textDidBeginEditing (NSNotification notification) | |
147 { | |
148 return invokeObjcSelf!(void, "textDidBeginEditing:", NSNotification)(notification); | |
149 } | |
150 | |
151 void textDidEndEditing (NSNotification notification) | |
152 { | |
153 return invokeObjcSelf!(void, "textDidEndEditing:", NSNotification)(notification); | |
154 } | |
155 | |
156 void textDidChange (NSNotification notification) | |
157 { | |
158 return invokeObjcSelf!(void, "textDidChange:", NSNotification)(notification); | |
159 } | |
160 | |
161 bool acceptsFirstResponder () | |
162 { | |
163 return invokeObjcSelf!(bool, "acceptsFirstResponder"); | |
164 } | |
165 | |
166 void setBezelStyle (uint style) | |
167 { | |
168 return invokeObjcSelf!(void, "setBezelStyle:", uint)(style); | |
169 } | |
170 | |
171 uint bezelStyle () | |
172 { | |
173 return invokeObjcSelf!(uint, "bezelStyle"); | |
174 } | |
175 | |
176 bool validateUserInterfaceItem (INSValidatedUserInterfaceItem anItem) | |
177 { | |
178 return invokeObjcSelf!(bool, "validateUserInterfaceItem:", INSValidatedUserInterfaceItem)(anItem); | |
179 } | |
180 | |
181 // NSTextFieldAttributedStringMethods | |
182 bool allowsEditingTextAttributes () | |
183 { | |
184 return invokeObjcSelf!(bool, "allowsEditingTextAttributes"); | |
185 } | |
186 | |
187 void setAllowsEditingTextAttributes (bool flag) | |
188 { | |
189 return invokeObjcSelf!(void, "setAllowsEditingTextAttributes:", bool)(flag); | |
190 } | |
191 | |
192 bool importsGraphics () | |
193 { | |
194 return invokeObjcSelf!(bool, "importsGraphics"); | |
195 } | |
196 | |
197 void setImportsGraphics (bool flag) | |
198 { | |
199 return invokeObjcSelf!(void, "setImportsGraphics:", bool)(flag); | |
200 } | |
201 } |