Changeset 221:82b599d21983
- Timestamp:
- 05/18/08 19:08:45
(5 months ago)
- Author:
- Frank Benoit <benoit@tionex.de>
- branch:
- default
- Message:
Fix tooltips for normal controls and the tray.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r214 |
r221 |
|
| 114 | 114 | } |
|---|
| 115 | 115 | |
|---|
| 116 | | private static int getNOTIFYICONDATAA_V2_SIZE (){ |
|---|
| 117 | | // hm, NOTIFYICONDATAA.dwInfoFlags.offsetof did not compile |
|---|
| 118 | | return IsWinCE ? NOTIFYICONDATAA.sizeof : cast(int)(&(cast(NOTIFYICONDATAA*)null).dwInfoFlags) + int.sizeof; |
|---|
| 119 | | } |
|---|
| 120 | | |
|---|
| 121 | | private static int getNOTIFYICONDATAW_V2_SIZE (){ |
|---|
| 122 | | return IsWinCE ? NOTIFYICONDATAW.sizeof : cast(int)(&(cast(NOTIFYICONDATAW*)null).dwInfoFlags) + int.sizeof; |
|---|
| 123 | | } |
|---|
| | 116 | // private static int getNOTIFYICONDATAA_V2_SIZE (){ |
|---|
| | 117 | // // hm, NOTIFYICONDATAA.dwInfoFlags.offsetof did not compile |
|---|
| | 118 | // return IsWinCE ? NOTIFYICONDATAA.sizeof : cast(int)(&(cast(NOTIFYICONDATAA*)null).dwInfoFlags) + int.sizeof; |
|---|
| | 119 | // } |
|---|
| | 120 | // |
|---|
| | 121 | // private static int getNOTIFYICONDATAW_V2_SIZE (){ |
|---|
| | 122 | // return IsWinCE ? NOTIFYICONDATAW.sizeof : cast(int)(&(cast(NOTIFYICONDATAW*)null).dwInfoFlags) + int.sizeof; |
|---|
| | 123 | // } |
|---|
| 124 | 124 | |
|---|
| 125 | 125 | /* |
|---|
| r213 |
r221 |
|
| 15029 | 15029 | UINT uCallbackMessage; |
|---|
| 15030 | 15030 | HICON hIcon; |
|---|
| 15031 | | char szTip[64]; |
|---|
| | 15031 | char szTip[128] = '\0'; |
|---|
| 15032 | 15032 | DWORD dwState; |
|---|
| 15033 | 15033 | DWORD dwStateMask; |
|---|
| 15034 | | char szInfo[256]; |
|---|
| 15035 | | // union { |
|---|
| 15036 | | // UINT uTimeout; |
|---|
| | 15034 | char szInfo[256] = '\0'; |
|---|
| | 15035 | union { |
|---|
| | 15036 | UINT uTimeout; |
|---|
| 15037 | 15037 | UINT uVersion; |
|---|
| 15038 | | // }; |
|---|
| 15039 | | char szInfoTitle[64]; |
|---|
| | 15038 | }; |
|---|
| | 15039 | char szInfoTitle[64] = '\0'; |
|---|
| 15040 | 15040 | DWORD dwInfoFlags; |
|---|
| 15041 | | // GUID guidItem; |
|---|
| | 15041 | //GUID guidItem; |
|---|
| | 15042 | //HICON hBalloonIcon; |
|---|
| 15042 | 15043 | } alias NOTIFYICONDATAA* PNOTIFYICONDATAA, LPNOTIFYICONDATAA; |
|---|
| 15043 | 15044 | |
|---|
| … | … | |
| 15049 | 15050 | UINT uCallbackMessage; |
|---|
| 15050 | 15051 | HICON hIcon; |
|---|
| 15051 | | WCHAR szTip[64]; |
|---|
| | 15052 | WCHAR szTip[128] = '\0'; |
|---|
| 15052 | 15053 | DWORD dwState; |
|---|
| 15053 | 15054 | DWORD dwStateMask; |
|---|
| 15054 | | WCHAR szInfo[256]; |
|---|
| 15055 | | // union { |
|---|
| 15056 | | // UINT uTimeout; |
|---|
| | 15055 | WCHAR szInfo[256] = '\0'; |
|---|
| | 15056 | union { |
|---|
| | 15057 | UINT uTimeout; |
|---|
| 15057 | 15058 | UINT uVersion; |
|---|
| 15058 | | // }; |
|---|
| 15059 | | WCHAR szInfoTitle[64]; |
|---|
| | 15059 | } |
|---|
| | 15060 | WCHAR szInfoTitle[64] = '\0'; |
|---|
| 15060 | 15061 | DWORD dwInfoFlags; |
|---|
| 15061 | | // GUID guidItem; |
|---|
| 15062 | | } |
|---|
| | 15062 | //GUID guidItem; |
|---|
| | 15063 | //HICON hBalloonIcon; |
|---|
| | 15064 | } |
|---|
| | 15065 | |
|---|
| 15063 | 15066 | alias NOTIFYICONDATAW* PNOTIFYICONDATAW, LPNOTIFYICONDATAW; |
|---|
| 15064 | 15067 | version(ANSI){ |
|---|
| r217 |
r221 |
|
| 1771 | 1771 | //OS.MoveMemory (lParam, cast(NMTTDISPINFOA)lpnmtdi, NMTTDISPINFOA.sizeof); |
|---|
| 1772 | 1772 | } else { |
|---|
| 1773 | | shell.setToolTipText (lpnmtdi, chars); |
|---|
| | 1773 | shell.setToolTipText (lpnmtdi, StrToTCHARs(chars,true)); |
|---|
| 1774 | 1774 | //OS.MoveMemory (lParam, cast(NMTTDISPINFOW)lpnmtdi, NMTTDISPINFOW.sizeof); |
|---|
| 1775 | 1775 | } |
|---|
| r214 |
r221 |
|
| 290 | 290 | |
|---|
| 291 | 291 | /* Message Only Window */ |
|---|
| 292 | | //Callback messageCallback; |
|---|
| 293 | 292 | HWND hwndMessage; |
|---|
| 294 | | int messageProc_; |
|---|
| 295 | 293 | |
|---|
| 296 | 294 | /* System Resources */ |
|---|
| r213 |
r221 |
|
| 1688 | 1688 | } |
|---|
| 1689 | 1689 | |
|---|
| 1690 | | void setToolTipText (NMTTDISPINFO* lpnmtdi, char [] buffer) { |
|---|
| | 1690 | void setToolTipText (NMTTDISPINFO* lpnmtdi, byte [] buffer) { |
|---|
| 1691 | 1691 | /* |
|---|
| 1692 | 1692 | * Ensure that the current position of the mouse |
|---|
| … | … | |
| 1714 | 1714 | auto hHeap = OS.GetProcessHeap (); |
|---|
| 1715 | 1715 | if (lpstrTip !is null) OS.HeapFree (hHeap, 0, lpstrTip); |
|---|
| 1716 | | TCHAR[] charz = buffer;//StrToTCHARs( 0, buffer ); |
|---|
| 1717 | | int byteCount = charz.length * TCHAR.sizeof; |
|---|
| | 1716 | int byteCount = buffer.length * 2; |
|---|
| 1718 | 1717 | lpstrTip = cast(TCHAR*)OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); |
|---|
| 1719 | | OS.MoveMemory (lpstrTip, charz.ptr, byteCount); |
|---|
| | 1718 | OS.MoveMemory (lpstrTip, buffer.ptr, byteCount); |
|---|
| 1720 | 1719 | lpnmtdi.lpszText = lpstrTip; |
|---|
| 1721 | 1720 | } |
|---|
| … | … | |
| 1742 | 1741 | } |
|---|
| 1743 | 1742 | if (hwndToolTip is toolTipHandle_) { |
|---|
| 1744 | | if (text is toolTitle || (toolTitle !is null && toolTitle ==/*eq*/text )) { |
|---|
| | 1743 | if (text is toolTitle || (toolTitle !is null && toolTitle.equals (text) )) { |
|---|
| 1745 | 1744 | if (icon is toolIcon) return; |
|---|
| 1746 | 1745 | } |
|---|
| … | … | |
| 1749 | 1748 | } else { |
|---|
| 1750 | 1749 | if (hwndToolTip is balloonTipHandle_) { |
|---|
| 1751 | | if (text is balloonTitle || (balloonTitle !is null && balloonTitle==/*eq*/text)) { |
|---|
| | 1750 | if (text is balloonTitle || (balloonTitle !is null && balloonTitle.equals (text))) { |
|---|
| 1752 | 1751 | if (icon is toolIcon) return; |
|---|
| 1753 | 1752 | } |
|---|
| r212 |
r221 |
|
| 29 | 29 | |
|---|
| 30 | 30 | import dwt.dwthelper.utils; |
|---|
| 31 | | |
|---|
| 32 | 31 | |
|---|
| 33 | 32 | /** |
|---|
| … | … | |
| 470 | 469 | toolTipText = value; |
|---|
| 471 | 470 | NOTIFYICONDATA iconData; |
|---|
| 472 | | TCHAR[] buffer = StrToTCHARs (0, toolTipText is null ? "" : toolTipText, true); |
|---|
| | 471 | TCHAR[] buffer = StrToTCHARs (0, toolTipText is null ? "X"[1..1] : toolTipText, true); |
|---|
| | 472 | assert( buffer.ptr !is null ); |
|---|
| 473 | 473 | /* |
|---|
| 474 | 474 | * Note that the size of the szTip field is different in version 5.0 of shell32.dll. |
|---|
| 475 | 475 | */ |
|---|
| 476 | | int length = OS.SHELL32_MAJOR < 5 ? 64 : 128; |
|---|
| | 476 | int length_ = OS.SHELL32_MAJOR < 5 ? 64 : 128; |
|---|
| 477 | 477 | static if (OS.IsUnicode) { |
|---|
| 478 | | TCHAR [] szTip = iconData.szTip; |
|---|
| 479 | | length = Math.min (length - 1, buffer.length ); |
|---|
| 480 | | System.arraycopy (buffer, 0, szTip, 0, length); |
|---|
| | 478 | TCHAR [] szTip = iconData.szTip[]; |
|---|
| | 479 | length_ = Math.min (length_ - 1, buffer.length ); |
|---|
| | 480 | System.arraycopy (buffer, 0, szTip, 0, length_); |
|---|
| 481 | 481 | } else { |
|---|
| 482 | | TCHAR [] szTip = iconData.szTip; |
|---|
| 483 | | length = Math.min (length - 1, buffer.length ); |
|---|
| 484 | | System.arraycopy (buffer, 0, szTip, 0, length); |
|---|
| | 482 | TCHAR [] szTip = iconData.szTip[]; |
|---|
| | 483 | length_ = Math.min (length_ - 1, buffer.length ); |
|---|
| | 484 | System.arraycopy (buffer, 0, szTip, 0, length_); |
|---|
| 485 | 485 | } |
|---|
| 486 | 486 | iconData.cbSize = NOTIFYICONDATA.sizeof; |
|---|