Show
Ignore:
Timestamp:
07/06/08 11:23:35 (6 months ago)
Author:
Frank Benoit <benoit@tionex.de>
branch:
default
Message:

Fix: compile errors

Files:

Legend:

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

    r246 r249  
    6868    SYSTEMTIME time; // only used in calendar mode 
    6969    static /+const+/ WNDPROC DateTimeProc; 
    70     static const TCHAR* DateTimeClass = OS.DATETIMEPICK_CLASS.ptr
     70    static const TCHAR[] DateTimeClass = OS.DATETIMEPICK_CLASS
    7171    static /+const+/ WNDPROC CalendarProc; 
    72     static const TCHAR* CalendarClass = OS.MONTHCAL_CLASS.ptr
     72    static const TCHAR[] CalendarClass = OS.MONTHCAL_CLASS
    7373 
    7474    private static bool static_this_completed = false; 
     
    8585            icex.dwICC = OS.ICC_DATE_CLASSES; 
    8686            OS.InitCommonControlsEx (&icex); 
    87     } 
    88     static { //TODO review 
    8987            WNDCLASS lpWndClass; 
    90             OS.GetClassInfo (null, DateTimeClass, &lpWndClass); 
     88            OS.GetClassInfo (null, DateTimeClass.ptr, &lpWndClass); 
    9189            DateTimeProc = lpWndClass.lpfnWndProc; 
    92         /* 
    93         * Feature in Windows.  The date time window class 
    94         * does not include CS_DBLCLKS.  This means that these 
    95         * controls will not get double click messages such as 
    96         * WM_LBUTTONDBLCLK.  The fix is to register a new  
    97         * window class with CS_DBLCLKS. 
    98         *  
    99         * NOTE:  Screen readers look for the exact class name 
    100         * of the control in order to provide the correct kind 
    101         * of assistance.  Therefore, it is critical that the 
    102         * new window class have the same name.  It is possible 
    103         * to register a local window class with the same name 
    104         * as a global class.  Since bits that affect the class 
    105         * are being changed, it is possible that other native 
    106         * code, other than DWT, could create a control with 
    107         * this class name, and fail unexpectedly. 
    108         */ 
    109         int /*long*/ hInstance = OS.GetModuleHandle (null); 
    110         int /*long*/ hHeap = OS.GetProcessHeap (); 
    111         lpWndClass.hInstance = hInstance; 
    112         lpWndClass.style &= ~OS.CS_GLOBALCLASS; 
    113         lpWndClass.style |= OS.CS_DBLCLKS; 
    114         int byteCount = DateTimeClass.length () * TCHAR.sizeof; 
    115         int /*long*/ lpszClassName = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); 
    116         OS.MoveMemory (lpszClassName, DateTimeClass, byteCount); 
    117         lpWndClass.lpszClassName = lpszClassName; 
    118         OS.RegisterClass (lpWndClass); 
    119         OS.HeapFree (hHeap, 0, lpszClassName); 
    120             OS.GetClassInfo (null, CalendarClass, &lpWndClass); 
     90            /* 
     91            * Feature in Windows.  The date time window class 
     92            * does not include CS_DBLCLKS.  This means that these 
     93            * controls will not get double click messages such as 
     94            * WM_LBUTTONDBLCLK.  The fix is to register a new  
     95            * window class with CS_DBLCLKS. 
     96            *  
     97            * NOTE:  Screen readers look for the exact class name 
     98            * of the control in order to provide the correct kind 
     99            * of assistance.  Therefore, it is critical that the 
     100            * new window class have the same name.  It is possible 
     101            * to register a local window class with the same name 
     102            * as a global class.  Since bits that affect the class 
     103            * are being changed, it is possible that other native 
     104            * code, other than DWT, could create a control with 
     105            * this class name, and fail unexpectedly. 
     106            */ 
     107            auto hInstance = OS.GetModuleHandle (null); 
     108            auto hHeap = OS.GetProcessHeap (); 
     109            lpWndClass.hInstance = hInstance; 
     110            lpWndClass.style &= ~OS.CS_GLOBALCLASS; 
     111            lpWndClass.style |= OS.CS_DBLCLKS; 
     112            int byteCount = DateTimeClass.length * TCHAR.sizeof; 
     113            auto lpszClassName = cast(TCHAR*) OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); 
     114            OS.MoveMemory (lpszClassName, DateTimeClass.ptr, byteCount); 
     115            lpWndClass.lpszClassName = lpszClassName; 
     116            OS.RegisterClass (&lpWndClass); 
     117            OS.HeapFree (hHeap, 0, lpszClassName); 
     118            OS.GetClassInfo (null, CalendarClass.ptr, &lpWndClass); 
    121119            CalendarProc = lpWndClass.lpfnWndProc; 
    122         /* 
    123         * Feature in Windows.  The date time window class 
    124         * does not include CS_DBLCLKS.  This means that these 
    125         * controls will not get double click messages such as 
    126         * WM_LBUTTONDBLCLK.  The fix is to register a new  
    127         * window class with CS_DBLCLKS. 
    128         *  
    129         * NOTE:  Screen readers look for the exact class name 
    130         * of the control in order to provide the correct kind 
    131         * of assistance.  Therefore, it is critical that the 
    132         * new window class have the same name.  It is possible 
    133         * to register a local window class with the same name 
    134         * as a global class.  Since bits that affect the class 
    135         * are being changed, it is possible that other native 
    136         * code, other than DWT, could create a control with 
    137         * this class name, and fail unexpectedly. 
    138         */ 
    139         int /*long*/ hInstance = OS.GetModuleHandle (null); 
    140         int /*long*/ hHeap = OS.GetProcessHeap (); 
    141         lpWndClass.hInstance = hInstance; 
    142         lpWndClass.style &= ~OS.CS_GLOBALCLASS; 
    143         lpWndClass.style |= OS.CS_DBLCLKS; 
    144         int byteCount = CalendarClass.length () * TCHAR.sizeof; 
    145         int /*long*/ lpszClassName = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); 
    146         OS.MoveMemory (lpszClassName, CalendarClass, byteCount); 
    147         lpWndClass.lpszClassName = lpszClassName; 
    148         OS.RegisterClass (lpWndClass); 
    149         OS.HeapFree (hHeap, 0, lpszClassName); 
     120            /* 
     121            * Feature in Windows.  The date time window class 
     122            * does not include CS_DBLCLKS.  This means that these 
     123            * controls will not get double click messages such as 
     124            * WM_LBUTTONDBLCLK.  The fix is to register a new  
     125            * window class with CS_DBLCLKS. 
     126            *  
     127            * NOTE:  Screen readers look for the exact class name 
     128            * of the control in order to provide the correct kind 
     129            * of assistance.  Therefore, it is critical that the 
     130            * new window class have the same name.  It is possible 
     131            * to register a local window class with the same name 
     132            * as a global class.  Since bits that affect the class 
     133            * are being changed, it is possible that other native 
     134            * code, other than DWT, could create a control with 
     135            * this class name, and fail unexpectedly. 
     136            */ 
     137            hInstance = OS.GetModuleHandle (null); 
     138            hHeap = OS.GetProcessHeap (); 
     139            lpWndClass.hInstance = hInstance; 
     140            lpWndClass.style &= ~OS.CS_GLOBALCLASS; 
     141            lpWndClass.style |= OS.CS_DBLCLKS; 
     142            byteCount = CalendarClass.length * TCHAR.sizeof; 
     143            lpszClassName = cast(TCHAR*)OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); 
     144            OS.MoveMemory (lpszClassName, CalendarClass.ptr, byteCount); 
     145            lpWndClass.lpszClassName = lpszClassName; 
     146            OS.RegisterClass (&lpWndClass); 
     147            OS.HeapFree (hHeap, 0, lpszClassName); 
    150148            static_this_completed = true; 
    151149        } 
     
    942940 
    943941override String windowClass () { 
    944     return (style & DWT.CALENDAR) !is 0 ? TCHARzToStr(CalendarClass) : TCHARzToStr(DateTimeClass); 
     942    return (style & DWT.CALENDAR) !is 0 ? TCHARsToStr(CalendarClass) : TCHARsToStr(DateTimeClass); 
    945943} 
    946944