Changeset 109:0a02d6d3466b

Show
Ignore:
Timestamp:
02/10/08 20:45:33 (1 year ago)
Author:
Frank Benoit <benoit@tionex.de>
Parents:

108:6f75fdfa1bcd 107:a378481be65f

branch:
default
Message:

merge

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • dwt/widgets/Control.d

    r107 r109  
    37153715 
    37163716int windowProc (HWND hwnd, int msg, int wParam, int lParam) { 
    3717     LRESULT result = LRESULT.NULL
     3717    LRESULT result = null
    37183718    switch (msg) { 
    37193719        case OS.WM_ACTIVATE:            result = WM_ACTIVATE (wParam, lParam); break; 
     
    38073807        default: 
    38083808    } 
    3809     if (result !is LRESULT.NULL) return result
     3809    if (result !is null) return result.value
    38103810    return callWindowProc (hwnd, msg, wParam, lParam); 
    38113811} 
    38123812 
    38133813LRESULT WM_ACTIVATE (int wParam, int lParam) { 
    3814     return LRESULT.NULL
     3814    return null
    38153815} 
    38163816 
     
    38243824 
    38253825LRESULT WM_CLEAR (int wParam, int lParam) { 
    3826     return LRESULT.NULL
     3826    return null
    38273827} 
    38283828 
    38293829LRESULT WM_CLOSE (int wParam, int lParam) { 
    3830     return LRESULT.NULL
     3830    return null
    38313831} 
    38323832 
     
    38453845            } 
    38463846        } 
    3847         return LRESULT.NULL
     3847        return null
    38483848    } 
    38493849    Control control = display.getControl (cast(HANDLE)lParam); 
    3850     if (control is null) return LRESULT.NULL
     3850    if (control is null) return null
    38513851    return control.wmCommandChild (wParam, lParam); 
    38523852} 
     
    38633863    } 
    38643864    Control control = display.getControl (cast(HANDLE)lParam); 
    3865     if (control is null) return LRESULT.NULL
     3865    if (control is null) return null
    38663866    return control.wmColorChild (wParam, lParam); 
    38673867} 
    38683868 
    38693869LRESULT WM_CUT (int wParam, int lParam) { 
    3870     return LRESULT.NULL
     3870    return null
    38713871} 
    38723872 
    38733873LRESULT WM_DESTROY (int wParam, int lParam) { 
    3874     return LRESULT.NULL
     3874    return null
    38753875} 
    38763876 
     
    38793879    if (struct_.CtlType is OS.ODT_MENU) { 
    38803880        MenuItem item = display.getMenuItem (struct_.itemID); 
    3881         if (item is null) return LRESULT.NULL
     3881        if (item is null) return null
    38823882        return item.wmDrawChild (wParam, lParam); 
    38833883    } 
    38843884    Control control = display.getControl (struct_.hwndItem); 
    3885     if (control is null) return LRESULT.NULL
     3885    if (control is null) return null
    38863886    return control.wmDrawChild (wParam, lParam); 
    38873887} 
    38883888 
    38893889LRESULT WM_ENDSESSION (int wParam, int lParam) { 
    3890     return LRESULT.NULL
     3890    return null
    38913891} 
    38923892 
    38933893LRESULT WM_ENTERIDLE (int wParam, int lParam) { 
    3894     return LRESULT.NULL
     3894    return null
    38953895} 
    38963896 
     
    39043904        } 
    39053905    } 
    3906     return LRESULT.NULL
     3906    return null
    39073907} 
    39083908 
    39093909LRESULT WM_GETDLGCODE (int wParam, int lParam) { 
    3910     return LRESULT.NULL
     3910    return null
    39113911} 
    39123912 
    39133913LRESULT WM_GETFONT (int wParam, int lParam) { 
    3914     return LRESULT.NULL
     3914    return null
    39153915} 
    39163916 
    39173917LRESULT WM_GETOBJECT (int wParam, int lParam) { 
    39183918    if (accessible !is null) { 
    3919         LRESULT result = cast(LRESULT) accessible.internal_WM_GETOBJECT (wParam, lParam); 
    3920         if (result !is 0) return result
    3921     } 
    3922     return LRESULT.NULL
     3919        int result = accessible.internal_WM_GETOBJECT (wParam, lParam); 
     3920        if (result !is 0) return new LRESULT (result)
     3921    } 
     3922    return null
    39233923} 
    39243924 
    39253925LRESULT WM_GETMINMAXINFO (int wParam, int lParam) { 
    3926     return LRESULT.NULL
     3926    return null
    39273927} 
    39283928 
    39293929LRESULT WM_HOTKEY (int wParam, int lParam) { 
    3930     return LRESULT.NULL
     3930    return null
    39313931} 
    39323932 
    39333933LRESULT WM_HELP (int wParam, int lParam) { 
    3934     static if (OS.IsWinCE) return LRESULT.NULL
     3934    static if (OS.IsWinCE) return null
    39353935    HELPINFO* lphi = cast(HELPINFO*)lParam; 
    39363936    Decorations shell = menuShell (); 
    3937     if (!shell.isEnabled ()) return LRESULT.NULL
     3937    if (!shell.isEnabled ()) return null
    39383938    if (lphi.iContextType is OS.HELPINFO_MENUITEM) { 
    39393939        MenuItem item = display.getMenuItem (lphi.iCtrlId); 
     
    39533953            } 
    39543954        } 
    3955         return LRESULT.NULL
     3955        return null
    39563956    } 
    39573957    if (hooks (DWT.Help)) { 
     
    39593959        return LRESULT.ONE; 
    39603960    } 
    3961     return LRESULT.NULL
     3961    return null
    39623962} 
    39633963 
    39643964LRESULT WM_HSCROLL (int wParam, int lParam) { 
    39653965    Control control = display.getControl (cast(HANDLE)lParam); 
    3966     if (control is null) return LRESULT.NULL
     3966    if (control is null) return null
    39673967    return control.wmScrollChild (wParam, lParam); 
    39683968} 
     
    39733973 
    39743974LRESULT WM_IME_COMPOSITION (int wParam, int lParam) { 
    3975     return LRESULT.NULL
     3975    return null
    39763976} 
    39773977 
     
    39793979 
    39803980    /* Ignore WM_INITMENUPOPUP for an accelerator */ 
    3981     if (display.accelKeyHit) return LRESULT.NULL
     3981    if (display.accelKeyHit) return null
    39823982 
    39833983    /* 
     
    40304030        // widget could be disposed at this point 
    40314031    } 
    4032     return LRESULT.NULL
     4032    return null
    40334033} 
    40344034 
    40354035LRESULT WM_INPUTLANGCHANGE (int wParam, int lParam) { 
    4036     return LRESULT.NULL
     4036    return null
    40374037} 
    40384038 
     
    40774077    if (struct_.CtlType is OS.ODT_MENU) { 
    40784078        MenuItem item = display.getMenuItem (struct_.itemID); 
    4079         if (item is null) return LRESULT.NULL
     4079        if (item is null) return null
    40804080        return item.wmMeasureChild (wParam, lParam); 
    40814081    } 
    40824082    auto hwnd = OS.GetDlgItem (handle, struct_.CtlID); 
    40834083    Control control = display.getControl (hwnd); 
    4084     if (control is null) return LRESULT.NULL
     4084    if (control is null) return null
    40854085    return control.wmMeasureChild (wParam, lParam); 
    40864086} 
     
    40984098    if (type is 0 || type is OS.MF_SYSMENU) { 
    40994099        display.mnemonicKeyHit = false; 
    4100         return cast( LRESULT )(OS.MNC_CLOSE << 16); 
    4101     } 
    4102     return LRESULT.NULL
     4100        return new LRESULT (OS.MNC_CLOSE << 16); 
     4101    } 
     4102    return null
    41034103} 
    41044104 
     
    41364136        */ 
    41374137        shell.activeMenu = null; 
    4138         return LRESULT.NULL
    4139     } 
    4140     if ((code & OS.MF_SYSMENU) !is 0) return LRESULT.NULL
     4138        return null
     4139    } 
     4140    if ((code & OS.MF_SYSMENU) !is 0) return null
    41414141    if ((code & OS.MF_HILITE) !is 0) { 
    41424142        MenuItem item = null; 
     
    41954195        if (item !is null) item.sendEvent (DWT.Arm); 
    41964196    } 
    4197     return LRESULT.NULL
     4197    return null
    41984198} 
    41994199 
    42004200LRESULT WM_MOUSEACTIVATE (int wParam, int lParam) { 
    4201     return LRESULT.NULL
     4201    return null
    42024202} 
    42034203 
     
    42334233    sendEvent (DWT.Move); 
    42344234    // widget could be disposed at this point 
    4235     return LRESULT.NULL
     4235    return null
    42364236} 
    42374237 
    42384238LRESULT WM_NCACTIVATE (int wParam, int lParam) { 
    4239     return LRESULT.NULL
     4239    return null
    42404240} 
    42414241 
    42424242LRESULT WM_NCCALCSIZE (int wParam, int lParam) { 
    4243     return LRESULT.NULL
     4243    return null
    42444244} 
    42454245 
    42464246LRESULT WM_NCHITTEST (int wParam, int lParam) { 
    4247     if (!OS.IsWindowEnabled (handle)) return LRESULT.NULL
    4248     if (!isActive ()) return cast( LRESULT )(OS.HTTRANSPARENT); 
    4249     return LRESULT.NULL
     4247    if (!OS.IsWindowEnabled (handle)) return null
     4248    if (!isActive ()) return new LRESULT (OS.HTTRANSPARENT); 
     4249    return null
    42504250} 
    42514251 
    42524252LRESULT WM_NCLBUTTONDOWN (int wParam, int lParam) { 
    4253     return LRESULT.NULL
     4253    return null
    42544254} 
    42554255 
    42564256LRESULT WM_NCPAINT (int wParam, int lParam) { 
    4257     return LRESULT.NULL
     4257    return null
    42584258} 
    42594259 
     
    42684268 
    42694269LRESULT WM_PALETTECHANGED (int wParam, int lParam) { 
    4270     return LRESULT.NULL
     4270    return null
    42714271} 
    42724272 
    42734273LRESULT WM_PARENTNOTIFY (int wParam, int lParam) { 
    4274     return LRESULT.NULL
     4274    return null
    42754275} 
    42764276 
    42774277LRESULT WM_PASTE (int wParam, int lParam) { 
    4278     return LRESULT.NULL
     4278    return null
    42794279} 
    42804280 
     
    42844284 
    42854285LRESULT WM_PRINTCLIENT (int wParam, int lParam) { 
    4286     return LRESULT.NULL
     4286    return null
    42874287} 
    42884288 
    42894289LRESULT WM_QUERYENDSESSION (int wParam, int lParam) { 
    4290     return LRESULT.NULL
     4290    return null
    42914291} 
    42924292 
    42934293LRESULT WM_QUERYNEWPALETTE (int wParam, int lParam) { 
    4294     return LRESULT.NULL
     4294    return null
    42954295} 
    42964296 
    42974297LRESULT WM_QUERYOPEN (int wParam, int lParam) { 
    4298     return LRESULT.NULL
     4298    return null
    42994299} 
    43004300 
     
    43154315    if (hitTest is OS.HTCLIENT) { 
    43164316        Control control = display.getControl (cast(HANDLE)wParam); 
    4317         if (control is null) return LRESULT.NULL
     4317        if (control is null) return null
    43184318        Cursor cursor = control.findCursor (); 
    43194319        if (cursor !is null) { 
     
    43224322        } 
    43234323    } 
    4324     return LRESULT.NULL
     4324    return null
    43254325} 
    43264326 
     
    43304330 
    43314331LRESULT WM_SETTINGCHANGE (int wParam, int lParam) { 
    4332     return LRESULT.NULL
     4332    return null
    43334333} 
    43344334 
    43354335LRESULT WM_SETFONT (int wParam, int lParam) { 
    4336     return LRESULT.NULL
     4336    return null
    43374337} 
    43384338 
    43394339LRESULT WM_SETREDRAW (int wParam, int lParam) { 
    4340     return LRESULT.NULL
     4340    return null
    43414341} 
    43424342 
    43434343LRESULT WM_SHOWWINDOW (int wParam, int lParam) { 
    4344     return LRESULT.NULL
     4344    return null
    43454345} 
    43464346 
     
    43484348    sendEvent (DWT.Resize); 
    43494349    // widget could be disposed at this point 
    4350     return LRESULT.NULL
     4350    return null
    43514351} 
    43524352 
     
    43564356 
    43574357LRESULT WM_SYSCOLORCHANGE (int wParam, int lParam) { 
    4358     return LRESULT.NULL
     4358    return null
    43594359} 
    43604360 
     
    44704470        default: 
    44714471    } 
    4472     return LRESULT.NULL
     4472    return null
    44734473} 
    44744474 
     
    44824482 
    44834483LRESULT WM_TIMER (int wParam, int lParam) { 
    4484     return LRESULT.NULL
     4484    return null
    44854485} 
    44864486 
    44874487LRESULT WM_UNDO (int wParam, int lParam) { 
    4488     return LRESULT.NULL
     4488    return null
    44894489} 
    44904490 
    44914491LRESULT WM_UPDATEUISTATE (int wParam, int lParam) { 
    4492     return LRESULT.NULL
     4492    return null
    44934493} 
    44944494 
    44954495LRESULT WM_VSCROLL (int wParam, int lParam) { 
    44964496    Control control = display.getControl (cast(HANDLE)lParam); 
    4497     if (control is null) return LRESULT.NULL
     4497    if (control is null) return null
    44984498    return control.wmScrollChild (wParam, lParam); 
    44994499} 
    45004500 
    45014501LRESULT WM_WINDOWPOSCHANGED (int wParam, int lParam) { 
    4502     return LRESULT.NULL
     4502    return null
    45034503} 
    45044504 
     
    45234523        } 
    45244524    } 
    4525     return LRESULT.NULL
     4525    return null
    45264526} 
    45274527 
     
    45514551                    fillThemeBackground (cast(HANDLE)wParam, control, &rect); 
    45524552                    OS.SetBkMode (cast(HANDLE)wParam, OS.TRANSPARENT); 
    4553                     return cast( LRESULT )(OS.GetStockObject (OS.NULL_BRUSH)); 
     4553                    return new LRESULT ( cast(int) OS.GetStockObject (OS.NULL_BRUSH)); 
    45544554                } 
    45554555            } 
    45564556        } 
    4557         if (foreground is -1) return LRESULT.NULL
     4557        if (foreground is -1) return null
    45584558    } 
    45594559    if (control is null) control = this; 
     
    45794579        } 
    45804580        OS.SetBkMode (cast(HANDLE)wParam, OS.TRANSPARENT); 
    4581         return cast( LRESULT )(hBrush); 
     4581        return new LRESULT ( cast(int) hBrush); 
    45824582    } 
    45834583    auto hBrush = findBrush (backPixel, OS.BS_SOLID); 
     
    45894589        OS.SelectObject (cast(HANDLE)wParam, hOldBrush); 
    45904590    } 
    4591     return cast( LRESULT )(hBrush); 
     4591    return new LRESULT ( cast(int) hBrush); 
    45924592} 
    45934593 
    45944594LRESULT wmCommandChild (int wParam, int lParam) { 
    4595     return LRESULT.NULL
     4595    return null
    45964596} 
    45974597 
    45984598LRESULT wmDrawChild (int wParam, int lParam) { 
    4599     return LRESULT.NULL
     4599    return null
    46004600} 
    46014601 
    46024602LRESULT wmMeasureChild (int wParam, int lParam) { 
    4603     return LRESULT.NULL
     4603    return null
    46044604} 
    46054605 
    46064606LRESULT wmNotify (NMHDR* hdr, int wParam, int lParam) { 
    46074607    Control control = display.getControl (hdr.hwndFrom); 
    4608     if (control is null) return LRESULT.NULL
     4608    if (control is null) return null
    46094609    return control.wmNotifyChild (hdr, wParam, lParam); 
    46104610} 
    46114611 
    46124612LRESULT wmNotifyChild (NMHDR* hdr, int wParam, int lParam) { 
    4613     return LRESULT.NULL
     4613    return null
    46144614} 
    46154615 
    46164616LRESULT wmScrollChild (int wParam, int lParam) { 
    4617     return LRESULT.NULL
    4618 } 
    4619  
    4620 } 
     4617    return null
     4618} 
     4619 
     4620} 
  • dwt/widgets/Control.d

    r108 r109  
    19631963//  checkWidget (); 
    19641964    if (!OS.IsWindowVisible (handle)) return; 
    1965     if (OS.IsWinCE) { 
     1965    static if (OS.IsWinCE) { 
    19661966        OS.InvalidateRect (handle, null, true); 
    19671967    } else { 
     
    20072007    RECT rect; 
    20082008    OS.SetRect (&rect, x, y, x + width, y + height); 
    2009     if (OS.IsWinCE) { 
     2009    static if (OS.IsWinCE) { 
    20102010        OS.InvalidateRect (handle, &rect, true); 
    20112011    } else { 
     
    25022502 
    25032503void setBackgroundImage (HBITMAP hBitmap) { 
    2504     if (OS.IsWinCE) { 
     2504    static if (OS.IsWinCE) { 
    25052505        OS.InvalidateRect (handle, null, true); 
    25062506    } else { 
     
    25112511 
    25122512void setBackgroundPixel (int pixel) { 
    2513     if (OS.IsWinCE) { 
     2513    static if (OS.IsWinCE) { 
    25142514        OS.InvalidateRect (handle, null, true); 
    25152515    } else { 
     
    28742874    * not running on WinCE. 
    28752875    */ 
    2876     if (!OS.IsWinCE) flags |= OS.SWP_DRAWFRAME; 
     2876    static if (!OS.IsWinCE) flags |= OS.SWP_DRAWFRAME; 
    28772877    setBounds (x, y, 0, 0, flags); 
    28782878} 
     
    29932993                if (handle !is topHandle_) OS.ShowWindow (handle, OS.SW_HIDE); 
    29942994            } else { 
    2995                 if (OS.IsWinCE) { 
     2995                static if (OS.IsWinCE) { 
    29962996                    OS.InvalidateRect (topHandle_, null, true); 
    29972997                    if (handle !is topHandle_) OS.InvalidateRect (handle, null, true); 
     
    35793579void update (bool all) { 
    35803580//  checkWidget (); 
    3581     if (OS.IsWinCE) { 
     3581    static if (OS.IsWinCE) { 
    35823582        OS.UpdateWindow (handle); 
    35833583    } else { 
     
    39323932 
    39333933LRESULT WM_HELP (int wParam, int lParam) { 
    3934     if (OS.IsWinCE) return null; 
     3934    static if (OS.IsWinCE) return null; 
    39353935    HELPINFO* lphi = cast(HELPINFO*)lParam; 
    39363936    Decorations shell = menuShell (); 
  • dwt/widgets/ExpandBar.d

    r107 r109  
    3636 
    3737import dwt.dwthelper.utils; 
     38import tango.util.log.Trace; 
     39void trc( long line ){ 
     40    //Trace.formatln( "ExpandBar {}", line ); 
     41} 
    3842 
    3943/** 
     
    132136} 
    133137 
    134 override LRESULT callWindowProc (HWND hwnd, int msg, int wParam, int lParam) { 
    135     if (handle is null) return LRESULT.ZERO
     138override int callWindowProc (HWND hwnd, int msg, int wParam, int lParam) { 
     139    if (handle is null) return 0
    136140    return cast(LRESULT) OS.DefWindowProc (hwnd, msg, wParam, lParam); 
    137141} 
     
    588592 
    589593override LRESULT WM_KEYDOWN (int wParam, int lParam) { 
     594trc(__LINE__); 
    590595    LRESULT result = super.WM_KEYDOWN (wParam, lParam); 
    591     if (result !is LRESULT.NULL) return result; 
     596    if (result !is null) return result; 
    592597    if (focusItem is null) return result; 
    593598    switch (wParam) { 
     
    626631 
    627632override LRESULT WM_KILLFOCUS (int wParam, int lParam) { 
     633trc(__LINE__); 
    628634    LRESULT result = super.WM_KILLFOCUS (wParam, lParam); 
    629635    if (focusItem !is null) focusItem.redraw (true); 
     
    632638 
    633639override LRESULT WM_LBUTTONDOWN (int wParam, int lParam) { 
     640//trc(__LINE__); 
    634641    LRESULT result = super.WM_LBUTTONDOWN (wParam, lParam); 
    635642    if (result is LRESULT.ZERO) return result; 
     
    668675 
    669676override LRESULT WM_MOUSELEAVE (int wParam, int lParam) { 
     677trc(__LINE__); 
    670678    LRESULT result = super.WM_MOUSELEAVE (wParam, lParam); 
    671     if (result !is LRESULT.NULL) return result; 
     679    if (result !is null) return result; 
    672680    for (int i = 0; i < itemCount; i++) { 
    673681        ExpandItem item = items [i]; 
     
    682690 
    683691override LRESULT WM_MOUSEMOVE (int wParam, int lParam) { 
     692trc(__LINE__); 
    684693    LRESULT result = super.WM_MOUSEMOVE (wParam, lParam); 
    685694    if (result is LRESULT.ZERO) return result; 
     
    698707 
    699708override LRESULT WM_PAINT (int wParam, int lParam) { 
     709trc(__LINE__); 
    700710    PAINTSTRUCT ps; 
    701711    GCData data = new GCData (); 
     
    727737 
    728738override LRESULT WM_PRINTCLIENT (int wParam, int lParam) { 
     739trc(__LINE__); 
    729740    LRESULT result = super.WM_PRINTCLIENT (wParam, lParam); 
    730741    RECT rect; 
     
    740751 
    741752override LRESULT WM_SETCURSOR (int wParam, int lParam) { 
     753trc(__LINE__); 
    742754    LRESULT result = super.WM_SETCURSOR (wParam, lParam); 
    743     if (result !is LRESULT.NULL) return result; 
     755    if (result !is null) return result; 
    744756    int hitTest = lParam & 0xFFFF; 
    745757    if (hitTest is OS.HTCLIENT) { 
     
    757769 
    758770override LRESULT WM_SETFOCUS (int wParam, int lParam) { 
     771trc(__LINE__); 
    759772    LRESULT result = super.WM_SETFOCUS (wParam, lParam); 
    760773    if (focusItem !is null) focusItem.redraw (true); 
     
    763776 
    764777override LRESULT WM_SIZE (int wParam, int lParam) { 
     778trc(__LINE__); 
    765779    LRESULT result = super.WM_SIZE (wParam, lParam); 
    766780    RECT rect; 
     
    777791 
    778792override LRESULT wmScroll (ScrollBar bar, bool update, HWND hwnd, int msg, int wParam, int lParam) { 
     793trc(__LINE__); 
    779794    LRESULT result = super.wmScroll (bar, true, hwnd, msg, wParam, lParam); 
    780795    SCROLLINFO info; 
  • dwt/widgets/ExpandBar.d

    r108 r109  
    165165                    hCurrentFont = hFont; 
    166166                } else { 
    167                     if (!OS.IsWinCE) { 
     167                    static if (!OS.IsWinCE) { 
    168168                        NONCLIENTMETRICS info; 
    169169                        info.cbSize = NONCLIENTMETRICS.sizeof; 
     
    288288    HFONT hCaptionFont, oldFont; 
    289289    if (hTheme is null) { 
    290         if (!OS.IsWinCE && hFont is null) { 
    291             NONCLIENTMETRICS info; 
    292             info.cbSize = NONCLIENTMETRICS.sizeof; 
    293             if (OS.SystemParametersInfo (OS.SPI_GETNONCLIENTMETRICS, 0, &info, 0)) { 
    294                 LOGFONT* logFont = &info.lfCaptionFont; 
    295                 hCaptionFont = OS.CreateFontIndirect (logFont); 
    296                 oldFont = OS.SelectObject (gc.handle, hCaptionFont); 
     290        static if (!OS.IsWinCE ) {  
     291            if (hFont is null) { 
     292                NONCLIENTMETRICS info; 
     293                info.cbSize = NONCLIENTMETRICS.sizeof; 
     294                if (OS.SystemParametersInfo (OS.SPI_GETNONCLIENTMETRICS, 0, &info, 0)) { 
     295                    LOGFONT* logFont = &info.lfCaptionFont; 
     296                    hCaptionFont = OS.CreateFontIndirect (logFont); 
     297                    oldFont = OS.SelectObject (gc.handle, hCaptionFont); 
     298                } 
    297299            } 
    298300        } 
     
    498500override void setBackgroundPixel (int pixel) { 
    499501    super.setBackgroundPixel (pixel); 
    500     if (!OS.IsWinCE) { 
     502    static if (!OS.IsWinCE) { 
    501503        int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE | OS.RDW_ALLCHILDREN; 
    502504        OS.RedrawWindow (handle, null, null, flags); 
     
    512514override void setForegroundPixel (int pixel) { 
    513515    super.setForegroundPixel (pixel); 
    514     if (!OS.IsWinCE) { 
     516    static if (!OS.IsWinCE) { 
    515517        int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE | OS.RDW_ALLCHILDREN; 
    516518        OS.RedrawWindow (handle, null, null, flags); 
  • dwt/widgets/Widget.d

    r107 r109  
    3333import tango.util.log.Trace; 
    3434void trc( long line ){ 
    35     //Trace.formatln( "Widget {}", line ); 
     35//    Trace.formatln( "Widget {}", line ); 
    3636} 
    3737 
     
    6565public abstract class Widget { 
    6666 
    67     public enum LRESULT { 
    68         NULL = -1, 
    69         ZERO = 0, 
    70         ONE = 1, 
    71     } 
    72  
    73  
    7467    int style, state; 
    7568    Display display; 
    7669    EventTable eventTable; 
    7770    Object data; 
     71 
     72    public alias dwt.internal.win32.OS.LDWTRESULT LRESULT; 
    7873 
    7974    /* Global state flags */ 
     
    238233} 
    239234 
    240 LRESULT callWindowProc (HWND hwnd, int msg, int wParam, int lParam) { 
    241     return LRESULT.ZERO
     235int callWindowProc (HWND hwnd, int msg, int wParam, int lParam) { 
     236    return 0
    242237} 
    243238 
     
    13131308LRESULT wmCaptureChanged (HWND hwnd, int wParam, int lParam) { 
    13141309    display.captureChanged = true; 
    1315     return LRESULT.NULL
     1310    return null
    13161311} 
    13171312 
     
    13221317    if (!OS.IsUnicode && OS.IsDBLocale) { 
    13231318        byte lead = cast(byte) (wParam & 0xFF); 
    1324         if (OS.IsDBCSLeadByte (lead)) return LRESULT.NULL
     1319        if (OS.IsDBCSLeadByte (lead)) return null
    13251320    } 
    13261321    display.lastAscii = wParam; 
     
    13301325    } 
    13311326    // widget could be disposed at this point 
    1332     return LRESULT.NULL
     1327    return null
    13331328} 
    13341329 
    13351330LRESULT wmContextMenu (HWND hwnd, int wParam, int lParam) { 
    1336     if (wParam !is cast(int)hwnd) return LRESULT.NULL
     1331    if (wParam !is cast(int)hwnd) return null
    13371332 
    13381333    /* 
     
    13471342    * not support WM_CONTEXTMENU. 
    13481343    */ 
    1349     static if (OS.IsWinCE) return LRESULT.NULL
     1344    static if (OS.IsWinCE) return null
    13501345 
    13511346    /* 
     
    13681363        RECT rect; 
    13691364        OS.GetClientRect (hwnd, &rect); 
    1370         if (!OS.PtInRect (&rect, pt)) return LRESULT.NULL
     1365        if (!OS.PtInRect (&rect, pt)) return null
    13711366    } else { 
    13721367        int pos = OS.GetMessagePos (); 
     
    13761371 
    13771372    /* Show the menu */ 
    1378     return showMenu (x, y) ? LRESULT.ZERO : LRESULT.NULL
     1373    return showMenu (x, y) ? LRESULT.ZERO : null
    13791374} 
    13801375 
     
    14031398        case OS.VK_NUMLOCK: 
    14041399        case OS.VK_SCROLL: 
    1405             if ((lParam & 0x40000000) !is 0) return LRESULT.NULL
     1400            if ((lParam & 0x40000000) !is 0) return null
    14061401        default: 
    14071402    } 
     
    14161411    if (!OS.IsUnicode && OS.IsDBLocale) { 
    14171412        byte lead = cast(byte) (wParam & 0xFF); 
    1418         if (OS.IsDBCSLeadByte (lead)) return LRESULT.NULL
     1413        if (OS.IsDBCSLeadByte (lead)) return null
    14191414    } 
    14201415 
     
    14611456    */ 
    14621457    if (OS.IsWinNT) { 
    1463         if ((mapKey & 0x80000000) !is 0) return LRESULT.NULL
    1464     } else { 
    1465         if ((mapKey & 0x8000) !is 0) return LRESULT.NULL
     1458        if ((mapKey & 0x80000000) !is 0) return null
     1459    } else { 
     1460        if ((mapKey & 0x8000) !is 0) return null
    14661461    } 
    14671462    MSG msg; 
     
    14711466        display.lastVirtual = mapKey is 0; 
    14721467        display.lastKey = display.lastVirtual ? wParam : mapKey; 
    1473         return LRESULT.NULL
     1468        return null
    14741469    } 
    14751470 
     
    15371532            * ALT+0231 should gives 'c' with a cedilla when NumLock is down). 
    15381533            */ 
    1539             if (display.asciiKey (display.lastKey) !is 0) return LRESULT.NULL
     1534            if (display.asciiKey (display.lastKey) !is 0) return null
    15401535            display.lastAscii = display.numpadKey (display.lastKey); 
    15411536        } 
     
    15751570            * issue the event from WM_CHAR. 
    15761571            */ 
    1577             if (asciiKey is ' ') return LRESULT.NULL
    1578             if (asciiKey !is wParam) return LRESULT.NULL
     1572            if (asciiKey is ' ') return null
     1573            if (asciiKey !is wParam) return null
    15791574            /* 
    15801575            * Feature in Windows. The virtual key VK_CANCEL is treated 
     
    15841579            * VK_CANCEL and issue the event from WM_CHAR. 
    15851580            */ 
    1586             if (wParam is OS.VK_CANCEL) return LRESULT.NULL
     1581            if (wParam is OS.VK_CANCEL) return null
    15871582        } 
    15881583 
     
    15931588        * key event from WM_CHAR. 
    15941589        */ 
    1595         if (OS.GetKeyState (OS.VK_CONTROL) >= 0) return LRESULT.NULL
     1590        if (OS.GetKeyState (OS.VK_CONTROL) >= 0) return null
    15961591 
    15971592        /* 
     
    16101605 
    16111606        /* Note that Ctrl+'@' is ASCII NUL and is delivered in WM_CHAR */ 
    1612         if (display.lastAscii is '@') return LRESULT.NULL
     1607        if (display.lastAscii is '@') return null
    16131608        display.lastAscii = display.controlKey (display.lastAscii); 
    16141609    } 
     
    16171612    } 
    16181613    // widget could be disposed at this point 
    1619     return LRESULT.NULL
     1614    return null
    16201615} 
    16211616 
     
    16341629            if (setInputState (event, type)) sendEvent (type, event); 
    16351630            // widget could be disposed at this point 
    1636             return LRESULT.NULL
     1631            return null
    16371632        } 
    16381633    } 
     
    16451640        display.lastKey = display.lastAscii = 0; 
    16461641        display.lastVirtual = display.lastNull = display.lastDead = false; 
    1647         return LRESULT.NULL
     1642        return null
    16481643    } 
    16491644 
     
    16831678    */ 
    16841679    if (OS.IsWinNT) { 
    1685         if ((mapKey & 0x80000000) !is 0) return LRESULT.NULL
    1686     } else { 
    1687         if ((mapKey & 0x8000) !is 0) return LRESULT.NULL
    1688     } 
    1689     if (display.lastDead) return LRESULT.NULL
     1680        if ((mapKey & 0x80000000) !is 0) return null
     1681    } else { 
     1682        if ((mapKey & 0x8000) !is 0) return null
     1683    } 
     1684    if (display.lastDead) return null
    16901685 
    16911686    /* 
     
    17101705            display.lastAscii = 0; 
    17111706            display.lastNull = display.lastDead = false; 
    1712             return LRESULT.NULL
    1713         } 
    1714     } 
    1715     LRESULT result = LRESULT.NULL
     1707            return null
     1708        } 
     1709    } 
     1710    LRESULT result = null
    17161711    if (!sendKeyEvent (DWT.KeyUp, OS.WM_KEYUP, wParam, lParam)) { 
    17171712        result = LRESULT.ONE; 
     
    17241719 
    17251720LRESULT wmKillFocus (HWND hwnd, int wParam, int lParam) { 
    1726     LRESULT code = callWindowProc (hwnd, OS.WM_KILLFOCUS, wParam, lParam); 
    1727     assert( code !is LRESULT.NULL ); 
     1721    int code = callWindowProc (hwnd, OS.WM_KILLFOCUS, wParam, lParam); 
    17281722    sendFocusEvent (DWT.FocusOut); 
    17291723    // widget could be disposed at this point 
     
    17381732    if (isDisposed ()) return LRESULT.ZERO; 
    17391733    if (code is 0) return LRESULT.ZERO; 
    1740     return cast(LRESULT) code
     1734    return new LRESULT(code)
    17411735} 
    17421736 
     
    17551749    * fix is to send a mouse down event. 
    17561750    */ 
    1757     LRESULT result = LRESULT.NULL
     1751    LRESULT result = null
    17581752    Display display = this.display; 
    17591753    display.captureChanged = false; 
    17601754    sendMouseEvent (DWT.MouseDown, 1, hwnd, OS.WM_LBUTTONDOWN, wParam, lParam); 
    17611755    if (sendMouseEvent (DWT.MouseDoubleClick, 1, hwnd, OS.WM_LBUTTONDBLCLK, wParam, lParam)) { 
    1762         result = callWindowProc (hwnd, OS.WM_LBUTTONDBLCLK, wParam, lParam); 
    1763         assert( result !is LRESULT.NULL ); 
     1756        result = new LRESULT( callWindowProc (hwnd, OS.WM_LBUTTONDBLCLK, wParam, lParam)); 
    17641757    } else { 
    17651758        result = LRESULT.ZERO; 
     
    17731766LRESULT wmLButtonDown (HWND hwnd, int wParam, int lParam) { 
    17741767    Display display = this.display; 
    1775     LRESULT result = LRESULT.NULL
     1768    LRESULT result = null
    17761769    int x = cast(short) (lParam & 0xFFFF); 
    17771770    int y = cast(short) (lParam >> 16); 
     
    17991792    bool dispatch = sendMouseEvent (DWT.MouseDown, 1, count, 0, false, hwnd, OS.WM_LBUTTONDOWN, wParam, lParam); 
    18001793    if (dispatch && (consume is null || !consume [0])) { 
    1801         result = callWindowProc (hwnd, OS.WM_LBUTTONDOWN, wParam, lParam); 
    1802         assert( result !is LRESULT.NULL ); 
     1794        result = new LRESULT( callWindowProc (hwnd, OS.WM_LBUTTONDOWN, wParam, lParam)); 
    18031795    } else { 
    18041796        result = LRESULT.ZERO; 
     
    18641856LRESULT wmLButtonUp (HWND hwnd, int wParam, int lParam) { 
    18651857    Display display = this.display; 
    1866     LRESULT result = LRESULT.NULL; 
     1858    LRESULT result = null; 
     1859trc(__LINE__); 
    18671860    if (sendMouseEvent (DWT.MouseUp, 1, hwnd, OS.WM_LBUTTONUP, wParam, lParam)) { 
    1868         result = callWindowProc (hwnd, OS.WM_LBUTTONUP, wParam, lParam); 
    1869         assert( result !is LRESULT.NULL ); 
     1861trc(__LINE__); 
     1862        result = new LRESULT( callWindowProc (hwnd, OS.WM_LBUTTONUP, wParam, lParam)); 
    18701863    } else { 
    18711864        result = LRESULT.ZERO; 
     
    18821875        if (OS.GetCapture () is hwnd) OS.ReleaseCapture (); 
    18831876    } 
     1877Trace.formatln( "result={}", result ); 
    18841878    return result; 
    18851879} 
     
    18991893    * fix is to send a mouse down event. 
    19001894    */ 
    1901     LRESULT result = LRESULT.NULL
     1895    LRESULT result = null
    19021896    Display display = this.display; 
    19031897    display.captureChanged = false; 
    19041898    sendMouseEvent (DWT.MouseDown, 2, hwnd, OS.WM_MBUTTONDOWN, wParam, lParam); 
    19051899    if (sendMouseEvent (DWT.MouseDoubleClick, 2, hwnd, OS.WM_MBUTTONDBLCLK, wParam, lParam)) { 
    1906         result = callWindowProc (hwnd, OS.WM_MBUTTONDBLCLK, wParam, lParam); 
    1907         assert( result !is LRESULT.NULL ); 
     1900        result = new LRESULT( callWindowProc (hwnd, OS.WM_MBUTTONDBLCLK, wParam, lParam)); 
    19081901    } else { 
    19091902        result = LRESULT.ZERO; 
     
    19161909 
    19171910LRESULT wmMButtonDown (HWND hwnd, int wParam, int lParam) { 
    1918     LRESULT result = LRESULT.NULL
     1911    LRESULT result = null
    19191912    Display display = this.display; 
    19201913    display.captureChanged = false; 
    19211914    if (sendMouseEvent (DWT.MouseDown, 2, hwnd, OS.WM_MBUTTONDOWN, wParam, lParam)) { 
    1922         result = callWindowProc (hwnd, OS.WM_MBUTTONDOWN, wParam, lParam); 
    1923         assert( result !is LRESULT.NULL ); 
     1915        result = new LRESULT( callWindowProc (hwnd, OS.WM_MBUTTONDOWN, wParam, lParam)); 
    19241916    } else { 
    19251917        result = LRESULT.ZERO; 
     
    19331925LRESULT wmMButtonUp (HWND hwnd, int wParam, int lParam) { 
    19341926    Display display = this.display; 
    1935     LRESULT result = LRESULT.NULL
     1927    LRESULT result = null
    19361928    if (sendMouseEvent (DWT.MouseUp, 2, hwnd, OS.WM_MBUTTONUP, wParam, lParam)) { 
    1937         result = callWindowProc (hwnd, OS.WM_MBUTTONUP, wParam, lParam); 
    1938         assert( result !is LRESULT.NULL ); 
     1929        result = new LRESULT( callWindowProc (hwnd, OS.WM_MBUTTONUP, wParam, lParam)); 
    19391930    } else { 
    19401931        result = LRESULT.ZERO; 
     
    19581949        return LRESULT.ZERO; 
    19591950    } 
    1960     return LRESULT.NULL
     1951    return null
    19611952} 
    19621953 
    19631954LRESULT wmMouseLeave (HWND hwnd, int wParam, int lParam) { 
    1964     if (!hooks (DWT.MouseExit) && !filters (DWT.MouseExit)) return LRESULT.NULL
     1955    if (!hooks (DWT.MouseExit) && !filters (DWT.MouseExit)) return null
    19651956    int pos = OS.GetMessagePos (); 
    19661957    POINT pt; 
     
    19721963        return LRESULT.ZERO; 
    19731964    } 
    1974     return LRESULT.NULL
     1965    return null
    19751966} 
    19761967 
    19771968LRESULT wmMouseMove (HWND hwnd, int wParam, int lParam) { 
    1978     LRESULT result = LRESULT.NULL
     1969    LRESULT result = null