Mercurial > projects > dwt-mac
comparison dwt/internal/Callback.d @ 11:a329f9c3d66d
Ported dwt.internal.cocoa.SWT* again
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Fri, 22 Aug 2008 15:39:51 +0200 |
parents | 8b48be5454ce |
children | f565d3a95c0a |
comparison
equal
deleted
inserted
replaced
2:354c569b57a9 | 11:a329f9c3d66d |
---|---|
13 *******************************************************************************/ | 13 *******************************************************************************/ |
14 module dwt.internal.Callback; | 14 module dwt.internal.Callback; |
15 | 15 |
16 import dwt.dwthelper.utils; | 16 import dwt.dwthelper.utils; |
17 import dwt.internal.C; | 17 import dwt.internal.C; |
18 import c = dwt.internal.c.callback; | |
18 | 19 |
19 /** | 20 /** |
20 * Instances of this class represent entry points into Java | 21 * Instances of this class represent entry points into Java |
21 * which can be invoked from operating system level callback | 22 * which can be invoked from operating system level callback |
22 * routines. | 23 * routines. |
136 * @param isArrayBased whether the callback's method is array based | 137 * @param isArrayBased whether the callback's method is array based |
137 * @param errorResult the callback's error result | 138 * @param errorResult the callback's error result |
138 */ | 139 */ |
139 static synchronized int /*long*/ bind (Callback callback, Object object, String method, String signature, int argCount, boolean isStatic, boolean isArrayBased, int /*long*/ errorResult) | 140 static synchronized int /*long*/ bind (Callback callback, Object object, String method, String signature, int argCount, boolean isStatic, boolean isArrayBased, int /*long*/ errorResult) |
140 { | 141 { |
141 | 142 return c.bind(callback, object, method, signature, argCount, isStatic, isArrayBased, errorResult); |
142 } | 143 } |
143 | 144 |
144 /** | 145 /** |
145 * Releases the native level resources associated with the callback, | 146 * Releases the native level resources associated with the callback, |
146 * and removes all references between the callback and | 147 * and removes all references between the callback and |
147 * other objects. This helps to prevent (bad) application code | 148 * other objects. This helps to prevent (bad) application code |
148 * from accidentally holding onto extraneous garbage. | 149 * from accidentally holding onto extraneous garbage. |
149 */ | 150 */ |
150 public void dispose () { | 151 public void dispose () { |
151 if (object == null) return; | 152 if (object is null) return; |
152 unbind (this); | 153 unbind (this); |
153 object = method = signature = null; | 154 object = method = signature = null; |
154 address = 0; | 155 address = 0; |
155 } | 156 } |
156 | 157 |
180 * | 181 * |
181 * @return the entry count | 182 * @return the entry count |
182 * | 183 * |
183 * @since 2.1 | 184 * @since 2.1 |
184 */ | 185 */ |
185 public static int getEntryCount (); | 186 public static int getEntryCount () |
187 { | |
188 return c.getEntryCount; | |
189 } | |
186 | 190 |
187 static String getSignature(int argCount) { | 191 static String getSignature(int argCount) { |
188 String signature = "("; //$NON-NLS-1$ | 192 String signature = "("; //$NON-NLS-1$ |
189 for (int i = 0; i < argCount; i++) signature += PTR_SIGNATURE; | 193 for (int i = 0; i < argCount; i++) signature = PTR_SIGNATURE; |
190 signature += ")" + PTR_SIGNATURE; //$NON-NLS-1$ | 194 signature += ")" ~ PTR_SIGNATURE; //$NON-NLS-1$ |
191 return signature; | 195 return signature; |
192 } | 196 } |
193 | 197 |
194 /** | 198 /** |
195 * Indicates whether or not callbacks which are triggered at the | 199 * Indicates whether or not callbacks which are triggered at the |
201 * Note: This should not be called by application code. | 205 * Note: This should not be called by application code. |
202 * </p> | 206 * </p> |
203 * | 207 * |
204 * @param enable true if callbacks should be invoked | 208 * @param enable true if callbacks should be invoked |
205 */ | 209 */ |
206 public static final synchronized void setEnabled (boolean enable); | 210 public static final synchronized void setEnabled (boolean enable) |
211 { | |
212 return c.setEnabled(enable); | |
213 } | |
207 | 214 |
208 /** | 215 /** |
209 * Returns whether or not callbacks which are triggered at the | 216 * Returns whether or not callbacks which are triggered at the |
210 * native level should cause the messages described by the matching | 217 * native level should cause the messages described by the matching |
211 * <code>Callback</code> objects to be invoked. This method is used | 218 * <code>Callback</code> objects to be invoked. This method is used |
215 * Note: This should not be called by application code. | 222 * Note: This should not be called by application code. |
216 * </p> | 223 * </p> |
217 * | 224 * |
218 * @return true if callbacks should not be invoked | 225 * @return true if callbacks should not be invoked |
219 */ | 226 */ |
220 public static final synchronized boolean getEnabled (); | 227 public static final synchronized boolean getEnabled () |
228 { | |
229 return c.getEnabled; | |
230 } | |
221 | 231 |
222 /** | 232 /** |
223 * This might be called directly from native code in environments | 233 * This might be called directly from native code in environments |
224 * which can generate spurious events. Check before removing it. | 234 * which can generate spurious events. Check before removing it. |
225 * | 235 * |
244 /** | 254 /** |
245 * Releases the native level resources associated with the callback. | 255 * Releases the native level resources associated with the callback. |
246 * | 256 * |
247 * @see #dispose | 257 * @see #dispose |
248 */ | 258 */ |
249 static final synchronized void unbind (Callback callback); | 259 static final synchronized void unbind (Callback callback) |
250 | 260 { |
251 } | 261 c.unbind(callback); |
262 } | |
263 | |
264 } |