changeset 165:07ed83d51a19

Fix tooltip bugs. by Zhiguang Liang 1).tailed by 0XFF string do a conversion of utf8-> utf16 string would throw exception by tango. We need to nullify the last byte of the chars string. 2).the function finger print doesn't keep consistency. setToolTipText in Shell.d Note: in the NMTTDISPINFO lpnmtdi struct from message, the field hinst should be forced to null. but from the test experience, it now keeps always 0, let it be the same as java code.
author davelzg@gmail.com
date Fri, 22 Feb 2008 00:40:30 +0800
parents d6bf6a720cde
children cd28aa5221a3
files dwt/internal/win32/OS.d dwt/internal/win32/WINAPI.d dwt/widgets/Composite.d dwt/widgets/Shell.d
diffstat 4 files changed, 12 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/dwt/internal/win32/OS.d	Sun Feb 17 09:30:11 2008 -0800
+++ b/dwt/internal/win32/OS.d	Fri Feb 22 00:40:30 2008 +0800
@@ -726,7 +726,7 @@
     public static const int CS_HREDRAW = 0x2;
     public static const int CS_VREDRAW = 0x1;
     public static const int CW_USEDEFAULT = 0x80000000;
-    public static const char[] DATETIMEPICK_CLASS = "SysDateTimePick32"; //$NON-NLS-1$
+    public static const TCHAR[] DATETIMEPICK_CLASS = "SysDateTimePick32"; //$NON-NLS-1$
     public static const int DATE_LONGDATE = 0x00000002;
     public static const int DATE_SHORTDATE = 0x00000001;
     public static const int DATE_YEARMONTH = 0x00000008; //#if(WINVER >= 0x0500)
@@ -1334,7 +1334,7 @@
     public static const int MNS_CHECKORBMP = 0x4000000;
     public static const int MONITOR_DEFAULTTONEAREST = 0x2;
     public static const int MONITORINFOF_PRIMARY = 0x1;
-    public static const char[] MONTHCAL_CLASS = "SysMonthCal32"; //$NON-NLS-1$
+    public static const TCHAR[] MONTHCAL_CLASS = "SysMonthCal32"; //$NON-NLS-1$
     public static const int MOUSEEVENTF_ABSOLUTE = 0x8000;
     public static const int MOUSEEVENTF_LEFTDOWN = 0x0002;
     public static const int MOUSEEVENTF_LEFTUP = 0x0004;
@@ -4029,6 +4029,8 @@
     alias WINAPI.GetClassInfoA GetClassInfo;
     alias WINAPI.GetClassNameA GetClassName;
     alias WINAPI.GetClipboardFormatNameA GetClipboardFormatName;
+    alias WINAPI.GetDateFormatA GetDateFormat;
+    alias WINAPI.GetTimeFormatA GetTimeFormat;
     alias WINAPI.GetKeyNameTextA GetKeyNameText;
     alias WINAPI.GetLocaleInfoA GetLocaleInfo;
     alias WINAPI.GetMenuItemInfoA GetMenuItemInfo;
@@ -4128,6 +4130,8 @@
     alias WINAPI.GetClassInfoW GetClassInfo;
     alias WINAPI.GetClassNameW GetClassName;
     alias WINAPI.GetClipboardFormatNameW GetClipboardFormatName;
+    alias WINAPI.GetDateFormatW GetDateFormat;
+    alias WINAPI.GetTimeFormatW GetTimeFormat;
     alias WINAPI.GetKeyNameTextW GetKeyNameText;
     alias WINAPI.GetLocaleInfoW GetLocaleInfo;
     alias WINAPI.GetMenuItemInfoW GetMenuItemInfo;
--- a/dwt/internal/win32/WINAPI.d	Sun Feb 17 09:30:11 2008 -0800
+++ b/dwt/internal/win32/WINAPI.d	Fri Feb 22 00:40:30 2008 +0800
@@ -339,8 +339,8 @@
 //     int LCMapStringA(LCID, DWORD, LPCSTR, int, LPSTR, int);
 //     int GetLocaleInfoA(LCID, LCTYPE, LPSTR, int);
 //     WINBOOL SetLocaleInfoA(LCID, LCTYPE, LPCSTR);
-//     int GetTimeFormatA(LCID, DWORD, LPSYSTEMTIME, LPCSTR, LPSTR, int);
-//     int GetDateFormatA(LCID, DWORD, LPSYSTEMTIME, LPCSTR, LPSTR, int);
+     int GetTimeFormatA(LCID, DWORD, LPSYSTEMTIME, LPCSTR, LPSTR, int);
+     int GetDateFormatA(LCID, DWORD, LPSYSTEMTIME, LPCSTR, LPSTR, int);
 //     int GetNumberFormatA(LCID, DWORD, LPCSTR, PNUMBERFMT, LPSTR, int);
 //     int GetCurrencyFormatA(LCID, DWORD, LPCSTR, PCURRENCYFMT, LPSTR, int);
 //     WINBOOL EnumCalendarInfoA(CALINFO_ENUMPROC, LCID, CALID, CALTYPE);
@@ -732,8 +732,8 @@
 //     int LCMapStringW(LCID, DWORD, LPCWSTR, int, LPWSTR, int);
 //     int GetLocaleInfoW(LCID, LCTYPE, LPWSTR, int);
 //     WINBOOL SetLocaleInfoW(LCID, LCTYPE, LPCWSTR);
-//     int GetTimeFormatW(LCID, DWORD, LPSYSTEMTIME, LPCWSTR, LPWSTR, int);
-//     int GetDateFormatW(LCID, DWORD, LPSYSTEMTIME, LPCWSTR, LPWSTR, int);
+     int GetTimeFormatW(LCID, DWORD, LPSYSTEMTIME, LPCWSTR, LPWSTR, int);
+     int GetDateFormatW(LCID, DWORD, LPSYSTEMTIME, LPCWSTR, LPWSTR, int);
 //     int GetNumberFormatW(LCID, DWORD, LPCWSTR, PNUMBERFMT, LPWSTR, int);
 //     int GetCurrencyFormatW(LCID, DWORD, LPCWSTR, PCURRENCYFMT, LPWSTR, int);
 //     WINBOOL EnumCalendarInfoW(CALINFO_ENUMPROC, LCID, CALID, CALTYPE);
--- a/dwt/widgets/Composite.d	Sun Feb 17 09:30:11 2008 -0800
+++ b/dwt/widgets/Composite.d	Fri Feb 22 00:40:30 2008 +0800
@@ -1571,6 +1571,7 @@
                     int length_ = string.length;
                     char [] chars = new char [length_ + 1];
                     string.getChars (0, length_, chars, 0);
+                    chars[$-1] = 0; // d initialize it to 0xFF, we need to make it null terminated
 
                     /*
                     * Ensure that the orientation of the tool tip matches
--- a/dwt/widgets/Shell.d	Sun Feb 17 09:30:11 2008 -0800
+++ b/dwt/widgets/Shell.d	Fri Feb 22 00:40:30 2008 +0800
@@ -1538,7 +1538,7 @@
     lpnmtdi.lpszText = lpstrTip;
 }
 
-void setToolTipText (NMTTDISPINFO lpnmtdi, char [] buffer) {
+void setToolTipText (NMTTDISPINFO* lpnmtdi, char [] buffer) {
     /*
     * Ensure that the current position of the mouse
     * is inside the client area of the shell.  This