Mercurial > projects > dwt-linux
diff dwt/graphics/Cursor.d @ 240:ce446666f5a2
Update to SWT 3.4M7
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 12 May 2008 19:13:01 +0200 |
parents | 380bad9f6852 |
children | c0d810de7093 |
line wrap: on
line diff
--- a/dwt/graphics/Cursor.d Mon May 12 15:36:37 2008 +0200 +++ b/dwt/graphics/Cursor.d Mon May 12 19:13:01 2008 +0200 @@ -90,7 +90,8 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; -this () { +this (Device device) { + super(device); } /** @@ -135,9 +136,7 @@ * @see DWT#CURSOR_HAND */ public this(Device device, int style) { - if (device is null) device = Device.getDevice(); - if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); - this.device = device; + super(device); int shape = 0; switch (style) { case DWT.CURSOR_APPSTARTING: break; @@ -171,7 +170,7 @@ handle = OS.gdk_cursor_new(shape); } if (handle is null) DWT.error(DWT.ERROR_NO_HANDLES); - if (device.tracking) device.new_Object(this); + init_(); } /** @@ -206,9 +205,7 @@ * </ul> */ public this(Device device, ImageData source, ImageData mask, int hotspotX, int hotspotY) { - if (device is null) device = Device.getDevice(); - if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); - this.device = device; + super(device); if (source is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); if (mask is null) { if (!(source.getTransparencyType() is DWT.TRANSPARENCY_MASK)) DWT.error(DWT.ERROR_NULL_ARGUMENT); @@ -260,7 +257,7 @@ maskData = ImageData.convertPad(maskData, mask.width, mask.height, mask.depth, mask.scanlinePad, 1); handle = createCursor(maskData, sourceData, source.width, source.height, hotspotX, hotspotY, true); if (handle is null) DWT.error(DWT.ERROR_NO_HANDLES); - if (device.tracking) device.new_Object(this); + init_(); } /** @@ -291,9 +288,7 @@ * @since 3.0 */ public this(Device device, ImageData source, int hotspotX, int hotspotY) { - if (device is null) device = Device.getDevice(); - if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); - this.device = device; + super(device); if (source is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); if (hotspotX >= source.width || hotspotX < 0 || hotspotY >= source.height || hotspotY < 0) { @@ -438,7 +433,7 @@ handle = createCursor(sourceData, maskData, source.width, source.height, hotspotX, hotspotY, false); } if (handle is null) DWT.error(DWT.ERROR_NO_HANDLES); - if (device.tracking) device.new_Object(this); + init_(); } GdkCursor* createCursor(byte[] sourceData, byte[] maskData, int width, int height, int hotspotX, int hotspotY, bool reverse) { @@ -457,18 +452,9 @@ return cursor; } -/** - * Disposes of the operating system resources associated with - * the cursor. Applications must dispose of all cursors which - * they allocate. - */ -public override void dispose() { - if (handle is null) return; - if (device.isDisposed()) return; +void destroy() { OS.gdk_cursor_destroy(handle); handle = null; - if (device.tracking) device.dispose_Object(this); - device = null; } /** @@ -505,10 +491,8 @@ * @private */ public static Cursor gtk_new(Device device, GdkCursor* handle) { - if (device is null) device = Device.getDevice(); - Cursor cursor = new Cursor(); + Cursor cursor = new Cursor(device); cursor.handle = handle; - cursor.device = device; return cursor; }