Mercurial > projects > dwt-win
comparison dwt/graphics/Resource.d @ 213:36f5cb12e1a2
Update to SWT 3.4M7
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 17 May 2008 17:34:28 +0200 |
parents | f906dbcacee5 |
children | fd9c62a2998e |
comparison
equal
deleted
inserted
replaced
212:ab60f3309436 | 213:36f5cb12e1a2 |
---|---|
42 /** | 42 /** |
43 * the device where this resource was created | 43 * the device where this resource was created |
44 */ | 44 */ |
45 Device device; | 45 Device device; |
46 | 46 |
47 this() { | |
48 } | |
49 | |
50 this(Device device) { | |
51 if (device is null) device = Device.getDevice(); | |
52 if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); | |
53 this.device = device; | |
54 } | |
55 | |
56 void destroy() { | |
57 } | |
58 | |
47 /** | 59 /** |
48 * Disposes of the operating system resources associated with | 60 * Disposes of the operating system resources associated with |
49 * this resource. Applications must dispose of all resources | 61 * this resource. Applications must dispose of all resources |
50 * which they allocate. | 62 * which they allocate. |
51 */ | 63 */ |
52 public abstract void dispose(); | 64 public void dispose() { |
65 if (device is null) return; | |
66 if (device.isDisposed()) return; | |
67 destroy(); | |
68 if (device.tracking) device.dispose_Object(this); | |
69 device = null; | |
70 } | |
53 | 71 |
54 /** | 72 /** |
55 * Returns the <code>Device</code> where this resource was | 73 * Returns the <code>Device</code> where this resource was |
56 * created. | 74 * created. |
57 * | 75 * |
63 Device device = this.device; | 81 Device device = this.device; |
64 if (device is null || isDisposed ()) DWT.error (DWT.ERROR_GRAPHIC_DISPOSED); | 82 if (device is null || isDisposed ()) DWT.error (DWT.ERROR_GRAPHIC_DISPOSED); |
65 return device; | 83 return device; |
66 } | 84 } |
67 | 85 |
86 void init_() { | |
87 if (device.tracking) device.new_Object(this); | |
88 } | |
89 | |
68 /** | 90 /** |
69 * Returns <code>true</code> if the resource has been disposed, | 91 * Returns <code>true</code> if the resource has been disposed, |
70 * and <code>false</code> otherwise. | 92 * and <code>false</code> otherwise. |
71 * <p> | 93 * <p> |
72 * This method gets the dispose state for the resource. | 94 * This method gets the dispose state for the resource. |