Changeset 28
- Timestamp:
- 07/02/04 03:52:16 (4 years ago)
- Files:
-
- branches/0.1/makefile (deleted)
- branches/0.1/src/dwt/internal/win32/os.d (modified) (1 diff)
- branches/0.1/src/dwt/internal/win32/tchar.d (modified) (4 diffs)
- branches/0.1/src/dwt/internal/win32/types.d (modified) (7 diffs)
- branches/0.1/src/dwt/util/util.d (modified) (2 diffs)
- branches/0.1/src/dwt/widgets/button.d (modified) (9 diffs)
- branches/0.1/src/dwt/widgets/canvas.d (modified) (6 diffs)
- branches/0.1/src/dwt/widgets/composite.d (modified) (41 diffs)
- branches/0.1/src/dwt/widgets/control.d (modified) (1 diff)
- branches/0.1/src/dwt/widgets/display.d (modified) (12 diffs)
- branches/0.1/src/dwt/widgets/event.d (modified) (2 diffs)
- branches/0.1/src/dwt/widgets/layout.d (modified) (2 diffs)
- branches/0.1/src/dwt/widgets/shell.d (modified) (1 diff)
- branches/0.1/src/dwt/widgets/widget.d (modified) (2 diffs)
- branches/0.1/src/makefile (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/0.1/src/dwt/internal/win32/os.d
r27 r28 1392 1392 static int CreateFontIndirect (int lplf) { 1393 1393 if (IsUnicode) 1394 return CreateFontIndirectW (cast(LOGFONTW*)lplf);1395 else1396 return CreateFontIndirectA (cast(LOGFONTA*)lplf);1397 } 1398 1399 static staticint CreateFontIndirect (LOGFONT* lplf) {1394 return CreateFontIndirectW (cast(LOGFONTW*)lplf); 1395 else 1396 return CreateFontIndirectA (cast(LOGFONTA*)lplf); 1397 } 1398 1399 static int CreateFontIndirect (LOGFONT* lplf) { 1400 1400 if (IsUnicode) 1401 return CreateFontIndirectW (cast(LOGFONTW*)lplf);1402 else1403 return CreateFontIndirectA (cast(LOGFONTA*)lplf);1401 return CreateFontIndirectW (cast(LOGFONTW*)lplf); 1402 else 1403 return CreateFontIndirectA (cast(LOGFONTA*)lplf); 1404 1404 } 1405 1405 branches/0.1/src/dwt/internal/win32/tchar.d
r17 r28 27 27 28 28 import dwt.internal.win32.os; 29 30 import dwt.util.system; 29 31 } 30 32 … … 57 59 } 58 60 59 60 /+61 + 2004.5.23 BSA62 + added these two constructors for playing with String being aliased to char[]63 + instead of Andy's work with aliasing wchar[]64 +/65 66 /+ (then I commented it out)67 public this(int codePage, char ch, bit terminate) {68 char[1] bleh;69 bleh[0] = ch;70 this (codePage, bleh, terminate);71 }72 73 public this(int codePage, char[] string, bit terminate) {74 this.codePage = codePage;75 // if (OS.IsUnicode) {76 // this.chars = string;77 // } else {78 int cp = codePage != 0 ? codePage : OS.CP_ACP;79 bytes = new char [byteCount = charCount * 2 + (terminate ? 1 : 0)];80 byteCount = OS.WideCharToMultiByte (cp, 0, string, string.length, bytes, byteCount, null, null);81 if (terminate) byteCount++;82 // }83 }84 +/85 61 86 62 … … 142 118 } 143 119 144 public wchar[] toStringw(int start, int length) { 120 public wchar[] toString( int start, int length ) { 121 return toStringw( start, length ); 122 } 123 124 public wchar[] toStringw( int start, int length ) { 145 125 if (OS.IsUnicode) { 146 126 //return new wchar[] (chars, start, length); … … 150 130 if (start != 0) { 151 131 bytes = new char [length]; 152 // TODO: in D 153 //System.arraycopy (this.bytes, start, bytes, 0, length); 132 System.arraycopy (this.bytes, start, bytes, 0, length); 154 133 bytes[] = this.bytes; // done. (D is cool) 155 134 } branches/0.1/src/dwt/internal/win32/types.d
r27 r28 21 21 module dwt.internal.win32.types; 22 22 23 version = Unicode;23 //version = Unicode; 24 24 25 25 /* … … 108 108 } 109 109 110 110 struct INITCOMMONCONTROLSEX { 111 int dwSize; 112 int dwICC; 113 } 114 115 struct LOGBRUSH { 111 116 int lbStyle; 112 117 int lbColor; … … 501 506 } 502 507 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 508 struct LOGFONTA { 522 509 int lfHeight; … … 557 544 } 558 545 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 546 // Yay D for not sucking 599 547 alias int LRESULT; … … 662 610 } 663 611 664 /+ With doing the version and alias for LOGFONT, the same thing is not necessary with this struct, as it can now 665 just use LOGFONT. See below the aliases and the A and W (after the end of this comment). 666 version(Unicode) { 667 alias NONCLIENTMETRICSW NONCLIENTMETRICS; 668 } else { 669 alias NONCLIENTMETRICSW NONCLIENTMETRICS; 670 } 671 672 struct NONCLIENTMETRICSA { 673 int cbSize; 674 int iBorderWidth; 675 int iScrollWidth; 676 int iScrollHeight; 677 int iCaptionWidth; 678 int iCaptionHeight; 679 int iSmCaptionWidth; 680 int iSmCaptionHeight; 681 int iMenuWidth; 682 int iMenuHeight; 683 LOGFONTA lfCaptionFont; 684 LOGFONTA lfSmCaptionFont; 685 LOGFONTA lfMenuFont; 686 LOGFONTA lfStatusFont; 687 LOGFONTA lfMessageFont; 688 } 689 690 struct NONCLIENTMETRICSW { 691 int cbSize; 692 int iBorderWidth; 693 int iScrollWidth; 694 int iScrollHeight; 695 int iCaptionWidth; 696 int iCaptionHeight; 697 int iSmCaptionWidth; 698 int iSmCaptionHeight; 699 int iMenuWidth; 700 int iMenuHeight; 701 LOGFONTW lfCaptionFont; 702 LOGFONTW lfSmCaptionFont; 703 LOGFONTW lfMenuFont; 704 LOGFONTW lfStatusFont; 705 LOGFONTW lfMessageFont; 706 } 707 +/ 612 // With doing the version and alias for LOGFONT, the same thing is not necessary with this struct, as it can now 613 // just use LOGFONT. 708 614 709 615 struct NONCLIENTMETRICS { … … 725 631 } 726 632 633 // the code still uses these in places 634 alias NONCLIENTMETRICS NONCLIENTMETRICSA; 635 alias NONCLIENTMETRICS NONCLIENTMETRICSW; 636 727 637 struct OSVERSIONINFO { 728 638 int dwOSVersionInfoSize; … … 783 693 } 784 694 785 786 struct TEXTMETRIC { 787 int tmHeight; 788 int tmAscent; 789 int tmDescent; 790 int tmInternalLeading; 791 int tmExternalLeading; 792 int tmAveCharWidth; 793 int tmMaxCharWidth; 794 int tmWeight; 795 int tmOverhang; 796 int tmDigitizedAspectX; 797 int tmDigitizedAspectY; 798 byte tmItalic; 799 byte tmUnderlined; 800 byte tmStruckOut; 801 byte tmPitchAndFamily; 802 byte tmCharSet; 695 version(Unicode) { 696 alias TEXTMETRICW TEXTMETRIC; 697 } else { 698 alias TEXTMETRICA TEXTMETRIC; 803 699 } 804 700 branches/0.1/src/dwt/util/util.d
r17 r28 21 21 module dwt.internal.util.util; 22 22 23 23 24 int abs(int x) { 24 25 return x > 0 ? x : -x; … … 26 27 27 28 int min(int a, int b) { 28 return a > b ? b : a; 29 return a >= b ? b : a; 30 } 31 32 double max(double a, double b) { 33 // Returns the greater of two double values. 34 return a >= b ? a : b; 35 } 36 37 float max(float a, float b) { 38 // Returns the greater of two float values. 39 return a >= b ? a : b; 29 40 } 30 41 31 42 int max(int a, int b) { 32 return a > b ? a : b; 43 // Returns the greater of two int values. 44 return a >= b ? a : b; 45 } 46 47 long max(long a, long b) { 48 // Returns the greater of two long values. 49 return a >= b ? a : b; 50 } 51 52 bool toUpperCase (char c) { 53 if ('a' <= c && c <= 'z') { 54 return c - (cast(char)'a' - 'A'); 55 } else { 56 return c; 57 } 58 33 59 } 34 60 branches/0.1/src/dwt/widgets/button.d
r25 r28 22 22 module dwt.widgets.button; 23 23 24 private import dwt.widgets.control; 24 private import dwt.util.util; 25 26 private import dwt.widgets.control; 25 27 26 28 … … 211 213 if (newFont != 0) oldFont = OS.SelectObject (hDC, newFont); 212 214 215 // TEXTMETRIC lptm = OS.IsUnicode ? new TEXTMETRICW () : new TEXTMETRICA (); 216 217 /+ D: try 1 213 218 if (OS.IsUnicode) 214 219 TEXTMETRIC lptm = new TEXTMETRICW(); 215 220 else 216 221 TEXTMETRIC lptm = new TEXTMETRICA(); 217 218 // TEXTMETRIC lptm = OS.IsUnicode ? new TEXTMETRICW () : new TEXTMETRICA ();219 OS.GetTextMetrics (hDC, lptm);222 +/ 223 TEXTMETRIC lptm; 224 OS.GetTextMetrics (hDC, &lptm); 220 225 int length = OS.GetWindowTextLength (handle); 221 226 if (length == 0) { 222 227 height += lptm.tmHeight; 223 228 } else { 224 extra = Math.max (8, lptm.tmAveCharWidth);229 extra = max (8, lptm.tmAveCharWidth); 225 230 TCHAR buffer = new TCHAR (getCodePage (), length + 1); 226 231 OS.GetWindowText (handle, buffer, length + 1); 227 RECT rect = new RECT ();232 RECT rect; 228 233 int flags = OS.DT_CALCRECT | OS.DT_SINGLELINE; 229 OS.DrawText (hDC, buffer, length, rect, flags);234 OS.DrawText (hDC, buffer, length, &rect, flags); 230 235 width += rect.right - rect.left; 231 236 height += rect.bottom - rect.top; … … 243 248 if ((style & (DWT.CHECK | DWT.RADIO)) != 0) { 244 249 width += CheckWidth + extra; 245 height = Math.max (height, CheckHeight + 3);250 height = max (height, CheckHeight + 3); 246 251 } 247 252 if ((style & (DWT.PUSH | DWT.TOGGLE)) != 0) { … … 388 393 char mnemonic = findMnemonic (getText ()); 389 394 if (mnemonic == '\0') return false; 390 return Character.toUpperCase (key) == Character.toUpperCase(mnemonic);395 return toUpperCase(key) == toUpperCase(mnemonic); 391 396 } 392 397 … … 559 564 if (getSelection () != value) { 560 565 setSelection (value); 566 /+ TODO: delegates? 561 567 postEvent (DWT.Selection); 568 +/ 562 569 } 563 570 return true; … … 677 684 LRESULT WM_GETDLGCODE (int wParam, int lParam) { 678 685 LRESULT result = super.WM_GETDLGCODE (wParam, lParam); 679 if ( result != null) return result;686 if (cast(void*)result != null) return result; 680 687 if ((style & DWT.ARROW) != 0) { 681 return new LRESULT (OS.DLGC_STATIC);688 return OS.DLGC_STATIC; // took out 'new' 682 689 } 683 690 return result; … … 729 736 } 730 737 } 738 /+ TODO: delegates? 731 739 postEvent (DWT.Selection); 740 +/ 732 741 } 733 742 return super.wmCommandChild (wParam, lParam); … … 736 745 LRESULT wmDrawChild (int wParam, int lParam) { 737 746 if ((style & DWT.ARROW) == 0) return super.wmDrawChild (wParam, lParam); 738 DRAWITEMSTRUCT distruct = new DRAWITEMSTRUCT ();747 DRAWITEMSTRUCT distruct; 739 748 OS.MoveMemory (distruct, lParam, DRAWITEMSTRUCT.sizeof); 740 749 int uState = OS.DFCS_SCROLLLEFT; … … 748 757 if ((style & DWT.FLAT) == DWT.FLAT) uState |= OS.DFCS_FLAT; 749 758 if ((distruct.itemState & OS.ODS_SELECTED) != 0) uState |= OS.DFCS_PUSHED; 750 RECT rect = new RECT ();751 OS.SetRect ( rect, distruct.left, distruct.top, distruct.right, distruct.bottom);752 OS.DrawFrameControl (distruct.hDC, rect, OS.DFC_SCROLL, uState);753 return null;754 } 755 756 } 759 RECT rect; 760 OS.SetRect (&rect, distruct.left, distruct.top, distruct.right, distruct.bottom); 761 OS.DrawFrameControl (distruct.hDC, &rect, OS.DFC_SCROLL, uState); 762 return cast(int)null; 763 } 764 765 } branches/0.1/src/dwt/widgets/canvas.d
r24 r28 118 118 checkWidget (); 119 119 if (OS.IsWindowVisible (handle)) return; 120 RECT rect = new RECT ();121 OS.SetRect ( rect, x, y, x + width, y + height);120 RECT rect; 121 OS.SetRect (&rect, x, y, x + width, y + height); 122 122 int hDC = OS.GetDCEx (handle, 0, OS.DCX_CACHE | OS.DCX_CLIPCHILDREN | OS.DCX_CLIPSIBLINGS); 123 123 drawBackground (hDC, rect); … … 190 190 OS.RedrawWindow (handle, null, 0, flags); 191 191 } 192 RECT lpRect = new RECT ();193 OS.SetRect ( lpRect, x, y, x + width, y + height);192 RECT lpRect; 193 OS.SetRect (&lpRect, x, y, x + width, y + height); 194 194 int deltaX = destX - x, deltaY = destY - y; 195 195 int flags = OS.SW_INVALIDATE | OS.SW_ERASE; … … 209 209 */ 210 210 // if (all) flags |= OS.SW_SCROLLCHILDREN; 211 OS.ScrollWindowEx (handle, deltaX, deltaY, lpRect, null, 0, null, flags);211 OS.ScrollWindowEx (handle, deltaX, deltaY, &lpRect, null, 0, null, flags); 212 212 if (all) { 213 213 Control [] children = getChildren (); … … 215 215 Control child = children [i]; 216 216 Rectangle rect = child.getBounds (); 217 if ( Math.min(x + width, rect.x + rect.width) >= Math.max (x, rect.x) &&218 Math.min(y + height, rect.y + rect.height) >= Math.max (y, rect.y)) {217 if (min(x + width, rect.x + rect.width) >= max (x, rect.x) && 218 min(y + height, rect.y + rect.height) >= max (y, rect.y)) { 219 219 child.setLocation (rect.x + deltaX, rect.y + deltaY); 220 220 } … … 280 280 LRESULT WM_WINDOWPOSCHANGED (int wParam, int lParam) { 281 281 LRESULT result = super.WM_WINDOWPOSCHANGED (wParam, lParam); 282 if ( result != null) return result;282 if (cast(void*)result != null) return result; 283 283 /* 284 284 * Bug in Windows. When a window with style WS_EX_LAYOUTRTL … … 295 295 LRESULT WM_WINDOWPOSCHANGING (int wParam, int lParam) { 296 296 LRESULT result = super.WM_WINDOWPOSCHANGING (wParam, lParam); 297 if ( result != null) return result;297 if (cast(void*)result != null) return result; 298 298 /* 299 299 * Bug in Windows. When a window with style WS_EX_LAYOUTRTL branches/0.1/src/dwt/widgets/composite.d
r24 r28 22 22 module dwt.widgets.composite; 23 23 24 private import dwt.util.system; 24 25 25 26 private import dwt.widgets.scrollable; … … 54 55 private { 55 56 import dwt.graphics.font; 57 import dwt.graphics.gc; 56 58 import dwt.graphics.point; 57 59 import dwt.graphics.rectangle; … … 67 69 } 68 70 69 /+ Layout layout; +/ // TODO: there is a method down below that this conflicts with (see around line 327) 71 Layout _layout; // TODO: there is a method down below that this conflicts with this 70 72 int font; 71 73 WINDOWPOS [] lpwp; … … 193 195 } 194 196 195 public Point computeSize(int wHint, int hHint, b itchanged) {197 public Point computeSize(int wHint, int hHint, bool changed) { 196 198 checkWidget (); 197 199 Point size; 198 if ( layout != null) {200 if (_layout != null) { 199 201 if (wHint == DWT.DEFAULT || hHint == DWT.DEFAULT) { 200 size = layout.computeSize (this, wHint, hHint, changed);202 size = _layout.computeSize (this, wHint, hHint, changed); 201 203 } else { 202 204 size = new Point (wHint, hHint); … … 299 301 300 302 /** 301 * Returns layout which is associated with the receiver, or303 * Returns _layout which is associated with the receiver, or 302 304 * null if one has not been set. 303 305 * 304 * @return the receiver's layout or null306 * @return the receiver's _layout or null 305 307 * 306 308 * @exception DWTException <ul> … … 311 313 public Layout getLayout () { 312 314 checkWidget (); 313 return layout;315 return _layout; 314 316 } 315 317 … … 346 348 } 347 349 348 b ithooksKeys () {350 bool hooksKeys () { 349 351 return hooks (DWT.KeyDown) || hooks (DWT.KeyUp); 350 352 } 353 351 354 352 355 /** … … 367 370 layout (true); 368 371 } 372 369 373 370 374 /** … … 385 389 * </ul> 386 390 */ 387 public void layout (b itchanged) {391 public void layout (bool changed) { 388 392 checkWidget (); 389 if ( layout == null) return;393 if (_layout == null) return; 390 394 setResizeChildren (false); 391 layout.layout (this, changed);395 _layout.layout (this, changed); 392 396 setResizeChildren (true); 393 397 } … … 398 402 for (int i=0; i<children.length; i++) { 399 403 Rectangle rect = children [i].getBounds (); 400 width = Math.max (width, rect.x + rect.width);401 height = Math.max (height, rect.y + rect.height);404 width = max (width, rect.x + rect.width); 405 height = max (height, rect.y + rect.height); 402 406 } 403 407 return new Point (width, height); … … 415 419 releaseChildren (); 416 420 super.releaseWidget (); 417 layout = null;421 _layout = null; 418 422 tabList = null; 419 423 lpwp = null; … … 436 440 } 437 441 438 b it resizeChildren (bitdefer, WINDOWPOS [] pwp) {442 bool resizeChildren (bool defer, WINDOWPOS [] pwp) { 439 443 if (pwp == null) return true; 440 444 int hdwp = 0; … … 445 449 for (int i=0; i<pwp.length; i++) { 446 450 WINDOWPOS wp = pwp [i]; 447 if ( wp != null) {451 if (cast(void*)wp != null) { 448 452 /* 449 453 * This code is intentionally commented. All widgets that … … 468 472 } 469 473 470 public b itsetFocus () {474 public bool setFocus () { 471 475 checkWidget (); 472 476 Control [] children = getChildren (); … … 496 500 public void setLayout (Layout layout) { 497 501 checkWidget (); 498 this. layout = layout;502 this._layout = layout; 499 503 } 500 504 … … 540 544 } 541 545 542 void setResizeChildren (b itresize) {546 void setResizeChildren (bool resize) { 543 547 if (resize) { 544 548 resizeChildren (); … … 551 555 } 552 556 553 b itsetTabGroupFocus () {557 bool setTabGroupFocus () { 554 558 if (isTabItem ()) return setTabItemFocus (); 555 559 if ((style & DWT.NO_FOCUS) == 0) { 556 b ittakeFocus = true;560 bool takeFocus = true; 557 561 if ((state & CANVAS) != 0) takeFocus = hooksKeys (); 558 562 if (takeFocus && setTabItemFocus ()) return true; … … 570 574 } 571 575 572 b itsetTabItemFocus () {576 bool setTabItemFocus () { 573 577 if ((style & DWT.NO_FOCUS) == 0) { 574 b ittakeFocus = true;578 bool takeFocus = true; 575 579 if ((state & CANVAS) != 0) takeFocus = hooksKeys (); 576 580 if (takeFocus) { … … 582 586 } 583 587 584 char[]toolTipText (NMTTDISPINFO hdr) {588 String toolTipText (NMTTDISPINFO hdr) { 585 589 if ((hdr.uFlags & OS.TTF_IDISHWND) == 0) { 586 590 return null; … … 593 597 } 594 598 595 bit translateMnemonic (Event event, Control control) { 599 /+ TODO: delegates 600 bool translateMnemonic (Event event, Control control) { 596 601 if (super.translateMnemonic (event, control)) return true; 597 602 if (control != null) { … … 604 609 return false; 605 610 } 611 +/ 606 612 607 613 void updateFont (Font oldFont, Font newFont) { … … 624 630 LRESULT WM_ERASEBKGND (int wParam, int lParam) { 625 631 LRESULT result = super.WM_ERASEBKGND (wParam, lParam); 626 if ( result != null) return result;632 if (cast(void*)result != null) return result; 627 633 if ((state & CANVAS) != 0) { 628 if ((style & DWT.NO_BACKGROUND) != 0) return LRESULT.ONE;634 if ((style & DWT.NO_BACKGROUND) != 0) return 1; 629 635 } 630 636 return result; … … 633 639 LRESULT WM_GETDLGCODE (int wParam, int lParam) { 634 640 LRESULT result = super.WM_GETDLGCODE (wParam, lParam); 635 if ( result != null) return result;641 if (cast(void*)result != null) return result; 636 642 if ((state & CANVAS) != 0) { 637 if ((style & DWT.NO_FOCUS) != 0) return new LRESULT (OS.DLGC_STATIC);643 if ((style & DWT.NO_FOCUS) != 0) return OS.DLGC_STATIC; 638 644 if (hooksKeys ()) { 639 645 int flags = OS.DLGC_WANTALLKEYS | OS.DLGC_WANTARROWS | OS.DLGC_WANTTAB; 640 return new LRESULT (flags);646 return flags; 641 647 } 642 648 int count = getChildrenCount (); 643 if (count != 0) return new LRESULT (OS.DLGC_STATIC);649 if (count != 0) return OS.DLGC_STATIC; 644 650 } 645 651 return result; … … 648 654 LRESULT WM_GETFONT (int wParam, int lParam) { 649 655 LRESULT result = super.WM_GETFONT (wParam, lParam); 650 if ( result != null) return result;656 if (cast(void*)result != null) return result; 651 657 int code = callWindowProc (OS.WM_GETFONT, wParam, lParam); 652 if (code != 0) return new LRESULT (code);658 if (code != 0) return code; 653 659 if (font == 0) font = defaultFont (); 654 return new LRESULT (font);660 return font; 655 661 } 656 662 … … 668 674 LRESULT WM_NOTIFY (int wParam, int lParam) { 669 675 if (!OS.IsWinCE) { 670 NMHDR hdr = new NMHDR ();676 NMHDR hdr; 671 677 OS.MoveMemory (hdr, lParam, NMHDR.sizeof); 672 678 switch (hdr.code) { … … 711 717 NMTTDISPINFO lpnmtdi; 712 718 if (hdr.code == OS.TTN_GETDISPINFOA) { 713 lpnmtdi = new NMTTDISPINFOA ();719 NMTTDISPINFOA lpnmtdi; 714 720 OS.MoveMemory (cast(NMTTDISPINFOA)lpnmtdi, lParam, NMTTDISPINFOA.sizeof); 715 721 } else { 716 lpnmtdi = new NMTTDISPINFOW ();722 NMTTDISPINFOW lpnmtdi; 717 723 OS.MoveMemory (cast(NMTTDISPINFOW)lpnmtdi, lParam, NMTTDISPINFOW.sizeof); 718 724 } 719 char[]string = toolTipText (lpnmtdi);725 String string = toolTipText (lpnmtdi); 720 726 if (string != null) { 721 727 Shell shell = getShell (); 722 728 string = Display.withCrLf (string); 723 int length = string.length (); 724 char [] chars = new char [length + 1]; 725 string.getChars (0, length, chars, 0); 729 //int length = string.length; 730 //String chars = new char [length + 1]; 731 //string.getChars (0, length, chars, 0); 732 String chars = string.dup; 726 733 727 734 /* … … 743 750 if (hdr.code == OS.TTN_GETDISPINFOA) { 744 751 byte [] bytes = new byte [chars.length * 2]; 745 OS.WideCharToMultiByte (OS.CP_ACP, 0, c hars, chars.length, bytes,bytes.length, null, null);752 OS.WideCharToMultiByte (OS.CP_ACP, 0, cast(wchar*)chars, cast(int)chars.length, cast(char*)bytes, cast(int)bytes.length, null, null); 746 753 shell.setToolTipText (lpnmtdi, bytes); 747 754 OS.MoveMemory (lParam, cast(NMTTDISPINFOA)lpnmtdi, NMTTDISPINFOA.sizeof); … … 750 757 OS.MoveMemory (lParam, cast(NMTTDISPINFOW)lpnmtdi, NMTTDISPINFOW.sizeof); 751 758 } 752 return LRESULT.ZERO;759 return 0; 753 760 } 754 761 break; … … 773 780 774 781 /* Paint the control and the background */ 775 PAINTSTRUCT ps = new PAINTSTRUCT ();782 PAINTSTRUCT ps; 776 783 if (hooks (DWT.Paint)) { 777 784 778 785 /* Get the damage */ 779 786 int [] lpRgnData = null; 780 b itisComplex = false;781 b itexposeRegion = false;787 bool isComplex = false; 788 bool exposeRegion = false; 782 789 if ((style & DWT.NO_MERGE_PAINTS) != 0) { 783 790 int rgn = OS.CreateRectRgn (0, 0, 0, 0); … … 793 800 /* Create the paint GC */ 794 801 GCData data = new GCData (); 795 data.ps = ps;802 data.ps = &ps; 796 803 GC gc = GC.win32_new (this, data); 797 804 int hDC = gc.handle; 798 805 799 806 /* Send the paint event */ 807 /+ TODO: delegates? +/ 800 808 Event event = new Event (); 801 809 event.gc = gc; 810 802 811 if (isComplex && exposeRegion) { 803 RECT rect = new RECT ();812 RECT rect; 804 813 int count = lpRgnData [2]; 805 814 for (int i=0; i<count; i++) { 806 OS.SetRect ( rect,815 OS.SetRect (&rect, 807 816 lpRgnData [8 + (i << 2)], 808 817 lpRgnData [8 + (i << 2) + 1], … … 824 833 * resource. 825 834 */ 835 /+ TODO: delegates? 826 836 sendEvent (DWT.Paint, event); 837 +/ 827 838 if (isDisposed ()) break; 828 839 } 829 840 } else { 830 841 if ((style & DWT.NO_BACKGROUND) == 0) { 831 RECT rect = new RECT ();832 OS.SetRect ( rect, ps.left, ps.top, ps.right, ps.bottom);842 RECT rect; 843 OS.SetRect (&rect, ps.left, ps.top, ps.right, ps.bottom); 833 844 drawBackground (hDC, rect); 834 845 } … … 837 848 event.width = ps.right - ps.left; 838 849 event.height = ps.bottom - ps.top; 850 /+ TODO: delegates? 839 851 sendEvent (DWT.Paint, event); 852 +/ 840 853 } 841 854 // widget could be disposed at this point … … 845 858 gc.dispose (); 846 859 } else { 847 int hDC = OS.BeginPaint (handle, ps);860 int hDC = OS.BeginPaint (handle, &ps); 848 861 if ((style & DWT.NO_BACKGROUND) == 0) { 849 RECT rect = new RECT ();850 OS.SetRect ( rect, ps.left, ps.top, ps.right, ps.bottom);862 RECT rect; 863 OS.SetRect (&rect, ps.left, ps.top, ps.right, ps.bottom); 851 864 drawBackground (hDC, rect); 852 865 } 853 OS.EndPaint (handle, ps);866 OS.EndPaint (handle, &ps); 854 867 } 855 868 … … 868 881 } 869 882 } 870 return LRESULT.ZERO;883 return 0; 871 884 } 872 885 873 886 LRESULT WM_PRINTCLIENT (int wParam, int lParam) { 874 887 LRESULT result = super.WM_PRINTCLIENT (wParam, lParam); 875 if ( result != null) return result;888 if (cast(void*)result != null) return result; 876 889 if ((state & CANVAS) != 0) { 877 RECT rect = new RECT ();878 OS.GetClientRect (handle, rect);890 RECT rect; 891 OS.GetClientRect (handle, &rect); 879 892 if ((style & DWT.NO_BACKGROUND) == 0) { 880 893 drawBackground (wParam, rect); … … 889 902 event.width = rect.right - rect.left; 890 903 event.height = rect.bottom - rect.top; 904 /+ TODO: delegates? 891 905 sendEvent (DWT.Paint, event); 906 +/ 892 907 event.gc = null; 893 908 gc.dispose (); … … 915 930 */ 916 931 if (isDisposed ()) return result; 917 if ( layout != null)layout.layout (this, false);932 if (_layout != null) _layout.layout (this, false); 918 933 919 934 /* End deferred window positioning */ … … 934 949 int threadId = OS.GetWindowThreadProcessId (hwndChild, null); 935 950 if (threadId != OS.GetCurrentThreadId ()) { 951 /+ TODO: delegates? 936 952 if (display.msgHook == 0) { 937 953 if (!OS.IsWinCE) { … … 943 959 } 944 960 OS.PostThreadMessage (threadId, OS.WM_APP + 4, hwndChild, lParam); 961 +/ 945 962 } 946 963 } … … 954 971 OS.SendMessage (hwndChild, OS.WM_SYSCOLORCHANGE, 0, 0); 955 972 } 956 return null;973 return cast(int)null; 957 974 } 958 975 959 976 LRESULT WM_SYSCOMMAND (int wParam, int lParam) { 960 977 LRESULT result = super.WM_SYSCOMMAND (wParam, lParam); 961 if ( result != null) return result;978 if (cast(void*)result != null) return result; 962 979 963 980 /* … … 979 996 case OS.SC_HSCROLL: 980 997 case OS.SC_VSCROLL: 981 b itshowHBar = horizontalBar != null && horizontalBar.getVisible ();982 b itshowVBar = verticalBar != null && verticalBar.getVisible ();998 bool showHBar = horizontalBar != null && horizontalBar.getVisible (); 999 bool showVBar = verticalBar != null && verticalBar.getVisible (); 983 1000 int code = callWindowProc (OS.WM_SYSCOMMAND, wParam, lParam); 984 1001 if ((showHBar != (horizontalBar != null && horizontalBar.getVisible ())) || … … 987 1004 OS.RedrawWindow (handle, null, 0, flags); 988 1005 } 989 if (code == 0) return LRESULT.ZERO;990 return new LRESULT (code);1006 if (code == 0) return 0; 1007 return code; 991 1008 } 992 1009 } branches/0.1/src/dwt/widgets/control.d
r25 r28 80 80 Cursor cursor; 81 81 Menu menu; 82 char[]toolTipText;82 String toolTipText; 83 83 Object layoutData; 84 84 Accessible accessible; branches/0.1/src/dwt/widgets/display.d
r27 r28 215 215 /* Display Data */ 216 216 Object data; 217 char[][] keys;217 String[] keys; 218 218 Object[] values; 219 219 … … 326 326 */ 327 327 // static { 328 // char[]name = Display.class.getName ();328 // String name = Display.class.getName (); 329 329 // int index = name.lastIndexOf ('.'); 330 330 // PACKAGE_PREFIX = name.substring (0, index + 1); … … 1027 1027 1028 1028 static bool isValidClass (Class clazz) { 1029 char[]name = clazz.getName ();1029 String name = clazz.getName (); 1030 1030 int index = name.lastIndexOf ('.'); 1031 1031 return name.substring (0, index + 1).equals (PACKAGE_PREFIX); … … 1059 1059 * @see #disposeExec 1060 1060 */ 1061 public Object getData ( char[]key) {1061 public Object getData (String key) { 1062 1062 checkDevice (); 1063 1063 if (key == null) error (DWT.ERROR_NULL_ARGUMENT); … … 1648 1648 1649 1649 /* Use the character encoding for the default locale */ 1650 windowClass = new TCHAR (0, WindowName + cast(w char[])(WindowClassCount++), true);1650 windowClass = new TCHAR (0, WindowName + cast(wString)(WindowClassCount++), true); 1651 1651 1652 1652 /* Register the DWT window class */ … … 2560 2560 * @see #disposeExec 2561 2561 */ 2562 public void setData ( char[]key, Object value) {2562 public void setData (String key, Object value) { 2563 2563 checkDevice (); 2564 2564 if (key == null) error (DWT.ERROR_NULL_ARGUMENT); … … 2574 2574 values = null; 2575 2575 } else { 2576 char[] [] newKeys = new char[][keys.length - 1];2576 String [] newKeys = new String [keys.length - 1]; 2577 2577 Object [] newValues = new Object [values.length - 1]; 2578 2578 System.arraycopy (keys, 0, newKeys, 0, index); … … 2588 2588 /* Add the key/value pair */ 2589 2589 if (keys == null) { 2590 keys = new char[][] [key];2590 keys = new String [] [key]; 2591 2591 values = new Object [] [value]; 2592 2592 return; … … 2598 2598 } 2599 2599 } 2600 char[] [] newKeys = new char[][keys.length + 1];2600 String [] newKeys = new String [keys.length + 1]; 2601 2601 Object [] newValues = new Object [values.length + 1]; 2602 2602 System.arraycopy (keys, 0, newKeys, 0, keys.length); … … 2643 2643 * @param name the new app name 2644 2644 */ 2645 public static void setAppName ( char[]name) {2645 public static void setAppName (String name) {
