Mercurial > projects > dwt-win
comparison dwt/widgets/ToolBar.d @ 213:36f5cb12e1a2
Update to SWT 3.4M7
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 17 May 2008 17:34:28 +0200 |
parents | ab60f3309436 |
children | fd9c62a2998e |
comparison
equal
deleted
inserted
replaced
212:ab60f3309436 | 213:36f5cb12e1a2 |
---|---|
315 /* | 315 /* |
316 * These lines are intentionally commented. The tool | 316 * These lines are intentionally commented. The tool |
317 * bar currently sets this value to 300 so it is not | 317 * bar currently sets this value to 300 so it is not |
318 * necessary to set TTM_SETMAXTIPWIDTH. | 318 * necessary to set TTM_SETMAXTIPWIDTH. |
319 */ | 319 */ |
320 // int hwndToolTip = OS.SendMessage (handle, OS.TB_GETTOOLTIPS, 0, 0); | 320 // int /*long*/ hwndToolTip = OS.SendMessage (handle, OS.TB_GETTOOLTIPS, 0, 0); |
321 // OS.SendMessage (hwndToolTip, OS.TTM_SETMAXTIPWIDTH, 0, 0x7FFF); | 321 // OS.SendMessage (hwndToolTip, OS.TTM_SETMAXTIPWIDTH, 0, 0x7FFF); |
322 | 322 |
323 /* | 323 /* |
324 * Feature in Windows. When the control is created, | 324 * Feature in Windows. When the control is created, |
325 * it does not use the default system font. A new HFONT | 325 * it does not use the default system font. A new HFONT |
674 */ | 674 */ |
675 if ((style & DWT.VERTICAL) !is 0) { | 675 if ((style & DWT.VERTICAL) !is 0) { |
676 TBBUTTONINFO info; | 676 TBBUTTONINFO info; |
677 info.cbSize = TBBUTTONINFO.sizeof; | 677 info.cbSize = TBBUTTONINFO.sizeof; |
678 info.dwMask = OS.TBIF_SIZE; | 678 info.dwMask = OS.TBIF_SIZE; |
679 int size = OS.SendMessage (handle, OS.TB_GETBUTTONSIZE, 0, 0); | 679 int /*long*/ size = OS.SendMessage (handle, OS.TB_GETBUTTONSIZE, 0, 0); |
680 info.cx = cast(short) (size & 0xFFFF); | 680 info.cx = cast(short) OS.LOWORD (size); |
681 int index = 0; | 681 int index = 0; |
682 while (index < items.length) { | 682 while (index < items.length) { |
683 ToolItem item = items [index]; | 683 ToolItem item = items [index]; |
684 if (item !is null && (item.style & DWT.DROP_DOWN) !is 0) break; | 684 if (item !is null && (item.style & DWT.DROP_DOWN) !is 0) break; |
685 index++; | 685 index++; |
686 } | 686 } |
687 if (index < items.length) { | 687 if (index < items.length) { |
688 int padding = OS.SendMessage (handle, OS.TB_GETPADDING, 0, 0); | 688 int /*long*/ padding = OS.SendMessage (handle, OS.TB_GETPADDING, 0, 0); |
689 info.cx += (padding & 0xFFFF) * 2; | 689 info.cx += OS.LOWORD (padding) * 2; |
690 } | 690 } |
691 for (int i=0; i<items.length; i++) { | 691 for (int i=0; i<items.length; i++) { |
692 ToolItem item = items [i]; | 692 ToolItem item = items [i]; |
693 if (item !is null && (item.style & DWT.SEPARATOR) is 0) { | 693 if (item !is null && (item.style & DWT.SEPARATOR) is 0) { |
694 OS.SendMessage (handle, OS.TB_SETBUTTONINFO, item.id, &info); | 694 OS.SendMessage (handle, OS.TB_SETBUTTONINFO, item.id, &info); |
972 * one more than the item count has no effect. The number of rows | 972 * one more than the item count has no effect. The number of rows |
973 * is already one more causing TB_SETROWS to do nothing. Therefore, | 973 * is already one more causing TB_SETROWS to do nothing. Therefore, |
974 * choosing two instead of one as the row increment fixes both cases. | 974 * choosing two instead of one as the row increment fixes both cases. |
975 */ | 975 */ |
976 count += 2; | 976 count += 2; |
977 OS.SendMessage (handle, OS.TB_SETROWS, (1 << 16) | count, 0); | 977 OS.SendMessage (handle, OS.TB_SETROWS, OS.MAKEWPARAM (count, 1), 0); |
978 int flags = OS.SWP_NOACTIVATE | OS.SWP_NOMOVE | OS.SWP_NOZORDER; | 978 int flags = OS.SWP_NOACTIVATE | OS.SWP_NOMOVE | OS.SWP_NOZORDER; |
979 SetWindowPos (handle, null, 0, 0, rect.right - rect.left, rect.bottom - rect.top, flags); | 979 SetWindowPos (handle, null, 0, 0, rect.right - rect.left, rect.bottom - rect.top, flags); |
980 ignoreResize = false; | 980 ignoreResize = false; |
981 } | 981 } |
982 } | 982 } |
1007 */ | 1007 */ |
1008 if (!hasCursor ()) return ""; //$NON-NLS-1$ | 1008 if (!hasCursor ()) return ""; //$NON-NLS-1$ |
1009 int index = hdr.hdr.idFrom; | 1009 int index = hdr.hdr.idFrom; |
1010 auto hwndToolTip = cast(HWND) OS.SendMessage (handle, OS.TB_GETTOOLTIPS, 0, 0); | 1010 auto hwndToolTip = cast(HWND) OS.SendMessage (handle, OS.TB_GETTOOLTIPS, 0, 0); |
1011 if (hwndToolTip is hdr.hdr.hwndFrom) { | 1011 if (hwndToolTip is hdr.hdr.hwndFrom) { |
1012 /* | |
1013 * Bug in Windows. For some reason the reading order | |
1014 * in NMTTDISPINFO is sometimes set incorrectly. The | |
1015 * reading order seems to change every time the mouse | |
1016 * enters the control from the top edge. The fix is | |
1017 * to explicitly set TTF_RTLREADING. | |
1018 */ | |
1019 if ((style & DWT.RIGHT_TO_LEFT) !is 0) { | |
1020 hdr.uFlags |= OS.TTF_RTLREADING; | |
1021 } else { | |
1022 hdr.uFlags &= ~OS.TTF_RTLREADING; | |
1023 } | |
1012 if (toolTipText_ !is null) return ""; //$NON-NLS-1$ | 1024 if (toolTipText_ !is null) return ""; //$NON-NLS-1$ |
1013 if (0 <= index && index < items.length) { | 1025 if (0 <= index && index < items.length) { |
1014 ToolItem item = items [index]; | 1026 ToolItem item = items [index]; |
1015 if (item !is null) return item.toolTipText; | 1027 if (item !is null) return item.toolTipText; |
1016 } | 1028 } |
1238 return result; | 1250 return result; |
1239 } | 1251 } |
1240 | 1252 |
1241 override LRESULT WM_SIZE (int wParam, int lParam) { | 1253 override LRESULT WM_SIZE (int wParam, int lParam) { |
1242 if (ignoreResize) { | 1254 if (ignoreResize) { |
1243 int code = callWindowProc (handle, OS.WM_SIZE, wParam, lParam); | 1255 int /*long*/ code = callWindowProc (handle, OS.WM_SIZE, wParam, lParam); |
1244 if (code is 0) return LRESULT.ZERO; | 1256 if (code is 0) return LRESULT.ZERO; |
1245 return new LRESULT (code); | 1257 return new LRESULT (code); |
1246 } | 1258 } |
1247 LRESULT result = super.WM_SIZE (wParam, lParam); | 1259 LRESULT result = super.WM_SIZE (wParam, lParam); |
1248 if (isDisposed ()) return result; | 1260 if (isDisposed ()) return result; |
1321 } | 1333 } |
1322 return result; | 1334 return result; |
1323 } | 1335 } |
1324 | 1336 |
1325 override LRESULT wmCommandChild (int wParam, int lParam) { | 1337 override LRESULT wmCommandChild (int wParam, int lParam) { |
1326 ToolItem child = items [wParam & 0xFFFF]; | 1338 ToolItem child = items [OS.LOWORD (wParam)]; |
1327 if (child is null) return null; | 1339 if (child is null) return null; |
1328 return child.wmCommandChild (wParam, lParam); | 1340 return child.wmCommandChild (wParam, lParam); |
1329 } | 1341 } |
1330 | 1342 |
1331 override LRESULT wmNotifyChild (NMHDR* hdr, int wParam, int lParam) { | 1343 override LRESULT wmNotifyChild (NMHDR* hdr, int wParam, int lParam) { |