Changeset 35:99d8b02576c3

Show
Ignore:
Timestamp:
01/28/08 18:16:12 (1 year ago)
Author:
Frank Benoit <benoit@tionex.de>
branch:
default
Message:

Control

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • dwt/accessibility/Accessible.d

    r34 r35  
    1313module dwt.accessibility.Accessible; 
    1414 
     15import dwt.widgets.Control; 
    1516//PORTING_TYPE 
    1617public class Accessible { 
     18    public static Accessible internal_new_Accessible(Control control) ; 
     19    public void internal_dispose_Accessible() ; 
     20    public int /*long*/ internal_WM_GETOBJECT (int /*long*/ wParam, int /*long*/ lParam) ; 
    1721} 
    1822 
  • dwt/internal/win32/OS.d

    r33 r35  
    44754475alias WINAPI.SetBkColor SetBkColor; 
    44764476alias WINAPI.SetBkMode SetBkMode; 
     4477alias STDWIN.SetBrushOrgEx SetBrushOrgEx; 
    44774478alias WINAPI.SetCapture SetCapture; 
    44784479alias WINAPI.SetCaretPos SetCaretPos; 
  • dwt/widgets/Composite.d

    r33 r35  
    1515import dwt.widgets.Scrollable; 
    1616import dwt.widgets.Control; 
     17import dwt.widgets.Layout; 
    1718import dwt.graphics.Font; 
     19import dwt.internal.win32.OS; 
    1820 
    1921class Composite : Scrollable { 
     22    Layout layout_; 
     23    int font; 
     24    WINDOWPOS* [] lpwp; 
     25    Control [] tabList; 
     26    int layoutCount, backgroundMode; 
     27 
    2028public Control [] getChildren () ; 
    2129void updateFont (Font oldFont, Font newFont) ; 
     
    2432public void layout (bool , bool ) ; 
    2533public void layout (Control[]) ; 
     34Control [] _getTabList () ; 
     35void removeControl (Control control) ; 
     36Control [] _getChildren () ; 
    2637} 
    2738/++ 
     
    3445import dwt.graphics.Point; 
    3546import dwt.graphics.Rectangle; 
    36 import dwt.internal.Callback; 
    37 import dwt.internal.win32.LRESULT; 
    38 import dwt.internal.win32.MSG; 
    39 import dwt.internal.win32.NMHDR; 
    40 import dwt.internal.win32.NMTTDISPINFO; 
    41 import dwt.internal.win32.NMTTDISPINFOA; 
    42 import dwt.internal.win32.NMTTDISPINFOW; 
    4347import dwt.internal.win32.OS; 
    44 import dwt.internal.win32.PAINTSTRUCT; 
    45 import dwt.internal.win32.POINT; 
    46 import dwt.internal.win32.RECT; 
    47 import dwt.internal.win32.WINDOWPOS; 
    4848 
    4949/** 
     
    8080    Layout layout; 
    8181    int font; 
    82     WINDOWPOS [] lpwp; 
     82    WINDOWPOS* [] lpwp; 
    8383    Control [] tabList; 
    8484    int layoutCount, backgroundMode; 
  • dwt/widgets/Control.d

    r34 r35  
    8383import dwt.widgets.Event; 
    8484import dwt.widgets.Shell; 
     85import dwt.widgets.Menu; 
     86import dwt.widgets.MenuItem; 
     87import dwt.widgets.Decorations; 
     88import dwt.widgets.TypedListener; 
     89import dwt.widgets.Listener; 
     90import dwt.widgets.Display; 
     91 
     92import dwt.dwthelper.utils; 
     93import dwt.dwthelper.System; 
    8594 
    8695/** 
     
    104113 
    105114public abstract class Control : Widget, Drawable { 
     115 
     116    alias Widget.dragDetect dragDetect; 
     117 
    106118    /** 
    107119     * the handle to the OS resource 
     
    500512} 
    501513 
    502 int borderHandle () { 
     514HANDLE borderHandle () { 
    503515    return handle; 
    504516} 
     
    510522    Composite composite = parent; 
    511523    do { 
    512         int mode = composite.backgroundMode; 
     524        auto mode = composite.backgroundMode; 
    513525        if (mode !is 0) { 
    514526            if (mode is DWT.INHERIT_DEFAULT) { 
     
    537549} 
    538550 
    539 bool checkHandle (int hwnd) { 
     551bool checkHandle (HWND hwnd) { 
    540552    return hwnd is handle; 
    541553} 
     
    669681    int bits = OS.GetWindowLong (handle, OS.GWL_STYLE); 
    670682    if ((bits & OS.WS_CHILD) !is 0) { 
    671         OS.SetWindowLong (handle, OS.GWL_ID, handle); 
    672     } 
    673     if (OS.IsDBLocale && hwndParent !is 0) { 
     683        OS.SetWindowLong (handle, OS.GWL_ID, cast(int)handle); 
     684    } 
     685    if (OS.IsDBLocale && hwndParent !is null) { 
    674686        auto hIMC = OS.ImmGetContext (hwndParent); 
    675687        OS.ImmAssociateContext (handle, hIMC); 
     
    849861} 
    850862 
    851 void drawBackground (int hDC) { 
    852     RECT rect = new RECT ()
    853     OS.GetClientRect (handle, rect); 
    854     drawBackground (hDC, rect); 
    855 } 
    856  
    857 void drawBackground (int hDC, RECT rect) { 
     863void drawBackground (HDC hDC) { 
     864    RECT rect
     865    OS.GetClientRect (handle, &rect); 
     866    drawBackground (hDC, &rect); 
     867} 
     868 
     869void drawBackground (HDC hDC, RECT* rect) { 
    858870    drawBackground (hDC, rect, -1); 
    859871} 
    860872 
    861 void drawBackground (int hDC, RECT rect, int pixel) { 
     873void drawBackground (HDC hDC, RECT* rect, int pixel) { 
    862874    Control control = findBackgroundControl (); 
    863875    if (control !is null) { 
     
    883895} 
    884896 
    885 void drawImageBackground (int hDC, int hwnd, int hBitmap, RECT rect) { 
    886     RECT rect2 = new RECT ()
    887     OS.GetClientRect (hwnd, rect2); 
    888     OS.MapWindowPoints (hwnd, handle, rect2, 2); 
    889     int hBrush = findBrush (hBitmap, OS.BS_PATTERN); 
    890     POINT lpPoint = new POINT ()
    891     OS.GetWindowOrgEx (hDC, lpPoint); 
    892     OS.SetBrushOrgEx (hDC, -rect2.left - lpPoint.x, -rect2.top - lpPoint.y, lpPoint); 
    893     int hOldBrush = OS.SelectObject (hDC, hBrush); 
     897void drawImageBackground (HDC hDC, HWND hwnd, HBITMAP hBitmap, RECT* rect) { 
     898    RECT rect2
     899    OS.GetClientRect (hwnd, &rect2); 
     900    OS.MapWindowPoints (hwnd, handle, cast(POINT*)&rect2, 2); 
     901    auto hBrush = findBrush ( cast(int)hBitmap, OS.BS_PATTERN); 
     902    POINT lpPoint
     903    OS.GetWindowOrgEx (hDC, &lpPoint); 
     904    OS.SetBrushOrgEx (hDC, -rect2.left - lpPoint.x, -rect2.top - lpPoint.y, &lpPoint); 
     905    auto hOldBrush = OS.SelectObject (hDC, hBrush); 
    894906    OS.PatBlt (hDC, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, OS.PATCOPY); 
    895907    OS.SetBrushOrgEx (hDC, lpPoint.x, lpPoint.y, null); 
     
    897909} 
    898910 
    899 void drawThemeBackground (int hDC, int hwnd, RECT rect) { 
     911void drawThemeBackground (HDC hDC, HWND hwnd, RECT* rect) { 
    900912    /* Do nothing */ 
    901913} 
     
    909921} 
    910922 
    911 void fillBackground (int hDC, int pixel, RECT rect) { 
     923void fillBackground (HDC hDC, int pixel, RECT* rect) { 
    912924    if (rect.left > rect.right || rect.top > rect.bottom) return; 
    913     int hPalette = display.hPalette; 
    914     if (hPalette !is 0) { 
     925    auto hPalette = display.hPalette; 
     926    if (hPalette !is null) { 
    915927        OS.SelectPalette (hDC, hPalette, false); 
    916928        OS.RealizePalette (hDC); 
     
    919931} 
    920932 
    921 void fillImageBackground (int hDC, Control control, RECT rect) { 
     933void fillImageBackground (HDC hDC, Control control, RECT* rect) { 
    922934    if (rect.left > rect.right || rect.top > rect.bottom) return; 
    923935    if (control !is null) { 
     
    929941} 
    930942 
    931 void fillThemeBackground (int hDC, Control control, RECT rect) { 
     943void fillThemeBackground (HDC hDC, Control control, RECT* rect) { 
    932944    if (rect.left > rect.right || rect.top > rect.bottom) return; 
    933945    if (control !is null) { 
     
    941953} 
    942954 
    943 int findBrush (int value, int lbStyle) { 
     955HBRUSH findBrush (int value, int lbStyle) { 
    944956    return parent.findBrush (value, lbStyle); 
    945957} 
     
    966978char findMnemonic (char[] string) { 
    967979    int index = 0; 
    968     int length = string.length; 
     980    int length_ = string.length; 
    969981    do { 
    970         while (index < length && string.charAt (index) !is '&') index++; 
    971         if (++index >= length) return '\0'; 
     982        while (index < length_ && string.charAt (index) !is '&') index++; 
     983        if (++index >= length_) return '\0'; 
    972984        if (string.charAt (index) !is '&') return string.charAt (index); 
    973985        index++; 
    974     } while (index < length); 
     986    } while (index < length_); 
    975987    return '\0'; 
    976988} 
     
    9881000    } 
    9891001    shell.setSavedFocus (focusControl); 
    990     OS.SetFocus (0); 
     1002    OS.SetFocus (null); 
    9911003} 
    9921004 
     
    11571169    checkWidget (); 
    11581170    forceResize (); 
    1159     RECT rect = new RECT ()
    1160     OS.GetWindowRect (topHandle (), rect); 
    1161     auto hwndParent = parent is null ? 0 : parent.handle; 
    1162     OS.MapWindowPoints (0, hwndParent, rect, 2); 
     1171    RECT rect
     1172    OS.GetWindowRect (topHandle (), &rect); 
     1173    auto hwndParent = parent is null ? null : parent.handle; 
     1174    OS.MapWindowPoints (null, hwndParent, cast(POINT*)&rect, 2); 
    11631175    int width = rect.right - rect.left; 
    11641176    int height =  rect.bottom - rect.top; 
     
    11681180int getCodePage () { 
    11691181    if (OS.IsUnicode) return OS.CP_ACP; 
    1170     auto hFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0); 
     1182    auto hFont = cast(HFONT) OS.SendMessage (handle, OS.WM_GETFONT, 0, 0); 
    11711183    LOGFONT logFont; 
    11721184    OS.GetObject (hFont, LOGFONT.sizeof, &logFont); 
    11731185    int cs = logFont.lfCharSet & 0xFF; 
    11741186    int [] lpCs = new int [8]; 
    1175     if (OS.TranslateCharsetInfo (cs, lpCs, OS.TCI_SRCCHARSET)) { 
     1187    if (OS.TranslateCharsetInfo (cast(uint*)cs, cast(CHARSETINFO*)lpCs.ptr, OS.TCI_SRCCHARSET)) { 
    11761188        return lpCs [1]; 
    11771189    } 
     
    11811193char[] getClipboardText () { 
    11821194    char[] string = ""; 
    1183     if (OS.OpenClipboard (0)) { 
    1184         int hMem = OS.GetClipboardData (OS.IsUnicode ? OS.CF_UNICODETEXT : OS.CF_TEXT); 
    1185         if (hMem !is 0) { 
     1195    if (OS.OpenClipboard (null)) { 
     1196        auto hMem = OS.GetClipboardData (OS.IsUnicode ? OS.CF_UNICODETEXT : OS.CF_TEXT); 
     1197        if (hMem !is null) { 
    11861198            /* Ensure byteCount is a multiple of 2 bytes on UNICODE platforms */ 
    11871199            int byteCount = OS.GlobalSize (hMem) / TCHAR.sizeof * TCHAR.sizeof; 
    1188             int ptr = OS.GlobalLock (hMem); 
    1189             if (ptr !is 0) { 
     1200            auto ptr = OS.GlobalLock (hMem); 
     1201            if (ptr !is null) { 
    11901202                /* Use the character encoding for the default locale */ 
    1191                 TCHAR buffer = new TCHAR (0, byteCount / TCHAR.sizeof); 
    1192                 OS.MoveMemory (buffer, ptr, byteCount); 
    1193                 string = buffer.toString (0, buffer.strlen ()); 
     1203                string = TCHARzToStr( cast(TCHAR*)ptr ); 
    11941204                OS.GlobalUnlock (hMem); 
    11951205            } 
     
    12541264public bool getEnabled () { 
    12551265    checkWidget (); 
    1256     return OS.IsWindowEnabled (handle); 
     1266    return cast(bool)OS.IsWindowEnabled (handle); 
    12571267} 
    12581268 
     
    12691279public Font getFont () { 
    12701280    checkWidget (); 
    1271     auto hFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0); 
     1281    auto hFont = cast(HFONT)OS.SendMessage (handle, OS.WM_GETFONT, 0, 0); 
    12721282    if (hFont is null) hFont = defaultFont (); 
    12731283    return Font.win32_new (display, hFont); 
     
    13261336    RECT rect; 
    13271337    OS.GetWindowRect (topHandle (), &rect); 
    1328     int hwndParent = parent is null ? 0 : parent.handle; 
    1329     OS.MapWindowPoints (0, hwndParent, &rect, 2); 
     1338    auto hwndParent = parent is null ? null : parent.handle; 
     1339    OS.MapWindowPoints (null, hwndParent, cast(POINT*)&rect, 2); 
    13301340    return new Point (rect.left, rect.top); 
    13311341} 
     
    13581368 * @since 3.0 
    13591369 */ 
    1360 public Monitor getMonitor () { 
     1370public dwt.widgets.Monitor.Monitor getMonitor () { 
    13611371    checkWidget (); 
    13621372    if (OS.IsWinCE || OS.WIN32_VERSION < OS.VERSION (4, 10)) { 
     
    13751385    monitor.clientX = lpmi.rcWork.left; 
    13761386    monitor.clientY = lpmi.rcWork.top; 
    1377     monitor.clientWidth = lpmi.rcWork_right - lpmi.rcWork.left; 
    1378     monitor.clientHeight = lpmi.rcWork_bottom - lpmi.rcWork.top; 
     1387    monitor.clientWidth = lpmi.rcWork.right - lpmi.rcWork.left; 
     1388    monitor.clientHeight = lpmi.rcWork.bottom - lpmi.rcWork.top; 
    13791389    return monitor; 
    13801390} 
     
    15001510    RECT rect; 
    15011511    if (!OS.GetClientRect (handle, &rect)) return false; 
    1502     OS.MapWindowPoints (handle, 0, &rect, 2); 
     1512    OS.MapWindowPoints (handle, null, cast(POINT*)&rect, 2); 
    15031513    POINT pt; 
    1504     return OS.GetCursorPos (pt) && OS.PtInRect (&rect, pt); 
     1514    return OS.GetCursorPos (&pt) && OS.PtInRect (&rect, pt); 
    15051515} 
    15061516 
     
    15701580        auto background = control.getBackgroundPixel (); 
    15711581        if (background !is OS.GetBkColor (hDC)) data.background = background; 
    1572         data.hFont = OS.SendMessage (hwnd, OS.WM_GETFONT, 0, 0); 
     1582        data.hFont = cast(HFONT) OS.SendMessage (hwnd, OS.WM_GETFONT, 0, 0); 
    15731583        data.uiState = OS.SendMessage (hwnd, OS.WM_QUERYUISTATE, 0, 0); 
    15741584    } 
     
    17731783} 
    17741784 
    1775 void mapEvent (int hwnd, Event event) { 
     1785void mapEvent (HWND hwnd, Event event) { 
    17761786    if (hwnd !is handle) { 
    1777         POINT point = new POINT ()
     1787        POINT point
    17781788        point.x = event.x; 
    17791789        point.y = event.y; 
    1780         OS.MapWindowPoints (hwnd, handle, point, 1); 
     1790        OS.MapWindowPoints (hwnd, handle, &point, 1); 
    17811791        event.x = point.x; 
    17821792        event.y = point.y; 
     
    18221832public void moveAbove (Control control) { 
    18231833    checkWidget (); 
    1824     int topHandle = topHandle (), hwndAbove = OS.HWND_TOP; 
     1834    auto topHandle_ = topHandle (); 
     1835    HWND hwndAbove = cast(HWND) OS.HWND_TOP; 
    18251836    if (control !is null) { 
    18261837        if (control.isDisposed ()) error(DWT.ERROR_INVALID_ARGUMENT); 
    18271838        if (parent !is control.parent) return; 
    1828         int hwnd = control.topHandle (); 
    1829         if (hwnd is null || hwnd is topHandle) return; 
     1839        auto hwnd = control.topHandle (); 
     1840        if (hwnd is null || hwnd is topHandle_) return; 
    18301841        hwndAbove = OS.GetWindow (hwnd, OS.GW_HWNDPREV); 
    18311842        /* 
     
    18371848        */ 
    18381849        if (hwndAbove is null || hwndAbove is hwnd) { 
    1839             hwndAbove = OS.HWND_TOP; 
     1850            hwndAbove = cast(HWND) OS.HWND_TOP; 
    18401851        } 
    18411852    } 
    18421853    int flags = OS.SWP_NOSIZE | OS.SWP_NOMOVE | OS.SWP_NOACTIVATE; 
    1843     SetWindowPos (topHandle, hwndAbove, 0, 0, 0, 0, flags); 
     1854    SetWindowPos (topHandle_, hwndAbove, 0, 0, 0, 0, flags); 
    18441855} 
    18451856 
     
    18661877public void moveBelow (Control control) { 
    18671878    checkWidget (); 
    1868     auto topHandle = topHandle (); 
    1869     int hwndAbove = OS.HWND_BOTTOM; 
     1879    auto topHandle_ = topHandle (); 
     1880    HWND hwndAbove = cast(HWND)OS.HWND_BOTTOM; 
    18701881    if (control !is null) { 
    18711882        if (control.isDisposed ()) error(DWT.ERROR_INVALID_ARGUMENT); 
     
    18911902            * at the bottom. 
    18921903            */ 
    1893             int hwndParent = parent.handle, hwnd = hwndParent; 
     1904            auto hwndParent = parent.handle; 
     1905            auto hwnd = hwndParent; 
    18941906            hwndAbove = OS.GetWindow (hwnd, OS.GW_HWNDPREV); 
    1895             while (hwndAbove !is 0 && hwndAbove !is hwnd) { 
     1907            while (hwndAbove !is null && hwndAbove !is hwnd) { 
    18961908                if (OS.GetWindow (hwndAbove, OS.GW_OWNER) is hwndParent) break; 
    18971909                hwndAbove = OS.GetWindow (hwnd = hwndAbove, OS.GW_HWNDPREV); 
     
    19001912        } 
    19011913    } 
    1902     if (hwndAbove is 0 || hwndAbove is topHandle) return; 
     1914    if (hwndAbove is null || hwndAbove is topHandle_) return; 
    19031915    int flags = OS.SWP_NOSIZE | OS.SWP_NOMOVE | OS.SWP_NOACTIVATE; 
    1904     SetWindowPos (topHandle, hwndAbove, 0, 0, 0, 0, flags); 
     1916    SetWindowPos (topHandle_, hwndAbove, 0, 0, 0, 0, flags); 
    19051917} 
    19061918 
     
    19882000        int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE; 
    19892001        if (all) flags |= OS.RDW_ALLCHILDREN; 
    1990         OS.RedrawWindow (handle, null, 0, flags); 
     2002        OS.RedrawWindow (handle, null, null, flags); 
    19912003    } 
    19922004} 
     
    20252037    if (width <= 0 || height <= 0) return; 
    20262038    if (!OS.IsWindowVisible (handle)) return; 
    2027     RECT rect = new RECT ()
    2028     OS.SetRect (rect, x, y, x + width, y + height); 
     2039    RECT rect
     2040    OS.SetRect (&rect, x, y, x + width, y + height); 
    20292041    if (OS.IsWinCE) { 
    2030         OS.InvalidateRect (handle, rect, true); 
     2042        OS.InvalidateRect (handle, &rect, true); 
    20312043    } else { 
    20322044        int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE; 
    20332045        if (all) flags |= OS.RDW_ALLCHILDREN; 
    2034         OS.RedrawWindow (handle, rect, 0, flags); 
     2046        OS.RedrawWindow (handle, &rect, null, flags); 
    20352047    } 
    20362048} 
     
    20612073void releaseHandle () { 
    20622074    super.releaseHandle (); 
    2063     handle = 0
     2075    handle = null
    20642076    parent = null; 
    20652077} 
     
    20722084    super.releaseWidget (); 
    20732085    if (OS.IsDBLocale) { 
    2074         OS.ImmAssociateContext (handle, 0); 
     2086        OS.ImmAssociateContext (handle, null); 
    20752087    } 
    20762088    if (toolTipText_ !is null) { 
     
    23962408 
    23972409void showWidget (bool visible) { 
    2398     int topHandle = topHandle (); 
    2399     OS.ShowWindow (topHandle, visible ? OS.SW_SHOW : OS.SW_HIDE); 
    2400     if (handle !is topHandle) OS.ShowWindow (handle, visible ? OS.SW_SHOW : OS.SW_HIDE); 
     2410    auto topHandle_ = topHandle (); 
     2411    OS.ShowWindow (topHandle_, visible ? OS.SW_SHOW : OS.SW_HIDE); 
     2412    if (handle !is topHandle_) OS.ShowWindow (handle, visible ? OS.SW_SHOW : OS.SW_HIDE); 
    24012413} 
    24022414 
     
    25202532} 
    25212533 
    2522 void setBackgroundImage (int hBitmap) { 
     2534void setBackgroundImage (HBITMAP hBitmap) { 
    25232535    if (OS.IsWinCE) { 
    25242536        OS.InvalidateRect (handle, null, true); 
    25252537    } else { 
    25262538        int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE; 
    2527         OS.RedrawWindow (handle, null, 0, flags); 
     2539        OS.RedrawWindow (handle, null, null, flags); 
    25282540    } 
    25292541} 
     
    25342546    } else { 
    25352547        int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE; 
    2536         OS.RedrawWindow (handle, null, 0, flags); 
     2548        OS.RedrawWindow (handle, null, null, flags); 
    25372549    } 
    25382550} 
     
    25722584 
    25732585void setBounds (int x, int y, int width, int height, int flags, bool defer) { 
    2574     int topHandle = topHandle (); 
     2586    auto topHandle_ = topHandle (); 
    25752587    if (defer && parent !is null) { 
    25762588        forceResize (); 
    2577         if (OS.GetWindow (handle, OS.GW_CHILD) is 0) { 
     2589        if (OS.GetWindow (handle, OS.GW_CHILD) is null) { 
    25782590            if (findImageControl () !is null) { 
    25792591                flags |= OS.SWP_NOCOPYBITS; 
     
    25842596            } 
    25852597        } 
    2586         WINDOWPOS [] lpwp = parent.lpwp; 
     2598        WINDOWPOS* [] lpwp = parent.lpwp; 
    25872599        if (lpwp is null) { 
    2588             SetWindowPos (topHandle, 0, x, y, width, height, flags); 
     2600            SetWindowPos (topHandle_, null, x, y, width, height, flags); 
    25892601        } else { 
    25902602            int index = 0; 
     
    25942606            } 
    25952607            if (index is lpwp.length) { 
    2596                 WINDOWPOS [] newLpwp = new WINDOWPOS [lpwp.length + 4]; 
    2597                 System.arraycopy (lpwp, 0, newLpwp, 0, lpwp.length); 
     2608                WINDOWPOS* [] newLpwp = new WINDOWPOS* [lpwp.length + 4]; 
     2609                SimpleType!(WINDOWPOS*).arraycopy (lpwp, 0, newLpwp, 0, lpwp.length); 
    25982610                parent.lpwp = lpwp = newLpwp; 
    25992611            } 
    2600             WINDOWPOS wp = new WINDOWPOS ()
    2601             wp.hwnd = topHandle
     2612            WINDOWPOS* wp = new WINDOWPOS
     2613            wp.hwnd = topHandle_
    26022614            wp.x = x; 
    26032615            wp.y = y; 
     
    26082620        } 
    26092621    } else { 
    2610         SetWindowPos (topHandle, 0, x, y, width, height, flags); 
     2622        SetWindowPos (topHandle_, null, x, y, width, height, flags); 
    26112623    } 
    26122624} 
     
    26872699    if (cursor !is null && cursor.isDisposed()) DWT.error(DWT.ERROR_INVALID_ARGUMENT); 
    26882700    this.cursor = cursor; 
    2689     if (OS.IsWinCE) { 
     2701    static if (OS.IsWinCE) { 
    26902702        int hCursor = cursor !is null ? cursor.handle : 0; 
    26912703        OS.SetCursor (hCursor); 
    26922704        return; 
    26932705    } 
    2694     int hwndCursor = OS.GetCapture (); 
    2695     if (hwndCursor is 0) { 
    2696         POINT pt = new POINT ()
    2697         if (!OS.GetCursorPos (pt)) return; 
    2698         int hwnd = hwndCursor = OS.WindowFromPoint (pt); 
    2699         while (hwnd !is 0 && hwnd !is handle) { 
     2706    auto hwndCursor = OS.GetCapture (); 
     2707    if (hwndCursor is null) { 
     2708        POINT pt
     2709        if (!OS.GetCursorPos (&pt)) return; 
     2710        auto hwnd = hwndCursor = OS.WindowFromPoint (pt); 
     2711        while (hwnd !is null && hwnd !is handle) { 
    27002712            hwnd = OS.GetParent (hwnd); 
    27012713        } 
    2702         if (hwnd is 0) return; 
     2714        if (hwnd is null) return; 
    27032715    } 
    27042716    Control control = display.getControl (hwndCursor); 
     
    27082720 
    27092721void setDefaultFont () { 
    2710     int hFont = display.getSystemFont ().handle; 
     2722    auto hFont = display.getSystemFont ().handle; 
    27112723    OS.SendMessage (handle, OS.WM_SETFONT, hFont, 0); 
    27122724} 
     
    27592771    */ 
    27602772    Control control = null; 
    2761     bool fixFocus = false; 
     2773    bool fixFocus_ = false; 
    27622774    if (!enabled) { 
    27632775        if (display.focusEvent !is DWT.FocusOut) { 
    27642776            control = display.getFocusControl (); 
    2765             fixFocus = isFocusAncestor (control); 
     2777            fixFocus_ = isFocusAncestor (control); 
    27662778        } 
    27672779    } 
    27682780    enableWidget (enabled); 
    2769     if (fixFocus) fixFocus (control); 
     2781    if (fixFocus_) fixFocus (control); 
    27702782} 
    27712783 
     
    28122824public void setFont (Font font) { 
    28132825    checkWidget (); 
    2814     int hFont = 0
     2826    HFONT hFont
    28152827    if (font !is null) { 
    28162828        if (font.isDisposed()) DWT.error(DWT.ERROR_INVALID_ARGUMENT); 
    28172829        hFont = font.handle; 
    28182830    } 
    2819     if (hFont is 0) hFont = defaultFont (); 
     2831    if (hFont is null) hFont = defaultFont (); 
    28202832    OS.SendMessage (handle, OS.WM_SETFONT, hFont, 1); 
    28212833} 
     
    30043016    if (redraw) { 
    30053017        if (--drawCount is 0) { 
    3006             int topHandle = topHandle (); 
    3007             OS.SendMessage (topHandle, OS.WM_SETREDRAW, 1, 0); 
    3008             if (handle !is topHandle) OS.SendMessage (handle, OS.WM_SETREDRAW, 1, 0); 
     3018            auto topHandle_ = topHandle (); 
     3019            OS.SendMessage (topHandle_, OS.WM_SETREDRAW, 1, 0); 
     3020            if (handle !is topHandle_) OS.SendMessage (handle, OS.WM_SETREDRAW, 1, 0); 
    30093021            if ((state & HIDDEN) !is 0) { 
    30103022                state &= ~HIDDEN; 
    3011                 OS.ShowWindow (topHandle, OS.SW_HIDE); 
    3012                 if (handle !is topHandle) OS.ShowWindow (handle, OS.SW_HIDE); 
     3023                OS.ShowWindow (topHandle_, OS.SW_HIDE); 
     3024                if (handle !is topHandle_) OS.ShowWindow (handle, OS.SW_HIDE); 
    30133025            } else { 
    30143026                if (OS.IsWinCE) { 
    3015                     OS.InvalidateRect (topHandle, null, true); 
    3016                     if (handle !is topHandle) OS.InvalidateRect (handle, null, true); 
     3027                    OS.InvalidateRect (topHandle_, null, true); 
     3028                    if (handle !is topHandle_) OS.InvalidateRect (handle, null, true); 
    30173029                } else { 
    30183030                    int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE | OS.RDW_ALLCHILDREN; 
    3019                     OS.RedrawWindow (topHandle, null, 0, flags); 
     3031                    OS.RedrawWindow (topHandle_, null, null, flags); 
    30203032                } 
    30213033            } 
     
    30233035    } else { 
    30243036        if (drawCount++ is 0) { 
    3025             int topHandle = topHandle (); 
    3026             OS.SendMessage (topHandle, OS.WM_SETREDRAW, 0, 0); 
    3027             if (handle !is topHandle) OS.SendMessage (handle, OS.WM_SETREDRAW, 0, 0); 
     3037            auto topHandle_ = topHandle (); 
     3038            OS.SendMessage (topHandle_, OS.WM_SETREDRAW, 0, 0); 
     3039            if (handle !is topHandle_) OS.SendMessage (handle, OS.WM_SETREDRAW, 0, 0); 
    30283040        } 
    30293041    } 
     
    31473159    */ 
    31483160    Control control = null; 
    3149     bool fixFocus = false; 
     3161    bool fixFocus_ = false; 
    31503162    if (!visible) { 
    31513163        if (display.focusEvent !is DWT.FocusOut) { 
    31523164            control = display.getFocusControl (); 
    3153             fixFocus = isFocusAncestor (control); 
     3165            fixFocus_ = isFocusAncestor (control); 
    31543166        } 
    31553167    } 
     
    31643176        if (isDisposed ()) return; 
    31653177    } 
    3166     if (fixFocus) fixFocus (control); 
     3178    if (fixFocus_) fixFocus (control); 
    31673179} 
    31683180 
     
    31853197void subclass () { 
    31863198    int oldProc = windowProc (); 
    3187     int newProc = display.windowProc
     3199    int newProc = display.windowProc()
    31883200    if (oldProc is newProc) return; 
    31893201    OS.SetWindowLong (handle, OS.GWL_WNDPROC, newProc); 
     
    32083220public Point toControl (int x, int y) { 
    32093221    checkWidget (); 
    3210     POINT pt = new POINT ()
     3222    POINT pt
    32113223    pt.x = x;  pt.y = y; 
    3212     OS.ScreenToClient (handle, pt); 
     3224    OS.ScreenToClient (handle, &pt); 
    32133225    return new Point (pt.x, pt.y); 
    32143226} 
     
    32543266public Point toDisplay (int x, int y) { 
    32553267    checkWidget (); 
    3256     POINT pt = new POINT ()
     3268    POINT pt
    32573269    pt.x = x;  pt.y = y; 
    3258     OS.ClientToScreen (handle, pt); 
     3270    OS.ClientToScreen (handle, &pt); 
    32593271    return new Point (pt.x, pt.y); 
    32603272} 
     
    32823294} 
    32833295 
    3284 int topHandle () { 
     3296HANDLE topHandle () { 
    32853297    return handle; 
    32863298} 
     
    32993311bool translateMnemonic (MSG* msg) { 
    33003312    if (msg.wParam < 0x20) return false; 
    3301     int hwnd = msg.hwnd; 
     3313    auto hwnd = msg.hwnd; 
    33023314    if (OS.GetKeyState (OS.VK_MENU) >= 0) { 
    33033315        int code = OS.SendMessage (hwnd, OS.WM_GETDLGCODE, 0, 0); 
     
    33193331 
    33203332bool translateTraversal (MSG* msg) { 
    3321     int hwnd = msg.hwnd; 
     3333    auto hwnd = msg.hwnd; 
    33223334    int key = msg.wParam; 
    33233335    if (key is OS.VK_MENU) { 
     
    33913403            * or VK_RIGHT. 
    33923404            */ 
    3393             if (OS.IsSP) { 
     3405            if (OS.IsSP_) { 
    33943406                if (key is OS.VK_LEFT || key is OS.VK_RIGHT) return false; 
    33953407            } 
     
    36023614        int flags = OS.RDW_UPDATENOW; 
    36033615        if (all) flags |= OS.RDW_ALLCHILDREN; 
    3604         OS.RedrawWindow (handle, null, 0, flags); 
     3616        OS.RedrawWindow (handle, null, null, flags); 
    36053617    } 
    36063618} 
     
    36153627    Control control = findBackgroundControl (); 
    36163628    Image image = control !is null ? control.backgroundImage : backgroundImage; 
    3617     setBackgroundImage (image !is null ? image.handle : 0); 
     3629    setBackgroundImage (image !is null ? image.handle : null); 
    36183630} 
    36193631 
     
    36273639 
    36283640void updateFont (Font oldFont, Font newFont) { 
    3629     if (getFont ().equals (oldFont)) setFont (newFont); 
     3641    if (getFont () ==/*eq*/oldFont ) setFont (newFont); 
    36303642} 
    36313643 
     
    36383650} 
    36393651 
    3640 CREATESTRUCT widgetCreateStruct () { 
     3652CREATESTRUCT* widgetCreateStruct () { 
    36413653    return null; 
    36423654} 
     
    36443656int widgetExtStyle () { 
    36453657    int bits = 0; 
    3646     if (!OS.IsPPC) { 
     3658    if (!OS.IsPPC_) { 
    36473659        if ((style & DWT.BORDER) !is 0) bits |= OS.WS_EX_CLIENTEDGE; 
    36483660    } 
     
    36733685//      if ((style & DWT.FLAT) !is 0) bits |= OS.WS_BORDER; 
    36743686//  } 
    3675     if (OS.IsPPC) { 
     3687    if (OS.IsPPC_) { 
    36763688        if ((style & DWT.BORDER) !is 0) bits |= OS.WS_BORDER; 
    36773689    } 
     
    37203732        fixChildren (newShell, oldShell, newDecorations, oldDecorations, menus); 
    37213733    } 
    3722     int topHandle = topHandle (); 
    3723     if (OS.SetParent (topHandle, parent.handle) is 0) return false; 
     3734    auto topHandle_ = topHandle (); 
     3735    if (OS.SetParent (topHandle_, parent.handle) is null) return false; 
    37243736    this.parent = parent; 
    37253737    int flags = OS.SWP_NOSIZE | OS.SWP_NOMOVE | OS.SWP_NOACTIVATE; 
    3726     SetWindowPos (topHandle, OS.HWND_BOTTOM, 0, 0, 0, 0, flags); 
     3738    SetWindowPos (topHandle_, cast(HWND)OS.HWND_BOTTOM, 0, 0, 0, 0, flags); 
    37273739    return true; 
    37283740} 
    37293741 
    3730 abstract TCHAR windowClass (); 
     3742abstract char[] windowClass (); 
    37313743 
    37323744abstract int windowProc (); 
    37333745 
    3734 int windowProc (int hwnd, int msg, int wParam, int lParam) { 
    3735     LRESULT result = null
     3746int windowProc (HWND hwnd, int msg, int wParam, int lParam) { 
     3747    LRESULT result = LRESULT.NULL
    37363748    switch (msg) { 
    37373749        case OS.WM_ACTIVATE:            result = WM_ACTIVATE (wParam, lParam); break; 
     
    38243836        case OS.WM_XBUTTONUP:           result = WM_XBUTTONUP (wParam, lParam); break; 
    38253837    } 
    3826     if (result !is null) return result.value
     3838    if (result !is LRESULT.NULL) return result
    38273839    return callWindowProc (hwnd, msg, wParam, lParam); 
    38283840} 
    38293841 
    38303842LRESULT WM_ACTIVATE (int wParam, int lParam) { 
    3831     return null
     3843    return LRESULT.NULL
    38323844} 
    38333845 
     
    38413853 
    38423854LRESULT WM_CLEAR (int wParam, int lParam) { 
    3843     return null
     3855    return LRESULT.NULL
    38443856} 
    38453857 
    38463858LRESULT WM_CLOSE (int wParam, int lParam) { 
    3847     return null
     3859    return LRESULT.NULL
    38483860} 
    38493861 
     
    38623874            } 
    38633875        } 
    3864         return null
    3865     } 
    3866     Control control = display.getControl (lParam); 
    3867     if (control is null) return null
     3876        return LRESULT.NULL
     3877    } 
     3878    Control control = display.getControl (cast(HANDLE)lParam); 
     3879    if (control is null) return LRESULT.NULL
    38683880    return control.wmCommandChild (wParam, lParam); 
    38693881} 
     
    38743886 
    38753887LRESULT WM_CTLCOLOR (int wParam, int lParam) { 
    3876     int hPalette = display.hPalette; 
    3877     if (hPalette !is 0) { 
    3878         OS.SelectPalette (wParam, hPalette, false); 
    3879         OS.RealizePalette (wParam); 
    3880     } 
    3881     Control control = display.getControl (lParam); 
    3882     if (control is null) return null
     3888    auto hPalette = display.hPalette; 
     3889    if (hPalette !is null) { 
     3890        OS.SelectPalette ( cast(HPALETTE)wParam, hPalette, false); 
     3891        OS.RealizePalette (cast(HPALETTE)wParam); 
     3892    } 
     3893    Control control = display.getControl (cast(HANDLE)lParam); 
     3894    if (control is null) return LRESULT.NULL
    38833895    return control.wmColorChild (wParam, lParam); 
    38843896} 
    38853897 
    38863898LRESULT WM_CUT (int wParam, int lParam) { 
    3887     return null
     3899    return LRESULT.NULL
    38883900} 
    38893901 
    38903902LRESULT WM_DESTROY (int wParam, int lParam) { 
    3891     return null
     3903    return LRESULT.NULL
    38923904} 
    38933905 
     
    38963908    if (struct_.CtlType is OS.ODT_MENU) { 
    38973909        MenuItem item = display.getMenuItem (struct_.itemID); 
    3898         if (item is null) return null
     3910        if (item is null) return LRESULT.NULL
    38993911        return item.wmDrawChild (wParam, lParam); 
    39003912    } 
    39013913    Control control = display.getControl (struct_.hwndItem); 
    3902     if (control is null) return null
     3914    if (control is null) return LRESULT.NULL
    39033915    return control.wmDrawChild (wParam, lParam); 
    39043916} 
    39053917 
    39063918LRESULT WM_ENDSESSION (int wParam, int lParam) { 
    3907     return null
     3919    return LRESULT.NULL
    39083920} 
    39093921 
    39103922LRESULT WM_ENTERIDLE (int wParam, int lParam) { 
    3911     return null
     3923    return LRESULT.NULL
    39123924} 
    39133925 
     
    39213933        } 
    39223934    } 
    3923     return null
     3935    return LRESULT.NULL
    39243936} 
    39253937 
    39263938LRESULT WM_GETDLGCODE (int wParam, int lParam) { 
    3927     return null
     3939    return LRESULT.NULL
    39283940} 
    39293941 
    39303942LRESULT WM_GETFONT (int wParam, int lParam) { 
    3931     return null
     3943    return LRESULT.NULL
    39323944} 
    39333945 
    39343946LRESULT WM_GETOBJECT (int wParam, int lParam) { 
    39353947    if (accessible !is null) { 
    3936         int result = accessible.internal_WM_GETOBJECT (wParam, lParam); 
    3937         if (result !is 0) return new LRESULT (result)
    3938     } 
    3939     return null
     3948        LRESULT result = cast(LRESULT) accessible.internal_WM_GETOBJECT (wParam, lParam); 
     3949        if (result !is 0) return result
     3950    } 
     3951    return LRESULT.NULL
    39403952} 
    39413953 
    39423954LRESULT WM_GETMINMAXINFO (int wParam, int lParam) { 
    3943     return null
     3955    return LRESULT.NULL
    39443956} 
    39453957 
    39463958LRESULT WM_HOTKEY (int wParam, int lParam) { 
    3947     return null
     3959    return LRESULT.NULL
    39483960} 
    39493961 
    39503962LRESULT WM_HELP (int wParam, int lParam) { 
    3951     if (OS.IsWinCE) return null; 
    3952     HELPINFO lphi = new HELPINFO (); 
    3953     OS.MoveMemory (lphi, lParam, HELPINFO.sizeof); 
     3963    if (OS.IsWinCE) return LRESULT.NULL; 
     3964    HELPINFO* lphi = cast(HELPINFO*)lParam; 
    39543965    Decorations shell = menuShell (); 
    3955     if (!shell.isEnabled ()) return null
     3966    if (!shell.isEnabled ()) return LRESULT.NULL
    39563967    if (lphi.iContextType is OS.HELPINFO_MENUITEM) { 
    39573968        MenuItem item = display.getMenuItem (lphi.iCtrlId); 
     
    39653976            } 
    39663977            if (widget !is null) { 
    3967                 int hwndShell = shell.handle; 
     3978                auto hwndShell = shell.handle; 
    39683979                OS.SendMessage (hwndShell, OS.WM_CANCELMODE, 0, 0); 
    39693980                widget.postEvent (DWT.Help); 
     
    39713982            } 
    39723983        } 
    3973         return null
     3984        return LRESULT.NULL
    39743985    } 
    39753986    if (hooks (DWT.Help)) { 
     
    39773988        return LRESULT.ONE; 
    39783989    } 
    3979     return null
     3990    return LRESULT.NULL
    39803991} 
    39813992 
    39823993LRESULT WM_HSCROLL (int wParam, int lParam) { 
    3983     Control control = display.getControl (lParam); 
    3984     if (control is null) return null
     3994    Control control = display.getControl (cast(HANDLE)lParam); 
     3995    if (control is null) return LRESULT.NULL
    39853996    return control.wmScrollChild (wParam, lParam); 
    39863997} 
     
    39914002 
    39924003LRESULT WM_IME_COMPOSITION (int wParam, int lParam) { 
    3993     return null
     4004    return LRESUL