Changeset 31 for branches/0.1
- Timestamp:
- 07/19/04 15:32:12 (4 years ago)
- Files:
-
- branches/0.1/src/SConstruct (modified) (2 diffs)
- branches/0.1/src/dwt/accessibility/acc.d (added)
- branches/0.1/src/dwt/accessibility/accessible.d (modified) (20 diffs)
- branches/0.1/src/dwt/dwt.d (modified) (2 diffs)
- branches/0.1/src/dwt/graphics/color.d (modified) (4 diffs)
- branches/0.1/src/dwt/graphics/cursor.d (modified) (12 diffs)
- branches/0.1/src/dwt/graphics/device.d (modified) (3 diffs)
- branches/0.1/src/dwt/graphics/font.d (modified) (3 diffs)
- branches/0.1/src/dwt/graphics/fontdata.d (modified) (3 diffs)
- branches/0.1/src/dwt/graphics/gc.d (modified) (3 diffs)
- branches/0.1/src/dwt/graphics/image.d (modified) (3 diffs)
- branches/0.1/src/dwt/graphics/imagedata.d (modified) (2 diffs)
- branches/0.1/src/dwt/graphics/imageloader.d (modified) (2 diffs)
- branches/0.1/src/dwt/graphics/point.d (modified) (3 diffs)
- branches/0.1/src/dwt/graphics/rectangle.d (modified) (3 diffs)
- branches/0.1/src/dwt/graphics/region.d (modified) (2 diffs)
- branches/0.1/src/dwt/graphics/rgb.d (modified) (1 diff)
- branches/0.1/src/dwt/internal/compatibility.d (modified) (2 diffs)
- branches/0.1/src/dwt/internal/win32/os.d (modified) (13 diffs)
- branches/0.1/src/dwt/internal/win32/tchar.d (modified) (2 diffs)
- branches/0.1/src/dwt/internal/win32/types.d (modified) (5 diffs)
- branches/0.1/src/dwt/util/throwable.d (modified) (1 diff)
- branches/0.1/src/dwt/util/util.d (modified) (1 diff)
- branches/0.1/src/dwt/widgets/button.d (modified) (8 diffs)
- branches/0.1/src/dwt/widgets/canvas.d (modified) (2 diffs)
- branches/0.1/src/dwt/widgets/caret.d (modified) (1 diff)
- branches/0.1/src/dwt/widgets/composite.d (modified) (15 diffs)
- branches/0.1/src/dwt/widgets/control.d (modified) (86 diffs)
- branches/0.1/src/dwt/widgets/decorations.d (modified) (22 diffs)
- branches/0.1/src/dwt/widgets/display.d (modified) (55 diffs)
- branches/0.1/src/dwt/widgets/event.d (modified) (5 diffs)
- branches/0.1/src/dwt/widgets/eventtable.d (added)
- branches/0.1/src/dwt/widgets/imagelist.d (modified) (2 diffs)
- branches/0.1/src/dwt/widgets/item.d (modified) (2 diffs)
- branches/0.1/src/dwt/widgets/layout.d (modified) (2 diffs)
- branches/0.1/src/dwt/widgets/menu.d (modified) (4 diffs)
- branches/0.1/src/dwt/widgets/menuitem.d (modified) (3 diffs)
- branches/0.1/src/dwt/widgets/runnablelock.d (modified) (1 diff)
- branches/0.1/src/dwt/widgets/scrollable.d (modified) (14 diffs)
- branches/0.1/src/dwt/widgets/scrollbar.d (modified) (15 diffs)
- branches/0.1/src/dwt/widgets/shell.d (modified) (43 diffs)
- branches/0.1/src/dwt/widgets/synchronizer.d (modified) (8 diffs)
- branches/0.1/src/dwt/widgets/widget.d (modified) (16 diffs)
- branches/0.1/src/makefile (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/0.1/src/SConstruct
r15 r31 7 7 8 8 SRC = ( 9 glob('dwt/*.d') + 10 glob('dwt/graphics/*.d') + 9 glob('dwt/*.d') + 10 glob('dwt/accessibility/*.d') + 11 glob('dwt/internal/win32/*.d') + 11 12 glob('dwt/internal/*.d') + 12 13 glob('dwt/util/*.d') + 13 glob('dwt/ widgets/*.d') +14 glob(' HelloDWT.d')14 glob('dwt/graphics/*.d') + 15 glob('dwt/widgets/*.d') 15 16 ) 16 17 … … 19 20 SRC += glob('dwt/*/win32/*.d') # ooo 20 21 22 21 23 elif 'linux' in sys.platform: 22 24 env.Append(DVERSIONS=['unix', 'linux']) 23 25 SRC += glob('dwt/*/gtk/*.d') 24 25 26 27 SRC += glob('HelloDWT.d') 28 26 29 env.Program(SRC) branches/0.1/src/dwt/accessibility/accessible.d
r30 r31 54 54 public class Accessible { 55 55 56 private import dwt.dwt; 57 private import dwt.widgets.control; 58 private import dwt.util.thread; 56 59 57 60 int refCount = 0, enumIndex = 0; 61 /+ 58 62 COMObject objIAccessible, objIEnumVARIANT; 59 63 IAccessible iaccessible; … … 61 65 Vector accessibleControlListeners = new Vector(); 62 66 Vector textListeners = new Vector (); 67 +/ 63 68 Object[] variants; 64 69 Control control; … … 66 71 this(Control control) { 67 72 this.control = control; 73 /+ TODO: 68 74 int[] ppvObject = new int[1]; 69 75 int result = COM.CreateStdAccessibleObject(control.handle, COM.OBJID_CLIENT, COM.IIDIAccessible, ppvObject); … … 113 119 // method6 Clone - not implemented 114 120 }; 121 +/ 115 122 AddRef(); 116 123 } 117 118 124 /** 119 125 * Invokes platform specific functionality to allocate a new accessible object. … … 132 138 return new Accessible(control); 133 139 } 134 /+ TODO: delegates? 140 141 /+ 135 142 /** 136 143 * Adds the listener to the collection of listeners who will … … 216 223 textListeners.addElement (listener); 217 224 } 218 +/ 219 225 +/ 220 226 /** 221 227 * Gets the control for this Accessible object. … … 238 244 */ 239 245 public void internal_dispose_Accessible() { 246 /+ TODO: working with COM 240 247 if (iaccessible != null) 241 248 iaccessible.Release(); 242 249 iaccessible = null; 250 +/ 243 251 Release(); 244 252 } … … 255 263 */ 256 264 public int internal_WM_GETOBJECT (int wParam, int lParam) { 265 /+ TODO: COM 257 266 if (objIAccessible == null) return 0; 258 267 if (lParam == COM.OBJID_CLIENT) { 259 268 return COM.LresultFromObject(COM.IIDIAccessible, wParam, objIAccessible.getAddress()); 260 269 } 270 +/ 261 271 return 0; 262 272 } 263 273 264 /+ TODO: delegates?265 274 /** 266 275 * Removes the listener from the collection of listeners who will … … 282 291 * @see #addAccessibleListener 283 292 */ 293 /+ 284 294 public void removeAccessibleListener(AccessibleListener listener) { 285 295 checkWidget(); … … 340 350 } 341 351 +/ 342 343 352 /** 344 353 * Sends a message to accessible clients that the child selection … … 354 363 public void selectionChanged () { 355 364 checkWidget(); 356 COM.NotifyWinEvent (COM.EVENT_OBJECT_SELECTIONWITHIN, control.handle, COM.OBJID_CLIENT, COM.CHILDID_SELF);365 // TODO: COM.NotifyWinEvent (COM.EVENT_OBJECT_SELECTIONWITHIN, control.handle, COM.OBJID_CLIENT, COM.CHILDID_SELF); 357 366 } 358 367 … … 371 380 checkWidget(); 372 381 int id; 382 /+ TODO: 373 383 if (childID == ACC.CHILDID_SELF) id = COM.CHILDID_SELF; 374 384 else if (control instanceof Tree) id = childID; // Tree item childIDs are pointers 375 385 else id = childID + 1; // All other childIDs are 1-based indices 376 386 COM.NotifyWinEvent (COM.EVENT_OBJECT_FOCUS, control.handle, COM.OBJID_CLIENT, id); 387 +/ 377 388 } 378 389 … … 392 403 public void textCaretMoved (int index) { 393 404 checkWidget(); 394 COM.NotifyWinEvent (COM.EVENT_OBJECT_LOCATIONCHANGE, control.handle, COM.OBJID_CARET, COM.CHILDID_SELF);405 // TODO: COM.NotifyWinEvent (COM.EVENT_OBJECT_LOCATIONCHANGE, control.handle, COM.OBJID_CARET, COM.CHILDID_SELF); 395 406 } 396 407 … … 416 427 public void textChanged (int type, int startIndex, int length) { 417 428 checkWidget(); 418 COM.NotifyWinEvent (COM.EVENT_OBJECT_VALUECHANGE, control.handle, COM.OBJID_CLIENT, COM.CHILDID_SELF);429 //TODO: COM.NotifyWinEvent (COM.EVENT_OBJECT_VALUECHANGE, control.handle, COM.OBJID_CLIENT, COM.CHILDID_SELF); 419 430 } 420 431 … … 434 445 // not an MSAA event 435 446 } 436 447 448 /+ 437 449 int QueryInterface(int arg1, int arg2) { 438 450 if (iaccessible == null) return COM.CO_E_OBJNOTCONNECTED; … … 470 482 return result; 471 483 } 484 +/ 472 485 473 486 int AddRef() { … … 478 491 int Release() { 479 492 refCount--; 480 493 /+ 481 494 if (refCount == 0) { 482 495 if (objIAccessible != null) … … 488 501 objIEnumVARIANT = null; 489 502 } 503 +/ 490 504 return refCount; 491 505 } 492 506 /+ 493 507 int accDoDefaultAction(int varChild_vt, int varChild_reserved1, int varChild_lVal, int varChild_reserved2) { 494 508 if (iaccessible == null) return COM.CO_E_OBJNOTCONNECTED; … … 1204 1218 return COM.S_OK; 1205 1219 } 1206 1220 1207 1221 int stateToOs(int state) { 1208 1222 int osState = 0; … … 1307 1321 return role; 1308 1322 } 1323 +/ 1309 1324 1310 1325 /* checkWidget was copied from Widget, and rewritten to work in this package */ 1311 1326 void checkWidget () { 1312 if (!isValidThread ()) SWT.error (SWT.ERROR_THREAD_INVALID_ACCESS);1313 if (control.isDisposed ()) SWT.error (SWT.ERROR_WIDGET_DISPOSED);1327 if (!isValidThread ()) DWT.error (DWT.ERROR_THREAD_INVALID_ACCESS); 1328 if (control.isDisposed ()) DWT.error (DWT.ERROR_WIDGET_DISPOSED); 1314 1329 } 1315 1330 1316 1331 /* isValidThread was copied from Widget, and rewritten to work in this package */ 1317 boolean isValidThread () { 1318 return control.getDisplay ().getThread () == Thread.currentThread (); 1319 } 1320 1321 +/ 1332 bit isValidThread () { 1333 bit result = false; 1334 result = control.getDisplay ().getThread () == Thread.currentThread () ? true : false; 1335 return result; 1336 } 1337 1338 1322 1339 1323 1340 } branches/0.1/src/dwt/dwt.d
r17 r31 2567 2567 public static void error (int code, bit throwable) { 2568 2568 2569 2570 2571 2569 /* 2572 2570 * This code prevents the creation of "chains" of SWTErrors and … … 2648 2646 // error.throwable = throwable; 2649 2647 // throw error; 2650 2651 2652 2648 2653 2649 } branches/0.1/src/dwt/graphics/color.d
r17 r31 27 27 +/ 28 28 29 /** 30 * Instances of this class manage the operating system resources that 31 * implement DWT's RGB color model. To create a color you can either 32 * specify the individual color components as integers in the range 33 * 0 to 255 or provide an instance of an <code>RGB</code>. 34 * <p> 35 * Application code must explicitly invoke the <code>Color.dispose()</code> 36 * method to release the operating system resources managed by each instance 37 * when those instances are no longer required. 38 * </p> 39 * 40 * @see RGB 41 * @see Device#getSystemColor 42 */ 43 44 public final class Color { 45 29 46 private import dwt.dwt; 30 47 private import dwt.graphics.rgb; … … 32 49 private import dwt.internal.win32.os; 33 50 private import std.string; 34 35 36 /**37 * Instances of this class manage the operating system resources that38 * implement DWT's RGB color model. To create a color you can either39 * specify the individual color components as integers in the range40 * 0 to 255 or provide an instance of an <code>RGB</code>.41 * <p>42 * Application code must explicitly invoke the <code>Color.dispose()</code>43 * method to release the operating system resources managed by each instance44 * when those instances are no longer required.45 * </p>46 *47 * @see RGB48 * @see Device#getSystemColor49 */50 51 public final class Color {52 51 53 52 /** … … 167 166 public bit equals (Object object) { 168 167 if (object == this) return true; 169 // TODO: deal with instanceof if (!(object instanceof Color)) return false; 168 // if (!(object instanceof Color)) return false; 169 if (!(cast(Color)object)) return false; 170 170 Color color = cast(Color) object; 171 171 return device == color.device && (handle & 0xFFFFFF) == (color.handle & 0xFFFFFF); … … 326 326 public char[] toString () { 327 327 if (isDisposed()) return "Color {*DISPOSED*}"; //$NON-NLS-1$ 328 return "Color {" ~ .toString(getRed()) ~ ", " ~ .toString(getGreen()) ~ ", " ~ .toString(getBlue()) ~ "}"; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ 328 char[] redColor = std.string.toString(getRed()); 329 return "Color {" ~ redColor 330 ~ ", " ~ std.string.toString(getGreen()) ~ ", " 331 ~ std.string.toString(getBlue()) ~ "}"; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ 329 332 } 330 333 branches/0.1/src/dwt/graphics/cursor.d
r17 r31 56 56 57 57 public final class Cursor { 58 58 59 private import dwt.graphics.device; 60 private import dwt.graphics.imagedata; 61 private import dwt.graphics.image; 62 63 private import dwt.util.util; 64 private import std.string; 65 private import dwt.dwt; 66 private import dwt.internal.win32.os; 67 private import dwt.internal.win32.types; 68 59 69 /** 60 70 * the handle to the OS cursor resource … … 154 164 } 155 165 156 /+157 158 166 /** 159 167 * Constructs a new cursor given a device and a style … … 197 205 * @see SWT#CURSOR_HAND 198 206 */ 199 public Cursor(Device device, int style) {207 public this(Device device, int style) { 200 208 if (device == null) device = Device.getDevice(); 201 if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);209 if (device == null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 202 210 this.device = device; 203 211 int lpCursorName = 0; 204 212 switch (style) { 205 case SWT.CURSOR_HAND: lpCursorName = OS.IDC_HAND; break;206 case SWT.CURSOR_ARROW: lpCursorName = OS.IDC_ARROW; break;207 case SWT.CURSOR_WAIT: lpCursorName = OS.IDC_WAIT; break;208 case SWT.CURSOR_CROSS: lpCursorName = OS.IDC_CROSS; break;209 case SWT.CURSOR_APPSTARTING: lpCursorName = OS.IDC_APPSTARTING; break;210 case SWT.CURSOR_HELP: lpCursorName = OS.IDC_HELP; break;211 case SWT.CURSOR_SIZEALL: lpCursorName = OS.IDC_SIZEALL; break;212 case SWT.CURSOR_SIZENESW: lpCursorName = OS.IDC_SIZENESW; break;213 case SWT.CURSOR_SIZENS: lpCursorName = OS.IDC_SIZENS; break;214 case SWT.CURSOR_SIZENWSE: lpCursorName = OS.IDC_SIZENWSE; break;215 case SWT.CURSOR_SIZEWE: lpCursorName = OS.IDC_SIZEWE; break;216 case SWT.CURSOR_SIZEN: lpCursorName = OS.IDC_SIZENS; break;217 case SWT.CURSOR_SIZES: lpCursorName = OS.IDC_SIZENS; break;218 case SWT.CURSOR_SIZEE: lpCursorName = OS.IDC_SIZEWE; break;219 case SWT.CURSOR_SIZEW: lpCursorName = OS.IDC_SIZEWE; break;220 case SWT.CURSOR_SIZENE: lpCursorName = OS.IDC_SIZENESW; break;221 case SWT.CURSOR_SIZESE: lpCursorName = OS.IDC_SIZENWSE; break;222 case SWT.CURSOR_SIZESW: lpCursorName = OS.IDC_SIZENESW; break;223 case SWT.CURSOR_SIZENW: lpCursorName = OS.IDC_SIZENWSE; break;224 case SWT.CURSOR_UPARROW: lpCursorName = OS.IDC_UPARROW; break;225 case SWT.CURSOR_IBEAM: lpCursorName = OS.IDC_IBEAM; break;226 case SWT.CURSOR_NO: lpCursorName = OS.IDC_NO; break;213 case DWT.CURSOR_HAND: lpCursorName = OS.IDC_HAND; break; 214 case DWT.CURSOR_ARROW: lpCursorName = OS.IDC_ARROW; break; 215 case DWT.CURSOR_WAIT: lpCursorName = OS.IDC_WAIT; break; 216 case DWT.CURSOR_CROSS: lpCursorName = OS.IDC_CROSS; break; 217 case DWT.CURSOR_APPSTARTING: lpCursorName = OS.IDC_APPSTARTING; break; 218 case DWT.CURSOR_HELP: lpCursorName = OS.IDC_HELP; break; 219 case DWT.CURSOR_SIZEALL: lpCursorName = OS.IDC_SIZEALL; break; 220 case DWT.CURSOR_SIZENESW: lpCursorName = OS.IDC_SIZENESW; break; 221 case DWT.CURSOR_SIZENS: lpCursorName = OS.IDC_SIZENS; break; 222 case DWT.CURSOR_SIZENWSE: lpCursorName = OS.IDC_SIZENWSE; break; 223 case DWT.CURSOR_SIZEWE: lpCursorName = OS.IDC_SIZEWE; break; 224 case DWT.CURSOR_SIZEN: lpCursorName = OS.IDC_SIZENS; break; 225 case DWT.CURSOR_SIZES: lpCursorName = OS.IDC_SIZENS; break; 226 case DWT.CURSOR_SIZEE: lpCursorName = OS.IDC_SIZEWE; break; 227 case DWT.CURSOR_SIZEW: lpCursorName = OS.IDC_SIZEWE; break; 228 case DWT.CURSOR_SIZENE: lpCursorName = OS.IDC_SIZENESW; break; 229 case DWT.CURSOR_SIZESE: lpCursorName = OS.IDC_SIZENWSE; break; 230 case DWT.CURSOR_SIZESW: lpCursorName = OS.IDC_SIZENESW; break; 231 case DWT.CURSOR_SIZENW: lpCursorName = OS.IDC_SIZENWSE; break; 232 case DWT.CURSOR_UPARROW: lpCursorName = OS.IDC_UPARROW; break; 233 case DWT.CURSOR_IBEAM: lpCursorName = OS.IDC_IBEAM; break; 234 case DWT.CURSOR_NO: lpCursorName = OS.IDC_NO; break; 227 235 default: 228 SWT.error(SWT.ERROR_INVALID_ARGUMENT);236 DWT.error(DWT.ERROR_INVALID_ARGUMENT); 229 237 } 230 238 handle = OS.LoadCursor(0, lpCursorName); … … 233 241 * Create a hand cursor if running in other Windows platforms. 234 242 */ 235 if (handle == 0 && style == SWT.CURSOR_HAND) {243 if (handle == 0 && style == DWT.CURSOR_HAND) { 236 244 int width = OS.GetSystemMetrics(OS.SM_CXCURSOR); 237 245 int height = OS.GetSystemMetrics(OS.SM_CYCURSOR); 238 246 if (width == 32 && height == 32) { 239 247 int hInst = OS.GetModuleHandle(null); 240 if (OS.IsWinCE) SWT.error(SWT.ERROR_NOT_IMPLEMENTED);241 handle = OS.CreateCursor(hInst, 5, 0, 32, 32, HAND_SOURCE,HAND_MASK);248 if (OS.IsWinCE) DWT.error(DWT.ERROR_NOT_IMPLEMENTED); 249 handle = OS.CreateCursor(hInst, 5, 0, 32, 32, &HAND_SOURCE, &HAND_MASK); 242 250 243 251 } 244 252 } 245 if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);253 if (handle == 0) DWT.error(DWT.ERROR_NO_HANDLES); 246 254 if (device.tracking) device.new_Object(this); 247 255 } … … 279 287 * </ul> 280 288 */ 281 public Cursor(Device device, ImageData source, ImageData mask, int hotspotX, int hotspotY) {289 public this(Device device, ImageData source, ImageData mask, int hotspotX, int hotspotY) { 282 290 if (device == null) device = Device.getDevice(); 283 if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);291 if (device == null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 284 292 this.device = device; 285 if (source == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);293 if (source == null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 286 294 if (mask == null) { 287 if (source.getTransparencyType() != SWT.TRANSPARENCY_MASK) {288 SWT.error(SWT.ERROR_NULL_ARGUMENT);295 if (source.getTransparencyType() != DWT.TRANSPARENCY_MASK) { 296 DWT.error(DWT.ERROR_NULL_ARGUMENT); 289 297 } 290 298 mask = source.getTransparencyMask(); … … 292 300 /* Check the bounds. Mask must be the same size as source */ 293 301 if (mask.width != source.width || mask.height != source.height) { 294 SWT.error(SWT.ERROR_INVALID_ARGUMENT);302 DWT.error(DWT.ERROR_INVALID_ARGUMENT); 295 303 } 296 304 /* Check color depths */ 297 if (mask.depth != 1) SWT.error(SWT.ERROR_INVALID_ARGUMENT);298 if (source.depth != 1) SWT.error(SWT.ERROR_INVALID_ARGUMENT);305 if (mask.depth != 1) DWT.error(DWT.ERROR_INVALID_ARGUMENT); 306 if (source.depth != 1) DWT.error(DWT.ERROR_INVALID_ARGUMENT); 299 307 /* Check the hotspots */ 300 308 if (hotspotX >= source.width || hotspotX < 0 || 301 309 hotspotY >= source.height || hotspotY < 0) { 302 SWT.error(SWT.ERROR_INVALID_ARGUMENT);310 DWT.error(DWT.ERROR_INVALID_ARGUMENT); 303 311 } 304 312 /* Create the cursor */ 305 313 int hInst = OS.GetModuleHandle(null); 306 if (OS.IsWinCE) SWT.error (SWT.ERROR_NOT_IMPLEMENTED);307 handle = OS.CreateCursor(hInst, hotspotX, hotspotY, source.width, source.height, source.data,mask.data);308 if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);314 if (OS.IsWinCE) DWT.error(DWT.ERROR_NOT_IMPLEMENTED); 315 handle = OS.CreateCursor(hInst, hotspotX, hotspotY, source.width, source.height, &source.data, &mask.data); 316 if (handle == 0) DWT.error(DWT.ERROR_NO_HANDLES); 309 317 if (device.tracking) device.new_Object(this); 310 318 } … … 337 345 * @since 3.0 338 346 */ 339 public Cursor(Device device, ImageData source, int hotspotX, int hotspotY) {347 public this(Device device, ImageData source, int hotspotX, int hotspotY) { 340 348 if (device == null) device = Device.getDevice(); 341 if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);349 if (device == null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 342 350 this.device = device; 343 if (source == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);351 if (source == null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 344 352 /* Check the hotspots */ 345 353 if (hotspotX >= source.width || hotspotX < 0 || 346 354 hotspotY >= source.height || hotspotY < 0) { 347 SWT.error(SWT.ERROR_INVALID_ARGUMENT);355 DWT.error(DWT.ERROR_INVALID_ARGUMENT); 348 356 } 349 357 ImageData mask = source.getTransparencyMask(); … … 352 360 int hMask = result[1]; 353 361 /* Create the icon */ 354 ICONINFO info = new ICONINFO();362 ICONINFO info; 355 363 info.fIcon = true; 356 364 info.hbmColor = hBitmap; 357 365 info.hbmMask = hMask; 358 handle = OS.CreateIconIndirect( info);359 if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);366 handle = OS.CreateIconIndirect(&info); 367 if (handle == 0) DWT.error(DWT.ERROR_NO_HANDLES); 360 368 OS.DeleteObject(hBitmap); 361 369 OS.DeleteObject(hMask); … … 414 422 * @see #hashCode 415 423 */ 416 public b ooleanequals (Object object) {424 public bit equals (Object object) { 417 425 if (object == this) return true; 418 if (!(object instanceof Cursor)) return false; 419 Cursor cursor = (Cursor) object; 426 if (!(cast(Cursor)object)) 427 return false; 428 Cursor cursor = cast(Cursor)object; 420 429 return device == cursor.device && handle == cursor.handle; 421 430 } … … 445 454 * @return <code>true</code> when the cursor is disposed and <code>false</code> otherwise 446 455 */ 447 public b ooleanisDisposed() {456 public bit isDisposed() { 448 457 return handle == 0; 449 458 } … … 455 464 * @return a string representation of the receiver 456 465 */ 457 public String toString() {466 public char[] toString() { 458 467 if (isDisposed()) return "Cursor {*DISPOSED*}"; 459 return "Cursor {" + handle +"}";468 return "Cursor {" ~ std.string.toString(handle) ~ "}"; 460 469 } 461 470 … … 481 490 } 482 491 483 +/ 484 485 } 492 } branches/0.1/src/dwt/graphics/device.d
r24 r31 62 62 63 63 import dwt.util.runnable; 64 import dwt.util.system; 64 65 } 65 66 … … 491 492 */ 492 493 if (OS.IsUnicode) { 493 OS.EnumFontFamiliesW (hDC, ( (LOGFONTW)lf).lfFaceName, lpEnumFontFamProc, scalable ? 1 : 0);494 OS.EnumFontFamiliesW (hDC, (cast(LOGFONTW)lf).lfFaceName, lpEnumFontFamProc, scalable ? 1 : 0); 494 495 } else { 495 OS.EnumFontFamiliesA (hDC, ( (LOGFONTA)lf).lfFaceName, lpEnumFontFamProc, scalable ? 1 : 0);496 OS.EnumFontFamiliesA (hDC, (cast(LOGFONTA)lf).lfFaceName, lpEnumFontFamProc, scalable ? 1 : 0); 496 497 } 497 498 +/ … … 753 754 } 754 755 Object [] newObjects = new Object [objects.length + 128]; 755 // TODO:System.arraycopy (objects, 0, newObjects, 0, objects.length);756 System.arraycopy (objects, 0, newObjects, 0, objects.length); 756 757 newObjects [objects.length] = object; 757 758 objects = newObjects; 758 759 Error [] newErrors = new Error [errors.length + 128]; 759 // TODO:System.arraycopy (errors, 0, newErrors, 0, errors.length);760 System.arraycopy (errors, 0, newErrors, 0, errors.length); 760 761 newErrors [errors.length] = new Error ("Same here"); 761 762 errors = newErrors; branches/0.1/src/dwt/graphics/font.d
r17 r31 32 32 private import dwt.internal.win32.os; 33 33 private import dwt.internal.win32.types; 34 private import std.string;34 //private import std.string; 35 35 36 36 … … 180 180 public bit equals(Object object) { 181 181 if (object == this) return true; 182 // TODO: instanceofif (!(object instanceof Font)) return false;182 // if (!(object instanceof Font)) return false; 183 183 Font font = cast(Font) object; 184 184 return device == font.device && handle == font.handle; … … 256 256 public char[] toString () { 257 257 if (isDisposed()) return "Font {*DISPOSED*}"; 258 return "Font {" ~ .toString(handle) ~ "}";258 return "Font {" ~ std.string.toString(handle) ~ "}"; 259 259 } 260 260 branches/0.1/src/dwt/graphics/fontdata.d
r17 r31 37 37 38 38 private import dwt.util.string; 39 //private import dwt.util.util; 39 40 40 41 private import std.string; 42 private import std.utf; 41 43 42 44 … … 279 281 public bit equals (Object object) { 280 282 if (object == this) return true; 281 // TODO: instanceof if (!(object instanceof FontData)) return false; 283 // if (!(object instanceof FontData)) return false; 284 if (!(cast(FontData)object)) return false; 282 285 FontData fd = cast(FontData)object; 283 286 LOGFONT* lf = fd.data; … … 588 591 */ 589 592 public char[] toString() { 590 /*// TODO: StringBuffer buffer = new StringBuffer(); 591 buffer.append("1|"); 592 buffer.append(getName()); 593 buffer.append("|"); 594 buffer.append(getHeight()); 595 buffer.append("|"); 596 buffer.append(getStyle()); 597 buffer.append("|"); 598 buffer.append("WINDOWS|1|"); 599 buffer.append(data.lfHeight); 600 buffer.append("|"); 601 buffer.append(data.lfWidth); 602 buffer.append("|"); 603 buffer.append(data.lfEscapement); 604 buffer.append("|"); 605 buffer.append(data.lfOrientation); 606 buffer.append("|"); 607 buffer.append(data.lfWeight); 608 buffer.append("|"); 609 buffer.append(data.lfItalic); 610 buffer.append("|"); 611 buffer.append(data.lfUnderline); 612 buffer.append("|"); 613 buffer.append(data.lfStrikeOut); 614 buffer.append("|"); 615 buffer.append(data.lfCharSet); 616 buffer.append("|"); 617 buffer.append(data.lfOutPrecision); 618 buffer.append("|"); 619 buffer.append(data.lfClipPrecision); 620 buffer.append("|"); 621 buffer.append(data.lfQuality); 622 buffer.append("|"); 623 buffer.append(data.lfPitchAndFamily); 624 buffer.append("|"); 625 buffer.append(getName()); 626 return buffer.toString();*/ 627 return "FontData blaaaaaah. TODO: replace me with something useful."; 593 char[] fontDescription = "1|" ~ std.utf.toUTF8(getName()) ~ "|" 594 ~ .toString(getHeight()) ~ "|" 595 ~ .toString(getStyle()) ~ "|" ~ "WINDOWS|1|" 596 ~ .toString(data.lfHeight) ~ "|" 597 ~ .toString(data.lfWidth) ~ "|" 598 ~ .toString(data.lfEscapement) ~ "|" 599 ~ .toString(data.lfOrientation) ~ "|" 600 ~ .toString(data.lfWeight) ~ "|" 601 ~ .toString(data.lfItalic) ~ "|" 602 ~ .toString(data.lfUnderline) ~ "|" 603 ~ .toString(data.lfStrikeOut) ~ "|" 604 ~ .toString(data.lfCharSet) ~ "|" 605 ~ .toString(data.lfOutPrecision) ~ "|" 606 ~ .toString(data.lfClipPrecision) ~ "|" 607 ~ .toString(data.lfQuality) ~ "|" 608 ~ .toString(data.lfPitchAndFamily) ~ "|" 609 ~ .toUTF8(getName()); 610 return fontDescription; 628 611 } 629 612 branches/0.1/src/dwt/graphics/gc.d
r27 r31 53 53 import dwt.util.util; 54 54 55 import std.math;56 import std.string;55 // import std.math; 56 // import std.string; 57 57 } 58 58 … … 1492 1492 return false; 1493 1493 return handle == gc.handle; 1494 //return (object === this); /+ TODO: instanceof || ((object instanceof GC) && (handle == ((GC)object).handle)) +/ ; 1494 // TODO: original code was 1495 //return (object == this) || ((object instanceof GC) && (handle == ((GC)object).handle)); 1495 1496 } 1496 1497 … … 2560 2561 public char[] toString () { 2561 2562 if (isDisposed()) return "GC {*DISPOSED*}"; 2562 return "GC {" ~ .toString(handle) ~ "}";2563 return "GC {" ~ std.string.toString(handle) ~ "}"; 2563 2564 } 2564 2565 branches/0.1/src/dwt/graphics/image.d
r27 r31 44 44 import dwt.internal.win32.types; 45 45 46 import std.string;46 // import std.string; 47 47 } 48 48 … … 911 911 public bit equals (Object object) { 912 912 if (object == this) return true; 913 // TODO: if (!(object instanceof Image)) return false;914 913 Image image = cast(Image)object; 914 if (!image) return false; 915 915 return device == image.device && handle == image.handle; 916 916 } … … 1963 1963 public char[] toString () { 1964 1964 if (isDisposed()) return "Image {*DISPOSED*}"; 1965 return "Image {" ~ .toString(handle) ~ "}";1965 return "Image {" ~ std.string.toString(handle) ~ "}"; 1966 1966 } 1967 1967 branches/0.1/src/dwt/graphics/imagedata.d
r17 r31 27 27 import org.eclipse.swt.internal.CloneableCompatibility; 28 28 +/ 29 30 private 31 { 32 import dwt.dwt; 33 import dwt.graphics.rgb; 34 import dwt.graphics.device; 35 import dwt.graphics.gc; 36 import dwt.graphics.palettedata; 37 import dwt.graphics.image; 38 import dwt.graphics.imageloader; 39 import dwt.internal.cloneablecompatibility; 40 41 import std.stream; 42 } 29 private import dwt.internal.cloneablecompatibility; 43 30 44 31 /** … … 60 47 public class ImageData : CloneableCompatibility { 61 48 49 private 50 { 51 import dwt.dwt; 52 import dwt.graphics.rgb; 53 import dwt.graphics.device; 54 import dwt.graphics.gc; 55 import dwt.graphics.palettedata; 56 import dwt.graphics.image; 57 import dwt.graphics.imageloader; 58 import std.stream; 59 } 62 60 /** 63 61 * The width of the image, in pixels. branches/0.1/src/dwt/graphics/imageloader.d
r17 r31 21 21 module dwt.graphics.imageloader; 22 22 23 private24 {25 import dwt.dwt;26 27 import dwt.internal.compatibility;28 29 import dwt.graphics.imagedata;30 31 import std.stream;32 }33 34 23 /** 35 24 * Instances of this class are used to load images from, … … 55 44 56 45 public class ImageLoader { 46 47 private 48 { 49 import dwt.dwt; 50 import dwt.internal.compatibility; 51 import dwt.graphics.imagedata; 52 import std.stream; 53 } 57 54 58 55 /** branches/0.1/src/dwt/graphics/point.d
r17 r31 25 25 // import org.eclipse.swt.internal.SerializableCompatibility; 26 26 27 private import dwt.util.util;28 29 27 /** 30 28 * Instances of this class represent places on the (x, y) … … 47 45 public final class Point /* implements SerializableCompatibility */ { 48 46 47 private import dwt.util.util; 48 private import std.string; 49 49 50 /** 50 51 * the x coordinate of the point … … 114 115 115 116 /+ TODO: compiler complains: 'dwt\graphics\point.d(97): function toString overrides but is not covariant with toString' +/ 116 /* 117 public String toString () { 118 return "Point {" + x + ", " + y + "}"; 117 public char[] toString () { 118 char[] pointDescription = "Point {"; // TODO: <Blandger> DMD complains, why?? 119 //~ .toString(x) ~ ", " ~ .toString(y) ~ "}"; 120 return pointDescription; 119 121 } 120 */121 122 122 123 } branches/0.1/src/dwt/graphics/rectangle.d
r17 r31 25 25 // import dwt.*; 26 26 27 private import dwt.dwt;28 private import dwt.graphics.point;29 30 27 /** 31 28 * Instances of this class represent rectangular areas in an … … 50 47 public final class Rectangle /* : SerializableCompatibility */ { 51 48 49 private import dwt.dwt; 50 private import dwt.graphics.point; 51 52 private import std.string; 53 52 54 /** 53 55 * the x coordinate of the rectangle … … 316 318 * @return a string representation of the rectangle 317 319 */ 318 /* public String toString () { 319 return "Rectangle {" + x + ", " + y + ", " + width + ", " + height + "}"; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ 320 }*/ 320 public char[] toString () { 321 char[] description = "Rectangle {"; // TODO: <Blandger> DMD complains, why? 322 // ~ .toString(x) ~ ", " ~ .toString(y) 323 // ~ ", " ~ .toString(width) ~ ", " ~ .toString(height) ~ "}"; 324 return description; 325 } 321 326 322 327 /** branches/0.1/src/dwt/graphics/region.d
r17 r31 38 38 import dwt.internal.win32.types; 39 39 40 import dwt.util.string;40 // import dwt.util.string; 41 41 42 42 } … … 251 251 public bit equals (Object object) { 252 252 if (this == object) return true; 253 // TODO: if (!(object instanceof Region)) return false; 253 // if (!(object instanceof Region)) return false; 254 if (!cast(Region)object) return false; 254 255 Region rgn = cast(Region)object; 255 256 return handle == rgn.handle; branches/0.1/src/dwt/graphics/rgb.d
r17 r31 128 128 */ 129 129 public char[] toString () { 130
