Changeset 30

Show
Ignore:
Timestamp:
07/03/04 04:20:31 (4 years ago)
Author:
brad
Message:

More work on control.d which is a beast. I'm down around line 1400.
Opened up the dwt.accessibility.accessible can of worms. This will get Win32 OLE and COMObject involved. accessible and comobject are monster files to convert.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/0.1/src/dwt/accessibility/accessible.d

    r17 r30  
    5454public class Accessible { 
    5555 
    56 /+  
     56 
    5757    int refCount = 0, enumIndex = 0; 
    5858    COMObject objIAccessible, objIEnumVARIANT; 
     
    132132        return new Accessible(control); 
    133133    } 
    134  
     134/+ TODO: delegates? 
    135135    /** 
    136136     * Adds the listener to the collection of listeners who will 
     
    216216        textListeners.addElement (listener);         
    217217    } 
    218      
     218+/ 
     219 
    219220    /** 
    220221     * Gets the control for this Accessible object.  
     
    261262    } 
    262263 
     264/+ TODO: delegates? 
    263265    /** 
    264266     * Removes the listener from the collection of listeners who will 
     
    337339        textListeners.remove (listener); 
    338340    } 
     341+/ 
    339342 
    340343    /** 
  • branches/0.1/src/dwt/widgets/control.d

    r28 r30  
    475475} 
    476476 
     477/+ TODO: new Control [] [this] +/ 
    477478Control [] computeTabList () { 
    478479    if (isTabGroup ()) { 
    479480        if (getVisible () && getEnabled ()) { 
    480             return new Control [] [this]; 
     481            // return new Control [] {this}; 
     482            Control[] ret; 
     483            ret[0] = this; 
     484            return ret; 
    481485        } 
    482486    } 
    483487    return new Control [0]; 
    484488} 
     489 
    485490 
    486491void createHandle () { 
    487492    int hwndParent = widgetParent (); 
     493    CREATESTRUCT wcs = widgetCreateStruct (); 
    488494    handle = OS.CreateWindowEx ( 
    489495        widgetExtStyle (), 
    490496        windowClass (), 
    491         null, 
     497        cast(TCHAR)null, 
    492498        widgetStyle (), 
    493499        OS.CW_USEDEFAULT, 0, OS.CW_USEDEFAULT, 0, 
     
    495501        0, 
    496502        OS.GetModuleHandle (null), 
    497         widgetCreateStruct ()); 
     503        &wcs); 
    498504    if (handle == 0) error (DWT.ERROR_NO_HANDLES); 
    499505    int bits = OS.GetWindowLong (handle, OS.GWL_STYLE); 
     
    544550 
    545551void drawBackground (int hDC) { 
    546     RECT rect = new RECT ()
    547     OS.GetClientRect (handle, rect); 
     552    RECT rect
     553    OS.GetClientRect (handle, &rect); 
    548554    drawBackground (hDC, rect); 
    549555} 
     
    557563    int pixel = getBackgroundPixel (); 
    558564    int hBrush = findBrush (pixel); 
    559     OS.FillRect (hDC, rect, hBrush); 
     565    OS.FillRect (hDC, &rect, hBrush); 
    560566} 
    561567 
     
    569575} 
    570576 
     577/+ TODO: new Menu[] [menu] +/ 
    571578Menu [] findMenus (Control control) { 
    572     if (menu != null && this != control) return new Menu[] [menu]; 
     579    if (menu != null && this != control) { 
     580        // return new Menu[] [menu]; 
     581        Menu[] ret; 
     582        ret[0] = menu;   
     583    } 
    573584    return new Menu [0]; 
    574585} 
    575586 
    576 char findMnemonic (String string) { 
     587wchar findMnemonic (String string) { 
    577588    int index = 0; 
    578     int length = string.length ()
     589    int length = string.length
    579590    do { 
    580         while (index < length && string.charAt (index) != '&') index++; 
     591        while (index < length && string[index] != '&') index++; 
    581592        if (++index >= length) return '\0'; 
    582         if (string.charAt (index) != '&') return string.charAt (index); 
     593        if (string[index] != '&') return string[index];  // TODO: if string[index] is a wchar, does comparing it to '&' really work? is '&' a wchar, too? 
    583594        index++; 
    584595    } while (index < length); 
     
    644655    for (int i=0; i<lpwp.length; i++) { 
    645656        WINDOWPOS wp = lpwp [i]; 
    646         if (wp != null && wp.hwnd == handle) { 
     657        if (cast(void*)wp != null && wp.hwnd == handle) { 
    647658            /* 
    648659            * This code is intentionally commented.  All widgets that 
     
    656667//          } 
    657668            OS.SetWindowPos (wp.hwnd, 0, wp.x, wp.y, wp.cx, wp.cy, wp.flags); 
    658             lpwp [i] = null; 
     669            // lpwp [i] = null;  TODO: set struct to null?  Use isActive in the WINDOWPOS like other structs before? 
    659670            return; 
    660671        }    
     
    739750    checkWidget (); 
    740751    forceResize (); 
    741     RECT rect = new RECT ()
    742     OS.GetWindowRect (handle, rect); 
     752    RECT rect
     753    OS.GetWindowRect (handle, &rect); 
    743754    int hwndParent = parent == null ? 0 : parent.handle; 
    744     OS.MapWindowPoints (0, hwndParent, rect, 2); 
     755    OS.MapWindowPoints (0, hwndParent, &rect, 2); 
    745756    int width = rect.right - rect.left; 
    746757    int height =  rect.bottom - rect.top; 
     
    751762    if (OS.IsUnicode) return OS.CP_ACP; 
    752763    int hFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0); 
    753     LOGFONT logFont = OS.IsUnicode ? cast(LOGFONT) new LOGFONTW () : new LOGFONTA (); 
    754     OS.GetObject (hFont, LOGFONT.sizeof, logFont); 
     764    LOGFONT logFont; // = OS.IsUnicode ? cast(LOGFONT) new LOGFONTW () : new LOGFONTA (); 
     765    OS.GetObject (hFont, cast(int)LOGFONT.sizeof, &logFont); 
    755766    int cs = logFont.lfCharSet & 0xFF; 
    756767    int [] lpCs = new int [8]; 
     
    847858    checkWidget (); 
    848859    forceResize (); 
    849     RECT rect = new RECT ()
    850     OS.GetWindowRect (handle, rect); 
     860    RECT rect
     861    OS.GetWindowRect (handle, &rect); 
    851862    int hwndParent = parent == null ? 0 : parent.handle; 
    852     OS.MapWindowPoints (0, hwndParent, rect, 2); 
     863    OS.MapWindowPoints (0, hwndParent, &rect, 2); 
    853864    return new Point (rect.left, rect.top); 
    854865} 
     
    887898    } 
    888899    int hmonitor = OS.MonitorFromWindow (handle, OS.MONITOR_DEFAULTTONEAREST); 
    889     MONITORINFO lpmi = new MONITORINFO ()
     900    MONITORINFO lpmi
    890901    lpmi.cbSize = MONITORINFO.sizeof; 
    891     OS.GetMonitorInfo (hmonitor, lpmi); 
     902    OS.GetMonitorInfo (hmonitor, &lpmi); 
    892903    Monitor monitor = new Monitor (); 
    893904    monitor.handle = hmonitor; 
     
    973984    checkWidget (); 
    974985    forceResize (); 
    975     RECT rect = new RECT ()
    976     OS.GetWindowRect (handle, rect); 
     986    RECT rect
     987    OS.GetWindowRect (handle, &rect); 
    977988    int width = rect.right - rect.left; 
    978989    int height = rect.bottom - rect.top; 
     
    10211032 
    10221033bit hasCursor () { 
    1023     RECT rect = new RECT ()
    1024     if (!OS.GetClientRect (handle, rect)) return false; 
    1025     if (OS.MapWindowPoints (handle, 0, rect, 2) == 0) return false; 
    1026     POINT pt = new POINT ()
    1027     return (OS.GetCursorPos (pt) && OS.PtInRect (rect, pt)); 
     1034    RECT rect
     1035    if (!OS.GetClientRect (handle, &rect)) return false; 
     1036    if (OS.MapWindowPoints (handle, 0, &rect, 2) == 0) return false;  // TODO: did we send this to MapWindowPoints(int,int,POINT*,int) ?? instead of RECT* 
     1037    POINT pt
     1038    return (OS.GetCursorPos (&pt) && OS.PtInRect (&rect, &pt)); 
    10281039} 
    10291040 
     
    11791190} 
    11801191 
    1181 bit isFocusAncestor () { 
     1192bool isFocusAncestor () { 
    11821193    Control control = display.getFocusControl (); 
    11831194    while (control != null && control != this) { 
    11841195        control = control.parent; 
    11851196    } 
    1186     return control == this
     1197    return cast(bool)(control == this)
    11871198} 
    11881199 
  • branches/0.1/src/dwt/widgets/shell.d

    r28 r30  
    127127 
    128128    Menu activeMenu; 
    129     int hIMC, hwndMDIClient, toolTipHandle, lpstrTip; 
     129    int hIMC, _hwndMDIClient, toolTipHandle, lpstrTip; 
    130130    int [] brushes; 
    131131    bit showWithParent; 
     
    369369 */ 
    370370 
    371 /+ 
     371 
    372372 
    373373public static Shell win32_new (Display display, int handle) { 
     
    385385} 
    386386 
     387/+ TODO: delegates 
    387388/** 
    388389 * Adds the listener to the collection of listeners who will 
     
    415416} 
    416417 
     418+/ 
     419 
    417420int callWindowProc (int msg, int wParam, int lParam) { 
    418421    if (parent != null) { 
     
    426429    } 
    427430    if (handle == 0) return 0; 
    428     if (hwndMDIClient != 0) { 
    429         return OS.DefFrameProc (handle, hwndMDIClient, msg, wParam, lParam); 
     431    if (_hwndMDIClient != 0) { 
     432        return OS.DefFrameProc (handle, _hwndMDIClient, msg, wParam, lParam); 
    430433    } 
    431434    return OS.DefWindowProc (handle, msg, wParam, lParam); 
     
    718721 
    719722int hwndMDIClient () { 
    720     if (hwndMDIClient == 0) { 
     723    if (_hwndMDIClient == 0) { 
    721724        int widgetStyle = OS.MDIS_ALLCHILDSTYLES | OS.WS_CHILD | OS.WS_CLIPCHILDREN | OS.WS_CLIPSIBLINGS; 
    722         hwndMDIClient = OS.CreateWindowEx ( 
     725        _hwndMDIClient = OS.CreateWindowEx ( 
    723726            0, 
    724727            new TCHAR (0, "MDICLIENT", true), 
     
    730733            OS.GetModuleHandle (null), 
    731734            new CREATESTRUCT ()); 
    732 //      OS.ShowWindow (hwndMDIClient, OS.SW_SHOW); 
    733     } 
    734     return hwndMDIClient; 
    735 } 
    736  
    737 +/ 
     735//      OS.ShowWindow (_hwndMDIClient, OS.SW_SHOW); 
     736    } 
     737    return _hwndMDIClient; 
     738} 
     739 
     740 
    738741 
    739742/** 
     
    796799void releaseHandle () { 
    797800    super.releaseHandle (); 
    798     hwndMDIClient = 0; 
     801    _hwndMDIClient = 0; 
    799802} 
    800803 
  • branches/0.1/src/makefile

    r28 r30  
    1313    dwt/dwt.d 
    1414 
     15dwt.accessibility = \ 
     16    dwt/accessibility/accessible.d 
     17     
    1518dwt.graphics = \ 
    1619    dwt/graphics/IDrawable.d \ 
     
    9194dwtSRC = \ 
    9295    $(dwt.dwt) \ 
     96    $(dwt.accessibility) \ 
    9397    $(dwt.graphics) \ 
    9498    $(dwt.internal) \