Mercurial > projects > dwt-win
comparison dwt/widgets/MenuItem.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 | c84e3d3feb3f |
comparison
equal
deleted
inserted
replaced
212:ab60f3309436 | 213:36f5cb12e1a2 |
---|---|
277 override void destroyWidget () { | 277 override void destroyWidget () { |
278 parent.destroyItem (this); | 278 parent.destroyItem (this); |
279 releaseHandle (); | 279 releaseHandle (); |
280 } | 280 } |
281 | 281 |
282 void fillAccel (ACCEL* accel) { | 282 bool fillAccel (ACCEL* accel) { |
283 accel.fVirt = 0; | 283 accel.cmd = accel.key = accel.fVirt = 0; |
284 accel.cmd = accel.key = 0; | 284 if (accelerator is 0 || !getEnabled ()) return false; |
285 if (accelerator is 0 || !getEnabled ()) return; | 285 if ((accelerator & DWT.COMMAND) !is 0) return false; |
286 int fVirt = OS.FVIRTKEY; | 286 int fVirt = OS.FVIRTKEY; |
287 int key = accelerator & DWT.KEY_MASK; | 287 int key = accelerator & DWT.KEY_MASK; |
288 auto vKey = Display.untranslateKey (key); | 288 auto vKey = Display.untranslateKey (key); |
289 if (vKey !is 0) { | 289 if (vKey !is 0) { |
290 key = vKey; | 290 key = vKey; |
298 */ | 298 */ |
299 case 27: key = OS.VK_ESCAPE; break; | 299 case 27: key = OS.VK_ESCAPE; break; |
300 case 127: key = OS.VK_DELETE; break; | 300 case 127: key = OS.VK_DELETE; break; |
301 default: { | 301 default: { |
302 key = Display.wcsToMbcs (cast(char) key); | 302 key = Display.wcsToMbcs (cast(char) key); |
303 if (key is 0) return; | 303 if (key is 0) return false; |
304 static if (OS.IsWinCE) { | 304 static if (OS.IsWinCE) { |
305 key = cast(int) OS.CharUpper (cast(TCHAR*) key); | 305 key = cast(int) OS.CharUpper (cast(TCHAR*) key); |
306 } else { | 306 } else { |
307 vKey = OS.VkKeyScan (cast(TCHAR) key) & 0xFF; | 307 vKey = OS.VkKeyScan (cast(TCHAR) key) & 0xFF; |
308 if (vKey is -1) { | 308 if (vKey is -1) { |
318 accel.cmd = cast(short) id; | 318 accel.cmd = cast(short) id; |
319 accel.fVirt = cast(byte) fVirt; | 319 accel.fVirt = cast(byte) fVirt; |
320 if ((accelerator & DWT.ALT) !is 0) accel.fVirt |= OS.FALT; | 320 if ((accelerator & DWT.ALT) !is 0) accel.fVirt |= OS.FALT; |
321 if ((accelerator & DWT.SHIFT) !is 0) accel.fVirt |= OS.FSHIFT; | 321 if ((accelerator & DWT.SHIFT) !is 0) accel.fVirt |= OS.FSHIFT; |
322 if ((accelerator & DWT.CONTROL) !is 0) accel.fVirt |= OS.FCONTROL; | 322 if ((accelerator & DWT.CONTROL) !is 0) accel.fVirt |= OS.FCONTROL; |
323 return true; | |
323 } | 324 } |
324 | 325 |
325 void fixMenus (Decorations newParent) { | 326 void fixMenus (Decorations newParent) { |
326 if (menu !is null) menu.fixMenus (newParent); | 327 if (menu !is null) menu.fixMenus (newParent); |
327 } | 328 } |
425 TBBUTTONINFO info; | 426 TBBUTTONINFO info; |
426 info.cbSize = TBBUTTONINFO.sizeof; | 427 info.cbSize = TBBUTTONINFO.sizeof; |
427 info.dwMask = OS.TBIF_STATE; | 428 info.dwMask = OS.TBIF_STATE; |
428 OS.SendMessage (hwndCB, OS.TB_GETBUTTONINFO, id, &info); | 429 OS.SendMessage (hwndCB, OS.TB_GETBUTTONINFO, id, &info); |
429 return (info.fsState & OS.TBSTATE_ENABLED) !is 0; | 430 return (info.fsState & OS.TBSTATE_ENABLED) !is 0; |
431 } | |
432 /* | |
433 * Feature in Windows. For some reason, when the menu item | |
434 * is a separator, GetMenuItemInfo() always indicates that | |
435 * the item is not enabled. The fix is to track the enabled | |
436 * state for separators. | |
437 */ | |
438 if ((style & DWT.SEPARATOR) !is 0) { | |
439 return (state & DISABLED) is 0; | |
430 } | 440 } |
431 auto hMenu = parent.handle; | 441 auto hMenu = parent.handle; |
432 MENUITEMINFO info; | 442 MENUITEMINFO info; |
433 info.cbSize = MENUITEMINFO.sizeof; | 443 info.cbSize = MENUITEMINFO.sizeof; |
434 info.fMask = OS.MIIM_STATE; | 444 info.fMask = OS.MIIM_STATE; |
541 super.releaseHandle (); | 551 super.releaseHandle (); |
542 parent = null; | 552 parent = null; |
543 id = -1; | 553 id = -1; |
544 } | 554 } |
545 | 555 |
546 void releaseMenu () { | |
547 if (!OS.IsSP) setMenu (null); | |
548 menu = null; | |
549 } | |
550 | |
551 override void releaseParent () { | 556 override void releaseParent () { |
552 super.releaseParent (); | 557 super.releaseParent (); |
553 if (menu !is null) menu.dispose (); | 558 if (menu !is null) menu.dispose (); |
554 menu = null; | 559 menu = null; |
555 } | 560 } |
693 OS.SendMessage (hwndCB, OS.TB_GETBUTTONINFO, id, &info); | 698 OS.SendMessage (hwndCB, OS.TB_GETBUTTONINFO, id, &info); |
694 info.fsState &= ~OS.TBSTATE_ENABLED; | 699 info.fsState &= ~OS.TBSTATE_ENABLED; |
695 if (enabled) info.fsState |= OS.TBSTATE_ENABLED; | 700 if (enabled) info.fsState |= OS.TBSTATE_ENABLED; |
696 OS.SendMessage (hwndCB, OS.TB_SETBUTTONINFO, id, &info); | 701 OS.SendMessage (hwndCB, OS.TB_SETBUTTONINFO, id, &info); |
697 } else { | 702 } else { |
703 /* | |
704 * Feature in Windows. For some reason, when the menu item | |
705 * is a separator, GetMenuItemInfo() always indicates that | |
706 * the item is not enabled. The fix is to track the enabled | |
707 * state for separators. | |
708 */ | |
709 if ((style & DWT.SEPARATOR) !is 0) { | |
710 if (enabled) { | |
711 state &= ~DISABLED; | |
712 } else { | |
713 state |= DISABLED; | |
714 } | |
715 } | |
698 auto hMenu = parent.handle; | 716 auto hMenu = parent.handle; |
699 static if (OS.IsWinCE) { | 717 static if (OS.IsWinCE) { |
700 int index = parent.indexOf (this); | 718 int index = parent.indexOf (this); |
701 if (index is -1) return; | 719 if (index is -1) return; |
702 int uEnable = OS.MF_BYPOSITION | (enabled ? OS.MF_ENABLED : OS.MF_GRAYED); | 720 int uEnable = OS.MF_BYPOSITION | (enabled ? OS.MF_ENABLED : OS.MF_GRAYED); |
754 checkWidget (); | 772 checkWidget (); |
755 if ((style & DWT.SEPARATOR) !is 0) return; | 773 if ((style & DWT.SEPARATOR) !is 0) return; |
756 super.setImage (image); | 774 super.setImage (image); |
757 static if (OS.IsWinCE) { | 775 static if (OS.IsWinCE) { |
758 if ((OS.IsPPC || OS.IsSP) && parent.hwndCB !is null) { | 776 if ((OS.IsPPC || OS.IsSP) && parent.hwndCB !is null) { |
759 int hwndCB = parent.hwndCB; | 777 int /*long*/ hwndCB = parent.hwndCB; |
760 TBBUTTONINFO info; | 778 TBBUTTONINFO info; |
761 info.cbSize = TBBUTTONINFO.sizeof; | 779 info.cbSize = TBBUTTONINFO.sizeof; |
762 info.dwMask = OS.TBIF_IMAGE; | 780 info.dwMask = OS.TBIF_IMAGE; |
763 info.iImage = parent.imageIndex (image); | 781 info.iImage = parent.imageIndex (image); |
764 OS.SendMessage (hwndCB, OS.TB_SETBUTTONINFO, id, &info); | 782 OS.SendMessage (hwndCB, OS.TB_SETBUTTONINFO, id, &info); |
823 } | 841 } |
824 if (menu.parent !is parent.parent) { | 842 if (menu.parent !is parent.parent) { |
825 error (DWT.ERROR_INVALID_PARENT); | 843 error (DWT.ERROR_INVALID_PARENT); |
826 } | 844 } |
827 } | 845 } |
846 setMenu (menu, false); | |
847 } | |
848 | |
849 void setMenu (Menu menu, bool dispose) { | |
828 | 850 |
829 /* Assign the new menu */ | 851 /* Assign the new menu */ |
830 Menu oldMenu = this.menu; | 852 Menu oldMenu = this.menu; |
831 if (oldMenu is menu) return; | 853 if (oldMenu is menu) return; |
832 if (oldMenu !is null) oldMenu.cascade = null; | 854 if (oldMenu !is null) oldMenu.cascade = null; |
839 HMENU hMenu = menu is null ? null : menu.handle; | 861 HMENU hMenu = menu is null ? null : menu.handle; |
840 OS.SendMessage (hwndCB, OS.SHCMBM_SETSUBMENU, id, hMenu); | 862 OS.SendMessage (hwndCB, OS.SHCMBM_SETSUBMENU, id, hMenu); |
841 } | 863 } |
842 if (OS.IsSP) error (DWT.ERROR_CANNOT_SET_MENU); | 864 if (OS.IsSP) error (DWT.ERROR_CANNOT_SET_MENU); |
843 } else { | 865 } else { |
844 /* | |
845 * Feature in Windows. When SetMenuItemInfo () is used to | |
846 * set a submenu and the menu item already has a submenu, | |
847 * Windows destroys the previous menu. This is undocumented | |
848 * and unexpected but not necessarily wrong. The fix is to | |
849 * remove the item with RemoveMenu () which does not destroy | |
850 * the submenu and then insert the item with InsertMenuItem (). | |
851 */ | |
852 HMENU hMenu = parent.handle; | 866 HMENU hMenu = parent.handle; |
853 MENUITEMINFO info; | 867 MENUITEMINFO info; |
854 info.cbSize = MENUITEMINFO.sizeof; | 868 info.cbSize = MENUITEMINFO.sizeof; |
855 info.fMask = OS.MIIM_DATA; | 869 info.fMask = OS.MIIM_DATA; |
856 int index = 0; | 870 int index = 0; |
857 while (OS.GetMenuItemInfo (hMenu, index, true, &info)) { | 871 while (OS.GetMenuItemInfo (hMenu, index, true, &info)) { |
858 if (info.dwItemData is id) break; | 872 if (info.dwItemData is id) break; |
859 index++; | 873 index++; |
860 } | 874 } |
861 if (info.dwItemData !is id) return; | 875 if (info.dwItemData !is id) return; |
862 bool restoreBitmap = false, success = false; | 876 int cch = 128; |
863 | 877 auto hHeap = OS.GetProcessHeap (); |
878 int byteCount = cch * TCHAR.sizeof; | |
879 auto pszText = cast(TCHAR*)OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); | |
880 info.fMask = OS.MIIM_STATE | OS.MIIM_ID | OS.MIIM_DATA; | |
864 /* | 881 /* |
865 * Bug in Windows. When GetMenuItemInfo() is used to get the text, | 882 * Bug in Windows. When GetMenuItemInfo() is used to get the text, |
866 * for an item that has a bitmap set using MIIM_BITMAP, the text is | 883 * for an item that has a bitmap set using MIIM_BITMAP, the text is |
867 * not returned. This means that when SetMenuItemInfo() is used to | 884 * not returned. This means that when SetMenuItemInfo() is used to |
868 * set the submenu and the current menu state, the text is lost. | 885 * set the submenu and the current menu state, the text is lost. |
869 * The fix is to temporarily remove the bitmap and restore it after | 886 * The fix is use MIIM_BITMAP and MIIM_STRING. |
870 * the text and submenu have been set. | |
871 */ | 887 */ |
872 if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (4, 10)) { | 888 if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (4, 10)) { |
873 info.fMask = OS.MIIM_BITMAP; | 889 info.fMask |= OS.MIIM_BITMAP | OS.MIIM_STRING; |
874 OS.GetMenuItemInfo (hMenu, index, true, &info); | 890 } else { |
875 restoreBitmap = info.hbmpItem !is null || parent.foreground !is -1; | 891 info.fMask |= OS.MIIM_TYPE; |
876 if (restoreBitmap) { | 892 } |
877 info.hbmpItem = null; | |
878 success = cast(bool) OS.SetMenuItemInfo (hMenu, id, false, &info); | |
879 } | |
880 } | |
881 | |
882 int cch = 128; | |
883 auto hHeap = OS.GetProcessHeap (); | |
884 int byteCount = cch * TCHAR.sizeof; | |
885 auto pszText = cast(TCHAR*) OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); | |
886 info.fMask = OS.MIIM_STATE | OS.MIIM_ID | OS.MIIM_TYPE | OS.MIIM_DATA; | |
887 info.dwTypeData = pszText; | 893 info.dwTypeData = pszText; |
888 info.cch = cch; | 894 info.cch = cch; |
889 success = cast(bool) OS.GetMenuItemInfo (hMenu, index, true, &info); | 895 bool success = cast(bool) OS.GetMenuItemInfo (hMenu, index, true, &info); |
890 if (menu !is null) { | 896 if (menu !is null) { |
891 menu.cascade = this; | 897 menu.cascade = this; |
892 info.fMask |= OS.MIIM_SUBMENU; | 898 info.fMask |= OS.MIIM_SUBMENU; |
893 info.hSubMenu = menu.handle; | 899 info.hSubMenu = menu.handle; |
894 } | 900 } |
895 OS.RemoveMenu (hMenu, index, OS.MF_BYPOSITION); | 901 if (OS.IsWinCE) { |
896 static if (OS.IsWinCE) { | 902 OS.RemoveMenu (hMenu, index, OS.MF_BYPOSITION); |
897 /* | 903 /* |
898 * On WinCE, InsertMenuItem() is not available. The fix is to | 904 * On WinCE, InsertMenuItem() is not available. The fix is to |
899 * use SetMenuItemInfo() but this call does not set the menu item | 905 * use SetMenuItemInfo() but this call does not set the menu item |
900 * state and submenu. The fix is to use InsertMenu() to insert | 906 * state and submenu. The fix is to use InsertMenu() to insert |
901 * the item, SetMenuItemInfo() to set the string and EnableMenuItem() | 907 * the item, SetMenuItemInfo() to set the string and EnableMenuItem() |
902 * and CheckMenuItem() to set the state. | 908 * and CheckMenuItem() to set the state. |
903 */ | 909 */ |
904 int uIDNewItem = id; | 910 int /*long*/ uIDNewItem = id; |
905 int uFlags = OS.MF_BYPOSITION; | 911 int uFlags = OS.MF_BYPOSITION; |
906 if (menu !is null) { | 912 if (menu !is null) { |
907 uFlags |= OS.MF_POPUP; | 913 uFlags |= OS.MF_POPUP; |
908 uIDNewItem = menu.handle; | 914 uIDNewItem = cast(int)menu.handle; |
909 } | 915 } |
910 TCHAR lpNewItem = new TCHAR (0, " ", true); | 916 TCHAR[] lpNewItem = StrToTCHARs (0, " ", true); |
911 success = OS.InsertMenu (hMenu, index, uFlags, uIDNewItem, lpNewItem); | 917 success = OS.InsertMenu (hMenu, index, uFlags, uIDNewItem, lpNewItem.ptr) !is 0; |
912 if (success) { | 918 if (success) { |
913 info.fMask = OS.MIIM_DATA | OS.MIIM_TYPE; | 919 info.fMask = OS.MIIM_DATA | OS.MIIM_TYPE; |
914 success = OS.SetMenuItemInfo (hMenu, index, true, info); | 920 success = OS.SetMenuItemInfo (hMenu, index, true, &info) !is 0; |
915 if ((info.fState & (OS.MFS_DISABLED | OS.MFS_GRAYED)) !is 0) { | 921 if ((info.fState & (OS.MFS_DISABLED | OS.MFS_GRAYED)) !is 0) { |
916 OS.EnableMenuItem (hMenu, index, OS.MF_BYPOSITION | OS.MF_GRAYED); | 922 OS.EnableMenuItem (hMenu, index, OS.MF_BYPOSITION | OS.MF_GRAYED); |
917 } | 923 } |
918 if ((info.fState & OS.MFS_CHECKED) !is 0) { | 924 if ((info.fState & OS.MFS_CHECKED) !is 0) { |
919 OS.CheckMenuItem (hMenu, index, OS.MF_BYPOSITION | OS.MF_CHECKED); | 925 OS.CheckMenuItem (hMenu, index, OS.MF_BYPOSITION | OS.MF_CHECKED); |
920 } | 926 } |
921 } | 927 } |
922 } else { | 928 } else { |
923 success = cast(bool) OS.InsertMenuItem (hMenu, index, true, &info); | 929 if (dispose || oldMenu is null) { |
924 /* | 930 success = cast(bool) OS.SetMenuItemInfo (hMenu, index, true, &info); |
925 * Restore the bitmap that was removed to work around a problem | 931 } else { |
926 * in GetMenuItemInfo() and menu items that have bitmaps set with | 932 /* |
927 * MIIM_BITMAP. | 933 * Feature in Windows. When SetMenuItemInfo () is used to |
928 */ | 934 * set a submenu and the menu item already has a submenu, |
929 if (OS.WIN32_VERSION >= OS.VERSION (4, 10)) { | 935 * Windows destroys the previous menu. This is undocumented |
930 if (restoreBitmap) { | 936 * and unexpected but not necessarily wrong. The fix is to |
931 info.fMask = OS.MIIM_BITMAP; | 937 * remove the item with RemoveMenu () which does not destroy |
932 if (parent.foreground !is -1) { | 938 * the submenu and then insert the item with InsertMenuItem (). |
933 info.hbmpItem = OS.HBMMENU_CALLBACK; | 939 */ |
934 } else { | 940 OS.RemoveMenu (hMenu, index, OS.MF_BYPOSITION); |
935 if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) { | 941 success = OS.InsertMenuItem (hMenu, index, true, &info) !is 0; |
936 info.hbmpItem = hBitmap; | |
937 } else { | |
938 info.hbmpItem = OS.HBMMENU_CALLBACK; | |
939 } | |
940 } | |
941 success = cast(bool) OS.SetMenuItemInfo (hMenu, id, false, &info); | |
942 } | |
943 } | 942 } |
944 } | 943 } |
945 if (pszText !is null ) OS.HeapFree (hHeap, 0, pszText); | 944 if (pszText !is null ) OS.HeapFree (hHeap, 0, pszText); |
946 if (!success) error (DWT.ERROR_CANNOT_SET_MENU); | 945 if (!success) error (DWT.ERROR_CANNOT_SET_MENU); |
947 } | 946 } |
1083 } else { | 1082 } else { |
1084 MENUITEMINFO info; | 1083 MENUITEMINFO info; |
1085 info.cbSize = MENUITEMINFO.sizeof; | 1084 info.cbSize = MENUITEMINFO.sizeof; |
1086 auto hMenu = parent.handle; | 1085 auto hMenu = parent.handle; |
1087 | 1086 |
1087 /* Use the character encoding for the default locale */ | |
1088 TCHAR[] buffer = StrToTCHARs (0, string, true); | |
1089 int byteCount = buffer.length * TCHAR.sizeof; | |
1090 pszText = cast(TCHAR*)OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); | |
1091 OS.MoveMemory (pszText, buffer.ptr, byteCount); | |
1088 /* | 1092 /* |
1089 * Bug in Windows 2000. For some reason, when MIIM_TYPE is set | 1093 * Bug in Windows 2000. For some reason, when MIIM_TYPE is set |
1090 * on a menu item that also has MIIM_BITMAP, the MIIM_TYPE clears | 1094 * on a menu item that also has MIIM_BITMAP, the MIIM_TYPE clears |
1091 * the MIIM_BITMAP style. The fix is to reset both MIIM_BITMAP. | 1095 * the MIIM_BITMAP style. The fix is to use MIIM_STRING. |
1092 * Note, this does not happen on Windows 98. | |
1093 */ | 1096 */ |
1094 bool restoreBitmap = false; | |
1095 if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (4, 10)) { | 1097 if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (4, 10)) { |
1096 info.fMask = OS.MIIM_BITMAP; | 1098 info.fMask = OS.MIIM_STRING; |
1097 OS.GetMenuItemInfo (hMenu, id, false, &info); | 1099 } else { |
1098 restoreBitmap = info.hbmpItem !is null || parent.foreground !is -1; | 1100 info.fMask = OS.MIIM_TYPE; |
1099 } | 1101 info.fType = widgetStyle (); |
1100 | 1102 } |
1101 /* Use the character encoding for the default locale */ | |
1102 TCHAR[] buffer = StrToTCHARs (0, string, true); | |
1103 int byteCount = buffer.length * TCHAR.sizeof; | |
1104 pszText = cast(TCHAR*) OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); | |
1105 OS.MoveMemory (pszText, buffer.ptr, byteCount); | |
1106 info.fMask = OS.MIIM_TYPE; | |
1107 info.fType = widgetStyle (); | |
1108 info.dwTypeData = pszText; | 1103 info.dwTypeData = pszText; |
1109 success = cast(bool) OS.SetMenuItemInfo (hMenu, id, false, &info); | 1104 success = cast(bool) OS.SetMenuItemInfo (hMenu, id, false, &info); |
1110 | |
1111 /* | |
1112 * Restore the bitmap that was removed to work around a problem | |
1113 * in GetMenuItemInfo() and menu items that have bitmaps set with | |
1114 * MIIM_BITMAP. | |
1115 */ | |
1116 if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (4, 10)) { | |
1117 if (restoreBitmap) { | |
1118 info.fMask = OS.MIIM_BITMAP; | |
1119 if (parent.foreground !is -1) { | |
1120 info.hbmpItem = OS.HBMMENU_CALLBACK; | |
1121 } else { | |
1122 if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) { | |
1123 info.hbmpItem = hBitmap; | |
1124 } else { | |
1125 info.hbmpItem = OS.HBMMENU_CALLBACK; | |
1126 } | |
1127 } | |
1128 success = cast(bool) OS.SetMenuItemInfo (hMenu, id, false, &info); | |
1129 } | |
1130 } | |
1131 } | 1105 } |
1132 if (pszText !is null) OS.HeapFree (hHeap, 0, pszText); | 1106 if (pszText !is null) OS.HeapFree (hHeap, 0, pszText); |
1133 if (!success) error (DWT.ERROR_CANNOT_SET_TEXT); | 1107 if (!success) error (DWT.ERROR_CANNOT_SET_TEXT); |
1134 parent.redraw (); | 1108 parent.redraw (); |
1135 } | 1109 } |
1149 if ((style & DWT.SEPARATOR) !is 0) return bits | OS.MFT_SEPARATOR; | 1123 if ((style & DWT.SEPARATOR) !is 0) return bits | OS.MFT_SEPARATOR; |
1150 if ((style & DWT.RADIO) !is 0) return bits | OS.MFT_RADIOCHECK; | 1124 if ((style & DWT.RADIO) !is 0) return bits | OS.MFT_RADIOCHECK; |
1151 return bits | OS.MFT_STRING; | 1125 return bits | OS.MFT_STRING; |
1152 } | 1126 } |
1153 | 1127 |
1154 LRESULT wmCommandChild (int wParam, int lParam) { | 1128 LRESULT wmCommandChild (int /*long*/ wParam, int /*long*/ lParam) { |
1155 if ((style & DWT.CHECK) !is 0) { | 1129 if ((style & DWT.CHECK) !is 0) { |
1156 setSelection (!getSelection ()); | 1130 setSelection (!getSelection ()); |
1157 } else { | 1131 } else { |
1158 if ((style & DWT.RADIO) !is 0) { | 1132 if ((style & DWT.RADIO) !is 0) { |
1159 if ((parent.getStyle () & DWT.NO_RADIO_GROUP) !is 0) { | 1133 if ((parent.getStyle () & DWT.NO_RADIO_GROUP) !is 0) { |
1167 setInputState (event, DWT.Selection); | 1141 setInputState (event, DWT.Selection); |
1168 postEvent (DWT.Selection, event); | 1142 postEvent (DWT.Selection, event); |
1169 return null; | 1143 return null; |
1170 } | 1144 } |
1171 | 1145 |
1172 LRESULT wmDrawChild (int wParam, int lParam) { | 1146 LRESULT wmDrawChild (int /*long*/ wParam, int /*long*/ lParam) { |
1173 DRAWITEMSTRUCT* struct_ = cast(DRAWITEMSTRUCT*)lParam; | 1147 DRAWITEMSTRUCT* struct_ = cast(DRAWITEMSTRUCT*)lParam; |
1174 //OS.MoveMemory (struct_, lParam, DRAWITEMSTRUCT.sizeof); | 1148 //OS.MoveMemory (struct_, lParam, DRAWITEMSTRUCT.sizeof); |
1175 if (image !is null) { | 1149 if (image !is null) { |
1176 GCData data = new GCData(); | 1150 GCData data = new GCData(); |
1177 data.device = display; | 1151 data.device = display; |
1190 } | 1164 } |
1191 if (parent.foreground !is -1) OS.SetTextColor (struct_.hDC, parent.foreground); | 1165 if (parent.foreground !is -1) OS.SetTextColor (struct_.hDC, parent.foreground); |
1192 return null; | 1166 return null; |
1193 } | 1167 } |
1194 | 1168 |
1195 LRESULT wmMeasureChild (int wParam, int lParam) { | 1169 LRESULT wmMeasureChild (int /*long*/ wParam, int /*long*/ lParam) { |
1196 MEASUREITEMSTRUCT* struct_ = cast(MEASUREITEMSTRUCT*)lParam; | 1170 MEASUREITEMSTRUCT* struct_ = cast(MEASUREITEMSTRUCT*)lParam; |
1197 //OS.MoveMemory (struct_, lParam, MEASUREITEMSTRUCT.sizeof); | 1171 //OS.MoveMemory (struct_, lParam, MEASUREITEMSTRUCT.sizeof); |
1198 int width = 0, height = 0; | 1172 int width = 0, height = 0; |
1199 if (image !is null) { | 1173 if (image !is null) { |
1200 Rectangle rect = image.getBounds (); | 1174 Rectangle rect = image.getBounds (); |