Changeset 28

Show
Ignore:
Timestamp:
07/02/04 03:52:16 (4 years ago)
Author:
brad
Message:

Reverted back to makefile in /src instead of scons. This got rid of the forward references messages from DMD.
Then, began to fix compiler errors in button, canvas, composite, display, event, layout, shell, widget.
Left off at control (line 480).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/0.1/src/dwt/internal/win32/os.d

    r27 r28  
    13921392static int CreateFontIndirect (int lplf) { 
    13931393    if (IsUnicode) 
    1394             return CreateFontIndirectW (cast(LOGFONTW*)lplf); 
    1395         else 
    1396         return CreateFontIndirectA (cast(LOGFONTA*)lplf); 
    1397 } 
    1398  
    1399 static static int CreateFontIndirect (LOGFONT* lplf) { 
     1394       return CreateFontIndirectW (cast(LOGFONTW*)lplf); 
     1395   else 
     1396       return CreateFontIndirectA (cast(LOGFONTA*)lplf); 
     1397} 
     1398 
     1399static int CreateFontIndirect (LOGFONT* lplf) { 
    14001400    if (IsUnicode) 
    1401             return CreateFontIndirectW (cast(LOGFONTW*)lplf); 
    1402         else 
    1403         return CreateFontIndirectA (cast(LOGFONTA*)lplf); 
     1401       return CreateFontIndirectW (cast(LOGFONTW*)lplf); 
     1402   else 
     1403       return CreateFontIndirectA (cast(LOGFONTA*)lplf); 
    14041404} 
    14051405 
  • branches/0.1/src/dwt/internal/win32/tchar.d

    r17 r28  
    2727 
    2828    import dwt.internal.win32.os; 
     29     
     30    import dwt.util.system; 
    2931} 
    3032 
     
    5759} 
    5860 
    59  
    60 /+  
    61  +  2004.5.23 BSA 
    62  +      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 +/ 
    8561 
    8662 
     
    142118} 
    143119 
    144 public wchar[] toStringw(int start, int length) { 
     120public wchar[] toString( int start, int length ) { 
     121        return toStringw( start, length ); 
     122
     123 
     124public wchar[] toStringw( int start, int length ) { 
    145125    if (OS.IsUnicode) { 
    146126        //return new wchar[] (chars, start, length); 
     
    150130        if (start != 0) { 
    151131            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); 
    154133            bytes[] = this.bytes; // done.  (D is cool) 
    155134        } 
  • branches/0.1/src/dwt/internal/win32/types.d

    r27 r28  
    2121module dwt.internal.win32.types; 
    2222 
    23 version = Unicode; 
     23//version = Unicode; 
    2424 
    2525/* 
     
    108108} 
    109109 
    110  
     110struct INITCOMMONCONTROLSEX { 
     111    int dwSize;  
     112    int dwICC; 
     113
     114 
     115struct LOGBRUSH { 
    111116    int lbStyle; 
    112117    int lbColor; 
     
    501506} 
    502507 
    503  
    504  
    505  
    506  
    507  
    508  
    509  
    510  
    511  
    512  
    513  
    514  
    515  
    516  
    517  
    518  
    519  
    520  
    521508struct LOGFONTA { 
    522509    int lfHeight; 
     
    557544} 
    558545 
    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  
    598546// Yay D for not sucking 
    599547alias int LRESULT; 
     
    662610} 
    663611 
    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. 
    708614 
    709615struct NONCLIENTMETRICS { 
     
    725631} 
    726632 
     633// the code still uses these in places 
     634alias NONCLIENTMETRICS NONCLIENTMETRICSA; 
     635alias NONCLIENTMETRICS NONCLIENTMETRICSW; 
     636 
    727637struct OSVERSIONINFO { 
    728638    int dwOSVersionInfoSize; 
     
    783693} 
    784694 
    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; 
     695version(Unicode) { 
     696    alias TEXTMETRICW TEXTMETRIC; 
     697} else { 
     698    alias TEXTMETRICA TEXTMETRIC; 
    803699} 
    804700 
  • branches/0.1/src/dwt/util/util.d

    r17 r28  
    2121module dwt.internal.util.util; 
    2222 
     23 
    2324int abs(int x) { 
    2425    return x > 0 ? x : -x; 
     
    2627 
    2728int min(int a, int b) { 
    28     return a > b ? b : a; 
     29    return a >= b ? b : a; 
     30
     31 
     32double max(double a, double b) { 
     33    // Returns the greater of two double values. 
     34    return a >= b ? a : b; 
     35
     36 
     37float max(float a, float b) { 
     38    // Returns the greater of two float values. 
     39    return a >= b ? a : b; 
    2940} 
    3041 
    3142int 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 
     47long max(long a, long b)  { 
     48    // Returns the greater of two long values. 
     49    return a >= b ? a : b; 
     50
     51 
     52bool toUpperCase (char c) { 
     53    if ('a' <= c && c <= 'z') { 
     54        return c - (cast(char)'a' - 'A'); 
     55    } else { 
     56        return c; 
     57    } 
     58     
    3359} 
    3460 
  • branches/0.1/src/dwt/widgets/button.d

    r25 r28  
    2222module dwt.widgets.button; 
    2323 
    24 private import dwt.widgets.control; 
     24    private import dwt.util.util; 
     25     
     26    private import dwt.widgets.control; 
    2527 
    2628 
     
    211213        if (newFont != 0) oldFont = OS.SelectObject (hDC, newFont); 
    212214         
     215        // TEXTMETRIC lptm = OS.IsUnicode ? new TEXTMETRICW () : new TEXTMETRICA (); 
     216 
     217        /+  D: try 1 
    213218        if (OS.IsUnicode) 
    214219            TEXTMETRIC lptm = new TEXTMETRICW(); 
    215220        else 
    216221            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); 
    220225        int length = OS.GetWindowTextLength (handle); 
    221226        if (length == 0) { 
    222227            height += lptm.tmHeight; 
    223228        } else { 
    224             extra = Math.max (8, lptm.tmAveCharWidth); 
     229            extra = max (8, lptm.tmAveCharWidth); 
    225230            TCHAR buffer = new TCHAR (getCodePage (), length + 1); 
    226231            OS.GetWindowText (handle, buffer, length + 1); 
    227             RECT rect = new RECT ()
     232            RECT rect
    228233            int flags = OS.DT_CALCRECT | OS.DT_SINGLELINE; 
    229             OS.DrawText (hDC, buffer, length, rect, flags); 
     234            OS.DrawText (hDC, buffer, length, &rect, flags); 
    230235            width += rect.right - rect.left; 
    231236            height += rect.bottom - rect.top; 
     
    243248    if ((style & (DWT.CHECK | DWT.RADIO)) != 0) { 
    244249        width += CheckWidth + extra; 
    245         height = Math.max (height, CheckHeight + 3); 
     250        height = max (height, CheckHeight + 3); 
    246251    } 
    247252    if ((style & (DWT.PUSH | DWT.TOGGLE)) != 0) { 
     
    388393    char mnemonic = findMnemonic (getText ()); 
    389394    if (mnemonic == '\0') return false; 
    390     return Character.toUpperCase (key) == Character.toUpperCase (mnemonic); 
     395    return toUpperCase(key) == toUpperCase(mnemonic); 
    391396} 
    392397 
     
    559564    if (getSelection () != value) { 
    560565        setSelection (value); 
     566        /+ TODO: delegates? 
    561567        postEvent (DWT.Selection); 
     568        +/ 
    562569    } 
    563570    return true; 
     
    677684LRESULT WM_GETDLGCODE (int wParam, int lParam) { 
    678685    LRESULT result = super.WM_GETDLGCODE (wParam, lParam); 
    679     if (result != null) return result; 
     686    if (cast(void*)result != null) return result; 
    680687    if ((style & DWT.ARROW) != 0) { 
    681         return new LRESULT (OS.DLGC_STATIC); 
     688        return OS.DLGC_STATIC;  // took out 'new' 
    682689    } 
    683690    return result; 
     
    729736                } 
    730737            } 
     738            /+ TODO: delegates? 
    731739            postEvent (DWT.Selection); 
     740            +/ 
    732741    } 
    733742    return super.wmCommandChild (wParam, lParam); 
     
    736745LRESULT wmDrawChild (int wParam, int lParam) { 
    737746    if ((style & DWT.ARROW) == 0) return super.wmDrawChild (wParam, lParam); 
    738     DRAWITEMSTRUCT distruct = new DRAWITEMSTRUCT ()
     747    DRAWITEMSTRUCT distruct
    739748    OS.MoveMemory (distruct, lParam, DRAWITEMSTRUCT.sizeof); 
    740749    int uState = OS.DFCS_SCROLLLEFT; 
     
    748757    if ((style & DWT.FLAT) == DWT.FLAT) uState |= OS.DFCS_FLAT; 
    749758    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  
    118118    checkWidget (); 
    119119    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); 
    122122    int hDC = OS.GetDCEx (handle, 0, OS.DCX_CACHE | OS.DCX_CLIPCHILDREN | OS.DCX_CLIPSIBLINGS); 
    123123    drawBackground (hDC, rect); 
     
    190190        OS.RedrawWindow (handle, null, 0, flags); 
    191191    } 
    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); 
    194194    int deltaX = destX - x, deltaY = destY - y; 
    195195    int flags = OS.SW_INVALIDATE | OS.SW_ERASE; 
     
    209209    */ 
    210210//  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); 
    212212    if (all) { 
    213213        Control [] children = getChildren (); 
     
    215215            Control child = children [i]; 
    216216            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)) { 
    219219                    child.setLocation (rect.x + deltaX, rect.y + deltaY); 
    220220            } 
     
    280280LRESULT WM_WINDOWPOSCHANGED (int wParam, int lParam) { 
    281281    LRESULT result  = super.WM_WINDOWPOSCHANGED (wParam, lParam); 
    282     if (result != null) return result; 
     282    if (cast(void*)result != null) return result; 
    283283    /* 
    284284    * Bug in Windows.  When a window with style WS_EX_LAYOUTRTL 
     
    295295LRESULT WM_WINDOWPOSCHANGING (int wParam, int lParam) { 
    296296    LRESULT result  = super.WM_WINDOWPOSCHANGING (wParam, lParam); 
    297     if (result != null) return result; 
     297    if (cast(void*)result != null) return result; 
    298298    /* 
    299299    * Bug in Windows.  When a window with style WS_EX_LAYOUTRTL 
  • branches/0.1/src/dwt/widgets/composite.d

    r24 r28  
    2222module dwt.widgets.composite; 
    2323 
     24private import dwt.util.system; 
    2425 
    2526private import dwt.widgets.scrollable; 
     
    5455    private { 
    5556        import dwt.graphics.font; 
     57        import dwt.graphics.gc; 
    5658        import dwt.graphics.point; 
    5759        import dwt.graphics.rectangle; 
     
    6769    } 
    6870 
    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 
    7072    int font; 
    7173    WINDOWPOS [] lpwp; 
     
    193195} 
    194196 
    195 public Point computeSize(int wHint, int hHint, bit changed) { 
     197public Point computeSize(int wHint, int hHint, bool changed) { 
    196198    checkWidget (); 
    197199    Point size; 
    198     if (layout != null) { 
     200    if (_layout != null) { 
    199201        if (wHint == DWT.DEFAULT || hHint == DWT.DEFAULT) { 
    200             size = layout.computeSize (this, wHint, hHint, changed); 
     202            size = _layout.computeSize (this, wHint, hHint, changed); 
    201203        } else { 
    202204            size = new Point (wHint, hHint); 
     
    299301 
    300302/** 
    301  * Returns layout which is associated with the receiver, or 
     303 * Returns _layout which is associated with the receiver, or 
    302304 * null if one has not been set. 
    303305 * 
    304  * @return the receiver's layout or null 
     306 * @return the receiver's _layout or null 
    305307 * 
    306308 * @exception DWTException <ul> 
     
    311313public Layout getLayout () { 
    312314    checkWidget (); 
    313     return layout; 
     315    return _layout; 
    314316} 
    315317 
     
    346348} 
    347349 
    348 bit hooksKeys () { 
     350bool hooksKeys () { 
    349351    return hooks (DWT.KeyDown) || hooks (DWT.KeyUp); 
    350352} 
     353 
    351354 
    352355/** 
     
    367370    layout (true); 
    368371} 
     372 
    369373 
    370374/** 
     
    385389 * </ul> 
    386390 */ 
    387 public void layout (bit changed) { 
     391public void layout (bool changed) { 
    388392    checkWidget (); 
    389     if (layout == null) return; 
     393    if (_layout == null) return; 
    390394    setResizeChildren (false); 
    391     layout.layout (this, changed); 
     395    _layout.layout (this, changed); 
    392396    setResizeChildren (true); 
    393397} 
     
    398402    for (int i=0; i<children.length; i++) { 
    399403        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); 
    402406    } 
    403407    return new Point (width, height); 
     
    415419    releaseChildren (); 
    416420    super.releaseWidget (); 
    417     layout = null; 
     421    _layout = null; 
    418422    tabList = null; 
    419423    lpwp = null; 
     
    436440} 
    437441 
    438 bit resizeChildren (bit defer, WINDOWPOS [] pwp) { 
     442bool resizeChildren (bool defer, WINDOWPOS [] pwp) { 
    439443    if (pwp == null) return true; 
    440444    int hdwp = 0; 
     
    445449    for (int i=0; i<pwp.length; i++) { 
    446450        WINDOWPOS wp = pwp [i]; 
    447         if (wp != null) { 
     451        if (cast(void*)wp != null) { 
    448452            /* 
    449453            * This code is intentionally commented.  All widgets that 
     
    468472} 
    469473 
    470 public bit setFocus () { 
     474public bool setFocus () { 
    471475    checkWidget (); 
    472476    Control [] children = getChildren (); 
     
    496500public void setLayout (Layout layout) { 
    497501    checkWidget (); 
    498     this.layout = layout; 
     502    this._layout = layout; 
    499503} 
    500504 
     
    540544} 
    541545 
    542 void setResizeChildren (bit resize) { 
     546void setResizeChildren (bool resize) { 
    543547    if (resize) { 
    544548        resizeChildren (); 
     
    551555} 
    552556 
    553 bit setTabGroupFocus () { 
     557bool setTabGroupFocus () { 
    554558    if (isTabItem ()) return setTabItemFocus (); 
    555559    if ((style & DWT.NO_FOCUS) == 0) { 
    556         bit takeFocus = true; 
     560        bool takeFocus = true; 
    557561        if ((state & CANVAS) != 0) takeFocus = hooksKeys (); 
    558562        if (takeFocus && setTabItemFocus ()) return true; 
     
    570574} 
    571575 
    572 bit setTabItemFocus () { 
     576bool setTabItemFocus () { 
    573577    if ((style & DWT.NO_FOCUS) == 0) { 
    574         bit takeFocus = true; 
     578        bool takeFocus = true; 
    575579        if ((state & CANVAS) != 0) takeFocus = hooksKeys (); 
    576580        if (takeFocus) { 
     
    582586} 
    583587 
    584 char[] toolTipText (NMTTDISPINFO hdr) { 
     588String toolTipText (NMTTDISPINFO hdr) { 
    585589    if ((hdr.uFlags & OS.TTF_IDISHWND) == 0) { 
    586590        return null; 
     
    593597} 
    594598 
    595 bit translateMnemonic (Event event, Control control) { 
     599/+ TODO: delegates 
     600bool translateMnemonic (Event event, Control control) { 
    596601    if (super.translateMnemonic (event, control)) return true; 
    597602    if (control != null) { 
     
    604609    return false; 
    605610} 
     611+/ 
    606612 
    607613void updateFont (Font oldFont, Font newFont) { 
     
    624630LRESULT WM_ERASEBKGND (int wParam, int lParam) { 
    625631    LRESULT result = super.WM_ERASEBKGND (wParam, lParam); 
    626     if (result != null) return result; 
     632    if (cast(void*)result != null) return result; 
    627633    if ((state & CANVAS) != 0) { 
    628         if ((style & DWT.NO_BACKGROUND) != 0) return LRESULT.ONE
     634        if ((style & DWT.NO_BACKGROUND) != 0) return 1
    629635    } 
    630636    return result; 
     
    633639LRESULT WM_GETDLGCODE (int wParam, int lParam) { 
    634640    LRESULT result = super.WM_GETDLGCODE (wParam, lParam); 
    635     if (result != null) return result; 
     641    if (cast(void*)result != null) return result; 
    636642    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
    638644        if (hooksKeys ()) { 
    639645            int flags = OS.DLGC_WANTALLKEYS | OS.DLGC_WANTARROWS | OS.DLGC_WANTTAB; 
    640             return new LRESULT (flags)
     646            return flags
    641647        } 
    642648        int count = getChildrenCount (); 
    643         if (count != 0) return new LRESULT (OS.DLGC_STATIC)
     649        if (count != 0) return OS.DLGC_STATIC
    644650    } 
    645651    return result; 
     
    648654LRESULT WM_GETFONT (int wParam, int lParam) { 
    649655    LRESULT result = super.WM_GETFONT (wParam, lParam); 
    650     if (result != null) return result; 
     656    if (cast(void*)result != null) return result; 
    651657    int code = callWindowProc (OS.WM_GETFONT, wParam, lParam); 
    652     if (code != 0) return new LRESULT (code)
     658    if (code != 0) return code
    653659    if (font == 0) font = defaultFont (); 
    654     return new LRESULT (font)
     660    return font
    655661} 
    656662 
     
    668674LRESULT WM_NOTIFY (int wParam, int lParam) { 
    669675    if (!OS.IsWinCE) { 
    670         NMHDR hdr = new NMHDR ()
     676        NMHDR hdr
    671677        OS.MoveMemory (hdr, lParam, NMHDR.sizeof); 
    672678        switch (hdr.code) { 
     
    711717                NMTTDISPINFO lpnmtdi; 
    712718                if (hdr.code == OS.TTN_GETDISPINFOA) { 
    713                     lpnmtdi = new NMTTDISPINFOA ()
     719                    NMTTDISPINFOA lpnmtdi
    714720                    OS.MoveMemory (cast(NMTTDISPINFOA)lpnmtdi, lParam, NMTTDISPINFOA.sizeof); 
    715721                } else { 
    716                     lpnmtdi = new NMTTDISPINFOW ()
     722                    NMTTDISPINFOW lpnmtdi
    717723                    OS.MoveMemory (cast(NMTTDISPINFOW)lpnmtdi, lParam, NMTTDISPINFOW.sizeof); 
    718724                } 
    719                 char[] string = toolTipText (lpnmtdi); 
     725                String string = toolTipText (lpnmtdi); 
    720726                if (string != null) { 
    721727                    Shell shell = getShell (); 
    722728                    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; 
    726733                     
    727734                    /* 
     
    743750                    if (hdr.code == OS.TTN_GETDISPINFOA) { 
    744751                        byte [] bytes = new byte [chars.length * 2]; 
    745                         OS.WideCharToMultiByte (OS.CP_ACP, 0, chars, 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); 
    746753                        shell.setToolTipText (lpnmtdi, bytes); 
    747754                        OS.MoveMemory (lParam, cast(NMTTDISPINFOA)lpnmtdi, NMTTDISPINFOA.sizeof); 
     
    750757                        OS.MoveMemory (lParam, cast(NMTTDISPINFOW)lpnmtdi, NMTTDISPINFOW.sizeof); 
    751758                    } 
    752                     return LRESULT.ZERO
     759                    return 0
    753760                } 
    754761                break; 
     
    773780 
    774781    /* Paint the control and the background */ 
    775     PAINTSTRUCT ps = new PAINTSTRUCT ()
     782    PAINTSTRUCT ps
    776783    if (hooks (DWT.Paint)) { 
    777784         
    778785        /* Get the damage */ 
    779786        int [] lpRgnData = null; 
    780         bit isComplex = false; 
    781         bit exposeRegion = false; 
     787        bool isComplex = false; 
     788        bool exposeRegion = false; 
    782789        if ((style & DWT.NO_MERGE_PAINTS) != 0) { 
    783790            int rgn = OS.CreateRectRgn (0, 0, 0, 0); 
     
    793800        /* Create the paint GC */ 
    794801        GCData data = new GCData (); 
    795         data.ps = ps; 
     802        data.ps = &ps; 
    796803        GC gc = GC.win32_new (this, data); 
    797804        int hDC = gc.handle; 
    798805         
    799806        /* Send the paint event */ 
     807/+ TODO: delegates? +/ 
    800808        Event event = new Event (); 
    801809        event.gc = gc; 
     810 
    802811        if (isComplex && exposeRegion) { 
    803             RECT rect = new RECT ()
     812            RECT rect
    804813            int count = lpRgnData [2]; 
    805814            for (int i=0; i<count; i++) { 
    806                 OS.SetRect (rect, 
     815                OS.SetRect (&rect, 
    807816                    lpRgnData [8 + (i << 2)], 
    808817                    lpRgnData [8 + (i << 2) + 1], 
     
    824833                * resource. 
    825834                */ 
     835/+ TODO: delegates?  
    826836                sendEvent (DWT.Paint, event); 
     837+/ 
    827838                if (isDisposed ()) break; 
    828839            } 
    829840        } else { 
    830841            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); 
    833844                drawBackground (hDC, rect); 
    834845            } 
     
    837848            event.width = ps.right - ps.left; 
    838849            event.height = ps.bottom - ps.top; 
     850/+ TODO: delegates?  
    839851            sendEvent (DWT.Paint, event); 
     852+/ 
    840853        } 
    841854        // widget could be disposed at this point 
     
    845858        gc.dispose (); 
    846859    } else { 
    847         int hDC = OS.BeginPaint (handle, ps); 
     860        int hDC = OS.BeginPaint (handle, &ps); 
    848861        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); 
    851864            drawBackground (hDC, rect); 
    852865        } 
    853         OS.EndPaint (handle, ps); 
     866        OS.EndPaint (handle, &ps); 
    854867    } 
    855868 
     
    868881        } 
    869882    } 
    870     return LRESULT.ZERO
     883    return 0
    871884} 
    872885 
    873886LRESULT WM_PRINTCLIENT (int wParam, int lParam) { 
    874887    LRESULT result = super.WM_PRINTCLIENT (wParam, lParam); 
    875     if (result != null) return result; 
     888    if (cast(void*)result != null) return result; 
    876889    if ((state & CANVAS) != 0) { 
    877         RECT rect = new RECT ()
    878         OS.GetClientRect (handle, rect); 
     890        RECT rect
     891        OS.GetClientRect (handle, &rect); 
    879892        if ((style & DWT.NO_BACKGROUND) == 0) { 
    880893            drawBackground (wParam, rect); 
     
    889902        event.width = rect.right - rect.left; 
    890903        event.height = rect.bottom - rect.top; 
     904/+ TODO: delegates?  
    891905        sendEvent (DWT.Paint, event); 
     906+/ 
    892907        event.gc = null; 
    893908        gc.dispose (); 
     
    915930    */ 
    916931    if (isDisposed ()) return result; 
    917     if (layout != null) layout.layout (this, false); 
     932    if (_layout != null) _layout.layout (this, false); 
    918933 
    919934    /* End deferred window positioning */ 
     
    934949        int threadId = OS.GetWindowThreadProcessId (hwndChild, null); 
    935950        if (threadId != OS.GetCurrentThreadId ()) { 
     951/+ TODO: delegates? 
    936952            if (display.msgHook == 0) { 
    937953                if (!OS.IsWinCE) { 
     
    943959            } 
    944960            OS.PostThreadMessage (threadId, OS.WM_APP + 4, hwndChild, lParam); 
     961+/ 
    945962        } 
    946963    } 
     
    954971        OS.SendMessage (hwndChild, OS.WM_SYSCOLORCHANGE, 0, 0); 
    955972    } 
    956     return null; 
     973    return cast(int)null; 
    957974} 
    958975 
    959976LRESULT WM_SYSCOMMAND (int wParam, int lParam) { 
    960977    LRESULT result = super.WM_SYSCOMMAND (wParam, lParam); 
    961     if (result != null) return result; 
     978    if (cast(void*)result != null) return result; 
    962979         
    963980    /* 
     
    979996            case OS.SC_HSCROLL: 
    980997            case OS.SC_VSCROLL: 
    981                 bit showHBar = horizontalBar != null && horizontalBar.getVisible (); 
    982                 bit showVBar = verticalBar != null && verticalBar.getVisible (); 
     998                bool showHBar = horizontalBar != null && horizontalBar.getVisible (); 
     999                bool showVBar = verticalBar != null && verticalBar.getVisible (); 
    9831000                int code = callWindowProc (OS.WM_SYSCOMMAND, wParam, lParam); 
    9841001                if ((showHBar != (horizontalBar != null && horizontalBar.getVisible ())) || 
     
    9871004                        OS.RedrawWindow (handle, null, 0, flags); 
    9881005                    }        
    989                 if (code == 0) return LRESULT.ZERO
    990                 return new LRESULT (code)
     1006                if (code == 0) return 0
     1007                return code
    9911008        } 
    9921009    } 
  • branches/0.1/src/dwt/widgets/control.d

    r25 r28  
    8080    Cursor cursor; 
    8181    Menu menu; 
    82     char[] toolTipText; 
     82    String toolTipText; 
    8383    Object layoutData; 
    8484    Accessible accessible; 
  • branches/0.1/src/dwt/widgets/display.d

    r27 r28  
    215215    /* Display Data */ 
    216216    Object data; 
    217     char[][] keys; 
     217    String[] keys; 
    218218    Object[] values; 
    219219     
     
    326326    */ 
    327327//  static { 
    328 //      char[] name = Display.class.getName (); 
     328//      String name = Display.class.getName (); 
    329329//      int index = name.lastIndexOf ('.'); 
    330330//      PACKAGE_PREFIX = name.substring (0, index + 1); 
     
    10271027 
    10281028static bool isValidClass (Class clazz) { 
    1029     char[] name = clazz.getName (); 
     1029    String name = clazz.getName (); 
    10301030    int index = name.lastIndexOf ('.'); 
    10311031    return name.substring (0, index + 1).equals (PACKAGE_PREFIX); 
     
    10591059 * @see #disposeExec 
    10601060 */ 
    1061 public Object getData (char[] key) { 
     1061public Object getData (String key) { 
    10621062    checkDevice (); 
    10631063    if (key == null) error (DWT.ERROR_NULL_ARGUMENT); 
     
    16481648     
    16491649    /* Use the character encoding for the default locale */ 
    1650     windowClass = new TCHAR (0, WindowName + cast(wchar[])(WindowClassCount++), true); 
     1650    windowClass = new TCHAR (0, WindowName + cast(wString)(WindowClassCount++), true); 
    16511651 
    16521652    /* Register the DWT window class */ 
     
    25602560 * @see #disposeExec 
    25612561 */ 
    2562 public void setData (char[] key, Object value) { 
     2562public void setData (String key, Object value) { 
    25632563    checkDevice (); 
    25642564    if (key == null) error (DWT.ERROR_NULL_ARGUMENT); 
     
    25742574            values = null; 
    25752575        } else { 
    2576             char[] [] newKeys = new char[] [keys.length - 1]; 
     2576            String [] newKeys = new String [keys.length - 1]; 
    25772577            Object [] newValues = new Object [values.length - 1]; 
    25782578            System.arraycopy (keys, 0, newKeys, 0, index); 
     
    25882588    /* Add the key/value pair */ 
    25892589    if (keys == null) { 
    2590         keys = new char[] [] [key]; 
     2590        keys = new String [] [key]; 
    25912591        values = new Object [] [value]; 
    25922592        return; 
     
    25982598        } 
    25992599    } 
    2600     char[] [] newKeys = new char[] [keys.length + 1]; 
     2600    String [] newKeys = new String [keys.length + 1]; 
    26012601    Object [] newValues = new Object [values.length + 1]; 
    26022602    System.arraycopy (keys, 0, newKeys, 0, keys.length); 
     
    26432643 * @param name the new app name 
    26442644 */ 
    2645 public static void setAppName (char[] name) { 
     2645public static void setAppName (String name) {