Mercurial > projects > dwt-win
comparison dwt/graphics/Region.d @ 213:36f5cb12e1a2
Update to SWT 3.4M7
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 17 May 2008 17:34:28 +0200 |
parents | ab60f3309436 |
children | fd9c62a2998e |
comparison
equal
deleted
inserted
replaced
212:ab60f3309436 | 213:36f5cb12e1a2 |
---|---|
36 * when those instances are no longer required. | 36 * when those instances are no longer required. |
37 * </p> | 37 * </p> |
38 */ | 38 */ |
39 | 39 |
40 public final class Region : Resource { | 40 public final class Region : Resource { |
41 alias Resource.init_ init_; | |
41 | 42 |
42 /** | 43 /** |
43 * the OS resource for the region | 44 * the OS resource for the region |
44 * (Warning: This field is platform dependent) | 45 * (Warning: This field is platform dependent) |
45 * <p> | 46 * <p> |
80 * @see #dispose | 81 * @see #dispose |
81 * | 82 * |
82 * @since 3.0 | 83 * @since 3.0 |
83 */ | 84 */ |
84 public this (Device device) { | 85 public this (Device device) { |
85 if (device is null) device = Device.getDevice(); | 86 super(device); |
86 if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); | |
87 this.device = device; | |
88 handle = OS.CreateRectRgn (0, 0, 0, 0); | 87 handle = OS.CreateRectRgn (0, 0, 0, 0); |
89 if (handle is null) DWT.error(DWT.ERROR_NO_HANDLES); | 88 if (handle is null) DWT.error(DWT.ERROR_NO_HANDLES); |
90 if (device.tracking) device.new_Object(this); | 89 init_(); |
91 } | 90 } |
92 | 91 |
93 /** | 92 /** |
94 * Constructs a new region given a handle to the operating | 93 * Constructs a new region given a handle to the operating |
95 * system resources that it should represent. | 94 * system resources that it should represent. |
96 * | 95 * |
97 * @param handle the handle for the result | 96 * @param handle the handle for the result |
98 */ | 97 */ |
99 this(Device device, HRGN handle) { | 98 this(Device device, HRGN handle) { |
100 this.device = device; | 99 super(device); |
101 this.handle = handle; | 100 this.handle = handle; |
102 } | 101 } |
103 | 102 |
104 /** | 103 /** |
105 * Adds the given polygon to the collection of polygons | 104 * Adds the given polygon to the collection of polygons |
231 if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); | 230 if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); |
232 if (pt is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); | 231 if (pt is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); |
233 return contains(pt.x, pt.y); | 232 return contains(pt.x, pt.y); |
234 } | 233 } |
235 | 234 |
236 /** | 235 void destroy () { |
237 * Disposes of the operating system resources associated with | |
238 * the region. Applications must dispose of all regions which | |
239 * they allocate. | |
240 */ | |
241 override public void dispose () { | |
242 if (handle is null) return; | |
243 if (device.isDisposed()) return; | |
244 OS.DeleteObject(handle); | 236 OS.DeleteObject(handle); |
245 handle = null; | 237 handle = null; |
246 if (device.tracking) device.dispose_Object(this); | |
247 device = null; | |
248 } | 238 } |
249 | 239 |
250 /** | 240 /** |
251 * Compares the argument to the receiver, and returns true | 241 * Compares the argument to the receiver, and returns true |
252 * if they represent the <em>same</em> object using a class | 242 * if they represent the <em>same</em> object using a class |