Mercurial > projects > dwt-win
comparison dwt/graphics/Device.d @ 212:ab60f3309436
reverted the char[] to String and use the an alias.
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 05 May 2008 00:12:38 +0200 |
parents | 184ab53b7785 |
children | 36f5cb12e1a2 |
comparison
equal
deleted
inserted
replaced
211:ff59aeb96cac | 212:ab60f3309436 |
---|---|
455 * | 455 * |
456 * @exception DWTException <ul> | 456 * @exception DWTException <ul> |
457 * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> | 457 * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> |
458 * </ul> | 458 * </ul> |
459 */ | 459 */ |
460 public FontData [] getFontList (char[] faceName, bool scalable) { | 460 public FontData [] getFontList (String faceName, bool scalable) { |
461 checkDevice (); | 461 checkDevice (); |
462 | 462 |
463 /* Create the callback */ | 463 /* Create the callback */ |
464 CallbackData cbdata; | 464 CallbackData cbdata; |
465 cbdata.device = this; | 465 cbdata.device = this; |
536 pixels = null; | 536 pixels = null; |
537 metrics = TEXTMETRIC.init; | 537 metrics = TEXTMETRIC.init; |
538 return result; | 538 return result; |
539 } | 539 } |
540 | 540 |
541 char[] getLastError () { | 541 String getLastError () { |
542 int error = OS.GetLastError(); | 542 int error = OS.GetLastError(); |
543 if (error is 0) return ""; //$NON-NLS-1$ | 543 if (error is 0) return ""; //$NON-NLS-1$ |
544 return " [GetLastError=0x" ~ .toHex(error) ~ "]"; //$NON-NLS-1$ //$NON-NLS-2$ | 544 return " [GetLastError=0x" ~ .toHex(error) ~ "]"; //$NON-NLS-1$ //$NON-NLS-2$ |
545 } | 545 } |
546 | 546 |
547 char[] getLastErrorText () { | 547 String getLastErrorText () { |
548 int error = OS.GetLastError(); | 548 int error = OS.GetLastError(); |
549 if (error is 0) return ""; //$NON-NLS-1$ | 549 if (error is 0) return ""; //$NON-NLS-1$ |
550 TCHAR* buffer = null; | 550 TCHAR* buffer = null; |
551 int dwFlags = OS.FORMAT_MESSAGE_ALLOCATE_BUFFER | OS.FORMAT_MESSAGE_FROM_SYSTEM | OS.FORMAT_MESSAGE_IGNORE_INSERTS; | 551 int dwFlags = OS.FORMAT_MESSAGE_ALLOCATE_BUFFER | OS.FORMAT_MESSAGE_FROM_SYSTEM | OS.FORMAT_MESSAGE_IGNORE_INSERTS; |
552 int length = OS.FormatMessage(dwFlags, null, error, OS.LANG_USER_DEFAULT, cast(TCHAR*)&buffer, 0, null); | 552 int length = OS.FormatMessage(dwFlags, null, error, OS.LANG_USER_DEFAULT, cast(TCHAR*)&buffer, 0, null); |
553 char[] errorNum = ("[GetLastError=") ~ .toHex(error) ~ "] "; | 553 String errorNum = ("[GetLastError=") ~ .toHex(error) ~ "] "; |
554 if (length == 0) return errorNum; | 554 if (length == 0) return errorNum; |
555 char[] buffer1 = .TCHARzToStr(buffer, length); | 555 String buffer1 = .TCHARzToStr(buffer, length); |
556 if ( *buffer != 0) | 556 if ( *buffer != 0) |
557 OS.LocalFree(cast(HLOCAL)buffer); | 557 OS.LocalFree(cast(HLOCAL)buffer); |
558 return errorNum ~ buffer1; | 558 return errorNum ~ buffer1; |
559 } | 559 } |
560 | 560 |
789 * | 789 * |
790 * @see Font | 790 * @see Font |
791 * | 791 * |
792 * @since 3.3 | 792 * @since 3.3 |
793 */ | 793 */ |
794 public bool loadFont (char[] path) { | 794 public bool loadFont (String path) { |
795 checkDevice(); | 795 checkDevice(); |
796 if (path is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); | 796 if (path is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); |
797 if (OS.IsWinNT && OS.WIN32_VERSION >= OS.VERSION (4, 10)) { | 797 if (OS.IsWinNT && OS.WIN32_VERSION >= OS.VERSION (4, 10)) { |
798 //TCHAR lpszFilename = new TCHAR (0, path, true); | 798 //TCHAR lpszFilename = new TCHAR (0, path, true); |
799 return OS.AddFontResourceEx ( .StrToTCHARz(path), OS.FR_PRIVATE, null) !is 0; | 799 return OS.AddFontResourceEx ( .StrToTCHARz(path), OS.FR_PRIVATE, null) !is 0; |