- Timestamp:
- Oct 29, 2002, 1:19:36 PM (23 years ago)
- Location:
- trunk/src/comctl32
- Files:
-
- 5 added
- 5 deleted
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comctl32/comboex.c
r8382 r9370 20 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 21 * 22 * FIXME: 23 * 1. Implement following extended styles: 24 * CBES_EX_PATHWORDBREAKPROC 25 * CBES_EX_NOSIZELIMIT 26 * CBES_EX_CASESENSITIVE 27 * 2. Notify CBEN_DRAGBEGIN is not implemented. 28 * 22 * NOTE 23 * 24 * This code was audited for completeness against the documented features 25 * of Comctl32.dll version 6.0 on Sep. 9, 2002, by Dimitrie O. Paun. 26 * 27 * Unless otherwise noted, we belive this code to be complete, as per 28 * the specification mentioned above. 29 * If you discover missing features, or bugs, please note them below. 30 * 29 31 */ 30 32 … … 74 76 75 77 /* internal flags in the COMBOEX_INFO structure */ 76 #define WCBE_ACTEDIT 0x00000001 78 #define WCBE_ACTEDIT 0x00000001 /* Edit active i.e. 77 79 * CBEN_BEGINEDIT issued 78 80 * but CBEN_ENDEDIT{A|W} 79 81 * not yet issued. */ 80 #define WCBE_EDITCHG 0x00000002 82 #define WCBE_EDITCHG 0x00000002 /* Edit issued EN_CHANGE */ 81 83 #define WCBE_EDITHASCHANGED (WCBE_ACTEDIT | WCBE_EDITCHG) 82 #define WCBE_EDITFOCUSED 0x00000004 /* Edit control has focus */ 83 84 #define WCBE_EDITFOCUSED 0x00000004 /* Edit control has focus */ 85 #define WCBE_MOUSECAPTURED 0x00000008 /* Combo has captured mouse */ 86 #define WCBE_MOUSEDRAGGED 0x00000010 /* User has dragged in combo */ 84 87 85 88 #define ID_CB_EDIT 1001 … … 88 91 /* 89 92 * Special flag set in DRAWITEMSTRUCT itemState field. It is set by 90 * the ComboEx version of the Combo Window Proc so that when the 91 * WM_DRAWITEM message is then passed to ComboEx, we know that this 93 * the ComboEx version of the Combo Window Proc so that when the 94 * WM_DRAWITEM message is then passed to ComboEx, we know that this 92 95 * particular WM_DRAWITEM message is for listbox only items. Any messasges 93 96 * without this flag is then for the Edit control field. 94 97 * 95 * We really cannot use the ODS_COMBOBOXEDIT flag because MSDN states that 98 * We really cannot use the ODS_COMBOBOXEDIT flag because MSDN states that 96 99 * only version 4.0 applications will have ODS_COMBOBOXEDIT set. 97 100 */ … … 121 124 static LRESULT WINAPI 122 125 COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); 126 static int CALLBACK 127 COMBOEX_PathWordBreakProc(LPWSTR lpch, int ichCurrent, int cch, int code); 123 128 static LRESULT COMBOEX_Destroy (COMBOEX_INFO *infoPtr); 129 130 #ifdef __WIN32OS2__ 131 #undef inline 132 #define inline 133 134 typedef INT (* WINAPI cmp_func_t)(LPCWSTR, LPCWSTR); 135 #else 136 typedef INT (WINAPI *cmp_func_t)(LPCWSTR, LPCWSTR); 137 #endif 124 138 125 139 inline static BOOL is_textW(LPCWSTR str) … … 164 178 inline static CBE_ITEMDATA *get_item_data(COMBOEX_INFO *infoPtr, INT index) 165 179 { 166 return (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo, CB_GETITEMDATA, 180 return (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo, CB_GETITEMDATA, 167 181 (WPARAM)index, 0); 168 182 } 169 183 184 inline static cmp_func_t get_cmp_func(COMBOEX_INFO *infoPtr) 185 { 186 return infoPtr->dwExtStyle & CBES_EX_CASESENSITIVE ? lstrcmpW : lstrcmpiW; 187 } 170 188 171 189 static INT COMBOEX_Notify (COMBOEX_INFO *infoPtr, INT code, NMHDR *hdr) … … 207 225 else if (code == CBEN_GETDISPINFOW) code = CBEN_GETDISPINFOA; 208 226 else if (code == CBEN_DRAGBEGINW) code = CBEN_DRAGBEGINA; 209 227 210 228 ret = COMBOEX_Notify (infoPtr, code, (NMHDR *)hdr); 211 229 212 230 if (astr && hdr->ceItem.pszText == (LPWSTR)astr) 213 231 hdr->ceItem.pszText = wstr; 214 232 215 233 if (astr) COMCTL32_Free(astr); 216 234 217 235 return ret; 218 236 } … … 228 246 } else { 229 247 NMCBEENDEDITA neea; 230 248 231 249 memcpy (&neea.hdr, &neew->hdr, sizeof(NMHDR)); 232 250 neea.fChanged = neew->fChanged; … … 240 258 241 259 260 static void COMBOEX_NotifyDragBegin(COMBOEX_INFO *infoPtr, LPCWSTR wstr) 261 { 262 /* Change the Text item from Unicode to ANSI if necessary for NOTIFY */ 263 if (infoPtr->NtfUnicode) { 264 NMCBEDRAGBEGINW ndbw; 265 266 ndbw.iItemid = -1; 267 lstrcpynW(ndbw.szText, wstr, CBEMAXSTRLEN); 268 COMBOEX_Notify (infoPtr, CBEN_DRAGBEGINW, &ndbw.hdr); 269 } else { 270 NMCBEDRAGBEGINA ndba; 271 272 ndba.iItemid = -1; 273 WideCharToMultiByte (CP_ACP, 0, wstr, -1, ndba.szText, CBEMAXSTRLEN, 0, 0); 274 275 COMBOEX_Notify (infoPtr, CBEN_DRAGBEGINA, &ndba.hdr); 276 } 277 } 278 279 242 280 static void COMBOEX_FreeText (CBE_ITEMDATA *item) 243 281 { … … 254 292 LPWSTR text, buf; 255 293 INT len; 256 257 if (item->pszText != LPSTR_TEXTCALLBACKW) 294 295 if (item->pszText != LPSTR_TEXTCALLBACKW) 258 296 return item->pszText; 259 297 260 298 ZeroMemory(&nmce, sizeof(nmce)); 261 299 nmce.ceItem.mask = CBEIF_TEXT; … … 277 315 } else 278 316 text = nmce.ceItem.pszText; 279 317 280 318 if (nmce.ceItem.mask & CBEIF_DI_SETITEM) 281 319 item->pszText = text; … … 290 328 291 329 mydc = GetDC (0); /* why the entire screen???? */ 292 nfont = SendMessageW (infoPtr->hwndCombo, WM_GETFONT, 0, 0);330 nfont = (HFONT)SendMessageW (infoPtr->hwndCombo, WM_GETFONT, 0, 0); 293 331 ofont = (HFONT) SelectObject (mydc, nfont); 294 332 GetTextExtentPointA (mydc, "A", 1, size); 295 333 SelectObject (mydc, ofont); 296 334 ReleaseDC (0, mydc); 297 TRACE("selected font hwnd=% 08x, height=%ld\n", nfont, size->cy);335 TRACE("selected font hwnd=%p, height=%ld\n", nfont, size->cy); 298 336 } 299 337 … … 376 414 } 377 415 SendMessageW (infoPtr->hwndSelf, CB_SETITEMHEIGHT, (WPARAM)-1, (LPARAM)cy); 378 if (infoPtr->hwndCombo) 416 if (infoPtr->hwndCombo) { 379 417 SendMessageW (infoPtr->hwndCombo, CB_SETITEMHEIGHT, 380 418 (WPARAM) 0, (LPARAM) cy); 419 if ( !(infoPtr->flags & CBES_EX_NOSIZELIMIT)) { 420 RECT comboRect; 421 if (GetWindowRect(infoPtr->hwndCombo, &comboRect)) { 422 RECT ourRect; 423 if (GetWindowRect(infoPtr->hwndSelf, &ourRect)) { 424 if (comboRect.bottom > ourRect.bottom) { 425 POINT pt = { ourRect.left, ourRect.top }; 426 if (ScreenToClient(infoPtr->hwndSelf, &pt)) 427 MoveWindow( infoPtr->hwndSelf, pt.x, pt.y, ourRect.right - ourRect.left, 428 comboRect.bottom - comboRect.top, FALSE); 429 } 430 } 431 } 432 } 433 } 381 434 } 382 435 … … 396 449 } 397 450 398 451 399 452 static CBE_ITEMDATA * COMBOEX_FindItem(COMBOEX_INFO *infoPtr, INT index) 400 453 { … … 424 477 static inline BOOL COMBOEX_HasEdit(COMBOEX_INFO *infoPtr) 425 478 { 426 return infoPtr->hwndEdit ;427 } 428 479 return infoPtr->hwndEdit ? TRUE : FALSE; 480 } 481 429 482 430 483 /* *** CBEM_xxx message support *** */ … … 481 534 482 535 if (is_textW(tmpcit.pszText) && cit->pszText) 483 WideCharToMultiByte (CP_ACP, 0, tmpcit.pszText, -1, 536 WideCharToMultiByte (CP_ACP, 0, tmpcit.pszText, -1, 484 537 cit->pszText, cit->cchTextMax, NULL, NULL); 485 538 else if (cit->pszText) cit->pszText[0] = 0; … … 520 573 /* get zero-filled space and chain it in */ 521 574 if(!(item = (CBE_ITEMDATA *)COMCTL32_Alloc (sizeof(*item)))) return -1; 522 575 523 576 /* locate position to insert new item in */ 524 577 if (index == infoPtr->nb_items) { … … 576 629 if (TRACE_ON(comboex)) COMBOEX_DumpItem (item); 577 630 578 SendMessageW (infoPtr->hwndCombo, CB_INSERTSTRING, 631 SendMessageW (infoPtr->hwndCombo, CB_INSERTSTRING, 579 632 (WPARAM)cit->iItem, (LPARAM)item); 580 633 … … 602 655 citW.pszText = wstr; 603 656 } 604 ret = COMBOEX_InsertItemW(infoPtr, &citW); ;605 657 ret = COMBOEX_InsertItemW(infoPtr, &citW); 658 606 659 if (wstr) COMCTL32_Free(wstr); 607 660 608 661 return ret; 609 662 } 610 663 611 664 612 static DWORD 665 static DWORD 613 666 COMBOEX_SetExtendedStyle (COMBOEX_INFO *infoPtr, DWORD mask, DWORD style) 614 667 { … … 618 671 619 672 dwTemp = infoPtr->dwExtStyle; 620 621 if (style & (CBES_EX_PATHWORDBREAKPROC |622 CBES_EX_NOSIZELIMIT |623 CBES_EX_CASESENSITIVE))624 FIXME("Extended style not implemented %08lx\n", style);625 673 626 674 if (mask) … … 628 676 else 629 677 infoPtr->dwExtStyle = style; 678 679 /* see if we need to change the word break proc on the edit */ 680 if ((infoPtr->dwExtStyle ^ dwTemp) & CBES_EX_PATHWORDBREAKPROC) { 681 SendMessageW(infoPtr->hwndEdit, EM_SETWORDBREAKPROC, 0, 682 (infoPtr->dwExtStyle & CBES_EX_PATHWORDBREAKPROC) ? 683 (LPARAM)COMBOEX_PathWordBreakProc : 0); 684 } 630 685 631 686 /* test if the control's appearance has changed */ … … 676 731 if (!(item = COMBOEX_FindItem(infoPtr, index))) return FALSE; 677 732 678 /* add/change stuff to the internal item structure */ 733 /* add/change stuff to the internal item structure */ 679 734 item->mask |= cit->mask; 680 735 if (cit->mask & CBEIF_TEXT) { … … 726 781 citW.pszText = wstr; 727 782 } 728 ret = COMBOEX_SetItemW(infoPtr, &citW); ;783 ret = COMBOEX_SetItemW(infoPtr, &citW); 729 784 730 785 if (wstr) COMCTL32_Free(wstr); … … 749 804 750 805 static INT 751 COMBOEX_FindStringExact (COMBOEX_INFO *infoPtr, INT start, LPCSTR str) 752 { 753 INT i, count; 754 CBE_ITEMDATA *item; 755 LPWSTR desired = NULL; 756 757 i = MultiByteToWideChar (CP_ACP, 0, str, -1, NULL, 0); 758 if (i > 0) { 759 desired = (LPWSTR)COMCTL32_Alloc ((i + 1)*sizeof(WCHAR)); 760 if (!desired) return CB_ERR; 761 MultiByteToWideChar (CP_ACP, 0, str, -1, desired, i); 762 } 763 764 count = SendMessageW (infoPtr->hwndCombo, CB_GETCOUNT, 0, 0); 806 COMBOEX_FindStringExact (COMBOEX_INFO *infoPtr, INT start, LPCWSTR str) 807 { 808 INT i; 809 cmp_func_t cmptext = get_cmp_func(infoPtr); 810 INT count = SendMessageW (infoPtr->hwndCombo, CB_GETCOUNT, 0, 0); 765 811 766 812 /* now search from after starting loc and wrapping back to start */ 767 813 for(i=start+1; i<count; i++) { 768 item = get_item_data(infoPtr, i); 769 if (lstrcmpiW(COMBOEX_GetText(infoPtr, item), desired) == 0) { 770 COMCTL32_Free (desired); 771 return i; 772 } 814 CBE_ITEMDATA *item = get_item_data(infoPtr, i); 815 if (cmptext(COMBOEX_GetText(infoPtr, item), str) == 0) return i; 773 816 } 774 817 for(i=0; i<=start; i++) { 775 item = get_item_data(infoPtr, i); 776 if (lstrcmpiW(COMBOEX_GetText(infoPtr, item), desired) == 0) { 777 COMCTL32_Free (desired); 778 return i; 779 } 780 } 781 COMCTL32_Free(desired); 818 CBE_ITEMDATA *item = get_item_data(infoPtr, i); 819 if (cmptext(COMBOEX_GetText(infoPtr, item), str) == 0) return i; 820 } 782 821 return CB_ERR; 783 822 } … … 857 896 GetWindowRect (infoPtr->hwndSelf, &cbx_wrect); 858 897 GetClientRect (infoPtr->hwndSelf, &cbx_crect); 859 /* the height of comboex as height of the combo + comboex border */ 898 /* the height of comboex as height of the combo + comboex border */ 860 899 height = cb_wrect.bottom-cb_wrect.top 861 900 + cbx_wrect.bottom-cbx_wrect.top … … 884 923 WCHAR NIL[] = { 0 }; 885 924 COMBOEX_INFO *infoPtr; 886 DWORD dwComboStyle;887 925 LOGFONTW mylogfont; 888 926 RECT wnrc1, clrc1, cmbwrc; … … 895 933 /* initialize info structure */ 896 934 /* note that infoPtr is allocated zero-filled */ 897 935 898 936 infoPtr->hwndSelf = hwnd; 899 937 infoPtr->selected = -1; … … 901 939 infoPtr->unicode = IsWindowUnicode (hwnd); 902 940 903 i = SendMessageW(GetParent (hwnd), WM_NOTIFYFORMAT, hwnd, NF_QUERY);941 i = SendMessageW(GetParent (hwnd), WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_QUERY); 904 942 if ((i != NFR_ANSI) && (i != NFR_UNICODE)) { 905 943 WARN("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n", i); … … 911 949 912 950 /* create combo box */ 913 dwComboStyle = GetWindowLongW (hwnd, GWL_STYLE) &914 (CBS_SIMPLE|CBS_DROPDOWN|CBS_DROPDOWNLIST|WS_CHILD);915 916 951 GetWindowRect(hwnd, &wnrc1); 917 952 GetClientRect(hwnd, &clrc1); … … 919 954 wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom, 920 955 clrc1.left, clrc1.top, clrc1.right, clrc1.bottom); 921 TRACE("combo style=%08lx, adding style=%08lx\n", dwComboStyle,922 WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VSCROLL |923 CBS_NOINTEGRALHEIGHT | CBS_DROPDOWNLIST |924 WS_CHILD | WS_VISIBLE | CBS_OWNERDRAWFIXED);925 956 926 957 /* Native version of ComboEx creates the ComboBox with DROPDOWNLIST */ … … 934 965 /* following line added to match native */ 935 966 WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VSCROLL | 936 CBS_NOINTEGRALHEIGHT | CBS_DROPDOWNLIST | 967 CBS_NOINTEGRALHEIGHT | CBS_DROPDOWNLIST | 937 968 /* was base and is necessary */ 938 WS_CHILD | WS_VISIBLE | CBS_OWNERDRAWFIXED | dwComboStyle, 969 WS_CHILD | WS_VISIBLE | CBS_OWNERDRAWFIXED | 970 GetWindowLongW (hwnd, GWL_STYLE), 939 971 cs->y, cs->x, cs->cx, cs->cy, hwnd, 940 972 (HMENU) GetWindowLongW (hwnd, GWL_ID), 941 GetWindowLongW (hwnd, GWL_HINSTANCE), NULL);942 943 /* 973 (HINSTANCE)GetWindowLongW (hwnd, GWL_HINSTANCE), NULL); 974 975 /* 944 976 * native does the following at this point according to trace: 945 977 * GetWindowThreadProcessId(hwndCombo,0) … … 950 982 951 983 /* 952 * Setup a property to hold the pointer to the COMBOBOXEX 984 * Setup a property to hold the pointer to the COMBOBOXEX 953 985 * data structure. 954 986 */ 955 987 SetPropA(infoPtr->hwndCombo, COMBOEX_SUBCLASS_PROP, hwnd); 956 infoPtr->prevComboWndProc = (WNDPROC)SetWindowLongW(infoPtr->hwndCombo, 988 infoPtr->prevComboWndProc = (WNDPROC)SetWindowLongW(infoPtr->hwndCombo, 957 989 GWL_WNDPROC, (LONG)COMBOEX_ComboWndProc); 958 infoPtr->font = SendMessageW (infoPtr->hwndCombo, WM_GETFONT, 0, 0);990 infoPtr->font = (HFONT)SendMessageW (infoPtr->hwndCombo, WM_GETFONT, 0, 0); 959 991 960 992 … … 967 999 WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | ES_AUTOHSCROLL, 968 1000 0, 0, 0, 0, /* will set later */ 969 infoPtr->hwndCombo, 1001 infoPtr->hwndCombo, 970 1002 (HMENU) GetWindowLongW (hwnd, GWL_ID), 971 GetWindowLongW (hwnd, GWL_HINSTANCE), 972 NULL); 1003 (HINSTANCE)GetWindowLongW (hwnd, GWL_HINSTANCE), NULL); 973 1004 974 1005 /* native does the following at this point according to trace: … … 980 1011 981 1012 /* 982 * Setup a property to hold the pointer to the COMBOBOXEX 1013 * Setup a property to hold the pointer to the COMBOBOXEX 983 1014 * data structure. 984 1015 */ 985 1016 SetPropA(infoPtr->hwndEdit, COMBOEX_SUBCLASS_PROP, hwnd); 986 infoPtr->prevEditWndProc = (WNDPROC)SetWindowLongW(infoPtr->hwndEdit, 1017 infoPtr->prevEditWndProc = (WNDPROC)SetWindowLongW(infoPtr->hwndEdit, 987 1018 GWL_WNDPROC, (LONG)COMBOEX_EditWndProc); 988 infoPtr->font = SendMessageW(infoPtr->hwndCombo, WM_GETFONT, 0, 0);1019 infoPtr->font = (HFONT)SendMessageW(infoPtr->hwndCombo, WM_GETFONT, 0, 0); 989 1020 } 990 1021 … … 994 1025 */ 995 1026 if (!infoPtr->font) { 996 SystemParametersInfoW (SPI_GETICONTITLELOGFONT, sizeof(mylogfont), 1027 SystemParametersInfoW (SPI_GETICONTITLELOGFONT, sizeof(mylogfont), 997 1028 &mylogfont, 0); 998 1029 infoPtr->font = infoPtr->defaultFont = CreateFontIndirectW (&mylogfont); … … 1015 1046 clrc1.left, clrc1.top, clrc1.right, clrc1.bottom, 1016 1047 cmbwrc.left, cmbwrc.top, cmbwrc.right, cmbwrc.bottom); 1017 SetWindowPos(infoPtr->hwndCombo, HWND_TOP, 1048 SetWindowPos(infoPtr->hwndCombo, HWND_TOP, 1018 1049 0, 0, wnrc1.right-wnrc1.left, wnrc1.bottom-wnrc1.top, 1019 1050 SWP_NOACTIVATE | SWP_NOREDRAW); … … 1022 1053 TRACE("CB window=(%d,%d)-(%d,%d)\n", 1023 1054 cmbwrc.left, cmbwrc.top, cmbwrc.right, cmbwrc.bottom); 1024 SetWindowPos(hwnd, HWND_TOP, 1055 SetWindowPos(hwnd, HWND_TOP, 1025 1056 0, 0, cmbwrc.right-cmbwrc.left, cmbwrc.bottom-cmbwrc.top, 1026 1057 SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE); … … 1029 1060 1030 1061 /* 1031 * Create an item structure to represent the data in the 1062 * Create an item structure to represent the data in the 1032 1063 * EDIT control. It is allocated zero-filled. 1033 1064 */ … … 1061 1092 ShowWindow (infoPtr->hwndEdit, SW_HIDE); 1062 1093 return SendMessageW (parent, WM_COMMAND, wParam, (LPARAM)infoPtr->hwndSelf); 1063 1094 1064 1095 case CBN_CLOSEUP: 1065 1096 SendMessageW (parent, WM_COMMAND, wParam, (LPARAM)infoPtr->hwndSelf); 1066 1097 /* 1067 * from native trace of first dropdown after typing in URL in IE4 1098 * from native trace of first dropdown after typing in URL in IE4 1068 1099 * CB_GETCURSEL(Combo) 1069 1100 * GetWindowText(Edit) … … 1075 1106 * CB_SETCURSEL(COMBOEX, n) 1076 1107 * SetFocus(Combo) 1077 * the rest is supposition 1108 * the rest is supposition 1078 1109 */ 1079 1110 ShowWindow (infoPtr->hwndEdit, SW_SHOW); … … 1082 1113 cursel = SendMessageW (infoPtr->hwndCombo, CB_GETCURSEL, 0, 0); 1083 1114 if (cursel == -1) { 1115 cmp_func_t cmptext = get_cmp_func(infoPtr); 1084 1116 /* find match from edit against those in Combobox */ 1085 1117 GetWindowTextW (infoPtr->hwndEdit, wintext, 520); … … 1088 1120 item = get_item_data(infoPtr, cursel); 1089 1121 if ((INT)item == CB_ERR) break; 1090 if (! lstrcmpiW(COMBOEX_GetText(infoPtr, item), wintext)) break;1122 if (!cmptext(COMBOEX_GetText(infoPtr, item), wintext)) break; 1091 1123 } 1092 1124 if ((cursel == n) || ((INT)item == CB_ERR)) { … … 1155 1187 1156 1188 case CBN_SELENDOK: 1157 /* 1189 /* 1158 1190 * We have to change the handle since we are the control 1159 1191 * issuing the message. IE4 depends on this. … … 1189 1221 1190 1222 default: 1191 /* 1223 /* 1192 1224 * We have to change the handle since we are the control 1193 1225 * issuing the message. IE4 depends on this. … … 1210 1242 INT i; 1211 1243 1212 TRACE("CtlType=%08x, CtlID=%08x, itemID=%08x, hwnd=% x, data=%08lx\n",1244 TRACE("CtlType=%08x, CtlID=%08x, itemID=%08x, hwnd=%p, data=%08lx\n", 1213 1245 dis->CtlType, dis->CtlID, dis->itemID, dis->hwndItem, dis->itemData); 1214 1246 … … 1264 1296 if (!IsWindowEnabled(infoPtr->hwndCombo)) return 0; 1265 1297 1266 TRACE("DRAWITEMSTRUCT: CtlType=0x%08x CtlID=0x%08x\n", 1298 TRACE("DRAWITEMSTRUCT: CtlType=0x%08x CtlID=0x%08x\n", 1267 1299 dis->CtlType, dis->CtlID); 1268 TRACE("itemID=0x%08x itemAction=0x%08x itemState=0x%08x\n", 1300 TRACE("itemID=0x%08x itemAction=0x%08x itemState=0x%08x\n", 1269 1301 dis->itemID, dis->itemAction, dis->itemState); 1270 TRACE("hWnd= 0x%04x hDC=0x%04x(%d,%d)-(%d,%d) itemData=0x%08lx\n",1271 dis->hwndItem, dis->hDC, dis->rcItem.left, 1272 dis->rcItem.top, dis->rcItem.right, dis->rcItem.bottom, 1302 TRACE("hWnd=%p hDC=%p (%d,%d)-(%d,%d) itemData=0x%08lx\n", 1303 dis->hwndItem, dis->hDC, dis->rcItem.left, 1304 dis->rcItem.top, dis->rcItem.right, dis->rcItem.bottom, 1273 1305 dis->itemData); 1274 1306 … … 1286 1318 if (dis->itemID == 0xffffffff) { 1287 1319 if ( ( (dis->itemAction & ODA_FOCUS) && (dis->itemState & ODS_SELECTED)) || 1288 ( (dis->itemAction & (ODA_SELECT | ODA_DRAWENTIRE)) && (dis->itemState & ODS_FOCUS) ) ) { 1320 ( (dis->itemAction & (ODA_SELECT | ODA_DRAWENTIRE)) && (dis->itemState & ODS_FOCUS) ) ) { 1289 1321 1290 1322 TRACE("drawing item -1 special focus, rect=(%d,%d)-(%d,%d)\n", … … 1292 1324 dis->rcItem.right, dis->rcItem.bottom); 1293 1325 } 1294 else if ((dis->CtlType == ODT_COMBOBOX) && 1326 else if ((dis->CtlType == ODT_COMBOBOX) && 1295 1327 (dis->itemAction == ODA_DRAWENTIRE)) { 1296 1328 /* draw of edit control data */ … … 1334 1366 if (item->pszText) 1335 1367 GetWindowTextW(infoPtr->hwndEdit, item->pszText, len+1); 1336 1337 TRACE("edit control hwndEdit=% 0x, text len=%d str=%s\n",1368 1369 TRACE("edit control hwndEdit=%p, text len=%d str=%s\n", 1338 1370 infoPtr->hwndEdit, len, debugstr_txt(item->pszText)); 1339 1371 } … … 1382 1414 /* drawing combo/edit entry */ 1383 1415 if (IsWindowVisible(infoPtr->hwndEdit)) { 1384 /* if we have an edit control, the slave the 1385 * selection state to the Edit focus state 1416 /* if we have an edit control, the slave the 1417 * selection state to the Edit focus state 1386 1418 */ 1387 1419 if (infoPtr->flags & WCBE_EDITFOCUSED) { … … 1391 1423 } 1392 1424 } else { 1393 /* if we don't have an edit control, use 1425 /* if we don't have an edit control, use 1394 1426 * the requested state. 1395 1427 */ … … 1415 1447 len = strlenW (str); 1416 1448 GetTextExtentPoint32W (dis->hDC, str, len, &txtsize); 1417 1449 1418 1450 if (dis->itemAction & (ODA_SELECT | ODA_DRAWENTIRE)) { 1419 1451 int overlay = item->iOverlay; 1420 1452 1421 1453 if (drawimage == I_IMAGECALLBACK) { 1422 1454 NMCOMBOBOXEXW nmce; … … 1442 1474 overlay = nmce.ceItem.iOverlay; 1443 1475 } 1444 1445 if (drawimage >= 0 && 1476 1477 if (drawimage >= 0 && 1446 1478 !(infoPtr->dwExtStyle & (CBES_EX_NOEDITIMAGE | CBES_EX_NOEDITIMAGEINDENT))) { 1447 1479 if (overlay > 0) ImageList_SetOverlayImage (infoPtr->himl, overlay, 1); 1448 ImageList_Draw (infoPtr->himl, drawimage, dis->hDC, xbase, dis->rcItem.top, 1480 ImageList_Draw (infoPtr->himl, drawimage, dis->hDC, xbase, dis->rcItem.top, 1449 1481 drawstate | (overlay > 0 ? INDEXTOOVERLAYMASK(1) : 0)); 1450 1482 } … … 1473 1505 } 1474 1506 } 1475 1507 1476 1508 if (dis->itemAction & ODA_FOCUS) { 1477 1509 rect.left = xbase + xioff - 1; … … 1509 1541 } 1510 1542 1511 if (infoPtr->defaultFont) 1543 if (infoPtr->defaultFont) 1512 1544 DeleteObject (infoPtr->defaultFont); 1513 1545 … … 1529 1561 mis->itemHeight = mysize.cy + CBE_EXTRA; 1530 1562 1531 TRACE("adjusted height hwnd=% 08x, height=%d\n",1563 TRACE("adjusted height hwnd=%p, height=%d\n", 1532 1564 infoPtr->hwndSelf, mis->itemHeight); 1533 1565 … … 1556 1588 if (lParam == NF_REQUERY) { 1557 1589 INT i = SendMessageW(GetParent (infoPtr->hwndSelf), 1558 WM_NOTIFYFORMAT, infoPtr->hwndSelf, NF_QUERY);1590 WM_NOTIFYFORMAT, (WPARAM)infoPtr->hwndSelf, NF_QUERY); 1559 1591 infoPtr->NtfUnicode = (i == NFR_UNICODE) ? 1 : 0; 1560 1592 } … … 1565 1597 static LRESULT COMBOEX_Size (COMBOEX_INFO *infoPtr, INT width, INT height) 1566 1598 { 1567 TRACE("(width=%d, height=%d)\n", width, height); 1599 TRACE("(width=%d, height=%d)\n", width, height); 1568 1600 1569 1601 MoveWindow (infoPtr->hwndCombo, 0, 0, width, height, TRUE); … … 1586 1618 /* width is winpos value + border width of comboex */ 1587 1619 width = wp->cx 1588 + (cbx_wrect.right-cbx_wrect.left) 1589 - (cbx_crect.right-cbx_crect.left); 1620 + (cbx_wrect.right-cbx_wrect.left) 1621 - (cbx_crect.right-cbx_crect.left); 1590 1622 1591 1623 TRACE("winpos=(%d,%d %dx%d) flags=0x%08x\n", … … 1618 1650 } 1619 1651 1652 static inline int is_delimiter(WCHAR c) 1653 { 1654 switch(c) { 1655 case '/': 1656 case '\\': 1657 case '.': 1658 return TRUE; 1659 } 1660 return FALSE; 1661 } 1662 1663 static int CALLBACK 1664 COMBOEX_PathWordBreakProc(LPWSTR lpch, int ichCurrent, int cch, int code) 1665 { 1666 if (code == WB_ISDELIMITER) { 1667 return is_delimiter(lpch[ichCurrent]); 1668 } else { 1669 int dir = (code == WB_LEFT) ? -1 : 1; 1670 for(; 0 <= ichCurrent && ichCurrent < cch; ichCurrent += dir) 1671 if (is_delimiter(lpch[ichCurrent])) return ichCurrent; 1672 } 1673 return ichCurrent; 1674 } 1620 1675 1621 1676 static LRESULT WINAPI … … 1631 1686 LRESULT lret; 1632 1687 1633 TRACE("hwnd=% x msg=%x wparam=%x lParam=%lx, info_ptr=%p\n",1688 TRACE("hwnd=%p msg=%x wparam=%x lParam=%lx, info_ptr=%p\n", 1634 1689 hwnd, uMsg, wParam, lParam, infoPtr); 1635 1690 … … 1643 1698 if (wParam == VK_RETURN) return 0; 1644 1699 /* all other characters pass into the real Edit */ 1645 return CallWindowProcW (infoPtr->prevEditWndProc, 1700 return CallWindowProcW (infoPtr->prevEditWndProc, 1646 1701 hwnd, uMsg, wParam, lParam); 1647 1702 1648 1703 case WM_ERASEBKGND: 1649 1704 /* 1650 * The following was determined by traces of the native 1705 * The following was determined by traces of the native 1651 1706 */ 1652 1707 hDC = (HDC) wParam; … … 1657 1712 ExtTextOutW (hDC, 0, 0, ETO_OPAQUE, &rect, 0, 0, 0); 1658 1713 SetBkColor (hDC, obkc); 1659 return CallWindowProcW (infoPtr->prevEditWndProc, 1714 return CallWindowProcW (infoPtr->prevEditWndProc, 1660 1715 hwnd, uMsg, wParam, lParam); 1661 1716 … … 1672 1727 * CB_GETCURSEL to Combo rets -1 x 1673 1728 * WM_NOTIFY to COMBOEX parent (rebar) x 1674 * (CBEN_ENDEDIT{A|W} 1729 * (CBEN_ENDEDIT{A|W} 1675 1730 * fChanged = FALSE x 1676 1731 * inewSelection = -1 x … … 1701 1756 break; 1702 1757 } 1703 infoPtr->selected = oldItem; 1758 infoPtr->selected = oldItem; 1704 1759 COMBOEX_SetEditText (infoPtr, item); 1705 RedrawWindow (infoPtr->hwndCombo, 0, 0, RDW_ERASE | 1760 RedrawWindow (infoPtr->hwndCombo, 0, 0, RDW_ERASE | 1706 1761 RDW_INVALIDATE); 1707 1762 break; … … 1713 1768 * CB_GETCURSEL to Combo rets -1 x 1714 1769 * CB_GETCOUNT to Combo rets 0 1715 * if >0 loop 1770 * if >0 loop 1716 1771 * CB_GETITEMDATA to match 1717 * *** above 3 lines simulated by FindItem x 1772 * *** above 3 lines simulated by FindItem x 1718 1773 * WM_NOTIFY to COMBOEX parent (rebar) x 1719 1774 * (CBEN_ENDEDIT{A|W} x … … 1738 1793 1739 1794 if (selected != -1) { 1795 cmp_func_t cmptext = get_cmp_func(infoPtr); 1740 1796 item = COMBOEX_FindItem (infoPtr, selected); 1741 1797 TRACE("handling VK_RETURN, selected = %d, selected_text=%s\n", … … 1743 1799 TRACE("handling VK_RETURN, edittext=%s\n", 1744 1800 debugstr_w(edit_text)); 1745 if ( lstrcmpiW(COMBOEX_GetText(infoPtr, item), edit_text)) {1801 if (cmptext (COMBOEX_GetText(infoPtr, item), edit_text)) { 1746 1802 /* strings not equal -- indicate edit has changed */ 1747 1803 selected = -1; … … 1750 1806 1751 1807 cbeend.iNewSelection = selected; 1752 cbeend.fChanged = TRUE; 1808 cbeend.fChanged = TRUE; 1753 1809 cbeend.iWhy = CBENF_RETURN; 1754 1810 if (COMBOEX_NotifyEndEdit (infoPtr, &cbeend, edit_text)) { … … 1756 1812 TRACE("Notify requested abort of change\n"); 1757 1813 COMBOEX_SetEditText (infoPtr, infoPtr->edit); 1758 RedrawWindow (infoPtr->hwndCombo, 0, 0, RDW_ERASE | 1814 RedrawWindow (infoPtr->hwndCombo, 0, 0, RDW_ERASE | 1759 1815 RDW_INVALIDATE); 1760 1816 return 0; … … 1763 1819 if (oldItem != -1) { 1764 1820 /* if something is selected, then deselect it */ 1765 SendMessageW (infoPtr->hwndCombo, CB_SETCURSEL, 1821 SendMessageW (infoPtr->hwndCombo, CB_SETCURSEL, 1766 1822 (WPARAM)-1, 0); 1767 1823 } … … 1787 1843 case WM_SETFOCUS: 1788 1844 /* remember the focus to set state of icon */ 1789 lret = CallWindowProcW (infoPtr->prevEditWndProc, 1845 lret = CallWindowProcW (infoPtr->prevEditWndProc, 1790 1846 hwnd, uMsg, wParam, lParam); 1791 1847 infoPtr->flags |= WCBE_EDITFOCUSED; … … 1793 1849 1794 1850 case WM_KILLFOCUS: 1795 /* 1851 /* 1796 1852 * do NOTIFY CBEN_ENDEDIT with CBENF_KILLFOCUS 1797 1853 */ … … 1811 1867 1812 1868 default: 1813 return CallWindowProcW (infoPtr->prevEditWndProc, 1869 return CallWindowProcW (infoPtr->prevEditWndProc, 1814 1870 hwnd, uMsg, wParam, lParam); 1815 1871 } … … 1829 1885 HWND focusedhwnd; 1830 1886 RECT rect; 1887 POINT pt; 1831 1888 WCHAR edit_text[260]; 1832 1889 1833 TRACE("hwnd=% x msg=%x wparam=%x lParam=%lx, info_ptr=%p\n",1890 TRACE("hwnd=%p msg=%x wparam=%x lParam=%lx, info_ptr=%p\n", 1834 1891 hwnd, uMsg, wParam, lParam, infoPtr); 1835 1892 … … 1838 1895 switch (uMsg) 1839 1896 { 1840 1841 case CB_FINDSTRINGEXACT:1842 return COMBOEX_FindStringExact (infoPtr, (INT)wParam, (LPCSTR)lParam);1843 1897 1844 1898 case WM_DRAWITEM: … … 1849 1903 */ 1850 1904 ((DRAWITEMSTRUCT *)lParam)->itemState |= ODS_COMBOEXLBOX; 1851 return CallWindowProcW (infoPtr->prevComboWndProc, 1905 return CallWindowProcW (infoPtr->prevComboWndProc, 1852 1906 hwnd, uMsg, wParam, lParam); 1853 1907 1854 1908 case WM_ERASEBKGND: 1855 1909 /* 1856 * The following was determined by traces of the native 1910 * The following was determined by traces of the native 1857 1911 */ 1858 1912 hDC = (HDC) wParam; … … 1863 1917 ExtTextOutW (hDC, 0, 0, ETO_OPAQUE, &rect, 0, 0, 0); 1864 1918 SetBkColor (hDC, obkc); 1865 return CallWindowProcW (infoPtr->prevComboWndProc, 1919 return CallWindowProcW (infoPtr->prevComboWndProc, 1866 1920 hwnd, uMsg, wParam, lParam); 1867 1921 … … 1878 1932 nmmse.dwHitInfo = lParam; 1879 1933 COMBOEX_Notify (infoPtr, NM_SETCURSOR, (NMHDR *)&nmmse); 1880 return CallWindowProcW (infoPtr->prevComboWndProc, 1934 return CallWindowProcW (infoPtr->prevComboWndProc, 1881 1935 hwnd, uMsg, wParam, lParam); 1936 1937 case WM_LBUTTONDOWN: 1938 GetClientRect (hwnd, &rect); 1939 rect.bottom = rect.top + SendMessageW(infoPtr->hwndSelf, 1940 CB_GETITEMHEIGHT, -1, 0); 1941 rect.left = rect.right - GetSystemMetrics(SM_CXVSCROLL); 1942 POINTSTOPOINT(pt, MAKEPOINTS(lParam)); 1943 if (PtInRect(&rect, pt)) 1944 return CallWindowProcW (infoPtr->prevComboWndProc, 1945 hwnd, uMsg, wParam, lParam); 1946 infoPtr->flags |= WCBE_MOUSECAPTURED; 1947 SetCapture(hwnd); 1948 break; 1949 1950 case WM_LBUTTONUP: 1951 if (!(infoPtr->flags & WCBE_MOUSECAPTURED)) 1952 return CallWindowProcW (infoPtr->prevComboWndProc, 1953 hwnd, uMsg, wParam, lParam); 1954 ReleaseCapture(); 1955 infoPtr->flags &= ~WCBE_MOUSECAPTURED; 1956 if (infoPtr->flags & WCBE_MOUSEDRAGGED) { 1957 infoPtr->flags &= ~WCBE_MOUSEDRAGGED; 1958 } else { 1959 SendMessageW(hwnd, CB_SHOWDROPDOWN, TRUE, 0); 1960 } 1961 break; 1962 1963 case WM_MOUSEMOVE: 1964 if ( (infoPtr->flags & WCBE_MOUSECAPTURED) && 1965 !(infoPtr->flags & WCBE_MOUSEDRAGGED)) { 1966 GetWindowTextW (infoPtr->hwndEdit, edit_text, 260); 1967 COMBOEX_NotifyDragBegin(infoPtr, edit_text); 1968 infoPtr->flags |= WCBE_MOUSEDRAGGED; 1969 } 1970 return CallWindowProcW (infoPtr->prevComboWndProc, 1971 hwnd, uMsg, wParam, lParam); 1882 1972 1883 1973 case WM_COMMAND: … … 1918 2008 if (focusedhwnd) 1919 2009 SendMessageW (infoPtr->hwndCombo, WM_KILLFOCUS, 1920 (WPARAM)focusedhwnd, 0); 2010 (WPARAM)focusedhwnd, 0); 1921 2011 return 0; 1922 2012 1923 2013 case EN_SETFOCUS: { 1924 /* 2014 /* 1925 2015 * For EN_SETFOCUS this issues the same calls and messages 1926 2016 * as the native seems to do. … … 1948 2038 1949 2039 case EN_CHANGE: { 1950 /* 2040 /* 1951 2041 * For EN_CHANGE this issues the same calls and messages 1952 2042 * as the native seems to do. … … 1954 2044 WCHAR edit_text[260]; 1955 2045 LPCWSTR lastwrk; 1956 INT selected; 1957 CBE_ITEMDATA *item; 1958 1959 selected = SendMessageW (infoPtr->hwndCombo, 1960 CB_GETCURSEL, 0, 0); 2046 cmp_func_t cmptext = get_cmp_func(infoPtr); 2047 2048 INT selected = SendMessageW (infoPtr->hwndCombo, 2049 CB_GETCURSEL, 0, 0); 1961 2050 1962 2051 /* lstrlenA( lastworkingURL ) */ … … 1967 2056 } 1968 2057 else { 1969 item = COMBOEX_FindItem (infoPtr, selected);2058 CBE_ITEMDATA *item = COMBOEX_FindItem (infoPtr, selected); 1970 2059 lastwrk = COMBOEX_GetText(infoPtr, item); 1971 2060 } … … 1976 2065 debugstr_w(edit_text)); 1977 2066 1978 /* lstrcmpiWis between lastworkingURL and GetWindowText */1979 if ( lstrcmpiW(lastwrk, edit_text)) {2067 /* cmptext is between lastworkingURL and GetWindowText */ 2068 if (cmptext (lastwrk, edit_text)) { 1980 2069 /* strings not equal -- indicate edit has changed */ 1981 2070 infoPtr->flags |= WCBE_EDITCHG; … … 1984 2073 MAKEWPARAM(GetDlgCtrlID (infoPtr->hwndSelf), 1985 2074 CBN_EDITCHANGE), 1986 infoPtr->hwndSelf);2075 (LPARAM)infoPtr->hwndSelf); 1987 2076 return 0; 1988 2077 } … … 2024 2113 }/* fall through */ 2025 2114 default: 2026 return CallWindowProcW (infoPtr->prevComboWndProc, 2115 return CallWindowProcW (infoPtr->prevComboWndProc, 2027 2116 hwnd, uMsg, wParam, lParam); 2028 2117 } … … 2036 2125 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd); 2037 2126 2038 TRACE("hwnd=% xmsg=%x wparam=%x lParam=%lx\n", hwnd, uMsg, wParam, lParam);2127 TRACE("hwnd=%p msg=%x wparam=%x lParam=%lx\n", hwnd, uMsg, wParam, lParam); 2039 2128 2040 2129 if (!infoPtr) { … … 2052 2141 2053 2142 case CBEM_GETCOMBOCONTROL: 2054 return infoPtr->hwndCombo;2143 return (LRESULT)infoPtr->hwndCombo; 2055 2144 2056 2145 case CBEM_GETEDITCONTROL: 2057 return infoPtr->hwndEdit;2146 return (LRESULT)infoPtr->hwndEdit; 2058 2147 2059 2148 case CBEM_GETEXTENDEDSTYLE: … … 2099 2188 /*case CBEM_SETWINDOWTHEME: 2100 2189 FIXME("CBEM_SETWINDOWTHEME: stub\n");*/ 2190 2191 case WM_SETTEXT: 2192 case WM_GETTEXT: 2193 return SendMessageW(infoPtr->hwndEdit, uMsg, wParam, lParam); 2101 2194 2102 2195 /* Combo messages we are not sure if we need to process or just forward */ … … 2109 2202 case CB_RESETCONTENT: 2110 2203 case CB_SELECTSTRING: 2111 case WM_SETTEXT:2112 case WM_GETTEXT:2113 FIXME("(0x%x 0x%x 0x%lx): possibly missing function\n",2114 uMsg, wParam, lParam);2115 2204 2116 2205 /* Combo messages OK to just forward to the regular COMBO */ 2117 case CB_GETCOUNT: 2206 case CB_GETCOUNT: 2118 2207 case CB_GETCURSEL: 2119 2208 case CB_GETDROPPEDSTATE: … … 2125 2214 /* Combo messages we need to process specially */ 2126 2215 case CB_FINDSTRINGEXACT: 2127 return COMBOEX_FindStringExact (infoPtr, (INT)wParam, (LPC STR)lParam);2216 return COMBOEX_FindStringExact (infoPtr, (INT)wParam, (LPCWSTR)lParam); 2128 2217 2129 2218 case CB_GETITEMDATA: … … 2175 2264 2176 2265 default: 2177 if ( uMsg >= WM_USER)2266 if ((uMsg >= WM_USER) && (uMsg < WM_APP)) 2178 2267 ERR("unknown msg %04x wp=%08x lp=%08lx\n",uMsg,wParam,lParam); 2179 2268 return DefWindowProcW (hwnd, uMsg, wParam, lParam); … … 2195 2284 wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); 2196 2285 wndClass.lpszClassName = WC_COMBOBOXEXW; 2197 2286 2198 2287 RegisterClassW (&wndClass); 2199 2288 } … … 2204 2293 UnregisterClassW (WC_COMBOBOXEXW, (HINSTANCE)NULL); 2205 2294 } 2206 -
trunk/src/comctl32/comctl32.def
r8382 r9370 1 ; $Id: comctl32.def,v 1.2 6 2002-05-08 11:24:59sandervl Exp $1 ; $Id: comctl32.def,v 1.27 2002-10-29 12:18:25 sandervl Exp $ 2 2 LIBRARY COMCTL32 INITINSTANCE 3 3 DESCRIPTION 'Odin32 System DLL - ComCtl32 - Common Controls Library' … … 193 193 _COMCTL32_415@20 @415 NONAME 194 194 195 _COMCTL32_417@32 @417 NONAME 195 196 _COMCTL32_419@16 @419 NONAME 196 197 198 199 ; These are only available in comctrl 6 200 DefSubclassProc = _DefSubclassProc@16 @500 201 GetWindowSubclass = _GetWindowSubclass@16 @501 202 RemoveWindowSubclass = _RemoveWindowSubclass@12 @502 203 SetWindowSubclass = _SetWindowSubclass@16 @503 -
trunk/src/comctl32/comctl32.h
r8524 r9370 1 1 /****************************************************************************** 2 * 2 * 3 3 * Common definitions (resource ids and global variables) 4 4 * 5 5 * Copyright 1999 Thuy Nguyen 6 6 * Copyright 1999 Eric Kohl 7 * Copyright 2002 Dimitrie O. Paun 7 8 * 8 9 * This library is free software; you can redistribute it and/or … … 24 25 #define __WINE_COMCTL32_H 25 26 26 #ifdef __WIN32OS2__ 27 #include <heapstring.h> 28 #endif 27 #include "commctrl.h" 29 28 30 29 extern HMODULE COMCTL32_hModule; … … 85 84 #define IDM_GOTODAY 4164 86 85 87 /* Treeview Chec boxes */86 /* Treeview Checkboxes */ 88 87 89 88 #define IDT_CHECK 401 … … 94 93 #define IDC_DIVIDEROPEN 107 95 94 96 #ifdef __WIN32OS2__97 /* Header filter bitmap */98 #define IDB_HEADER_FILTER 14099 100 #define IDC_COMCTL32_DRAGHLINE 106101 #define IDC_COMCTL32_SPLITHLINE 107102 103 #endif104 95 105 96 /* DragList icon */ 106 97 #define IDI_DRAGARROW 150 107 98 108 typedef struct 99 100 /* HOTKEY internal strings */ 101 #define HKY_NONE 2048 102 103 typedef struct 109 104 { 110 105 COLORREF clrBtnHighlight; /* COLOR_BTNHIGHLIGHT */ … … 134 129 BOOL Str_SetPtrAtoW (LPWSTR *lppDest, LPCSTR lpSrc); 135 130 136 #define COMCTL32_VERSION_MINOR 0 131 #define COMCTL32_VERSION_MINOR 0 137 132 #define WINE_FILEVERSION 5, COMCTL32_VERSION_MINOR, 0, 0 138 133 #define WINE_FILEVERSIONSTR "5.00" 139 134 135 /* Notification support */ 136 137 #ifndef RC_INVOKED 138 140 139 #ifdef __WIN32OS2__ 140 #include <heapstring.h> 141 142 #ifndef __cplusplus 143 #undef inline 144 #define inline 145 #endif 146 #endif 147 148 inline static LRESULT send_notify(HWND hwnd, UINT code, NMHDR *hdr) 149 { 150 hdr->hwndFrom = hwnd; 151 hdr->idFrom = GetWindowLongW (hwnd, GWL_ID); 152 hdr->code = code; 153 154 return SendMessageW (GetParent(hwnd), WM_NOTIFY, hdr->idFrom, (LPARAM)hdr); 155 } 156 157 158 inline static LRESULT hwnd_notify(HWND hwnd, UINT code) 159 { 160 NMHDR hdr; 161 162 return send_notify(hwnd, code, &hdr); 163 } 164 165 inline static BOOL hwnd_notify_char(HWND hwnd, UINT ch, DWORD prev, DWORD next) 166 { 167 NMCHAR nmch; 168 169 nmch.ch = ch; 170 nmch.dwItemPrev = prev; 171 nmch.dwItemNext = next; 172 return (BOOL)send_notify(hwnd, NM_CHAR, &nmch.hdr); 173 } 174 175 inline static BOOL hwnd_notify_keydown(HWND hwnd, UINT nVKey, UINT uFlags) 176 { 177 NMKEY nmk; 178 179 nmk.nVKey = nVKey; 180 nmk.uFlags = uFlags; 181 return (BOOL)send_notify(hwnd, NM_KEYDOWN, &nmk.hdr); 182 } 183 184 inline static DWORD hwnd_notify_mouse(HWND hwnd, UINT code, DWORD spec, DWORD data, POINT *pt, LPARAM dwHitInfo) 185 { 186 NMMOUSE nmm; 187 188 nmm.dwItemSpec = spec; 189 nmm.dwItemData = data; 190 nmm.pt.x = pt->x; 191 nmm.pt.y = pt->y; 192 nmm.dwHitInfo = dwHitInfo; 193 return send_notify(hwnd, code, &nmm.hdr); 194 } 195 196 #define DEFINE_CHAR_NOTIFICATION(CTRLINFO, hwndSelf) \ 197 inline static BOOL notify_char(CTRLINFO *infoPtr, UINT ch, DWORD prev, DWORD next) \ 198 { return hwnd_notify_char(infoPtr->hwndSelf, ch, prev, next); } 199 200 #define DEFINE_CLICK_NOTIFICATION(CTRLINFO, hwndSelf) \ 201 inline static void notify_click(CTRLINFO *infoPtr) \ 202 { hwnd_notify(infoPtr->hwndSelf, NM_CLICK); } 203 204 #define DEFINE_DBLCLK_NOTIFICATION(CTRLINFO, hwndSelf) \ 205 inline static void notify_dblclk(CTRLINFO *infoPtr) \ 206 { hwnd_notify(infoPtr->hwndSelf, NM_DBLCLK); } 207 208 #define DEFINE_HOVER_NOTIFICATION(CTRLINFO, hwndSelf) \ 209 inline static BOOL notify_hover(CTRLINFO *infoPtr) \ 210 { return hwnd_notify(infoPtr->hwndSelf, NM_HOVER); } 211 212 #define DEFINE_KEYDOWN_NOTIFICATION(CTRLINFO, hwndSelf) \ 213 inline static BOOL notify_keydown(CTRLINFO *infoPtr, UINT nVKey, UINT uFlags) \ 214 { return hwnd_notify_keydown(infoPtr->hwndSelf, nVKey, uFlags); } 215 216 #define DEFINE_KILLFOCUS_NOTIFICATION(CTRLINFO, hwndSelf) \ 217 inline static void notify_killfocus(CTRLINFO *infoPtr) \ 218 { hwnd_notify(infoPtr->hwndSelf, NM_KILLFOCUS); } 219 220 #define DEFINE_NCHITTEST_NOTIFICATION(CTRLINFO, hwndSelf) \ 221 inline static DWORD notify_nchittest(CTRLINFO *infoPtr, DWORD spec, DWORD data, POINT *pt, LPARAM dwHitInfo) \ 222 { return hwnd_notify_mouse(infoPtr->hwndSelf, NM_NCHITTEST, spec, data, pt, dwHitInfo); } 223 224 #define DEFINE_OUTOFMEMORY_NOTIFICATION(CTRLINFO, hwndSelf) \ 225 inline static void notify_outofmemory(CTRLINFO *infoPtr) \ 226 { hwnd_notify(infoPtr->hwndSelf, NM_OUTOFMEMORY); } 227 228 #define DEFINE_RCLICK_NOTIFICATION(CTRLINFO, hwndSelf) \ 229 inline static BOOL notify_rclick(CTRLINFO *infoPtr) \ 230 { return hwnd_notify(infoPtr->hwndSelf, NM_RCLICK); } 231 232 #define DEFINE_RDBLCLK_NOTIFICATION(CTRLINFO, hwndSelf) \ 233 inline static void notify_rdblclk(CTRLINFO *infoPtr) \ 234 { hwnd_notify(infoPtr->hwndSelf, NM_RDBLCLK); } 235 236 #define DEFINE_RELEASEDCAPTURE_NOTIFICATION(CTRLINFO, hwndSelf) \ 237 inline static void notify_releasedcapture(CTRLINFO *infoPtr) \ 238 { hwnd_notify(infoPtr->hwndSelf, NM_RELEASEDCAPTURE); } 239 240 #define DEFINE_RETURN_NOTIFICATION(CTRLINFO, hwndSelf) \ 241 inline static void notify_return(CTRLINFO *infoPtr) \ 242 { hwnd_notify(infoPtr->hwndSelf, NM_RETURN); } 243 244 #define DEFINE_SETCURSOR_NOTIFICATION(CTRLINFO, hwndSelf) \ 245 inline static BOOL notify_setcursor(CTRLINFO *infoPtr, DWORD spec, DWORD data, POINT *pt, LPARAM dwHitInfo) \ 246 { return hwnd_notify_mouse(infoPtr->hwndSelf, NM_SETCURSOR, spec, data, pt, dwHitInfo); } 247 248 #define DEFINE_SETFOCUS_NOTIFICATION(CTRLINFO, hwndSelf) \ 249 inline static void notify_setfocus(CTRLINFO *infoPtr) \ 250 { hwnd_notify(infoPtr->hwndSelf, NM_SETFOCUS); } 251 252 #define DEFINE_TOOLTIPSCREATED_NOTIFICATION(CTRLINFO, hwndSelf) \ 253 inline static void notify_tooltipscreated(CTRLINFO *infoPtr) \ 254 { hwnd_notify(infoPtr->hwndSelf, NM_TOOLTIPSCREATED); } 255 256 #define DEFINE_COMMON_NOTIFICATIONS(CTRLINFO, hwndSelf) \ 257 DEFINE_CHAR_NOTIFICATION(CTRLINFO, hwndSelf) \ 258 DEFINE_CLICK_NOTIFICATION(CTRLINFO, hwndSelf) \ 259 DEFINE_DBLCLK_NOTIFICATION(CTRLINFO, hwndSelf) \ 260 DEFINE_HOVER_NOTIFICATION(CTRLINFO, hwndSelf) \ 261 DEFINE_KEYDOWN_NOTIFICATION(CTRLINFO, hwndSelf) \ 262 DEFINE_KILLFOCUS_NOTIFICATION(CTRLINFO, hwndSelf) \ 263 DEFINE_NCHITTEST_NOTIFICATION(CTRLINFO, hwndSelf) \ 264 DEFINE_OUTOFMEMORY_NOTIFICATION(CTRLINFO, hwndSelf) \ 265 DEFINE_RCLICK_NOTIFICATION(CTRLINFO, hwndSelf) \ 266 DEFINE_RDBLCLK_NOTIFICATION(CTRLINFO, hwndSelf) \ 267 DEFINE_RELEASEDCAPTURE_NOTIFICATION(CTRLINFO, hwndSelf) \ 268 DEFINE_RETURN_NOTIFICATION(CTRLINFO, hwndSelf) \ 269 DEFINE_SETCURSOR_NOTIFICATION(CTRLINFO, hwndSelf) \ 270 DEFINE_SETFOCUS_NOTIFICATION(CTRLINFO, hwndSelf) \ 271 DEFINE_TOOLTIPSCREATED_NOTIFICATION(CTRLINFO, hwndSelf) \ 272 struct __forward_dummy_struc_dec_to_catch_missing_semicolon 273 274 #endif //#ifndef RC_INVOKED 275 276 /* Our internal stack structure of the window procedures to subclass */ 277 typedef struct 278 { 279 struct { 280 SUBCLASSPROC subproc; 281 UINT_PTR id; 282 DWORD_PTR ref; 283 } SubclassProcs[31]; 284 int stackpos; 285 int stacknum; 286 int stacknew; 287 WNDPROC origproc; 288 } SUBCLASS_INFO, *LPSUBCLASS_INFO; 289 290 #ifdef __WIN32OS2__ 291 292 /* Header filter bitmap */ 293 #define IDB_HEADER_FILTER 140 294 295 #define IDC_COMCTL32_DRAGHLINE 106 296 #define IDC_COMCTL32_SPLITHLINE 107 297 141 298 #define swprintf wsprintfW 299 142 300 #ifdef __cplusplus 143 301 extern "C" { … … 189 347 } 190 348 #endif 349 191 350 #endif 192 351 -
trunk/src/comctl32/comctl32dbg.def
r8382 r9370 1 ; $Id: comctl32dbg.def,v 1. 2 2002-05-08 11:24:59sandervl Exp $1 ; $Id: comctl32dbg.def,v 1.3 2002-10-29 12:18:25 sandervl Exp $ 2 2 LIBRARY COMCTL32 INITINSTANCE 3 3 DESCRIPTION 'Odin32 System DLL - ComCtl32 - Common Controls Library' … … 190 190 _COMCTL32_415@20 @415 NONAME 191 191 192 _COMCTL32_417@32 @417 NONAME 192 193 _COMCTL32_419@16 @419 NONAME 193 194 195 ; These are only available in comctrl 6 196 DefSubclassProc = _DefSubclassProc@16 @500 197 GetWindowSubclass = _GetWindowSubclass@16 @501 198 RemoveWindowSubclass = _RemoveWindowSubclass@12 @502 199 SetWindowSubclass = _SetWindowSubclass@16 @503 -
trunk/src/comctl32/comctl32undoc.c
r8382 r9370 74 74 typedef HRESULT (CALLBACK *DPALOADPROC)(LPLOADDATA,IStream*,LPARAM); 75 75 #endif 76 77 INT __cdecl _wtoi(LPWSTR string);78 76 79 77 /************************************************************************** … … 283 281 } 284 282 nResult = (pfnCompare)(*pWork1, *pWork2, lParam); 285 TRACE("compare result=%d, dpa1.cnt=%d, dpa2.cnt=%d\n", 283 TRACE("compare result=%d, dpa1.cnt=%d, dpa2.cnt=%d\n", 286 284 nResult, nIndex, nCount); 287 285 … … 532 530 533 531 /* open the sub key */ 534 if ((err = RegOpenKeyExW( mp->extview.hKey, mp->extview.lpszSubKey, 532 if ((err = RegOpenKeyExW( mp->extview.hKey, mp->extview.lpszSubKey, 535 533 0, KEY_WRITE, &newkey))) { 536 534 /* not present - what to do ??? */ … … 552 550 if (mp->wineFlags & WMRUF_CHANGED) { 553 551 mp->wineFlags &= ~WMRUF_CHANGED; 554 err = RegSetValueExA(newkey, "MRUList", 0, REG_SZ, 552 err = RegSetValueExA(newkey, "MRUList", 0, REG_SZ, 555 553 mp->realMRU, strlen(mp->realMRU) + 1); 556 554 if (err) { … … 565 563 witem->itemFlag &= ~WMRUIF_CHANGED; 566 564 realname[0] = 'a' + i; 567 err = RegSetValueExW(newkey, realname, 0, 568 (mp->extview.dwFlags & MRUF_BINARY_LIST) ? 565 err = RegSetValueExW(newkey, realname, 0, 566 (mp->extview.dwFlags & MRUF_BINARY_LIST) ? 569 567 REG_BINARY : REG_SZ, 570 568 &witem->datastart, witem->size); … … 611 609 /************************************************************************** 612 610 * FindMRUData [COMCTL32.169] 613 * 611 * 614 612 * Searches binary list for item that matches lpData of length cbData. 615 613 * Returns position in list order 0 -> MRU and if lpRegNum != NULL then value … … 646 644 for(i=0; i<mp->cursize; i++) { 647 645 if (mp->extview.dwFlags & MRUF_BINARY_LIST) { 648 if (!mp->extview.lpfnCompare(lpData, &mp->array[i]->datastart, 646 if (!mp->extview.lpfnCompare(lpData, &mp->array[i]->datastart, 649 647 cbData)) 650 648 break; … … 679 677 *lpRegNum = 'a' + i; 680 678 681 TRACE("(% 08x, %p, %ld, %p) returning %d\n",679 TRACE("(%p, %p, %ld, %p) returning %d\n", 682 680 hList, lpData, cbData, lpRegNum, ret); 683 681 … … 688 686 /************************************************************************** 689 687 * AddMRUData [COMCTL32.167] 690 * 688 * 691 689 * Add item to MRU binary list. If item already exists in list then it is 692 690 * simply moved up to the top of the list and not added again. If list is … … 728 726 729 727 /* Allocate space for new item and move in the data */ 730 mp->array[replace] = witem = (LPWINEMRUITEM)COMCTL32_Alloc(cbData + 728 mp->array[replace] = witem = (LPWINEMRUITEM)COMCTL32_Alloc(cbData + 731 729 sizeof(WINEMRUITEM)); 732 730 witem->itemFlag |= WMRUIF_CHANGED; … … 740 738 } 741 739 mp->realMRU[0] = replace + 'a'; 742 TRACE("(% 08x, %p, %ld) adding data, /%c/ now most current\n",740 TRACE("(%p, %p, %ld) adding data, /%c/ now most current\n", 743 741 hList, lpData, cbData, replace+'a'); 744 742 ret = replace; … … 754 752 /************************************************************************** 755 753 * AddMRUStringW [COMCTL32.401] 756 * 754 * 757 755 * Add item to MRU string list. If item already exists in list them it is 758 756 * simply moved up to the top of the list and not added again. If list is … … 770 768 AddMRUStringW(HANDLE hList, LPCWSTR lpszString) 771 769 { 772 FIXME("(% 08x, %s) empty stub!\n", hList, debugstr_w(lpszString));770 FIXME("(%p, %s) empty stub!\n", hList, debugstr_w(lpszString)); 773 771 774 772 return 0; … … 781 779 AddMRUStringA(HANDLE hList, LPCSTR lpszString) 782 780 { 783 FIXME("(% 08x, %s) empty stub!\n", hList, debugstr_a(lpszString));781 FIXME("(%p, %s) empty stub!\n", hList, debugstr_a(lpszString)); 784 782 785 783 return 0; … … 801 799 DelMRUString(HANDLE hList, INT nItemPos) 802 800 { 803 FIXME("(% 08x, %d): stub\n", hList, nItemPos);801 FIXME("(%p, %d): stub\n", hList, nItemPos); 804 802 return TRUE; 805 803 } … … 817 815 /************************************************************************** 818 816 * FindMRUStringA [COMCTL32.155] 819 * 817 * 820 818 * Searches string list for item that matches lpszString. 821 819 * Returns position in list order 0 -> MRU and if lpRegNum != NULL then value … … 868 866 869 867 /* open the sub key */ 870 if ((err = RegCreateKeyExW( mp->extview.hKey, mp->extview.lpszSubKey, 868 if ((err = RegCreateKeyExW( mp->extview.hKey, mp->extview.lpszSubKey, 871 869 0, 872 870 emptyW, 873 REG_OPTION_NON_VOLATILE, 871 REG_OPTION_NON_VOLATILE, 874 872 KEY_READ | KEY_WRITE, 875 873 0, … … 887 885 if (newkey) { 888 886 datasize = mp->extview.nMaxItems + 1; 889 if((err=RegQueryValueExA( newkey, "MRUList", 0, &type, mp->realMRU, 887 if((err=RegQueryValueExA( newkey, "MRUList", 0, &type, mp->realMRU, 890 888 &datasize))) { 891 889 /* not present - set size to 1 (will become 0 later) */ … … 907 905 ERR("Key %s not found 1\n", debugstr_w(realname)); 908 906 } 909 mp->array[i] = witem = (LPWINEMRUITEM)COMCTL32_Alloc(datasize + 907 mp->array[i] = witem = (LPWINEMRUITEM)COMCTL32_Alloc(datasize + 910 908 sizeof(WINEMRUITEM)); 911 909 witem->size = datasize; 912 if(RegQueryValueExW( newkey, realname, 0, &type, 910 if(RegQueryValueExW( newkey, realname, 0, &type, 913 911 &witem->datastart, &datasize)) { 914 912 /* not present - what to do ??? */ … … 949 947 mp->isUnicode = TRUE; 950 948 951 return CreateMRUListLazy_common(mp); 949 return CreateMRUListLazy_common(mp); 952 950 } 953 951 … … 1018 1016 * of list returns -1. 1019 1017 * If lpBuffer == NULL or nItemPos is -ve return value is no. of items in 1020 * the list. 1018 * the list. 1021 1019 */ 1022 1020 INT WINAPI EnumMRUListW(HANDLE hList, INT nItemPos, LPVOID lpBuffer, … … 1033 1031 TRACE("nItemPos=%d, desired=%d\n", nItemPos, desired); 1034 1032 witem = mp->array[desired]; 1035 datasize = min( witem->size, nBufferSize ); 1033 datasize = min( witem->size, nBufferSize ); 1036 1034 memcpy( lpBuffer, &witem->datastart, datasize); 1037 TRACE("(% 08x, %d, %p, %ld): returning len=%d\n",1035 TRACE("(%p, %d, %p, %ld): returning len=%d\n", 1038 1036 hList, nItemPos, lpBuffer, nBufferSize, datasize); 1039 1037 return datasize; … … 1042 1040 /************************************************************************** 1043 1041 * EnumMRUListA [COMCTL32.154] 1044 * 1042 * 1045 1043 */ 1046 1044 INT WINAPI EnumMRUListA(HANDLE hList, INT nItemPos, LPVOID lpBuffer, … … 1059 1057 witem = mp->array[desired]; 1060 1058 if(mp->extview.dwFlags & MRUF_BINARY_LIST) { 1061 datasize = min( witem->size, nBufferSize ); 1059 datasize = min( witem->size, nBufferSize ); 1062 1060 memcpy( lpBuffer, &witem->datastart, datasize); 1063 1061 } else { … … 1068 1066 lpBuffer, datasize, NULL, NULL); 1069 1067 } 1070 TRACE("(% 08x, %d, %p, %ld): returning len=%d\n",1068 TRACE("(%p, %d, %p, %ld): returning len=%d\n", 1071 1069 hList, nItemPos, lpBuffer, nBufferSize, datasize); 1072 1070 return datasize; 1073 1071 } 1074 1072 1075 1073 1076 1074 /************************************************************************** … … 1128 1126 { 1129 1127 TRACE("(%p %p)\n", lppDest, lpSrc); 1130 1128 1131 1129 if (lpSrc) { 1132 1130 LPSTR ptr = COMCTL32_ReAlloc (*lppDest, strlen (lpSrc) + 1); … … 1201 1199 { 1202 1200 TRACE("(%p %p)\n", lppDest, lpSrc); 1203 1201 1204 1202 if (lpSrc) { 1205 1203 INT len = strlenW (lpSrc) + 1; … … 1373 1371 1374 1372 /************************************************************************** 1375 * DSA_GetItem [COMCTL32.322] 1373 * DSA_GetItem [COMCTL32.322] 1376 1374 * 1377 1375 * PARAMS … … 1391 1389 1392 1390 TRACE("(%p %d %p)\n", hdsa, nIndex, pDest); 1393 1391 1394 1392 if (!hdsa) 1395 1393 return FALSE; … … 1405 1403 1406 1404 /************************************************************************** 1407 * DSA_GetItemPtr [COMCTL32.323] 1405 * DSA_GetItemPtr [COMCTL32.323] 1408 1406 * 1409 1407 * Retrieves a pointer to the specified item. … … 1431 1429 1432 1430 pSrc = (char *) hdsa->pData + (hdsa->nItemSize * nIndex); 1433 1431 1434 1432 TRACE("-- ret=%p\n", pSrc); 1435 1433 … … 1439 1437 1440 1438 /************************************************************************** 1441 * DSA_SetItem [COMCTL32.325] 1439 * DSA_SetItem [COMCTL32.325] 1442 1440 * 1443 1441 * Sets the contents of an item in the array. … … 1458 1456 INT nSize, nNewItems; 1459 1457 LPVOID pDest, lpTemp; 1460 1458 1461 1459 TRACE("(%p %d %p)\n", hdsa, nIndex, pSrc); 1462 1460 1463 1461 if ((!hdsa) || nIndex < 0) 1464 1462 return FALSE; 1465 1463 1466 1464 if (hdsa->nItemCount <= nIndex) { 1467 1465 /* within the old array */ … … 1483 1481 hdsa->nItemCount = nIndex + 1; 1484 1482 hdsa->pData = lpTemp; 1485 } 1483 } 1486 1484 } 1487 1485 … … 1497 1495 1498 1496 /************************************************************************** 1499 * DSA_InsertItem [COMCTL32.324] 1497 * DSA_InsertItem [COMCTL32.324] 1500 1498 * 1501 1499 * PARAMS … … 1514 1512 INT nNewItems, nSize; 1515 1513 LPVOID lpTemp, lpDest; 1516 1514 1517 1515 TRACE("(%p %d %p)\n", hdsa, nIndex, pSrc); 1518 1516 … … 1534 1532 1535 1533 hdsa->nMaxCount = nNewItems; 1536 hdsa->pData = lpTemp; 1534 hdsa->pData = lpTemp; 1537 1535 } 1538 1536 … … 1559 1557 1560 1558 /************************************************************************** 1561 * DSA_DeleteItem [COMCTL32.326] 1559 * DSA_DeleteItem [COMCTL32.326] 1562 1560 * 1563 1561 * PARAMS … … 1575 1573 LPVOID lpDest,lpSrc; 1576 1574 INT nSize; 1577 1575 1578 1576 TRACE("(%p %d)\n", hdsa, nIndex); 1579 1577 … … 1592 1590 memmove (lpDest, lpSrc, nSize); 1593 1591 } 1594 1592 1595 1593 hdsa->nItemCount--; 1596 1594 1597 1595 /* free memory ? */ 1598 1596 if ((hdsa->nMaxCount - hdsa->nItemCount) >= hdsa->nGrow) { … … 1629 1627 TRACE("(%p)\n", hdsa); 1630 1628 1631 if (!hdsa) 1629 if (!hdsa) 1632 1630 return FALSE; 1633 1631 if (hdsa->pData && (!COMCTL32_Free (hdsa->pData))) … … 1855 1853 INT i; 1856 1854 1857 if (!hdpa ->ptrs)1855 if (!hdpa || !hdpa->ptrs) 1858 1856 return -1; 1859 1857 … … 1885 1883 DPA_InsertPtr (const HDPA hdpa, INT i, LPVOID p) 1886 1884 { 1887 INT nNewItems, nSize, nIndex = 0;1888 LPVOID *lpTemp, *lpDest;1889 1890 1885 TRACE("(%p %d %p)\n", hdpa, i, p); 1891 1886 1892 if ((!hdpa) || (i < 0)) 1893 return -1; 1894 1895 if (!hdpa->ptrs) { 1896 hdpa->ptrs = 1897 (LPVOID*)HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, 1898 2 * hdpa->nGrow * sizeof(LPVOID)); 1899 if (!hdpa->ptrs) 1900 return -1; 1901 hdpa->nMaxCount = hdpa->nGrow * 2; 1902 nIndex = 0; 1903 } 1904 else { 1905 if (hdpa->nItemCount >= hdpa->nMaxCount) { 1906 TRACE("-- resizing\n"); 1907 nNewItems = hdpa->nMaxCount + hdpa->nGrow; 1908 nSize = nNewItems * sizeof(LPVOID); 1909 1910 lpTemp = (LPVOID*)HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, 1911 hdpa->ptrs, nSize); 1912 if (!lpTemp) 1913 return -1; 1914 hdpa->nMaxCount = nNewItems; 1915 hdpa->ptrs = lpTemp; 1916 } 1917 1918 if (i >= hdpa->nItemCount) { 1919 nIndex = hdpa->nItemCount; 1920 TRACE("-- appending at %d\n", nIndex); 1921 } 1922 else { 1923 TRACE("-- inserting at %d\n", i); 1924 lpTemp = hdpa->ptrs + i; 1925 lpDest = lpTemp + 1; 1926 nSize = (hdpa->nItemCount - i) * sizeof(LPVOID); 1927 TRACE("-- move dest=%p src=%p size=%x\n", 1928 lpDest, lpTemp, nSize); 1929 memmove (lpDest, lpTemp, nSize); 1930 nIndex = i; 1931 } 1932 } 1933 1934 /* insert item */ 1935 hdpa->nItemCount++; 1936 hdpa->ptrs[nIndex] = p; 1937 1938 return nIndex; 1939 } 1940 1887 if (!hdpa || i < 0) return -1; 1888 1889 if (i >= 0x7fff) 1890 i = hdpa->nItemCount; 1891 1892 if (i >= hdpa->nItemCount) 1893 return DPA_SetPtr(hdpa, i, p) ? i : -1; 1894 1895 /* create empty spot at the end */ 1896 if (!DPA_SetPtr(hdpa, hdpa->nItemCount, 0)) return -1; 1897 memmove (hdpa->ptrs + i + 1, hdpa->ptrs + i, (hdpa->nItemCount - i - 1) * sizeof(LPVOID)); 1898 hdpa->ptrs[i] = p; 1899 return i; 1900 } 1941 1901 1942 1902 /************************************************************************** … … 1959 1919 { 1960 1920 LPVOID *lpTemp; 1961 1921 1962 1922 TRACE("(%p %d %p)\n", hdpa, i, p); 1963 1923 1964 if ( (!hdpa) || i < 0)1924 if (!hdpa || i < 0 || i > 0x7fff) 1965 1925 return FALSE; 1966 1926 1967 1927 if (hdpa->nItemCount <= i) { 1968 1928 /* within the old array */ 1969 if (hdpa->nMaxCount > i) { 1970 /* within the allocated space, set a new boundary */ 1971 hdpa->nItemCount = i+1; 1972 } 1973 else { 1929 if (hdpa->nMaxCount <= i) { 1974 1930 /* resize the block of memory */ 1975 1931 INT nNewItems = … … 1977 1933 INT nSize = nNewItems * sizeof(LPVOID); 1978 1934 1979 lpTemp = (LPVOID*)HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, 1980 hdpa->ptrs, nSize); 1935 if (hdpa->ptrs) 1936 lpTemp = (LPVOID*)HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, hdpa->ptrs, nSize); 1937 else 1938 lpTemp = (LPVOID*)HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, nSize); 1939 1981 1940 if (!lpTemp) 1982 1941 return FALSE; 1983 1942 1984 hdpa->nItemCount = nNewItems; 1985 hdpa->ptrs = lpTemp; 1986 } 1943 hdpa->nMaxCount = nNewItems; 1944 hdpa->ptrs = lpTemp; 1945 } 1946 hdpa->nItemCount = i+1; 1987 1947 } 1988 1948 … … 2013 1973 LPVOID *lpDest, *lpSrc, lpTemp = NULL; 2014 1974 INT nSize; 2015 1975 2016 1976 TRACE("(%p %d)\n", hdpa, i); 2017 1977 … … 2030 1990 memmove (lpDest, lpSrc, nSize); 2031 1991 } 2032 1992 2033 1993 hdpa->nItemCount --; 2034 1994 2035 1995 /* free memory ?*/ 2036 1996 if ((hdpa->nMaxCount - hdpa->nItemCount) >= hdpa->nGrow) { … … 2043 2003 2044 2004 hdpa->nMaxCount = nNewItems; 2045 hdpa->ptrs = (LPVOID*)lpDest; 2005 hdpa->ptrs = (LPVOID*)lpDest; 2046 2006 } 2047 2007 … … 2068 2028 TRACE("(%p)\n", hdpa); 2069 2029 2070 if (!hdpa) 2030 if (!hdpa) 2071 2031 return FALSE; 2072 2032 … … 2107 2067 2108 2068 TRACE("l=%i r=%i\n", l, r); 2109 2069 2110 2070 if (l==r) /* one element is always sorted */ 2111 2071 return; … … 2120 2080 2121 2081 /* join the two sides */ 2122 while( (l<=m) && (m<r) ) 2082 while( (l<=m) && (m<r) ) 2123 2083 { 2124 2084 if(pfnCompare(lpPtrs[l],lpPtrs[m+1],lParam)>0) … … 2238 2198 2239 2199 TRACE("linear search\n"); 2240 2200 2241 2201 nIndex = (nStart == -1)? 0 : nStart; 2242 2202 lpPtr = hdpa->ptrs; … … 2273 2233 HDPA hdpa; 2274 2234 2275 TRACE("(%d 0x%x)\n", nGrow, hHeap);2235 TRACE("(%d %p)\n", nGrow, hHeap); 2276 2236 2277 2237 if (hHeap) … … 2321 2281 UINT idFrom = 0; 2322 2282 2323 TRACE("( 0x%04x 0x%04x%d %p 0x%08lx)\n",2283 TRACE("(%p %p %d %p 0x%08lx)\n", 2324 2284 lpNotify->hwndFrom, lpNotify->hwndTo, uCode, lpHdr, 2325 2285 lpNotify->dwParam5); … … 2328 2288 return 0; 2329 2289 2330 if (lpNotify->hwndFrom == -1) {2290 if (lpNotify->hwndFrom == (HWND)-1) { 2331 2291 lpNmh = lpHdr; 2332 2292 idFrom = lpHdr->idFrom; … … 2374 2334 NOTIFYDATA notify; 2375 2335 2376 TRACE("( 0x%04x 0x%04x%d %p)\n",2336 TRACE("(%p %p %d %p)\n", 2377 2337 hwndTo, hwndFrom, uCode, lpHdr); 2378 2338 … … 2408 2368 HWND hwndNotify; 2409 2369 2410 TRACE("( 0x%04x 0x%04x%d %p 0x%08lx)\n",2370 TRACE("(%p %p %d %p 0x%08lx)\n", 2411 2371 hwndFrom, hwndTo, uCode, lpHdr, dwParam5); 2412 2372 … … 2491 2451 COMCTL32_StrToIntW (LPWSTR lpString) 2492 2452 { 2493 return _wtoi(lpString);2453 return atoiW(lpString); 2494 2454 } 2495 2455 … … 2503 2463 * hdpa [I] handle to the dynamic pointer array 2504 2464 * enumProc [I] 2505 * lParam [I] 2465 * lParam [I] 2506 2466 * 2507 2467 * RETURNS … … 2684 2644 if (dbcs && lpStart[1] != HIBYTE(wMatch)) continue; 2685 2645 lpGotIt = lpStart; 2686 } 2646 } 2687 2647 return (LPSTR)lpGotIt; 2688 2648 } … … 2738 2698 if( strchrW(lpSet, *(WORD*)lpLoop)) 2739 2699 return (INT)(lpLoop-lpStr); 2740 2700 2741 2701 return (INT)(lpLoop-lpStr); 2742 2702 } … … 2751 2711 BOOL WINAPI COMCTL32_410( HWND hw, DWORD b, DWORD c, DWORD d) { 2752 2712 2753 FIXME("(% x, %lx, %lx, %lx): stub!\n", hw, b, c, d);2713 FIXME("(%p, %lx, %lx, %lx): stub!\n", hw, b, c, d); 2754 2714 2755 2715 return TRUE; … … 2765 2725 BOOL WINAPI COMCTL32_411( HWND hw, DWORD b, DWORD c) { 2766 2726 2767 FIXME("(% x, %lx, %lx): stub!\n", hw, b, c);2727 FIXME("(%p, %lx, %lx): stub!\n", hw, b, c); 2768 2728 2769 2729 return TRUE; … … 2779 2739 BOOL WINAPI COMCTL32_412( HWND hwnd, DWORD b, DWORD c) 2780 2740 { 2781 FIXME("(% x, %lx, %lx): stub!\n", hwnd, b, c);2741 FIXME("(%p, %lx, %lx): stub!\n", hwnd, b, c); 2782 2742 2783 2743 if (IsWindow (hwnd) == FALSE) … … 2800 2760 BOOL WINAPI COMCTL32_413( HWND hw, DWORD b, DWORD c, DWORD d) { 2801 2761 2802 FIXME("(% x, %lx, %lx, %lx): stub!\n", hw, b, c, d);2762 FIXME("(%p, %lx, %lx, %lx): stub!\n", hw, b, c, d); 2803 2763 2804 2764 return TRUE; … … 2816 2776 { 2817 2777 2818 FIXME("(% x, %lx, %lx, %lx, %lx): stub!\n", hwnd, b, c, d, e);2778 FIXME("(%p, %lx, %lx, %lx, %lx): stub!\n", hwnd, b, c, d, e); 2819 2779 2820 2780 return TRUE; … … 2822 2782 2823 2783 /************************************************************************** 2784 * @ [COMCTL32.417] 2785 * 2786 */ 2787 BOOL WINAPI COMCTL32_417(HDC hdc, INT x, INT y, UINT flags, const RECT *lprect, 2788 LPCWSTR str, UINT count, const INT *lpDx) 2789 { 2790 return ExtTextOutW(hdc, x, y, flags, lprect, str, count, lpDx); 2791 } 2792 2793 /************************************************************************** 2824 2794 * @ [COMCTL32.419] 2825 2795 * -
trunk/src/comctl32/commctrl.c
r8382 r9370 1 /* 1 /* 2 2 * Common controls functions 3 3 * … … 18 18 * License along with this library; if not, write to the Free Software 19 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * 21 * NOTES 22 * 23 * This code was audited for completeness against the documented features 24 * of Comctl32.dll version 6.0 on Oct. 21, 2002, by Christian Neumair. 25 * 26 * Unless otherwise noted, we belive this code to be complete, as per 27 * the specification mentioned above. 28 * If you discover missing features, or bugs, please note them below. 29 * 30 * TODO 31 * -- implement GetMUILanguage + InitMUILanguage 32 * -- LibMain => DLLMain ("DLLMain takes over the functionality of both the 33 * LibMain and the WEP function.", MSDN) 34 * -- finish NOTES for MenuHelp, GetEffectiveClientRect and GetStatusTextW 35 * -- FIXMEs + BUGS (search for them) 36 * 37 * Control Classes 38 * -- ICC_ANIMATE_CLASS 39 * -- ICC_BAR_CLASSES 40 * -- ICC_COOL_CLASSES 41 * -- ICC_DATE_CLASSES 42 * -- ICC_HOTKEY_CLASS 43 * -- ICC_INTERNET_CLASSES 44 * -- ICC_LINK_CLASS (not yet implemented) 45 * -- ICC_LISTVIEW_CLASSES 46 * -- ICC_NATIVEFNTCTL_CLASS 47 * -- ICC_PAGESCROLLER_CLASS 48 * -- ICC_PROGRESS_CLASS 49 * -- ICC_STANDARD_CLASSES (not yet implemented) 50 * -- ICC_TAB_CLASSES 51 * -- ICC_TREEVIEW_CLASSES 52 * -- ICC_UPDOWN_CLASS 53 * -- ICC_USEREX_CLASSES 54 * -- ICC_WIN95_CLASSES 20 55 */ 21 56 … … 108 143 COMCTL32_LibMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) 109 144 { 110 TRACE("% x,%lx,%p\n", hinstDLL, fdwReason, lpvReserved);145 TRACE("%p,%lx,%p\n", hinstDLL, fdwReason, lpvReserved); 111 146 112 147 switch (fdwReason) { … … 116 151 /* create private heap */ 117 152 COMCTL32_hHeap = HeapCreate (0, 0x10000, 0); 118 TRACE("Heap created: 0x%x\n", COMCTL32_hHeap);153 TRACE("Heap created: %p\n", COMCTL32_hHeap); 119 154 120 155 /* add global subclassing atom (used by 'tooltip' and 'updown') */ … … 181 216 /* destroy private heap */ 182 217 HeapDestroy (COMCTL32_hHeap); 183 TRACE("Heap destroyed: 0x%x\n", COMCTL32_hHeap);218 TRACE("Heap destroyed: %p\n", COMCTL32_hHeap); 184 219 COMCTL32_hHeap = (HANDLE)NULL; 185 220 break; … … 219 254 VOID WINAPI 220 255 MenuHelp (UINT uMsg, WPARAM wParam, LPARAM lParam, HMENU hMainMenu, 221 HINSTANCE hInst, HWND hwndStatus, LPUINTlpwIDs)256 HINSTANCE hInst, HWND hwndStatus, UINT* lpwIDs) 222 257 { 223 258 UINT uMenuID = 0; … … 275 310 276 311 /*********************************************************************** 277 * ShowHideMenuCtl [COMCTL32.3] 312 * ShowHideMenuCtl [COMCTL32.3] 278 313 * 279 314 * Shows or hides controls and updates the corresponding menu item. … … 309 344 LPINT lpMenuId; 310 345 311 TRACE("% x, %x, %p\n", hwnd, uFlags, lpInfo);346 TRACE("%p, %x, %p\n", hwnd, uFlags, lpInfo); 312 347 313 348 if (lpInfo == NULL) … … 322 357 lpMenuId += 2; 323 358 324 if (GetMenuState ( lpInfo[1], uFlags, MF_BYCOMMAND) & MFS_CHECKED) {359 if (GetMenuState ((HMENU)lpInfo[1], uFlags, MF_BYCOMMAND) & MFS_CHECKED) { 325 360 /* uncheck menu item */ 326 CheckMenuItem ( lpInfo[0], *lpMenuId, MF_BYCOMMAND | MF_UNCHECKED);361 CheckMenuItem ((HMENU)lpInfo[0], *lpMenuId, MF_BYCOMMAND | MF_UNCHECKED); 327 362 328 363 /* hide control */ … … 333 368 else { 334 369 /* check menu item */ 335 CheckMenuItem ( lpInfo[0], *lpMenuId, MF_BYCOMMAND | MF_CHECKED);370 CheckMenuItem ((HMENU)lpInfo[0], *lpMenuId, MF_BYCOMMAND | MF_CHECKED); 336 371 337 372 /* show control */ … … 361 396 * 362 397 * lpInfo 363 * (will be written ...)398 * (will be written ...) 364 399 */ 365 400 … … 395 430 396 431 /*********************************************************************** 397 * DrawStatusTextW [COMCTL32. 28]432 * DrawStatusTextW [COMCTL32.@] 398 433 * 399 434 * Draws text with borders, like in a status bar. … … 439 474 r.left += 3; 440 475 if (style & SBT_RTLREADING) 441 FIXME("U supported RTL style!");476 FIXME("Unsupported RTL style!\n"); 442 477 DrawTextW (hdc, text, -1, &r, align|DT_VCENTER|DT_SINGLELINE); 443 478 SetBkMode(hdc, oldbkmode); … … 447 482 448 483 /*********************************************************************** 449 * DrawStatusText [COMCTL32. 27]484 * DrawStatusText [COMCTL32.@] 450 485 * DrawStatusTextA [COMCTL32.5] 451 486 * … … 479 514 480 515 /*********************************************************************** 481 * CreateStatusWindow [COMCTL32. 21]516 * CreateStatusWindow [COMCTL32.@] 482 517 * CreateStatusWindowA [COMCTL32.6] 483 518 * … … 498 533 CreateStatusWindowA (INT style, LPCSTR text, HWND parent, UINT wid) 499 534 { 500 return CreateWindowA(STATUSCLASSNAMEA, text, style, 535 return CreateWindowA(STATUSCLASSNAMEA, text, style, 501 536 CW_USEDEFAULT, CW_USEDEFAULT, 502 CW_USEDEFAULT, CW_USEDEFAULT, 503 parent, wid, 0, 0);504 } 505 506 507 /*********************************************************************** 508 * CreateStatusWindowW [COMCTL32. 22] Creates a status bar control537 CW_USEDEFAULT, CW_USEDEFAULT, 538 parent, (HMENU)wid, 0, 0); 539 } 540 541 542 /*********************************************************************** 543 * CreateStatusWindowW [COMCTL32.@] Creates a status bar control 509 544 * 510 545 * PARAMS … … 525 560 CW_USEDEFAULT, CW_USEDEFAULT, 526 561 CW_USEDEFAULT, CW_USEDEFAULT, 527 parent, wid, 0, 0);562 parent, (HMENU)wid, 0, 0); 528 563 } 529 564 … … 558 593 HWND hUD = 559 594 CreateWindowA (UPDOWN_CLASSA, 0, style, x, y, cx, cy, 560 parent, id, inst, 0);595 parent, (HMENU)id, inst, 0); 561 596 if (hUD) { 562 SendMessageA (hUD, UDM_SETBUDDY, buddy, 0);597 SendMessageA (hUD, UDM_SETBUDDY, (WPARAM)buddy, 0); 563 598 SendMessageA (hUD, UDM_SETRANGE, 0, MAKELONG(maxVal, minVal)); 564 SendMessageA (hUD, UDM_SETPOS, 0, MAKELONG(curVal, 0)); 599 SendMessageA (hUD, UDM_SETPOS, 0, MAKELONG(curVal, 0)); 565 600 } 566 601 … … 593 628 594 629 /*********************************************************************** 595 * InitCommonControlsEx [COMCTL32. 84]630 * InitCommonControlsEx [COMCTL32.@] 596 631 * 597 632 * Registers the common controls. … … 607 642 * Only the additional common controls are registered by this function. 608 643 * The Win95 controls are registered at the DLL's initialization. 644 * 645 * FIXME 646 * implement the following control classes: 647 * ICC_LINK_CLASS 648 * ICC_STANDARD_CLASSES 609 649 */ 610 650 … … 676 716 677 717 /*********************************************************************** 678 * CreateToolbarEx [COMCTL32. 23] Creates a tool bar window718 * CreateToolbarEx [COMCTL32.@] Creates a tool bar window 679 719 * 680 720 * PARAMS … … 897 937 898 938 /*********************************************************************** 899 * DllGetVersion [COMCTL32. 25]939 * DllGetVersion [COMCTL32.@] 900 940 * 901 941 * Retrieves version information of the 'COMCTL32.DLL' … … 933 973 934 974 /*********************************************************************** 935 * DllInstall (COMCTL32. 26)975 * DllInstall (COMCTL32.@) 936 976 */ 937 977 HRESULT WINAPI COMCTL32_DllInstall(BOOL bInstall, LPCWSTR cmdline) 938 978 { 939 FIXME("(%s, %s): stub\n", bInstall?"TRUE":"FALSE", 979 FIXME("(%s, %s): stub\n", bInstall?"TRUE":"FALSE", 940 980 debugstr_w(cmdline)); 941 981 … … 944 984 945 985 /*********************************************************************** 946 * _TrackMouseEvent [COMCTL32. 91]986 * _TrackMouseEvent [COMCTL32.@] 947 987 * 948 988 * Requests notification of mouse events … … 974 1014 975 1015 /************************************************************************* 976 * GetMUILanguage [COMCTL32.39] 977 * 978 * FIXME: What's this supposed to do? Apparently some i18n thing. 1016 * GetMUILanguage [COMCTL32.@] 1017 * 1018 * FIXME: "Returns the language currently in use by the common controls 1019 * for a particular process." (MSDN) 979 1020 * 980 1021 */ … … 986 1027 987 1028 /************************************************************************* 988 * InitMUILanguage [COMCTL32.85] 989 * 990 * FIXME: What's this supposed to do? Apparently some i18n thing. 1029 * InitMUILanguage [COMCTL32.@] 1030 * 1031 * FIXME: "Enables an application to specify a language to be used with 1032 * the common controls that is different than the system language." (MSDN) 991 1033 * 992 1034 */ … … 995 1037 { 996 1038 COMCTL32_uiLang = uiLang; 1039 } 1040 1041 1042 /*********************************************************************** 1043 * SetWindowSubclass [COMCTL32.@] 1044 * 1045 * Starts a window subclass 1046 * 1047 * PARAMS 1048 * hWnd [in] handle to window subclass. 1049 * pfnSubclass [in] Pointer to new window procedure. 1050 * uIDSubclass [in] Unique identifier of sublass together with pfnSubclass. 1051 * dwRef [in] Reference data to pass to window procedure. 1052 * 1053 * RETURNS 1054 * Success: non-zero 1055 * Failure: zero 1056 * 1057 * BUGS 1058 * If an application manually subclasses a window after subclassing it with 1059 * this API and then with this API again, then none of the previous 1060 * subclasses get called or the origional window procedure. 1061 */ 1062 1063 BOOL WINAPI SetWindowSubclass (HWND hWnd, SUBCLASSPROC pfnSubclass, 1064 UINT_PTR uIDSubclass, DWORD_PTR dwRef) 1065 { 1066 LPSUBCLASS_INFO stack; 1067 int newnum, n; 1068 1069 TRACE ("(%p, %p, %x, %lx)\n", hWnd, pfnSubclass, uIDSubclass, dwRef); 1070 1071 /* Since the window procedure that we set here has two additional arguments, 1072 * we can't simply set it as the new window procedure of the window. So we 1073 * set our own window procedure and then calculate the other two arguments 1074 * from there. */ 1075 1076 /* See if we have been called for this window */ 1077 stack = (LPSUBCLASS_INFO)GetPropA (hWnd, COMCTL32_aSubclass); 1078 if (!stack) { 1079 /* allocate stack */ 1080 stack = (LPSUBCLASS_INFO)HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, 1081 sizeof(SUBCLASS_INFO)); 1082 if (!stack) { 1083 ERR ("Failed to allocate our Subclassing stack"); 1084 return FALSE; 1085 } 1086 SetPropA (hWnd, COMCTL32_aSubclass, (HANDLE)stack); 1087 1088 /* set window procedure to our own and save the current one */ 1089 if (IsWindowUnicode (hWnd)) 1090 stack->origproc = (WNDPROC)SetWindowLongW (hWnd, GWL_WNDPROC, 1091 (LONG)DefSubclassProc); 1092 else 1093 stack->origproc = (WNDPROC)SetWindowLongA (hWnd, GWL_WNDPROC, 1094 (LONG)DefSubclassProc); 1095 } else { 1096 WNDPROC current; 1097 if (IsWindowUnicode (hWnd)) 1098 current = (WNDPROC)GetWindowLongW (hWnd, GWL_WNDPROC); 1099 else 1100 current = (WNDPROC)GetWindowLongA (hWnd, GWL_WNDPROC); 1101 1102 if (current != DefSubclassProc) { 1103 ERR ("Application has subclassed with our procedure, then manually, then with us again. The current implementation can't handle this.\n"); 1104 return FALSE; 1105 } 1106 } 1107 1108 /* Check to see if we have called this function with the same uIDSubClass 1109 * and pfnSubclass */ 1110 for (n = 0; n <= stack->stacknum + stack->stacknew - 1; n++) 1111 if ((stack->SubclassProcs[n].id == uIDSubclass) && 1112 (stack->SubclassProcs[n].subproc == pfnSubclass)) { 1113 stack->SubclassProcs[n].ref = dwRef; 1114 return TRUE; 1115 } 1116 1117 if ((stack->stacknum + stack->stacknew) >= 32) { 1118 ERR ("We have a Subclass stack overflow, please increment size"); 1119 return FALSE; 1120 } 1121 1122 /* we can't simply increment both stackpos and stacknum because there might 1123 * be a window procedure running lower in the stack, we can only get them 1124 * up to date once the last window procedure has run */ 1125 if (stack->stacknum == stack->stackpos) { 1126 stack->stacknum++; 1127 stack->stackpos++; 1128 } else 1129 stack->stacknew++; 1130 1131 newnum = stack->stacknew + stack->stacknum - 1; 1132 1133 stack->SubclassProcs[newnum].subproc = pfnSubclass; 1134 stack->SubclassProcs[newnum].ref = dwRef; 1135 stack->SubclassProcs[newnum].id = uIDSubclass; 1136 1137 return TRUE; 1138 } 1139 1140 1141 /*********************************************************************** 1142 * GetWindowSubclass [COMCTL32.@] 1143 * 1144 * Gets the Reference data from a subclass. 1145 * 1146 * PARAMS 1147 * hWnd [in] Handle to window which were subclassing 1148 * pfnSubclass [in] Pointer to the subclass procedure 1149 * iID [in] Unique indentifier of the subclassing procedure 1150 * pdwRef [out] Pointer to the reference data 1151 * 1152 * RETURNS 1153 * Success: non-sero 1154 * Failure: zero 1155 */ 1156 1157 BOOL WINAPI GetWindowSubclass (HWND hWnd, SUBCLASSPROC pfnSubclass, 1158 UINT_PTR uID, DWORD_PTR *pdwRef) 1159 { 1160 LPSUBCLASS_INFO stack; 1161 int n; 1162 1163 TRACE ("(%p, %p, %x, %p)\n", hWnd, pfnSubclass, uID, pdwRef); 1164 1165 /* See if we have been called for this window */ 1166 stack = (LPSUBCLASS_INFO)GetPropA (hWnd, COMCTL32_aSubclass); 1167 if (!stack) 1168 return FALSE; 1169 1170 for (n = 0; n <= stack->stacknum + stack->stacknew - 1; n++) 1171 if ((stack->SubclassProcs[n].id == uID) && 1172 (stack->SubclassProcs[n].subproc == pfnSubclass)) { 1173 *pdwRef = stack->SubclassProcs[n].ref; 1174 return TRUE; 1175 } 1176 1177 return FALSE; 1178 } 1179 1180 1181 /*********************************************************************** 1182 * RemoveWindowSubclass [COMCTL32.@] 1183 * 1184 * Removes a window subclass. 1185 * 1186 * PARAMS 1187 * hWnd [in] Handle to the window were subclassing 1188 * pfnSubclass [in] Pointer to the subclass procedure 1189 * uID [in] Unique identifier of this subclass 1190 * 1191 * RETURNS 1192 * Success: non-zero 1193 * Failure: zero 1194 */ 1195 1196 BOOL WINAPI RemoveWindowSubclass(HWND hWnd, SUBCLASSPROC pfnSubclass, UINT_PTR uID) 1197 { 1198 LPSUBCLASS_INFO stack; 1199 int n; 1200 1201 TRACE ("(%p, %p, %x)\n", hWnd, pfnSubclass, uID); 1202 1203 /* Find the Subclass to remove */ 1204 stack = (LPSUBCLASS_INFO)GetPropA (hWnd, COMCTL32_aSubclass); 1205 if (!stack) 1206 return FALSE; 1207 1208 if ((stack->stacknum == stack->stackpos == 1) && !stack->stacknew) { 1209 TRACE("Last Subclass removed, cleaning up\n"); 1210 /* clean up our heap and reset the origional window procedure */ 1211 if (IsWindowUnicode (hWnd)) 1212 SetWindowLongW (hWnd, GWL_WNDPROC, (LONG)stack->origproc); 1213 else 1214 SetWindowLongA (hWnd, GWL_WNDPROC, (LONG)stack->origproc); 1215 HeapFree (GetProcessHeap (), 0, stack); 1216 RemovePropA( hWnd, COMCTL32_aSubclass ); 1217 return TRUE; 1218 } 1219 1220 for (n = stack->stacknum + stack->stacknew - 1; n >= 0; n--) 1221 if ((stack->SubclassProcs[n].id == uID) && 1222 (stack->SubclassProcs[n].subproc == pfnSubclass)) { 1223 if (n != (stack->stacknum + stack->stacknew)) 1224 /* Fill the hole in the stack */ 1225 memmove (&stack->SubclassProcs[n], &stack->SubclassProcs[n + 1], 1226 sizeof(stack->SubclassProcs[0]) * (stack->stacknew + stack->stacknum - n)); 1227 stack->SubclassProcs[n].subproc = NULL; 1228 stack->SubclassProcs[n].ref = 0; 1229 stack->SubclassProcs[n].id = 0; 1230 1231 /* If we are currently running a window procedure we have to manipulate 1232 * the stack position pointers so that we don't corrupt the stack */ 1233 if ((n < stack->stackpos) || (stack->stackpos == stack->stacknum)) { 1234 stack->stacknum--; 1235 stack->stackpos--; 1236 } else if (n >= stack->stackpos) 1237 stack->stacknew--; 1238 return TRUE; 1239 } 1240 1241 return FALSE; 1242 } 1243 1244 1245 /*********************************************************************** 1246 * DefSubclassProc [COMCTL32.@] 1247 * 1248 * Calls the next window procedure (ie. the one before this subclass) 1249 * 1250 * PARAMS 1251 * hWnd [in] The window that we're subclassing 1252 * uMsg [in] Message 1253 * wParam [in] WPARAM 1254 * lParam [in] LPARAM 1255 * 1256 * RETURNS 1257 * Success: non-zero 1258 * Failure: zero 1259 */ 1260 1261 LRESULT WINAPI DefSubclassProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) 1262 { 1263 LPSUBCLASS_INFO stack; 1264 int stackpos; 1265 LRESULT ret; 1266 1267 /* retrieve our little stack from the Properties */ 1268 stack = (LPSUBCLASS_INFO)GetPropA (hWnd, COMCTL32_aSubclass); 1269 if (!stack) { 1270 ERR ("Our sub classing stack got erased for %p!! Nothing we can do\n", hWnd); 1271 return 0; 1272 } 1273 1274 /* If we are at pos 0 then we have to call the origional window procedure */ 1275 if (stack->stackpos == 0) { 1276 if (IsWindowUnicode (hWnd)) 1277 return CallWindowProcW (stack->origproc, hWnd, uMsg, wParam, lParam); 1278 else 1279 return CallWindowProcA (stack->origproc, hWnd, uMsg, wParam, lParam); 1280 } 1281 1282 stackpos = --stack->stackpos; 1283 /* call the Subclass procedure from the stack */ 1284 ret = stack->SubclassProcs[stackpos].subproc (hWnd, uMsg, wParam, lParam, 1285 stack->SubclassProcs[stackpos].id, stack->SubclassProcs[stackpos].ref); 1286 stack->stackpos++; 1287 1288 if ((stack->stackpos == stack->stacknum) && stack->stacknew) { 1289 stack->stacknum += stack->stacknew; 1290 stack->stackpos += stack->stacknew; 1291 stack->stacknew = 0; 1292 } 1293 1294 /* If we removed the last entry in our stack while a window procedure was 1295 * running then we have to clean up */ 1296 if (stack->stackpos == stack->stacknum == 0) { 1297 TRACE("Last Subclass removed, cleaning up\n"); 1298 /* clean up our heap and reset the origional window procedure */ 1299 if (IsWindowUnicode (hWnd)) 1300 SetWindowLongW (hWnd, GWL_WNDPROC, (LONG)stack->origproc); 1301 else 1302 SetWindowLongA (hWnd, GWL_WNDPROC, (LONG)stack->origproc); 1303 HeapFree (GetProcessHeap (), 0, stack); 1304 RemovePropA( hWnd, COMCTL32_aSubclass ); 1305 return TRUE; 1306 } 1307 1308 return ret; 997 1309 } 998 1310 … … 1011 1323 * Failure: NULL 1012 1324 */ 1325 1013 1326 HWND 1014 1327 COMCTL32_CreateToolTip(HWND hwndOwner) … … 1053 1366 * none 1054 1367 */ 1368 1055 1369 VOID 1056 1370 COMCTL32_RefreshSysColors(void) -
trunk/src/comctl32/flatsb.c
r8382 r9370 47 47 48 48 /*********************************************************************** 49 * InitializeFlatSB (COMCTL32. 86)49 * InitializeFlatSB (COMCTL32.@) 50 50 * 51 51 * returns nonzero if successful, zero otherwise … … 54 54 BOOL WINAPI InitializeFlatSB(HWND hwnd) 55 55 { 56 TRACE("[% 04x]\n", hwnd);56 TRACE("[%p]\n", hwnd); 57 57 FIXME("stub\n"); 58 58 return FALSE; … … 60 60 61 61 /*********************************************************************** 62 * UninitializeFlatSB (COMCTL32. 90)62 * UninitializeFlatSB (COMCTL32.@) 63 63 * 64 64 * returns: … … 70 70 HRESULT WINAPI UninitializeFlatSB(HWND hwnd) 71 71 { 72 TRACE("[% 04x]\n", hwnd);72 TRACE("[%p]\n", hwnd); 73 73 FIXME("stub\n"); 74 74 return S_FALSE; … … 76 76 77 77 /*********************************************************************** 78 * FlatSB_GetScrollProp (COMCTL32. 32)78 * FlatSB_GetScrollProp (COMCTL32.@) 79 79 * 80 80 * Returns nonzero if successful, or zero otherwise. If index is WSB_PROP_HSTYLE, 81 81 * the return is nonzero if InitializeFlatSB has been called for this window, or 82 * zero otherwise. 83 * 84 */ 85 BOOL WINAPI 82 * zero otherwise. 83 * 84 */ 85 BOOL WINAPI 86 86 FlatSB_GetScrollProp(HWND hwnd, INT propIndex, LPINT prop) 87 87 { 88 TRACE("[% 04x] propIndex=%d\n", hwnd, propIndex);88 TRACE("[%p] propIndex=%d\n", hwnd, propIndex); 89 89 FIXME("stub\n"); 90 90 return FALSE; … … 92 92 93 93 /*********************************************************************** 94 * FlatSB_SetScrollProp (COMCTL32. 36)95 */ 96 BOOL WINAPI 94 * FlatSB_SetScrollProp (COMCTL32.@) 95 */ 96 BOOL WINAPI 97 97 FlatSB_SetScrollProp(HWND hwnd, UINT index, INT newValue, BOOL flag) 98 98 { 99 TRACE("[% 04x] index=%u newValue=%d flag=%d\n", hwnd, index, newValue, flag);99 TRACE("[%p] index=%u newValue=%d flag=%d\n", hwnd, index, newValue, flag); 100 100 FIXME("stub\n"); 101 101 return FALSE; … … 110 110 * 111 111 * So, if we just call the standard functions until we implement 112 * the flat scroll bar functions, flat scroll bars will show up and 112 * the flat scroll bar functions, flat scroll bars will show up and 113 113 * behave properly, as though they had simply not been setup to 114 114 * have flat properties. … … 119 119 120 120 /*********************************************************************** 121 * FlatSB_EnableScrollBar (COMCTL32. 29)122 */ 123 BOOL WINAPI 121 * FlatSB_EnableScrollBar (COMCTL32.@) 122 */ 123 BOOL WINAPI 124 124 FlatSB_EnableScrollBar(HWND hwnd, int nBar, UINT flags) 125 125 { … … 128 128 129 129 /*********************************************************************** 130 * FlatSB_ShowScrollBar (COMCTL32. 38)131 */ 132 BOOL WINAPI 130 * FlatSB_ShowScrollBar (COMCTL32.@) 131 */ 132 BOOL WINAPI 133 133 FlatSB_ShowScrollBar(HWND hwnd, int nBar, BOOL fShow) 134 134 { … … 137 137 138 138 /*********************************************************************** 139 * FlatSB_GetScrollRange (COMCTL32. 33)140 */ 141 BOOL WINAPI 139 * FlatSB_GetScrollRange (COMCTL32.@) 140 */ 141 BOOL WINAPI 142 142 FlatSB_GetScrollRange(HWND hwnd, int nBar, LPINT min, LPINT max) 143 143 { … … 146 146 147 147 /*********************************************************************** 148 * FlatSB_GetScrollInfo (COMCTL32. 30)149 */ 150 BOOL WINAPI 148 * FlatSB_GetScrollInfo (COMCTL32.@) 149 */ 150 BOOL WINAPI 151 151 FlatSB_GetScrollInfo(HWND hwnd, int nBar, LPSCROLLINFO info) 152 152 { … … 155 155 156 156 /*********************************************************************** 157 * FlatSB_GetScrollPos (COMCTL32. 31)158 */ 159 INT WINAPI 157 * FlatSB_GetScrollPos (COMCTL32.@) 158 */ 159 INT WINAPI 160 160 FlatSB_GetScrollPos(HWND hwnd, int nBar) 161 161 { … … 164 164 165 165 /*********************************************************************** 166 * FlatSB_SetScrollPos (COMCTL32. 35)167 */ 168 INT WINAPI 166 * FlatSB_SetScrollPos (COMCTL32.@) 167 */ 168 INT WINAPI 169 169 FlatSB_SetScrollPos(HWND hwnd, int nBar, INT pos, BOOL bRedraw) 170 170 { … … 173 173 174 174 /*********************************************************************** 175 * FlatSB_SetScrollInfo (COMCTL32. 34)176 */ 177 INT WINAPI 175 * FlatSB_SetScrollInfo (COMCTL32.@) 176 */ 177 INT WINAPI 178 178 FlatSB_SetScrollInfo(HWND hwnd, int nBar, LPSCROLLINFO info, BOOL bRedraw) 179 179 { … … 182 182 183 183 /*********************************************************************** 184 * FlatSB_SetScrollRange (COMCTL32. 37)185 */ 186 INT WINAPI 184 * FlatSB_SetScrollRange (COMCTL32.@) 185 */ 186 INT WINAPI 187 187 FlatSB_SetScrollRange(HWND hwnd, int nBar, INT min, INT max, BOOL bRedraw) 188 188 { … … 194 194 FlatSB_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) 195 195 { 196 TRACE("[% 04x] wParam=%04x lParam=%08lx\n", hwnd, wParam, lParam);196 TRACE("[%p] wParam=%04x lParam=%08lx\n", hwnd, wParam, lParam); 197 197 return 0; 198 198 } … … 202 202 FlatSB_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam) 203 203 { 204 TRACE("[% 04x] wParam=%04x lParam=%08lx\n", hwnd, wParam, lParam);204 TRACE("[%p] wParam=%04x lParam=%08lx\n", hwnd, wParam, lParam); 205 205 return 0; 206 206 } … … 212 212 if (!FlatSB_GetInfoPtr(hwnd) && (uMsg != WM_CREATE)) 213 213 return DefWindowProcA( hwnd, uMsg, wParam, lParam ); 214 214 215 215 switch (uMsg) 216 216 { … … 222 222 223 223 default: 224 if ( uMsg >= WM_USER)224 if ((uMsg >= WM_USER) && (uMsg < WM_APP)) 225 225 ERR("unknown msg %04x wp=%08x lp=%08lx\n", 226 226 uMsg, wParam, lParam); … … 244 244 wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); 245 245 wndClass.lpszClassName = FLATSB_CLASSA; 246 246 247 247 RegisterClassA (&wndClass); 248 248 } … … 254 254 UnregisterClassA (FLATSB_CLASSA, (HINSTANCE)NULL); 255 255 } 256 -
trunk/src/comctl32/imagelist.c
r8520 r9370 3 3 * 4 4 * Copyright 1998 Eric Kohl 5 * 2000 Jason Mawdsley. 6 * 2001 Michael Stefaniuc 7 * 2001 Charles Loep for CodeWeavers 5 * Copyright 2000 Jason Mawdsley 6 * Copyright 2001 Michael Stefaniuc 7 * Copyright 2001 Charles Loep for CodeWeavers 8 * Copyright 2002 Dimitrie O. Paun 8 9 * 9 10 * This library is free software; you can redistribute it and/or … … 21 22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 23 * 24 * NOTE 25 * 26 * This code was audited for completeness against the documented features 27 * of Comctl32.dll version 6.0 on Sep. 12, 2002, by Dimitrie O. Paun. 28 * 29 * Unless otherwise noted, we belive this code to be complete, as per 30 * the specification mentioned above. 31 * If you discover missing features, or bugs, please note them below. 32 * 23 33 * TODO: 24 * - Fix ImageList_DrawIndirect (xBitmap, yBitmap, rgbFg, rgbBk, dwRop). 25 * - Fix ImageList_GetIcon. 26 * - Fix ImageList_SetFilter (undocumented). 27 * BTW does anybody know anything about this function??? 28 * - It removes 12 Bytes from the stack (3 Parameters). 29 * - First parameter SHOULD be a HIMAGELIST. 30 * - Second parameter COULD be an index????? 31 * - Third parameter.... ????????????????????? 32 * 33 * Comments: 34 * - ImageList_Draw, ImageList_DrawEx and ImageList_GetIcon use 35 * ImageList_DrawIndirect. Since ImageList_DrawIndirect is still 36 * partially implemented, the functions mentioned above will be 37 * limited in functionality too. 38 * 34 * - Add support for ILD_PRESERVEALPHA, ILD_SCALE, ILD_DPISCALE 35 * - Add support for ILS_GLOW, ILS_SHADOW, ILS_SATURATE, ILS_ALPHA 36 * 37 * FIXME: 39 38 * - Hotspot handling still not correct. The Hotspot passed to BeginDrag 40 39 * is the offset of the image position relative to the actual mouse pointer … … 81 80 82 81 /************************************************************************* 83 * IMAGELIST_InternalExpandBitmaps [Internal] 82 * IMAGELIST_InternalExpandBitmaps [Internal] 84 83 * 85 84 * Expands the bitmaps of an image list by the given number of images. … … 95 94 * This function can NOT be used to reduce the number of images. 96 95 */ 97 static VOID96 static void 98 97 IMAGELIST_InternalExpandBitmaps (HIMAGELIST himl, INT nImageCount, INT cx, INT cy) 99 98 { … … 128 127 129 128 if (himl->hbmMask) { 130 hbmNewBitmap = 129 hbmNewBitmap = 131 130 CreateBitmap (nNewWidth, cy, 1, 1, NULL); 132 131 … … 150 149 151 150 /************************************************************************* 152 * IMAGELIST_InternalDraw [Internal] 153 * 154 * Draws the image in the ImageList (without the mask) 155 * 156 * PARAMS 157 * pimldp [I] pointer to IMAGELISTDRAWPARAMS structure. 158 * cx [I] the width of the image to display 159 * cy............[I] the height of the image to display 160 * 161 * RETURNS 162 * nothing 163 * 164 * NOTES 165 * This function is used by ImageList_DrawIndirect, when it is 166 * required to draw only the Image (without the mask) to the screen. 167 * 168 * Blending and Overlays styles are accomplished by another function 169 */ 170 static VOID 171 IMAGELIST_InternalDraw(IMAGELISTDRAWPARAMS *pimldp, INT cx, INT cy) 172 { 173 HDC hImageDC; 174 HBITMAP hOldBitmap; 175 176 hImageDC = CreateCompatibleDC(0); 177 hOldBitmap = SelectObject(hImageDC, pimldp->himl->hbmImage); 178 BitBlt(pimldp->hdcDst, 179 pimldp->x, pimldp->y, cx, cy, 180 hImageDC, 181 pimldp->himl->cx * pimldp->i, 0, 182 SRCCOPY); 183 184 SelectObject(hImageDC, hOldBitmap); 185 DeleteDC(hImageDC); 186 } 187 188 189 /************************************************************************* 190 * IMAGELIST_InternalDrawMask [Internal] 191 * 192 * Draws the image in the ImageList with the mask 193 * 194 * PARAMS 195 * pimldp [I] pointer to IMAGELISTDRAWPARAMS structure. 196 * cx [I] the width of the image to display 197 * cy............[I] the height of the image to display 198 * 199 * RETURNS 200 * nothing 201 * 202 * NOTES 203 * This function is used by ImageList_DrawIndirect, when it is 204 * required to draw the Image with the mask to the screen. 205 * 206 * Blending and Overlays styles are accomplished by another function. 207 */ 208 static VOID 209 IMAGELIST_InternalDrawMask(IMAGELISTDRAWPARAMS *pimldp, INT cx, INT cy) 210 { 211 BOOL bUseCustomBackground, bBlendFlag; 212 HBRUSH hBrush, hOldBrush; 213 HDC hMaskDC, hImageDC; 214 HBITMAP hOldBitmapImage, hOldBitmapMask; 215 HIMAGELIST himlLocal = pimldp->himl; 216 COLORREF oldBkColor, oldFgColor; 217 UINT fStyle = pimldp->fStyle & (~ILD_OVERLAYMASK); 218 219 /* 220 * We need a dc and bitmap to draw on that is 221 * not on the screen. 222 */ 223 HDC hOffScreenDC = 0; 224 HBITMAP hOffScreenBmp = 0; 225 226 bUseCustomBackground = (himlLocal->clrBk != CLR_NONE); 227 bBlendFlag = (fStyle & ILD_BLEND50 ) || (fStyle & ILD_BLEND25); 228 229 hImageDC = CreateCompatibleDC(0); 230 hMaskDC = CreateCompatibleDC(0); 231 232 /* Create a compatible DC. */ 233 hOffScreenDC = CreateCompatibleDC( pimldp->hdcDst ); 234 235 if ( hOffScreenDC ) 236 { 237 hOffScreenBmp = CreateCompatibleBitmap( pimldp->hdcDst, cx, cy ); 238 239 if ( hOffScreenBmp ) 240 SelectObject( hOffScreenDC, hOffScreenBmp ); 241 else 242 goto cleanup; 243 } 244 else 245 goto cleanup; 246 247 hOldBitmapImage = SelectObject(hImageDC, himlLocal->hbmImage); 248 hOldBitmapMask = SelectObject(hMaskDC, himlLocal->hbmMask); 249 250 /* 251 * Get a copy of the image for the masking operations. 252 * We will use the copy, and this dc for all the various 253 * blitting, and then do one final blit to the screen dc. 254 * This should clean up most of the flickering. 255 */ 256 BitBlt( hOffScreenDC, 0, 0, cx, cy, pimldp->hdcDst, pimldp->x, 257 pimldp->y, SRCCOPY); 258 259 /* 260 * Draw the Background for the appropriate Styles 261 */ 262 if( bUseCustomBackground && (fStyle == ILD_NORMAL || fStyle & ILD_IMAGE 263 || bBlendFlag) ) 264 { 265 266 hBrush = CreateSolidBrush (himlLocal->clrBk); 267 hOldBrush = SelectObject (pimldp->hdcDst, hBrush); 268 269 PatBlt( hOffScreenDC, pimldp->x, pimldp->y, cx, cy, PATCOPY ); 270 271 DeleteObject (SelectObject (pimldp->hdcDst, hOldBrush)); 272 } 273 274 /* 275 * Draw Image Transparently over the current background 276 */ 277 if(fStyle == ILD_NORMAL || (fStyle & ILD_TRANSPARENT) || 278 ((fStyle & ILD_IMAGE) && bUseCustomBackground) || bBlendFlag) 279 { /* 280 * To obtain a transparent look, background color should be set 281 * to white and foreground color to black when blting the 282 * monochrome mask. 283 */ 284 285 oldBkColor = SetBkColor( hOffScreenDC, RGB( 0xff, 0xff, 0xff ) ); 286 oldFgColor = SetTextColor( hOffScreenDC, RGB( 0, 0, 0 ) ); 287 288 BitBlt( hOffScreenDC, 0, 0, cx, cy,hMaskDC, himlLocal->cx * pimldp->i, 289 0, SRCAND ); 290 291 BitBlt( hOffScreenDC, 0, 0, cx, cy, hImageDC,himlLocal->cx * pimldp->i, 292 0, SRCPAINT ); 293 294 } 295 296 /* 297 * Draw the image when no Background is specified 298 */ 299 else if((fStyle & ILD_IMAGE) && !bUseCustomBackground) 300 { 301 BitBlt( hOffScreenDC, 0, 0, cx, cy, hImageDC, 302 himlLocal->cx * pimldp->i, 0, SRCCOPY); 303 } 304 /* 305 * Draw the mask with or without a background 306 */ 307 else if(fStyle & ILD_MASK) 308 { 309 BitBlt( hOffScreenDC, 0, 0, cx, cy, hMaskDC, himlLocal->cx * pimldp->i, 310 0, bUseCustomBackground ? SRCCOPY : SRCAND); 311 } 312 313 /* 314 * Blit the bitmap to the screen now. 315 */ 316 BitBlt( pimldp->hdcDst, pimldp->x, pimldp->y, cx, cy, 317 hOffScreenDC, 0, 0, SRCCOPY); 318 319 320 SelectObject(hImageDC, hOldBitmapImage); 321 SelectObject(hMaskDC, hOldBitmapMask); 322 323 cleanup: 324 325 DeleteDC(hImageDC); 326 DeleteDC(hMaskDC); 327 328 DeleteDC( hOffScreenDC ); 329 DeleteObject( hOffScreenBmp ); 330 331 return; 332 } 333 334 /************************************************************************* 335 * IMAGELIST_InternalDrawBlend [Internal] 336 * 337 * Draws the Blend over the current image 338 * 339 * PARAMS 340 * pimldp [I] pointer to IMAGELISTDRAWPARAMS structure. 341 * cx [I] the width of the image to display 342 * cy............[I] the height of the image to display 343 * 344 * RETURNS 345 * nothing 346 * 347 * NOTES 348 * This functions is used by ImageList_DrawIndirect, when it is 349 * required to add the blend to the current image. 350 * 351 */ 352 static VOID 353 IMAGELIST_InternalDrawBlend(IMAGELISTDRAWPARAMS *pimldp, INT cx, INT cy) 354 { 355 356 HDC hBlendMaskDC,hMaskDC; 357 HBRUSH hBlendColorBrush, hBlendBrush, hOldBrush; 358 HBITMAP hBlendMaskBitmap, hOldBitmap; 359 COLORREF clrBlend, OldTextColor, OldBkColor; 360 HIMAGELIST himlLocal = pimldp->himl; 361 362 clrBlend = GetSysColor (COLOR_HIGHLIGHT); 363 if (!(pimldp->rgbFg == CLR_DEFAULT)) 364 { 365 clrBlend = pimldp->rgbFg; 366 } 367 /* Create the blend Mask 368 */ 369 hBlendMaskDC = CreateCompatibleDC(0); 370 hBlendBrush = pimldp->fStyle & ILD_BLEND50 ? 371 himlLocal->hbrBlend50 : himlLocal->hbrBlend25; 372 373 hBlendMaskBitmap = CreateBitmap(cx, cy, 1, 1, NULL); 374 hOldBitmap = SelectObject(hBlendMaskDC, hBlendMaskBitmap); 375 376 hOldBrush = (HBRUSH) SelectObject(hBlendMaskDC, hBlendBrush); 377 PatBlt(hBlendMaskDC, 0, 0, cx, cy, PATCOPY); 378 SelectObject(hBlendMaskDC, hOldBrush); 379 380 /* Modify the blend mask if an Image Mask exist 381 */ 382 if(pimldp->himl->hbmMask != 0) 383 { 384 HBITMAP hOldMaskBitmap; 385 hMaskDC = CreateCompatibleDC(0); 386 hOldMaskBitmap = (HBITMAP) SelectObject(hMaskDC, himlLocal->hbmMask); 387 388 BitBlt(hBlendMaskDC, 389 0,0, cx, cy, 390 hMaskDC, 391 himlLocal->cx * pimldp->i,0, 392 0x220326); /* NOTSRCAND */ 393 394 BitBlt(hBlendMaskDC, 395 0,0, cx, cy, 396 hBlendMaskDC, 397 0,0, 398 NOTSRCCOPY); 399 400 SelectObject(hMaskDC, hOldMaskBitmap); 401 DeleteDC(hMaskDC); 402 403 } 404 /* Apply blend to the current image given the BlendMask 405 */ 406 OldTextColor = SetTextColor(pimldp->hdcDst, 0); 407 OldBkColor = SetBkColor(pimldp->hdcDst, RGB(255,255,255)); 408 hBlendColorBrush = CreateSolidBrush(clrBlend); 409 hOldBrush = (HBRUSH) SelectObject (pimldp->hdcDst, hBlendColorBrush); 410 411 BitBlt (pimldp->hdcDst, 412 pimldp->x, pimldp->y, cx, cy, 413 hBlendMaskDC, 414 0, 0, 415 0xB8074A); /* PSDPxax */ 416 417 SelectObject(pimldp->hdcDst, hOldBrush); 418 SetTextColor(pimldp->hdcDst, OldTextColor); 419 SetBkColor(pimldp->hdcDst, OldBkColor); 420 SelectObject(hBlendMaskDC, hOldBitmap); 421 DeleteDC(hBlendMaskDC); 422 DeleteObject(hBlendMaskBitmap); 423 DeleteObject(hBlendColorBrush); 424 } 425 426 /************************************************************************* 427 * IMAGELIST_InternalDrawOverlay [Internal] 428 * 429 * Draws the overlay image 430 * 431 * PARAMS 432 * pimldp [I] pointer to IMAGELISTDRAWPARAMS structure. 433 * cx [I] the width of the image to display 434 * cy............[I] the height of the image to display 435 * 436 * RETURNS 437 * nothing 438 * 439 * NOTES 440 * This functions is used by ImageList_DrawIndirect, when it is 441 * required to draw the overlay 442 * 443 * 444 */ 445 static VOID 446 IMAGELIST_InternalDrawOverlay(IMAGELISTDRAWPARAMS *pimldp, INT cx, INT cy) 447 { 448 INT nOvlIdx; 449 HDC hImageDC; 450 HBITMAP hOldBitmap; 451 452 nOvlIdx = (pimldp->fStyle & ILD_OVERLAYMASK) >> 8; 453 if ((nOvlIdx >= 1) && (nOvlIdx <= MAX_OVERLAYIMAGE)) 454 { 455 nOvlIdx = pimldp->himl->nOvlIdx[nOvlIdx - 1]; 456 if ((nOvlIdx >= 0) && (nOvlIdx <= pimldp->himl->cCurImage)) 457 { 458 hImageDC = CreateCompatibleDC(0); 459 if (pimldp->himl->hbmMask) 460 { 461 hOldBitmap = (HBITMAP) SelectObject (hImageDC, 462 pimldp->himl->hbmMask); 463 464 BitBlt (pimldp->hdcDst, 465 pimldp->x, pimldp->y, cx, cy, 466 hImageDC, pimldp->himl->cx * nOvlIdx, 0, 467 SRCAND); 468 469 SelectObject(hImageDC, hOldBitmap); 470 } 471 hOldBitmap = (HBITMAP) SelectObject (hImageDC, 472 pimldp->himl->hbmImage); 473 474 BitBlt (pimldp->hdcDst, 475 pimldp->x, pimldp->y, cx, cy, 476 hImageDC, 477 pimldp->himl->cx * nOvlIdx, 0, 478 SRCPAINT); 479 480 SelectObject(hImageDC, hOldBitmap); 481 DeleteDC(hImageDC); 482 } 483 } 484 } 485 486 487 /************************************************************************* 488 * ImageList_Add [COMCTL32.40] 151 * ImageList_Add [COMCTL32.@] 489 152 * 490 153 * Add an image or images to an image list. … … 509 172 HBITMAP hOldBitmapImage, hOldBitmap; 510 173 511 TRACE("himl=%p hbmimage=% x hbmmask=%x\n", himl, hbmImage, hbmMask);174 TRACE("himl=%p hbmimage=%p hbmmask=%p\n", himl, hbmImage, hbmMask); 512 175 if (!himl || !hbmImage) 513 176 return -1; … … 533 196 if(himl->hbmMask) 534 197 { 535 HDC hdcMask, hdcTemp, hOldBitmapMask, hOldBitmapTemp; 198 HDC hdcMask, hdcTemp; 199 HBITMAP hOldBitmapMask, hOldBitmapTemp; 536 200 537 201 hdcMask = CreateCompatibleDC (0); 538 202 hdcTemp = CreateCompatibleDC(0); 539 hOldBitmapMask = (HBITMAP)SelectObject(hdcMask, himl->hbmMask);540 hOldBitmapTemp = (HBITMAP)SelectObject(hdcTemp, hbmMask);541 542 BitBlt (hdcMask, 203 hOldBitmapMask = SelectObject(hdcMask, himl->hbmMask); 204 hOldBitmapTemp = SelectObject(hdcTemp, hbmMask); 205 206 BitBlt (hdcMask, 543 207 nStartX, 0, bmp.bmWidth, bmp.bmHeight, 544 hdcTemp, 545 0, 0, 208 hdcTemp, 209 0, 0, 546 210 SRCCOPY); 547 211 … … 551 215 /* Remove the background from the image 552 216 */ 553 BitBlt (hdcImage, 217 BitBlt (hdcImage, 554 218 nStartX, 0, bmp.bmWidth, bmp.bmHeight, 555 hdcMask, 556 nStartX, 0, 219 hdcMask, 220 nStartX, 0, 557 221 0x220326); /* NOTSRCAND */ 558 222 … … 574 238 575 239 /************************************************************************* 576 * ImageList_AddIcon [COMCTL32. 41]240 * ImageList_AddIcon [COMCTL32.@] 577 241 * 578 242 * Adds an icon to an image list. … … 595 259 596 260 /************************************************************************* 597 * ImageList_AddMasked [COMCTL32. 42]261 * ImageList_AddMasked [COMCTL32.@] 598 262 * 599 263 * Adds an image or images to an image list and creates a mask from the … … 620 284 COLORREF bkColor; 621 285 622 TRACE("himl=%p hbitmap=% xclrmask=%lx\n", himl, hBitmap, clrMask);286 TRACE("himl=%p hbitmap=%p clrmask=%lx\n", himl, hBitmap, clrMask); 623 287 if (himl == NULL) 624 288 return -1; … … 660 324 GetPixel (hdcBitmap, 0, 0); 661 325 SetBkColor (hdcBitmap, bkColor); 662 BitBlt (hdcMask, 326 BitBlt (hdcMask, 663 327 nMaskXOffset, 0, bmp.bmWidth, bmp.bmHeight, 664 hdcBitmap, 0, 0, 328 hdcBitmap, 0, 0, 665 329 SRCCOPY); 666 330 … … 677 341 This is here in case some apps rely on this bug 678 342 */ 679 BitBlt(hdcBitmap, 343 BitBlt(hdcBitmap, 680 344 0, 0, bmp.bmWidth, bmp.bmHeight, 681 hdcMask, 682 nMaskXOffset, 0, 345 hdcMask, 346 nMaskXOffset, 0, 683 347 0x220326); /* NOTSRCAND */ 684 348 /* Copy result to the imagelist 685 349 */ 686 BitBlt (hdcImage, 350 BitBlt (hdcImage, 687 351 nIndex * himl->cx, 0, bmp.bmWidth, bmp.bmHeight, 688 hdcBitmap, 689 0, 0, 352 hdcBitmap, 353 0, 0, 690 354 SRCCOPY); 691 355 /* Clean up … … 707 371 708 372 /************************************************************************* 709 * ImageList_BeginDrag [COMCTL32. 43]373 * ImageList_BeginDrag [COMCTL32.@] 710 374 * 711 375 * Creates a temporary image list that contains one image. It will be used … … 744 408 InternalDrag.himl = ImageList_Create (cx, cy, himlTrack->flags, 1, 1); 745 409 if (InternalDrag.himl == NULL) { 746 ERR("Error creating drag image list!\n");410 WARN("Error creating drag image list!\n"); 747 411 return FALSE; 748 412 } … … 775 439 776 440 /************************************************************************* 777 * ImageList_Copy [COMCTL32. 44]778 * 779 * Copies an image of the source image list to an image of the 441 * ImageList_Copy [COMCTL32.@] 442 * 443 * Copies an image of the source image list to an image of the 780 444 * destination image list. Images can be copied or swapped. 781 445 * … … 801 465 INT iSrc, INT uFlags) 802 466 { 803 HDC hdcSrc, hdcDst; 467 HDC hdcSrc, hdcDst; 804 468 805 469 TRACE("iDst=%d iSrc=%d\n", iDst, iSrc); … … 903 567 904 568 /************************************************************************* 905 * ImageList_Create [COMCTL32. 45] Creates a new image list.569 * ImageList_Create [COMCTL32.@] Creates a new image list. 906 570 * 907 571 * PARAMS … … 925 589 INT nCount; 926 590 HBITMAP hbmTemp; 927 static WORD aBitBlend25[] = 591 static WORD aBitBlend25[] = 928 592 {0xAA, 0x00, 0x55, 0x00, 0xAA, 0x00, 0x55, 0x00}; 929 593 … … 968 632 else 969 633 himl->hbmImage = 0; 970 971 if ( (himl->cMaxImage > 0) && (himl->flags & ILC_MASK)) { 972 himl->hbmMask = CreateBitmap (himl->cx * himl->cMaxImage, himl->cy, 634 635 if ( (himl->flags & ILC_MASK)) { 636 int images = himl->cMaxImage; 637 if (images <= 0) 638 images = 1; 639 640 himl->hbmMask = CreateBitmap (himl->cx * images, himl->cy, 973 641 1, 1, NULL); 974 642 if (himl->hbmMask == 0) { … … 997 665 998 666 /************************************************************************* 999 * ImageList_Destroy [COMCTL32. 46]667 * ImageList_Destroy [COMCTL32.@] 1000 668 * 1001 669 * Destroys an image list. … … 1011 679 BOOL WINAPI 1012 680 ImageList_Destroy (HIMAGELIST himl) 1013 { 681 { 1014 682 if (!himl) 1015 683 return FALSE; … … 1026 694 if (himl->hbrBlend50) 1027 695 DeleteObject (himl->hbrBlend50); 1028 696 1029 697 COMCTL32_Free (himl); 1030 698 … … 1034 702 1035 703 /************************************************************************* 1036 * ImageList_DragEnter [COMCTL32. 47]704 * ImageList_DragEnter [COMCTL32.@] 1037 705 * 1038 706 * Locks window update and displays the drag image at the given position. … … 1055 723 ImageList_DragEnter (HWND hwndLock, INT x, INT y) 1056 724 { 1057 TRACE("(hwnd=% #xx=%d y=%d)\n", hwndLock, x, y);725 TRACE("(hwnd=%p x=%d y=%d)\n", hwndLock, x, y); 1058 726 1059 727 if (InternalDrag.himl == NULL) … … 1078 746 1079 747 /************************************************************************* 1080 * ImageList_DragLeave [COMCTL32. 48]748 * ImageList_DragLeave [COMCTL32.@] 1081 749 * 1082 750 * Unlocks window update and hides the drag image. … … 1111 779 1112 780 /************************************************************************* 1113 * ImageList_DragMove [COMCTL32.49] 781 * ImageList_InternalDragDraw [Internal] 782 * 783 * Draws the drag image. 784 * 785 * PARAMS 786 * hdc [I] device context to draw into. 787 * x [I] X position of the drag image. 788 * y [I] Y position of the drag image. 789 * 790 * RETURNS 791 * Success: TRUE 792 * Failure: FALSE 793 * 794 * NOTES 795 * The position of the drag image is relative to the window, not 796 * the client area. 797 * 798 */ 799 800 static inline void 801 ImageList_InternalDragDraw (HDC hdc, INT x, INT y) 802 { 803 IMAGELISTDRAWPARAMS imldp; 804 805 ZeroMemory (&imldp, sizeof(imldp)); 806 imldp.cbSize = sizeof(imldp); 807 imldp.himl = InternalDrag.himl; 808 imldp.i = 0; 809 imldp.hdcDst = hdc, 810 imldp.x = x; 811 imldp.y = y; 812 imldp.rgbBk = CLR_DEFAULT; 813 imldp.rgbFg = CLR_DEFAULT; 814 imldp.fStyle = ILD_NORMAL; 815 imldp.fState = ILS_ALPHA; 816 imldp.Frame = 128; 817 818 /* FIXME: instead of using the alpha blending, we should 819 * create a 50% mask, and draw it semitransparantly that way */ 820 ImageList_DrawIndirect (&imldp); 821 } 822 823 /************************************************************************* 824 * ImageList_DragMove [COMCTL32.@] 1114 825 * 1115 826 * Moves the drag image. … … 1150 861 INT origRegX, origRegY; 1151 862 INT sizeRegX, sizeRegY; 1152 863 1153 864 1154 865 /* calculate the update region */ … … 1182 893 hdcOffScreen, origNewX - origRegX, origNewY - origRegY, SRCCOPY); 1183 894 /* draw the image */ 1184 /* FIXME: image should be drawn semitransparent */ 1185 ImageList_Draw(InternalDrag.himl, 0, hdcOffScreen, origNewX - origRegX, 1186 origNewY - origRegY, ILD_NORMAL); 895 ImageList_InternalDragDraw(hdcOffScreen, origNewX - origRegX, 896 origNewY - origRegY); 1187 897 /* draw the update region to the screen */ 1188 898 BitBlt(hdcDrag, origRegX, origRegY, sizeRegX, sizeRegY, … … 1204 914 1205 915 /************************************************************************* 1206 * ImageList_DragShowNolock [COMCTL32. 50]916 * ImageList_DragShowNolock [COMCTL32.@] 1207 917 * 1208 918 * Shows or hides the drag image. … … 1249 959 } 1250 960 SelectObject(hdcBg, InternalDrag.hbmBg); 1251 961 1252 962 if (bShow) { 1253 963 /* save the background */ … … 1255 965 hdcDrag, x, y, SRCCOPY); 1256 966 /* show the image */ 1257 /* FIXME: this should be drawn semitransparent */ 1258 ImageList_Draw(InternalDrag.himl, 0, hdcDrag, x, y, ILD_NORMAL); 1259 } else { 967 ImageList_InternalDragDraw(hdcDrag, x, y); 968 } else { 1260 969 /* hide the image */ 1261 970 BitBlt(hdcDrag, x, y, InternalDrag.himl->cx, InternalDrag.himl->cy, … … 1272 981 1273 982 /************************************************************************* 1274 * ImageList_Draw [COMCTL32. 51] Draws an image.983 * ImageList_Draw [COMCTL32.@] Draws an image. 1275 984 * 1276 985 * PARAMS … … 1286 995 * Failure: FALSE 1287 996 * 1288 * NOTES1289 * Calls ImageList_DrawIndirect.1290 *1291 997 * SEE 1292 * ImageList_Draw Indirect.998 * ImageList_DrawEx. 1293 999 */ 1294 1000 1295 1001 BOOL WINAPI 1296 ImageList_Draw (HIMAGELIST himl, INT i, HDC hdc, 1297 INT x, INT y, UINT fStyle) 1298 { 1299 IMAGELISTDRAWPARAMS imldp; 1300 1301 imldp.cbSize = sizeof(IMAGELISTDRAWPARAMS); 1302 imldp.himl = himl; 1303 imldp.i = i; 1304 imldp.hdcDst = hdc, 1305 imldp.x = x; 1306 imldp.y = y; 1307 imldp.cx = 0; 1308 imldp.cy = 0; 1309 imldp.xBitmap = 0; 1310 imldp.yBitmap = 0; 1311 imldp.rgbBk = CLR_DEFAULT; 1312 imldp.rgbFg = CLR_DEFAULT; 1313 imldp.fStyle = fStyle; 1314 imldp.dwRop = 0; 1315 1316 return ImageList_DrawIndirect (&imldp); 1317 } 1318 1319 1320 /************************************************************************* 1321 * ImageList_DrawEx [COMCTL32.52] 1002 ImageList_Draw (HIMAGELIST himl, INT i, HDC hdc, INT x, INT y, UINT fStyle) 1003 { 1004 return ImageList_DrawEx (himl, i, hdc, x, y, 0, 0, 1005 CLR_DEFAULT, CLR_DEFAULT, fStyle); 1006 } 1007 1008 1009 /************************************************************************* 1010 * ImageList_DrawEx [COMCTL32.@] 1322 1011 * 1323 1012 * Draws an image and allows to use extended drawing features. … … 1329 1018 * x [I] X position 1330 1019 * y [I] Y position 1331 * xOffs[I] X offset1332 * yOffs[I] Y offset1020 * dx [I] X offset 1021 * dy [I] Y offset 1333 1022 * rgbBk [I] background color 1334 1023 * rgbFg [I] foreground color … … 1353 1042 IMAGELISTDRAWPARAMS imldp; 1354 1043 1355 imldp.cbSize = sizeof(IMAGELISTDRAWPARAMS); 1044 ZeroMemory (&imldp, sizeof(imldp)); 1045 imldp.cbSize = sizeof(imldp); 1356 1046 imldp.himl = himl; 1357 1047 imldp.i = i; … … 1361 1051 imldp.cx = dx; 1362 1052 imldp.cy = dy; 1363 imldp.xBitmap = 0;1364 imldp.yBitmap = 0;1365 1053 imldp.rgbBk = rgbBk; 1366 1054 imldp.rgbFg = rgbFg; 1367 1055 imldp.fStyle = fStyle; 1368 imldp.dwRop = 0;1369 1056 1370 1057 return ImageList_DrawIndirect (&imldp); … … 1373 1060 1374 1061 /************************************************************************* 1375 * ImageList_DrawIndirect [COMCTL32. 53]1062 * ImageList_DrawIndirect [COMCTL32.@] 1376 1063 * 1377 1064 * Draws an image using ... … … 1388 1075 ImageList_DrawIndirect (IMAGELISTDRAWPARAMS *pimldp) 1389 1076 { 1390 INT cx, cy; 1391 /* 1392 Do some Error Checking 1393 */ 1394 if (pimldp == NULL) 1395 return FALSE; 1396 if (pimldp->cbSize < sizeof(IMAGELISTDRAWPARAMS)) 1397 return FALSE; 1398 if (pimldp->himl == NULL) 1399 return FALSE; 1400 if ((pimldp->i < 0) || (pimldp->i >= pimldp->himl->cCurImage)) { 1401 ERR("%d not within range (max %d)\n",pimldp->i,pimldp->himl->cCurImage-1); 1402 return FALSE; 1403 } 1077 INT cx, cy, nOvlIdx; 1078 DWORD fState, dwRop; 1079 UINT fStyle; 1080 COLORREF clrBk, oldImageBk, oldImageFg; 1081 HDC hImageDC, hImageListDC, hMaskListDC; 1082 HBITMAP hImageBmp, hOldImageBmp, hOldImageListBmp, hOldMaskListBmp, hBlendMaskBmp; 1083 BOOL bIsTransparent, bBlend, bResult = FALSE; 1084 const HIMAGELIST himl = pimldp->himl; 1085 const INT lx = himl->cx * pimldp->i + pimldp->xBitmap; 1086 const INT ly = pimldp->yBitmap; 1087 1088 if (!pimldp || !himl) return FALSE; 1089 if ((pimldp->i < 0) || (pimldp->i >= himl->cCurImage)) return FALSE; 1090 1091 fState = pimldp->cbSize < sizeof(IMAGELISTDRAWPARAMS) ? ILS_NORMAL : pimldp->fState; 1092 fStyle = pimldp->fStyle & ~ILD_OVERLAYMASK; 1093 cx = (pimldp->cx == 0) ? himl->cx : pimldp->cx; 1094 cy = (pimldp->cy == 0) ? himl->cy : pimldp->cy; 1095 clrBk = (pimldp->rgbBk == CLR_DEFAULT) ? himl->clrBk : pimldp->rgbBk; 1096 bIsTransparent = (fStyle & ILD_TRANSPARENT) || clrBk == CLR_NONE; 1097 bBlend = fStyle & (ILD_BLEND25 | ILD_BLEND50); 1098 1099 TRACE("hbmMask(%p) iImage(%d) x(%d) y(%d) cx(%d) cy(%d)\n", 1100 himl->hbmMask, pimldp->i, pimldp->x, pimldp->y, cx, cy); 1101 1102 /* we will use these DCs to access the images and masks in the ImageList */ 1103 hImageListDC = CreateCompatibleDC(0); 1104 hMaskListDC = himl->hbmMask ? CreateCompatibleDC(0) : 0; 1105 1106 /* these will accumulate the image and mask for the image we're drawing */ 1107 hImageDC = CreateCompatibleDC( pimldp->hdcDst ); 1108 hImageBmp = CreateCompatibleBitmap( pimldp->hdcDst, cx, cy ); 1109 hBlendMaskBmp = bBlend ? CreateBitmap(cx, cy, 1, 1, NULL) : 0; 1110 1111 /* Create a compatible DC. */ 1112 if (!hImageListDC || !hImageDC || !hImageBmp || 1113 (bBlend && !hBlendMaskBmp) || (himl->hbmMask && !hMaskListDC)) 1114 goto cleanup; 1115 1116 hOldImageListBmp = SelectObject(hImageListDC, himl->hbmImage); 1117 hOldImageBmp = SelectObject(hImageDC, hImageBmp); 1118 hOldMaskListBmp = hMaskListDC ? SelectObject(hMaskListDC, himl->hbmMask) : 0; 1119 1404 1120 /* 1405 Get the Height and Width to display 1406 */ 1407 cx = (pimldp->cx == 0) ? pimldp->himl->cx : pimldp->cx; 1408 cy = (pimldp->cy == 0) ? pimldp->himl->cy : pimldp->cy; 1121 * To obtain a transparent look, background color should be set 1122 * to white and foreground color to black when blting the 1123 * monochrome mask. 1124 */ 1125 oldImageFg = SetTextColor( hImageDC, RGB( 0, 0, 0 ) ); 1126 oldImageBk = SetBkColor( hImageDC, RGB( 0xff, 0xff, 0xff ) ); 1127 1409 1128 /* 1410 Draw the image 1411 */ 1412 if(pimldp->himl->hbmMask != 0) 1413 { 1414 IMAGELIST_InternalDrawMask(pimldp, cx, cy); 1415 } 1416 else 1417 { 1418 IMAGELIST_InternalDraw(pimldp, cx, cy); 1419 } 1420 /* 1421 Apply the blend if needed to the Image 1422 */ 1423 if((pimldp->fStyle & ILD_BLEND50) 1424 || (pimldp->fStyle & ILD_BLEND25)) 1425 { 1426 IMAGELIST_InternalDrawBlend(pimldp, cx, cy); 1427 } 1428 /* 1429 Apply the Overlay if needed 1430 */ 1431 if (pimldp->fStyle & ILD_OVERLAYMASK) 1432 { 1433 IMAGELIST_InternalDrawOverlay(pimldp, cx, cy); 1434 } 1435 1436 return TRUE; 1437 } 1438 1439 1440 /************************************************************************* 1441 * ImageList_Duplicate [COMCTL32.54] Duplicates an image list. 1129 * Draw the initial image 1130 */ 1131 if(fStyle & ILD_MASK) { 1132 if (himl->hbmMask) { 1133 BitBlt(hImageDC, 0, 0, cx, cy, hMaskListDC, lx, ly, SRCCOPY); 1134 } else { 1135 HBRUSH hOldBrush = SelectObject (hImageDC, GetStockObject(BLACK_BRUSH)); 1136 PatBlt( hImageDC, 0, 0, cx, cy, PATCOPY); 1137 SelectObject(hImageDC, hOldBrush); 1138 } 1139 } else if (himl->hbmMask && !bIsTransparent) { 1140 /* blend the image with the needed solid background */ 1141 HBRUSH hOldBrush = SelectObject (hImageDC, CreateSolidBrush (clrBk)); 1142 PatBlt( hImageDC, 0, 0, cx, cy, PATCOPY ); 1143 BitBlt( hImageDC, 0, 0, cx, cy, hMaskListDC, lx, ly, SRCAND ); 1144 BitBlt( hImageDC, 0, 0, cx, cy, hImageListDC, lx, ly, SRCPAINT ); 1145 DeleteObject (SelectObject (hImageDC, hOldBrush)); 1146 } else { 1147 /* start off with the image, if we have a mask, we'll use it later */ 1148 BitBlt( hImageDC, 0, 0, cx, cy, hImageListDC, lx, ly, SRCCOPY); 1149 } 1150 1151 /* Time for blending, if required */ 1152 if (bBlend) { 1153 HBRUSH hBlendBrush, hOldBrush; 1154 COLORREF clrBlend = pimldp->rgbFg; 1155 HDC hBlendMaskDC = hImageListDC; 1156 HBITMAP hOldBitmap; 1157 1158 /* Create the blend Mask */ 1159 hOldBitmap = SelectObject(hBlendMaskDC, hBlendMaskBmp); 1160 hBlendBrush = fStyle & ILD_BLEND50 ? himl->hbrBlend50 : himl->hbrBlend25; 1161 hOldBrush = (HBRUSH) SelectObject(hBlendMaskDC, hBlendBrush); 1162 PatBlt(hBlendMaskDC, 0, 0, cx, cy, PATCOPY); 1163 SelectObject(hBlendMaskDC, hOldBrush); 1164 1165 /* Modify the blend mask if an Image Mask exist */ 1166 if(himl->hbmMask) { 1167 BitBlt(hBlendMaskDC, 0, 0, cx, cy, hMaskListDC, lx, ly, 0x220326); /* NOTSRCAND */ 1168 BitBlt(hBlendMaskDC, 0, 0, cx, cy, hBlendMaskDC, 0, 0, NOTSRCCOPY); 1169 } 1170 1171 /* now apply blend to the current image given the BlendMask */ 1172 if (clrBlend == CLR_DEFAULT) clrBlend = GetSysColor (COLOR_HIGHLIGHT); 1173 else if (clrBlend == CLR_NONE) clrBlend = GetTextColor (pimldp->hdcDst); 1174 hOldBrush = (HBRUSH) SelectObject (hImageDC, CreateSolidBrush(clrBlend)); 1175 BitBlt (hImageDC, 0, 0, cx, cy, hBlendMaskDC, 0, 0, 0xB8074A); /* PSDPxax */ 1176 DeleteObject(SelectObject(hImageDC, hOldBrush)); 1177 SelectObject(hBlendMaskDC, hOldBitmap); 1178 } 1179 1180 /* Now do the overlay image, if any */ 1181 nOvlIdx = (pimldp->fStyle & ILD_OVERLAYMASK) >> 8; 1182 if ( (nOvlIdx >= 1) && (nOvlIdx <= MAX_OVERLAYIMAGE)) { 1183 nOvlIdx = himl->nOvlIdx[nOvlIdx - 1]; 1184 if ((nOvlIdx >= 0) && (nOvlIdx < himl->cCurImage)) { 1185 const INT ox = himl->cx * nOvlIdx + pimldp->xBitmap; 1186 if (himl->hbmMask && !(fStyle & ILD_IMAGE)) 1187 BitBlt (hImageDC, 0, 0, cx, cy, hMaskListDC, ox, ly, SRCAND); 1188 BitBlt (hImageDC, 0, 0, cx, cy, hImageListDC, ox, ly, SRCPAINT); 1189 } 1190 } 1191 1192 if (fState & ILS_SATURATE) FIXME("ILS_SATURATE: unimplemented!\n"); 1193 if (fState & ILS_GLOW) FIXME("ILS_GLOW: unimplemented!\n"); 1194 if (fState & ILS_SHADOW) FIXME("ILS_SHADOW: unimplemented!\n"); 1195 if (fState & ILS_ALPHA) FIXME("ILS_SHADOW: unimplemented!\n"); 1196 1197 if (fStyle & ILD_PRESERVEALPHA) FIXME("ILD_PRESERVEALPHA: unimplemented!\n"); 1198 if (fStyle & ILD_SCALE) FIXME("ILD_SCALE: unimplemented!\n"); 1199 if (fStyle & ILD_DPISCALE) FIXME("ILD_DPISCALE: unimplemented!\n"); 1200 1201 /* now copy the image to the screen */ 1202 dwRop = SRCCOPY; 1203 if (himl->hbmMask && bIsTransparent && !(fStyle & ILD_MASK)) { 1204 COLORREF oldDstFg = SetTextColor(pimldp->hdcDst, RGB( 0, 0, 0 ) ); 1205 COLORREF oldDstBk = SetBkColor(pimldp->hdcDst, RGB( 0xff, 0xff, 0xff )); 1206 BitBlt (pimldp->hdcDst, pimldp->x, pimldp->y, cx, cy, hMaskListDC, lx, ly, SRCAND); 1207 SetBkColor(pimldp->hdcDst, oldDstBk); 1208 SetTextColor(pimldp->hdcDst, oldDstFg); 1209 dwRop = SRCPAINT; 1210 } 1211 if (fStyle & ILD_ROP) dwRop = pimldp->dwRop; 1212 BitBlt (pimldp->hdcDst, pimldp->x, pimldp->y, cx, cy, hImageDC, 0, 0, dwRop); 1213 1214 bResult = TRUE; 1215 1216 /* cleanup the mess */ 1217 SetBkColor(hImageDC, oldImageBk); 1218 SetTextColor(hImageDC, oldImageFg); 1219 SelectObject(hImageDC, hOldImageBmp); 1220 SelectObject(hImageListDC, hOldImageListBmp); 1221 if (hMaskListDC) SelectObject(hMaskListDC, hOldMaskListBmp); 1222 cleanup: 1223 DeleteObject(hBlendMaskBmp); 1224 DeleteObject(hImageBmp); 1225 DeleteObject(hImageDC); 1226 DeleteObject(hImageListDC); 1227 DeleteObject(hMaskListDC); 1228 1229 return bResult; 1230 } 1231 1232 1233 /************************************************************************* 1234 * ImageList_Duplicate [COMCTL32.@] Duplicates an image list. 1442 1235 * 1443 1236 * PARAMS … … 1491 1284 1492 1285 /************************************************************************* 1493 * ImageList_EndDrag [COMCTL32. 55] Finishes a drag operation.1286 * ImageList_EndDrag [COMCTL32.@] Finishes a drag operation. 1494 1287 * 1495 1288 * Finishes a drag operation. … … 1524 1317 1525 1318 /************************************************************************* 1526 * ImageList_GetBkColor [COMCTL32. 56]1319 * ImageList_GetBkColor [COMCTL32.@] 1527 1320 * 1528 1321 * Returns the background color of an image list. … … 1539 1332 ImageList_GetBkColor (HIMAGELIST himl) 1540 1333 { 1541 if (himl == NULL) 1542 return CLR_NONE; 1543 1544 return himl->clrBk; 1545 } 1546 1547 1548 /************************************************************************* 1549 * ImageList_GetDragImage [COMCTL32.57] 1334 return himl ? himl->clrBk : CLR_NONE; 1335 } 1336 1337 1338 /************************************************************************* 1339 * ImageList_GetDragImage [COMCTL32.@] 1550 1340 * 1551 1341 * Returns the handle to the internal drag image list. … … 1580 1370 1581 1371 /************************************************************************* 1582 * ImageList_GetFlags [COMCTL32. 58]1372 * ImageList_GetFlags [COMCTL32.@] 1583 1373 * 1584 1374 * BUGS … … 1595 1385 1596 1386 /************************************************************************* 1597 * ImageList_GetIcon [COMCTL32. 59]1387 * ImageList_GetIcon [COMCTL32.@] 1598 1388 * 1599 1389 * Creates an icon from a masked image of an image list. … … 1613 1403 { 1614 1404 ICONINFO ii; 1615 HICON hIcon; 1616 HBITMAP hOldSrcBitmap,hOldDstBitmap; 1617 HDC hdcSrc, hdcDst; 1618 1619 if ((himl == NULL) || (i < 0) || (i >= himl->cCurImage)) { 1620 FIXME("(%p,%d,%x), params out of range!\n",himl,i,fStyle); 1621 return 0; 1622 } 1623 1624 hdcSrc = CreateCompatibleDC(0); 1405 HICON hIcon; 1406 HBITMAP hOldDstBitmap; 1407 HDC hdcDst; 1408 1409 if ((himl == NULL) || (i < 0) || (i >= himl->cCurImage)) return 0; 1410 1625 1411 hdcDst = CreateCompatibleDC(0); 1626 1412 1627 1413 ii.fIcon = TRUE; 1414 1415 /* draw mask*/ 1628 1416 ii.hbmMask = CreateCompatibleBitmap (hdcDst, himl->cx, himl->cy); 1629 1630 /* draw mask*/1631 1417 hOldDstBitmap = (HBITMAP)SelectObject (hdcDst, ii.hbmMask); 1632 if (himl->hbmMask) { 1633 SelectObject (hdcSrc, himl->hbmMask); 1634 BitBlt (hdcDst, 0, 0, himl->cx, himl->cy, 1635 hdcSrc, i * himl->cx, 0, SRCCOPY); 1636 } 1637 else 1638 PatBlt (hdcDst, 0, 0, himl->cx, himl->cy, BLACKNESS); 1418 ImageList_Draw(himl, i, hdcDst, 0, 0, ILD_MASK); 1639 1419 1640 1420 /* draw image*/ 1641 hOldSrcBitmap = (HBITMAP)SelectObject (hdcSrc, himl->hbmImage);1642 ii.hbmColor = CreateCompatibleBitmap (hdc Src, himl->cx, himl->cy);1421 SelectObject (hdcDst, himl->hbmImage); 1422 ii.hbmColor = CreateCompatibleBitmap (hdcDst, himl->cx, himl->cy); 1643 1423 SelectObject (hdcDst, ii.hbmColor); 1644 BitBlt (hdcDst, 0, 0, himl->cx, himl->cy, 1645 hdcSrc, i * himl->cx, 0, SRCCOPY); 1424 ImageList_Draw(himl, i, hdcDst, 0, 0, fStyle); 1646 1425 1647 1426 /* 1648 1427 * CreateIconIndirect requires us to deselect the bitmaps from 1649 * the DCs before calling 1428 * the DCs before calling 1650 1429 */ 1651 SelectObject(hdcSrc, hOldSrcBitmap);1652 1430 SelectObject(hdcDst, hOldDstBitmap); 1653 1431 1654 hIcon = CreateIconIndirect (&ii); 1655 1656 DeleteDC (hdcSrc); 1657 DeleteDC (hdcDst); 1432 hIcon = CreateIconIndirect (&ii); 1433 1658 1434 DeleteObject (ii.hbmMask); 1659 1435 DeleteObject (ii.hbmColor); 1436 DeleteDC (hdcDst); 1660 1437 1661 1438 return hIcon; … … 1664 1441 1665 1442 /************************************************************************* 1666 * ImageList_GetIconSize [COMCTL32. 60]1443 * ImageList_GetIconSize [COMCTL32.@] 1667 1444 * 1668 1445 * Retrieves the size of an image in an image list. … … 1699 1476 1700 1477 /************************************************************************* 1701 * ImageList_GetImageCount [COMCTL32. 61]1478 * ImageList_GetImageCount [COMCTL32.@] 1702 1479 * 1703 1480 * Returns the number of images in an image list. … … 1722 1499 1723 1500 /************************************************************************* 1724 * ImageList_GetImageInfo [COMCTL32. 62]1501 * ImageList_GetImageInfo [COMCTL32.@] 1725 1502 * 1726 1503 * Returns information about an image in an image list. … … 1746 1523 pImageInfo->hbmImage = himl->hbmImage; 1747 1524 pImageInfo->hbmMask = himl->hbmMask; 1748 1525 1749 1526 pImageInfo->rcImage.top = 0; 1750 1527 pImageInfo->rcImage.bottom = himl->cy; 1751 1528 pImageInfo->rcImage.left = i * himl->cx; 1752 1529 pImageInfo->rcImage.right = (i+1) * himl->cx; 1753 1530 1754 1531 return TRUE; 1755 1532 } … … 1757 1534 1758 1535 /************************************************************************* 1759 * ImageList_GetImageRect [COMCTL32. 63]1536 * ImageList_GetImageRect [COMCTL32.@] 1760 1537 * 1761 1538 * Retrieves the rectangle of the specified image in an image list. … … 1792 1569 1793 1570 /************************************************************************* 1794 * ImageList_LoadImage [COMCTL32. 64]1795 * ImageList_LoadImageA [COMCTL32. 65]1571 * ImageList_LoadImage [COMCTL32.@] 1572 * ImageList_LoadImageA [COMCTL32.@] 1796 1573 * 1797 1574 * Creates an image list from a bitmap, icon or cursor. … … 1856 1633 GetIconInfo (handle, &ii); 1857 1634 GetObjectA (ii.hbmColor, sizeof(BITMAP), (LPVOID)&bmp); 1858 himl = ImageList_Create (bmp.bmWidth, bmp.bmHeight, 1635 himl = ImageList_Create (bmp.bmWidth, bmp.bmHeight, 1859 1636 ILC_MASK | ILC_COLOR, 1, cGrow); 1860 1637 ImageList_Add (himl, ii.hbmColor, ii.hbmMask); … … 1864 1641 1865 1642 DeleteObject (handle); 1866 1643 1867 1644 return himl; 1868 1645 } … … 1870 1647 1871 1648 /************************************************************************* 1872 * ImageList_LoadImageW [COMCTL32. 66]1649 * ImageList_LoadImageW [COMCTL32.@] 1873 1650 * 1874 1651 * Creates an image list from a bitmap, icon or cursor. … … 1933 1710 GetIconInfo (handle, &ii); 1934 1711 GetObjectA (ii.hbmMask, sizeof(BITMAP), (LPVOID)&bmp); 1935 himl = ImageList_Create (bmp.bmWidth, bmp.bmHeight, 1712 himl = ImageList_Create (bmp.bmWidth, bmp.bmHeight, 1936 1713 ILC_MASK | ILC_COLOR, 1, cGrow); 1937 1714 ImageList_Add (himl, ii.hbmColor, ii.hbmMask); … … 1941 1718 1942 1719 DeleteObject (handle); 1943 1720 1944 1721 return himl; 1945 1722 } … … 1947 1724 1948 1725 /************************************************************************* 1949 * ImageList_Merge [COMCTL32. 67]1726 * ImageList_Merge [COMCTL32.@] 1950 1727 * 1951 1728 * Creates a new image list that contains a merged image from the specified … … 2031 1808 nX1 = i1 * himl1->cx; 2032 1809 nX2 = i2 * himl2->cx; 2033 1810 2034 1811 /* copy image */ 2035 1812 SelectObject (hdcSrcImage, himl1->hbmImage); 2036 1813 SelectObject (hdcDstImage, himlDst->hbmImage); 2037 BitBlt (hdcDstImage, 0, 0, cxDst, cyDst, 1814 BitBlt (hdcDstImage, 0, 0, cxDst, cyDst, 2038 1815 hdcSrcImage, 0, 0, BLACKNESS); 2039 BitBlt (hdcDstImage, xOff1, yOff1, himl1->cx, himl1->cy, 1816 BitBlt (hdcDstImage, xOff1, yOff1, himl1->cx, himl1->cy, 2040 1817 hdcSrcImage, nX1, 0, SRCCOPY); 2041 1818 2042 1819 SelectObject (hdcSrcImage, himl2->hbmMask); 2043 BitBlt (hdcDstImage, xOff2, yOff2, himl2->cx, himl2->cy, 1820 BitBlt (hdcDstImage, xOff2, yOff2, himl2->cx, himl2->cy, 2044 1821 hdcSrcImage, nX2, 0, SRCAND); 2045 1822 2046 1823 SelectObject (hdcSrcImage, himl2->hbmImage); 2047 BitBlt (hdcDstImage, xOff2, yOff2, himl2->cx, himl2->cy, 1824 BitBlt (hdcDstImage, xOff2, yOff2, himl2->cx, himl2->cy, 2048 1825 hdcSrcImage, nX2, 0, SRCPAINT); 2049 1826 … … 2051 1828 SelectObject (hdcSrcImage, himl1->hbmMask); 2052 1829 SelectObject (hdcDstImage, himlDst->hbmMask); 2053 BitBlt (hdcDstImage, 0, 0, cxDst, cyDst, 1830 BitBlt (hdcDstImage, 0, 0, cxDst, cyDst, 2054 1831 hdcSrcImage, 0, 0, WHITENESS); 2055 BitBlt (hdcDstImage, xOff1, yOff1, himl1->cx, himl1->cy, 1832 BitBlt (hdcDstImage, xOff1, yOff1, himl1->cx, himl1->cy, 2056 1833 hdcSrcImage, nX1, 0, SRCCOPY); 2057 1834 2058 1835 SelectObject (hdcSrcImage, himl2->hbmMask); 2059 BitBlt (hdcDstImage, xOff2, yOff2, himl2->cx, himl2->cy, 1836 BitBlt (hdcDstImage, xOff2, yOff2, himl2->cx, himl2->cy, 2060 1837 hdcSrcImage, nX2, 0, SRCAND); 2061 1838 … … 2064 1841 himlDst->cCurImage = 1; 2065 1842 } 2066 1843 2067 1844 return himlDst; 2068 1845 } … … 2179 1956 2180 1957 /************************************************************************* 2181 * ImageList_Read [COMCTL32. 68]1958 * ImageList_Read [COMCTL32.@] 2182 1959 * 2183 1960 * Reads an image list from a stream. … … 2194 1971 * 2195 1972 * for the color image part: 2196 * BITMAPFILEHEADER bmfh; 1973 * BITMAPFILEHEADER bmfh; 2197 1974 * BITMAPINFOHEADER bmih; 2198 1975 * only if it has a palette: 2199 * RGBQUAD rgbs[nr_of_paletted_colors]; 1976 * RGBQUAD rgbs[nr_of_paletted_colors]; 2200 1977 * 2201 1978 * BYTE colorbits[imagesize]; … … 2205 1982 * BITMAPINFOHEADER bmih_mask; 2206 1983 * only if it has a palette (it usually does not): 2207 * RGBQUAD rgbs[nr_of_paletted_colors]; 1984 * RGBQUAD rgbs[nr_of_paletted_colors]; 2208 1985 * 2209 1986 * BYTE maskbits[imagesize]; … … 2275 2052 2276 2053 /************************************************************************* 2277 * ImageList_Remove [COMCTL32. 69] Removes an image from an image list2054 * ImageList_Remove [COMCTL32.@] Removes an image from an image list 2278 2055 * 2279 2056 * PARAMS … … 2293 2070 INT cxNew, nCount; 2294 2071 2072 TRACE("(himl=%p i=%d)\n", himl, i); 2073 2295 2074 if (himl == NULL) { 2296 2075 ERR("Invalid image list handle!\n"); 2297 2076 return FALSE; 2298 2077 } 2299 2078 2300 2079 if ((i < -1) || (i >= himl->cCurImage)) { 2301 2080 ERR("index out of range! %d\n", i); … … 2303 2082 } 2304 2083 2305 if (himl->cCurImage == 0) {2306 ERR("image list is already empty!\n");2307 return FALSE;2308 }2309 2310 2084 if (i == -1) { 2311 2085 /* remove all */ 2312 TRACE("remove all!\n"); 2086 if (himl->cCurImage == 0) { 2087 /* remove all on empty ImageList is allowed */ 2088 TRACE("remove all on empty ImageList!\n"); 2089 return TRUE; 2090 } 2313 2091 2314 2092 himl->cMaxImage = himl->cInitial + himl->cGrow; … … 2340 2118 TRACE(" - Max. number of images: %d / %d (Old/New)\n", 2341 2119 himl->cMaxImage, himl->cCurImage + himl->cGrow - 1); 2342 2120 2343 2121 hbmNewImage = 2344 2122 CreateBitmap (cxNew, himl->cy, 1, himl->uBitsPixel, NULL); … … 2355 2133 if (i > 0) { 2356 2134 TRACE("Pre image copy: Copy %d images\n", i); 2357 2135 2358 2136 SelectObject (hdcSrc, himl->hbmImage); 2359 2137 SelectObject (hdcDst, hbmNewImage); … … 2406 2184 2407 2185 /************************************************************************* 2408 * ImageList_Replace [COMCTL32. 70]2186 * ImageList_Replace [COMCTL32.@] 2409 2187 * 2410 2188 * Replaces an image in an image list with a new image. … … 2428 2206 BITMAP bmp; 2429 2207 2208 TRACE("%p %d %p %p\n", himl, i, hbmImage, hbmMask); 2209 2430 2210 if (himl == NULL) { 2431 2211 ERR("Invalid image list handle!\n"); 2432 2212 return FALSE; 2433 2213 } 2434 2214 2435 2215 if ((i >= himl->cMaxImage) || (i < 0)) { 2436 2216 ERR("Invalid image index!\n"); … … 2462 2242 */ 2463 2243 SelectObject (hdcImageList, himl->hbmImage); 2464 StretchBlt (hdcImageList, 2244 StretchBlt (hdcImageList, 2465 2245 i*himl->cx, 0, himl->cx, himl->cy, 2466 hdcImage, 2467 0, 0, bmp.bmWidth, bmp.bmHeight, 2246 hdcImage, 2247 0, 0, bmp.bmWidth, bmp.bmHeight, 2468 2248 0x220326); /* NOTSRCAND */ 2469 2249 } … … 2477 2257 2478 2258 /************************************************************************* 2479 * ImageList_ReplaceIcon [COMCTL32. 75]2259 * ImageList_ReplaceIcon [COMCTL32.@] 2480 2260 * 2481 2261 * Replaces an image in an image list using an icon. … … 2501 2281 BITMAP bmp; 2502 2282 2503 TRACE("(0x%lx 0x%x 0x%x)\n", (DWORD)himl, i, hIcon);2283 TRACE("(0x%lx 0x%x %p)\n", (DWORD)himl, i, hIcon); 2504 2284 2505 2285 if (himl == NULL) … … 2509 2289 2510 2290 hBestFitIcon = CopyImage( 2511 hIcon, IMAGE_ICON, 2512 himl->cx, himl->cy, 2291 hIcon, IMAGE_ICON, 2292 himl->cx, himl->cy, 2513 2293 LR_COPYFROMRESOURCE); 2514 2294 … … 2531 2311 2532 2312 hdcImageList = CreateCompatibleDC (0); 2533 TRACE("hdcImageList= 0x%x!\n", hdcImageList);2313 TRACE("hdcImageList=%p!\n", hdcImageList); 2534 2314 if (hdcImageList == 0) 2535 2315 ERR("invalid hdcImageList!\n"); 2536 2316 2537 2317 hdcImage = CreateCompatibleDC (0); 2538 TRACE("hdcImage= 0x%x!\n", hdcImage);2318 TRACE("hdcImage=%p!\n", hdcImage); 2539 2319 if (hdcImage == 0) 2540 2320 ERR("invalid hdcImage!\n"); … … 2573 2353 2574 2354 /************************************************************************* 2575 * ImageList_SetBkColor [COMCTL32. 76]2355 * ImageList_SetBkColor [COMCTL32.@] 2576 2356 * 2577 2357 * Sets the background color of an image list. … … 2601 2381 2602 2382 /************************************************************************* 2603 * ImageList_SetDragCursorImage [COMCTL32. 77]2383 * ImageList_SetDragCursorImage [COMCTL32.@] 2604 2384 * 2605 2385 * Combines the specified image with the current drag image … … 2683 2463 2684 2464 /************************************************************************* 2685 * ImageList_SetFilter [COMCTL32. 78]2465 * ImageList_SetFilter [COMCTL32.@] 2686 2466 * 2687 2467 * Sets a filter (or does something completely different)!!??? 2688 * 2689 * PARAMS 2690 * himl [I] handle to image list 2691 * i [I] ??? 2468 * It removes 12 Bytes from the stack (3 Parameters). 2469 * 2470 * PARAMS 2471 * himl [I] SHOULD be a handle to image list 2472 * i [I] COULD be an index? 2692 2473 * dwFilter [I] ??? 2693 2474 * … … 2704 2485 ImageList_SetFilter (HIMAGELIST himl, INT i, DWORD dwFilter) 2705 2486 { 2706 FIXME("(%p 0x%x 0x%lx):empty stub!\n", 2707 himl, i, dwFilter); 2487 FIXME("(%p 0x%x 0x%lx):empty stub!\n", himl, i, dwFilter); 2708 2488 2709 2489 return FALSE; … … 2712 2492 2713 2493 /************************************************************************* 2714 * ImageList_SetFlags [COMCTL32. 79]2494 * ImageList_SetFlags [COMCTL32.@] 2715 2495 * 2716 2496 * BUGS … … 2727 2507 2728 2508 /************************************************************************* 2729 * ImageList_SetIconSize [COMCTL32. 80]2509 * ImageList_SetIconSize [COMCTL32.@] 2730 2510 * 2731 2511 * Sets the image size of the bitmap and deletes all images. … … 2776 2556 2777 2557 /************************************************************************* 2778 * ImageList_SetImageCount [COMCTL32. 81]2558 * ImageList_SetImageCount [COMCTL32.@] 2779 2559 * 2780 2560 * Resizes an image list to the specified number of images. … … 2795 2575 HBITMAP hbmNewBitmap; 2796 2576 INT nNewCount, nCopyCount; 2577 2578 TRACE("%p %d\n",himl,iImageCount); 2797 2579 2798 2580 if (!himl) … … 2801 2583 return FALSE; 2802 2584 if (himl->cMaxImage > iImageCount) 2585 { 2586 himl->cCurImage = iImageCount; 2803 2587 return TRUE; 2588 } 2804 2589 2805 2590 nNewCount = iImageCount + himl->cGrow; … … 2823 2608 SetBkColor (hdcBitmap, RGB(255, 255, 255)); 2824 2609 SetTextColor (hdcBitmap, RGB(0, 0, 0)); 2825 PatBlt (hdcBitmap, nCopyCount * himl->cx, 0, 2610 PatBlt (hdcBitmap, nCopyCount * himl->cx, 0, 2826 2611 (nNewCount - nCopyCount) * himl->cx, himl->cy, BLACKNESS); 2827 2612 #endif … … 2848 2633 SetBkColor (hdcBitmap, RGB(255, 255, 255)); 2849 2634 SetTextColor (hdcBitmap, RGB(0, 0, 0)); 2850 PatBlt (hdcBitmap, nCopyCount * himl->cx, 0, 2635 PatBlt (hdcBitmap, nCopyCount * himl->cx, 0, 2851 2636 (nNewCount - nCopyCount) * himl->cx, himl->cy, BLACKNESS); 2852 2637 #endif … … 2863 2648 /* Update max image count and current image count */ 2864 2649 himl->cMaxImage = nNewCount; 2865 if (himl->cCurImage > nCopyCount) 2866 himl->cCurImage = nCopyCount; 2650 himl->cCurImage = iImageCount; 2867 2651 2868 2652 return TRUE; … … 2871 2655 2872 2656 /************************************************************************* 2873 * ImageList_SetOverlayImage [COMCTL32. 82]2657 * ImageList_SetOverlayImage [COMCTL32.@] 2874 2658 * 2875 2659 * Assigns an overlay mask index to an existing image in an image list. … … 2900 2684 2901 2685 2902 /* helper for ImageList_Write - write bitmap to pstm 2686 /* helper for ImageList_Write - write bitmap to pstm 2903 2687 * currently everything is written as 24 bit RGB, except masks 2904 2688 */ 2905 static BOOL 2689 static BOOL 2906 2690 _write_bitmap(HBITMAP hBitmap, LPSTREAM pstm, int cx, int cy) 2907 2691 { … … 2918 2702 xdc = GetDC(0); 2919 2703 GetObjectA(hBitmap, sizeof(BITMAP), (LPVOID)&bm); 2920 2704 2921 2705 /* XXX is this always correct? */ 2922 2706 icount = bm.bmWidth / cx; … … 2960 2744 2961 2745 lpBitsOrg = (LPBYTE)LocalAlloc(LMEM_ZEROINIT, nsizeImage); 2962 if(!GetDIBits(xdc, hBitmap, 0, bm.bmHeight, lpBitsOrg, 2746 if(!GetDIBits(xdc, hBitmap, 0, bm.bmHeight, lpBitsOrg, 2963 2747 (BITMAPINFO *)bmih, DIB_RGB_COLORS)) 2964 2748 goto failed; … … 2967 2751 int obpl = (((bm.bmWidth*bitCount+31) & ~31)>>3); 2968 2752 int nbpl = (((nwidth*bitCount+31) & ~31)>>3); 2969 2753 2970 2754 for(i = 0; i < nheight; i++) { 2971 2755 int ooff = ((nheight-1-i)%cy) * obpl + ((i/cy) * nbpl); … … 2974 2758 } 2975 2759 } 2976 2760 2977 2761 bmih->biWidth = nwidth; 2978 2762 bmih->biHeight = nheight; … … 2999 2783 3000 2784 /************************************************************************* 3001 * ImageList_Write [COMCTL32. 83]2785 * ImageList_Write [COMCTL32.@] 3002 2786 * 3003 2787 * Writes an image list to a stream. … … 3052 2836 return TRUE; 3053 2837 } 3054 -
trunk/src/comctl32/ipaddress.c
r8382 r9370 22 22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 23 * 24 * NOTE 25 * 26 * This code was audited for completeness against the documented features 27 * of Comctl32.dll version 6.0 on Sep. 9, 2002, by Dimitrie O. Paun. 28 * 29 * Unless otherwise noted, we belive this code to be complete, as per 30 * the specification mentioned above. 31 * If you discover missing features, or bugs, please note them below. 32 * 24 33 */ 25 34 … … 29 38 #include <string.h> 30 39 31 #include "ntddk.h"32 40 #include "winbase.h" 33 41 #include "commctrl.h" 42 #include "wine/unicode.h" 34 43 #include "wine/debug.h" 35 #ifdef __WIN32OS2__36 #include "comctl32.h"37 #endif38 44 39 45 WINE_DEFAULT_DEBUG_CHANNEL(ipaddress); … … 68 74 { 69 75 HWND hwnd = infoPtr->Self; 70 76 71 77 TRACE("(command=%x)\n", command); 72 78 73 79 return SendMessageW (GetParent (hwnd), WM_COMMAND, 74 80 MAKEWPARAM (GetWindowLongW (hwnd, GWL_ID), command), (LPARAM)hwnd); … … 80 86 81 87 TRACE("(field=%x, value=%d)\n", field, value); 82 88 83 89 nmip.hdr.hwndFrom = infoPtr->Self; 84 90 nmip.hdr.idFrom = GetWindowLongW (infoPtr->Self, GWL_ID); … … 92 98 93 99 TRACE("<-- %d\n", nmip.iValue); 94 100 95 101 return nmip.iValue; 96 102 } … … 100 106 { 101 107 int i; 102 103 TRACE("(hwnd=% x)\n", hwnd);104 105 for (i = 0; i < 4; i++) 108 109 TRACE("(hwnd=%p)\n", hwnd); 110 111 for (i = 0; i < 4; i++) 106 112 if (infoPtr->Part[i].EditHwnd == hwnd) return i; 107 108 ERR("We subclassed the wrong window! (hwnd=% x)\n", hwnd);113 114 ERR("We subclassed the wrong window! (hwnd=%p)\n", hwnd); 109 115 return -1; 110 116 } … … 118 124 119 125 TRACE("\n"); 120 126 121 127 GetClientRect (infoPtr->Self, &rect); 122 128 DrawEdge (hdc, &rect, EDGE_SUNKEN, BF_RECT | BF_ADJUST); … … 126 132 pt.x = rcPart.right; 127 133 ScreenToClient(infoPtr->Self, &pt); 128 rect.left = pt.x; 134 rect.left = pt.x; 129 135 GetWindowRect (infoPtr->Part[i+1].EditHwnd, &rcPart); 130 136 pt.x = rcPart.left; … … 146 152 147 153 TRACE("\n"); 148 154 149 155 SetWindowLongW (hwnd, GWL_STYLE, 150 156 GetWindowLongW(hwnd, GWL_STYLE) & ~WS_BORDER); 151 157 152 158 infoPtr = (IPADDRESS_INFO *)COMCTL32_Alloc (sizeof(IPADDRESS_INFO)); 153 159 if (!infoPtr) return -1; … … 162 168 163 169 infoPtr->Self = hwnd; 164 170 165 171 for (i = 0; i < 4; i++) { 166 172 IPPART_INFO* part = &infoPtr->Part[i]; 167 173 168 174 part->LowerLimit = 0; 169 175 part->UpperLimit = 255; … … 172 178 part->EditHwnd = 173 179 CreateWindowW (EDIT, NULL, WS_CHILD | WS_VISIBLE | ES_CENTER, 174 edit.left, edit.top, edit.right - edit.left, 175 edit.bottom - edit.top, hwnd, (HMENU) 1, 176 GetWindowLongW(hwnd, GWL_HINSTANCE), NULL);180 edit.left, edit.top, edit.right - edit.left, 181 edit.bottom - edit.top, hwnd, (HMENU) 1, 182 (HINSTANCE)GetWindowLongW(hwnd, GWL_HINSTANCE), NULL); 177 183 SetPropA(part->EditHwnd, IP_SUBCLASS_PROP, hwnd); 178 184 part->OrigProc = (WNDPROC) 179 SetWindowLongW (part->EditHwnd, GWL_WNDPROC, 185 SetWindowLongW (part->EditHwnd, GWL_WNDPROC, 180 186 (LONG)IPADDRESS_SubclassProc); 181 187 } … … 190 196 191 197 TRACE("\n"); 192 198 193 199 for (i = 0; i < 4; i++) { 194 200 IPPART_INFO* part = &infoPtr->Part[i]; … … 207 213 208 214 TRACE("\n"); 209 215 210 216 if (hdc) return IPADDRESS_Draw (infoPtr, hdc); 211 217 212 218 hdc = BeginPaint (infoPtr->Self, &ps); 213 219 IPADDRESS_Draw (infoPtr, hdc); … … 240 246 for (i = 0; i < 4; i++) { 241 247 ip_addr *= 256; 242 if (GetWindowTextW (infoPtr->Part[i].EditHwnd, field, 4)) 243 ip_addr += wcstol(field, 0, 10);248 if (GetWindowTextW (infoPtr->Part[i].EditHwnd, field, 4)) 249 ip_addr += atolW(field); 244 250 else 245 251 invalid++; … … 271 277 TRACE("\n"); 272 278 273 for (i = 0; i < 4; i++) 279 for (i = 0; i < 4; i++) 274 280 SetWindowTextW (infoPtr->Part[i].EditHwnd, nil); 275 281 } … … 287 293 int value = ip_address & 0xff; 288 294 if ( (value >= part->LowerLimit) && (value <= part->UpperLimit) ) { 289 swprintf(buf, fmt, value);295 wsprintfW (buf, fmt, value); 290 296 SetWindowTextW (part->EditHwnd, buf); 291 297 IPADDRESS_Notify (infoPtr, EN_CHANGE); … … 301 307 { 302 308 TRACE("(index=%d)\n", index); 303 309 304 310 if (index > 3) { 305 311 for (index = 0; index < 4; index++) … … 307 313 } 308 314 if (index < 9 || index > 3) index = 0; 309 315 310 316 SetFocus (infoPtr->Part[index].EditHwnd); 311 317 } … … 321 327 322 328 if (currentfield < 0 || currentfield > 3) return FALSE; 323 329 324 330 if (!GetWindowTextW (part->EditHwnd, field, 4)) return FALSE; 325 326 curValue = wcstol(field, 0, 10);331 332 curValue = atoiW(field); 327 333 TRACE(" curValue=%d\n", curValue); 328 334 329 335 newValue = IPADDRESS_IPNotify(infoPtr, currentfield, curValue); 330 336 TRACE(" newValue=%d\n", newValue); … … 332 338 if (newValue < part->LowerLimit) newValue = part->LowerLimit; 333 339 if (newValue > part->UpperLimit) newValue = part->UpperLimit; 334 340 335 341 if (newValue == curValue) return FALSE; 336 337 swprintf(field, fmt, newValue);342 343 wsprintfW (field, fmt, newValue); 338 344 TRACE(" field='%s'\n", debugstr_w(field)); 339 345 return SetWindowTextW (part->EditHwnd, field); … … 347 353 if(cur >= -1 && cur < 4) { 348 354 IPADDRESS_ConstrainField(infoPtr, cur); 349 355 350 356 if(cur < 3) { 351 357 IPPART_INFO *next = &infoPtr->Part[cur + 1]; … … 361 367 return TRUE; 362 368 } 363 369 364 370 } 365 371 return FALSE; … … 376 382 * alpha characters: completely ignored 377 383 * 378 * digits: accepted when field text length < 2 ignored otherwise. 379 * when 3 numbers have been entered into the field the value 380 * of the field is checked, if the field value exceeds the 381 * maximum value and is changed the field remains the current 382 * field, otherwise focus moves to the field to the right 383 * 384 * tab: change focus from the current ipaddress control to the next 385 * control in the tab order 386 * 387 * right arrow: move to the field on the right to the left most 388 * position in that field if no text is selected, 389 * we are in the right most position in the field, 390 * we are not in the right most field 391 * 392 * left arrow: move to the field on the left to the right most 393 * position in that field if no text is selected, 394 * we are in the left most position in the current field 395 * and we are not in the left most field 396 * 397 * backspace: delete the character to the left of the cursor position, 398 * if none are present move to the field on the left if 399 * we are not in the left most field and delete the right 400 * most digit in that field while keeping the cursor 401 * on the right side of the field 384 * digits: accepted when field text length < 2 ignored otherwise. 385 * when 3 numbers have been entered into the field the value 386 * of the field is checked, if the field value exceeds the 387 * maximum value and is changed the field remains the current 388 * field, otherwise focus moves to the field to the right 389 * 390 * tab: change focus from the current ipaddress control to the next 391 * control in the tab order 392 * 393 * right arrow: move to the field on the right to the left most 394 * position in that field if no text is selected, 395 * we are in the right most position in the field, 396 * we are not in the right most field 397 * 398 * left arrow: move to the field on the left to the right most 399 * position in that field if no text is selected, 400 * we are in the left most position in the current field 401 * and we are not in the left most field 402 * 403 * backspace: delete the character to the left of the cursor position, 404 * if none are present move to the field on the left if 405 * we are not in the left most field and delete the right 406 * most digit in that field while keeping the cursor 407 * on the right side of the field 402 408 */ 403 409 LRESULT CALLBACK … … 410 416 IPPART_INFO *part; 411 417 412 TRACE("(hwnd= 0x%xmsg=0x%x wparam=0x%x lparam=0x%lx)\n", hwnd, uMsg, wParam, lParam);418 TRACE("(hwnd=%p msg=0x%x wparam=0x%x lparam=0x%lx)\n", hwnd, uMsg, wParam, lParam); 413 419 414 420 if ( (index = IPADDRESS_GetPartIndex(infoPtr, hwnd)) < 0) return 0; … … 418 424 len = GetWindowTextLengthW (hwnd); 419 425 SendMessageW(hwnd, EM_GETSEL, (WPARAM)&startsel, (LPARAM)&endsel); 420 } 426 } 421 427 switch (uMsg) { 422 case WM_CHAR: 428 case WM_CHAR: 423 429 if(isdigit(c)) { 424 430 if(len == 2 && startsel==endsel && endsel==len) { 425 431 /* process the digit press before we check the field */ 426 432 int return_val = CallWindowProcW (part->OrigProc, hwnd, uMsg, wParam, lParam); 427 433 428 434 /* if the field value was changed stay at the current field */ 429 435 if(!IPADDRESS_ConstrainField(infoPtr, index)) … … 433 439 } else if (len == 3 && startsel==endsel && endsel==len) 434 440 IPADDRESS_GotoNextField (infoPtr, index, POS_SELALL); 435 else if (len < 3) break; 441 else if (len < 3) break; 436 442 } else if(c == '.' || c == ' ') { 437 443 if(len && startsel==endsel && startsel != 0) { 438 IPADDRESS_GotoNextField(infoPtr, index, POS_SELALL); 444 IPADDRESS_GotoNextField(infoPtr, index, POS_SELALL); 439 445 } 440 446 } else if (c == VK_BACK) break; 441 447 return 0; 442 448 443 449 case WM_KEYDOWN: 444 450 switch(c) { … … 459 465 IPPART_INFO *prev = &infoPtr->Part[index-1]; 460 466 WCHAR val[10]; 461 467 462 468 if(GetWindowTextW(prev->EditHwnd, val, 5)) { 463 469 val[lstrlenW(val) - 1] = 0; 464 470 SetWindowTextW(prev->EditHwnd, val); 465 471 } 466 472 467 473 IPADDRESS_GotoNextField(infoPtr, index - 2, POS_RIGHT); 468 474 return 0; 469 475 } 470 476 break; 471 } 477 } 472 478 break; 473 479 case WM_KILLFOCUS: … … 488 494 { 489 495 IPADDRESS_INFO *infoPtr = IPADDRESS_GetInfoPtr (hwnd); 490 491 TRACE("(hwnd= 0x%xmsg=0x%x wparam=0x%x lparam=0x%lx)\n", hwnd, uMsg, wParam, lParam);492 496 497 TRACE("(hwnd=%p msg=0x%x wparam=0x%x lparam=0x%lx)\n", hwnd, uMsg, wParam, lParam); 498 493 499 if (!infoPtr && (uMsg != WM_CREATE)) 494 500 return DefWindowProcW (hwnd, uMsg, wParam, lParam); 495 501 496 502 switch (uMsg) 497 503 { … … 537 543 538 544 default: 539 if ( uMsg >= WM_USER)545 if ((uMsg >= WM_USER) && (uMsg < WM_APP)) 540 546 ERR("unknown msg %04x wp=%08x lp=%08lx\n", uMsg, wParam, lParam); 541 547 return DefWindowProcW (hwnd, uMsg, wParam, lParam); … … 557 563 wndClass.hbrBackground = GetStockObject(WHITE_BRUSH); 558 564 wndClass.lpszClassName = WC_IPADDRESSW; 559 565 560 566 RegisterClassW (&wndClass); 561 567 } -
trunk/src/comctl32/listview.c
r9247 r9370 76 76 #include <heapstring.h> 77 77 #include "ccbase.h" 78 #include "header.h"79 78 80 79 typedef struct … … 10108 10107 RECT rect; 10109 10108 10110 if (H EADER_GetItemRect(infoPtr->hwndHeader,(WPARAM)nSubItem,(LPARAM)&rect))10109 if (Header_GetItemRect(infoPtr->hwndHeader,(WPARAM)nSubItem,(LPARAM)&rect)) 10111 10110 { 10112 10111 lpptPosition->x = rect.left+REPORT_MARGINX; … … 10148 10147 10149 10148 nSubItem = lprc->top; 10150 if ((nSubItem < 0) || (nSubItem >= H EADER_GetItemCount(infoPtr->hwndHeader))) return FALSE;10149 if ((nSubItem < 0) || (nSubItem >= Header_GetItemCount(infoPtr->hwndHeader))) return FALSE; 10151 10150 if (!LISTVIEW_GetSubItemPosition(hwnd, infoPtr,nItem,nSubItem,&ptItem)) return FALSE; 10152 10151 … … 10347 10346 if (checkSubItems && (uView == LVS_REPORT)) 10348 10347 { 10349 INT nColumnCount = H EADER_GetItemCount(infoPtr->hwndHeader);10348 INT nColumnCount = Header_GetItemCount(infoPtr->hwndHeader); 10350 10349 INT xDiff = -infoPtr->lefttop.x*infoPtr->scrollStep.x; 10351 10350 … … 10356 10355 RECT rcColumn; 10357 10356 10358 H EADER_GetItemRect(infoPtr->hwndHeader,(WPARAM)x,(LPARAM)&rcColumn);10357 Header_GetItemRect(infoPtr->hwndHeader,(WPARAM)x,(LPARAM)&rcColumn); 10359 10358 rcItem.left = xDiff+REPORT_MARGINX+rcColumn.left; 10360 10359 rcItem.right = xDiff+rcColumn.right-REPORT_MARGINX; -
trunk/src/comctl32/pager.c
r8382 r9370 45 45 INT nPos; /* scroll position */ 46 46 INT nWidth; /* from child wnd's response to PGN_CALCSIZE */ 47 INT nHeight; /* from child wnd's response to PGN_CALCSIZE */ 47 INT nHeight; /* from child wnd's response to PGN_CALCSIZE */ 48 48 BOOL bForward; /* forward WM_MOUSEMOVE msgs to the contained wnd */ 49 BOOL bCapture; /* we have captured the mouse */ 49 50 INT TLbtnState; /* state of top or left btn */ 50 51 INT BRbtnState; /* state of bottom or right btn */ … … 63 64 #define REPEAT_DELAY 50 64 65 65 /* the horizontal arrows are: 66 /* the horizontal arrows are: 66 67 * 67 68 * 01234 01234 … … 72 73 * 5 ** ** 73 74 * 6 * * 74 * 7 75 * 7 75 76 * 76 77 */ … … 79 80 { 80 81 INT x, y, w, h; 81 HPEN h OldPen;82 82 HPEN hPen, hOldPen; 83 83 84 w = r.right - r.left + 1; 84 85 h = r.bottom - r.top + 1; … … 86 87 return; /* refuse to draw partial arrow */ 87 88 88 hOldPen = SelectObject ( hdc, GetSysColorPen (colorRef)); 89 if (!(hPen = CreatePen( PS_SOLID, 1, GetSysColor( colorRef )))) return; 90 hOldPen = SelectObject ( hdc, hPen ); 89 91 if (left) 90 92 { … … 111 113 112 114 SelectObject( hdc, hOldPen ); 113 } 114 115 /* the vertical arrows are: 115 DeleteObject( hPen ); 116 } 117 118 /* the vertical arrows are: 116 119 * 117 120 * 01234567 01234567 118 * 1****** ** 121 * 1****** ** 119 122 * 2 **** **** 120 123 * 3 ** ****** … … 126 129 { 127 130 INT x, y, w, h; 128 HPEN h OldPen;129 131 HPEN hPen, hOldPen; 132 130 133 w = r.right - r.left + 1; 131 134 h = r.bottom - r.top + 1; … … 133 136 return; /* refuse to draw partial arrow */ 134 137 135 hOldPen = SelectObject ( hdc, GetSysColorPen (colorRef)); 138 if (!(hPen = CreatePen( PS_SOLID, 1, GetSysColor( colorRef )))) return; 139 hOldPen = SelectObject ( hdc, hPen ); 136 140 if (up) 137 141 { … … 158 162 159 163 SelectObject( hdc, hOldPen ); 164 DeleteObject( hPen ); 160 165 } 161 166 … … 171 176 172 177 if ((rc.right - rc.left <= 0) || (rc.bottom - rc.top <= 0)) 173 return; 178 return; 174 179 175 180 hBrush = CreateSolidBrush(clrBk); … … 178 183 FillRect(hdc, &rc, hBrush); 179 184 180 if (btnState == PGF_HOT) 185 if (btnState == PGF_HOT) 181 186 { 182 187 DrawEdge( hdc, &rc, BDR_RAISEDINNER, BF_RECT); … … 186 191 PAGER_DrawVertArrow(hdc, rc, COLOR_WINDOWFRAME, topLeft); 187 192 } 188 else if (btnState == PGF_NORMAL) 193 else if (btnState == PGF_NORMAL) 189 194 { 190 195 DrawEdge (hdc, &rc, BDR_OUTER, BF_FLAT); … … 194 199 PAGER_DrawVertArrow(hdc, rc, COLOR_WINDOWFRAME, topLeft); 195 200 } 196 else if (btnState == PGF_DEPRESSED) 201 else if (btnState == PGF_DEPRESSED) 197 202 { 198 203 DrawEdge( hdc, &rc, BDR_SUNKENOUTER, BF_RECT); … … 202 207 PAGER_DrawVertArrow(hdc, rc, COLOR_WINDOWFRAME, topLeft); 203 208 } 204 else if (btnState == PGF_GRAYED) 209 else if (btnState == PGF_GRAYED) 205 210 { 206 211 DrawEdge (hdc, &rc, BDR_OUTER, BF_FLAT); … … 223 228 } 224 229 230 static void PAGER_CaptureandTrack(PAGER_INFO *infoPtr, HWND hwnd) 231 { 232 TRACKMOUSEEVENT trackinfo; 233 234 TRACE("[%p] SetCapture\n", hwnd); 235 SetCapture(hwnd); 236 infoPtr->bCapture = TRUE; 237 238 trackinfo.cbSize = sizeof(TRACKMOUSEEVENT); 239 trackinfo.dwFlags = TME_QUERY; 240 trackinfo.hwndTrack = hwnd; 241 trackinfo.dwHoverTime = HOVER_DEFAULT; 242 243 /* call _TrackMouseEvent to see if we are currently tracking for this hwnd */ 244 _TrackMouseEvent(&trackinfo); 245 246 /* Make sure tracking is enabled so we receive a WM_MOUSELEAVE message */ 247 if(!(trackinfo.dwFlags & TME_LEAVE)) { 248 trackinfo.dwFlags = TME_LEAVE; /* notify upon leaving */ 249 250 /* call TRACKMOUSEEVENT so we receive a WM_MOUSELEAVE message */ 251 /* and can properly deactivate the hot button */ 252 _TrackMouseEvent(&trackinfo); 253 } 254 } 255 256 225 257 /* << PAGER_GetDropTarget >> */ 226 258 … … 229 261 { 230 262 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); 231 TRACE("[% 04x]\n", hwnd);263 TRACE("[%p]\n", hwnd); 232 264 233 265 infoPtr->bForward = (BOOL)wParam; … … 239 271 PAGER_GetButtonState (HWND hwnd, WPARAM wParam, LPARAM lParam) 240 272 { 241 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); 273 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); 242 274 LRESULT btnState = PGF_INVISIBLE; 243 275 INT btn = (INT)lParam; 244 TRACE("[% 04x]\n", hwnd);276 TRACE("[%p]\n", hwnd); 245 277 246 278 if (btn == PGB_TOPORLEFT) … … 256 288 PAGER_GetPos(HWND hwnd) 257 289 { 258 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); 259 TRACE("[% 04x] returns %d\n", hwnd, infoPtr->nPos);290 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); 291 TRACE("[%p] returns %d\n", hwnd, infoPtr->nPos); 260 292 return (LRESULT)infoPtr->nPos; 261 293 } … … 264 296 PAGER_GetButtonSize(HWND hwnd) 265 297 { 266 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); 267 TRACE("[% 04x] returns %d\n", hwnd, infoPtr->nButtonSize);298 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); 299 TRACE("[%p] returns %d\n", hwnd, infoPtr->nButtonSize); 268 300 return (LRESULT)infoPtr->nButtonSize; 269 301 } … … 272 304 PAGER_GetBorder(HWND hwnd) 273 305 { 274 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); 275 TRACE("[% 04x] returns %d\n", hwnd, infoPtr->nBorder);306 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); 307 TRACE("[%p] returns %d\n", hwnd, infoPtr->nBorder); 276 308 return (LRESULT)infoPtr->nBorder; 277 309 } … … 280 312 PAGER_GetBkColor(HWND hwnd) 281 313 { 282 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); 283 TRACE("[% 04x] returns %06lx\n", hwnd, infoPtr->clrBk);314 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); 315 TRACE("[%p] returns %06lx\n", hwnd, infoPtr->clrBk); 284 316 return (LRESULT)infoPtr->clrBk; 285 317 } 286 318 287 static void 288 PAGER_CalcSize (HWND hwnd, INT* size, BOOL getWidth) 319 static void 320 PAGER_CalcSize (HWND hwnd, INT* size, BOOL getWidth) 289 321 { 290 322 NMPGCALCSIZE nmpgcs; … … 301 333 *size = getWidth ? nmpgcs.iWidth : nmpgcs.iHeight; 302 334 303 TRACE("[% 04x] PGN_CALCSIZE returns %s=%d\n", hwnd,335 TRACE("[%p] PGN_CALCSIZE returns %s=%d\n", hwnd, 304 336 getWidth ? "width" : "height", *size); 305 337 } … … 325 357 infoPtr->nWidth = wndSize; 326 358 327 TRACE("[% 04x] SWP %dx%d at (%d,%d)\n", hwnd,359 TRACE("[%p] SWP %dx%d at (%d,%d)\n", hwnd, 328 360 infoPtr->nWidth, infoPtr->nHeight, 329 361 -nPos, 0); … … 339 371 infoPtr->nHeight = wndSize; 340 372 341 TRACE("[% 04x] SWP %dx%d at (%d,%d)\n", hwnd,373 TRACE("[%p] SWP %dx%d at (%d,%d)\n", hwnd, 342 374 infoPtr->nWidth, infoPtr->nHeight, 343 375 0, -nPos); … … 381 413 } 382 414 383 TRACE("[% 04x] returns %d\n", hwnd, scrollRange);415 TRACE("[%p] returns %d\n", hwnd, scrollRange); 384 416 return scrollRange; 385 417 } 386 418 387 static void 419 static void 388 420 PAGER_GrayAndRestoreBtns(PAGER_INFO* infoPtr, INT scrollRange, 389 421 BOOL* needsResize, BOOL* needsRepaint) … … 422 454 423 455 424 static void 456 static void 425 457 PAGER_NormalizeBtns(PAGER_INFO* infoPtr, BOOL* needsRepaint) 426 458 { … … 438 470 } 439 471 440 static void 472 static void 441 473 PAGER_HideGrayBtns(PAGER_INFO* infoPtr, BOOL* needsResize) 442 474 { … … 470 502 471 503 if (resizeClient) /* initiate NCCalcSize to resize client wnd */ { 472 SetWindowPos(hwnd, 0,0,0,0,0, 504 SetWindowPos(hwnd, 0,0,0,0,0, 473 505 SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | 474 506 SWP_NOZORDER | SWP_NOACTIVATE); … … 476 508 477 509 if (repaintBtns) 478 SendMessageA(hwnd, WM_NCPAINT, 0, 0); 479 } 480 481 static LRESULT 510 SendMessageA(hwnd, WM_NCPAINT, 0, 0); 511 } 512 513 static LRESULT 482 514 PAGER_SetPos(HWND hwnd, INT newPos, BOOL fromBtnPress) 483 515 { … … 493 525 infoPtr->nPos = newPos; 494 526 495 TRACE("[% 04x] pos=%d\n", hwnd, infoPtr->nPos);527 TRACE("[%p] pos=%d, oldpos=%d\n", hwnd, infoPtr->nPos, oldPos); 496 528 497 529 if (infoPtr->nPos != oldPos) … … 537 569 } 538 570 539 static INT 571 static INT 540 572 PAGER_SetFixedWidth(HWND hwnd, PAGER_INFO* infoPtr) 541 573 { … … 562 594 h = wndRect.bottom - wndRect.top + infoPtr->nButtonSize; 563 595 564 TRACE("[% 04x] infoPtr->nWidth set to %d\n",596 TRACE("[%p] infoPtr->nWidth set to %d\n", 565 597 hwnd, infoPtr->nWidth); 566 598 … … 568 600 } 569 601 570 static INT 602 static INT 571 603 PAGER_SetFixedHeight(HWND hwnd, PAGER_INFO* infoPtr) 572 604 { … … 593 625 w = wndRect.right - wndRect.left + infoPtr->nButtonSize; 594 626 595 TRACE("[% 04x] infoPtr->nHeight set to %d\n",627 TRACE("[%p] infoPtr->nHeight set to %d\n", 596 628 hwnd, infoPtr->nHeight); 597 629 … … 616 648 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); 617 649 618 TRACE("[% 04x]\n", hwnd);650 TRACE("[%p]\n", hwnd); 619 651 620 652 if (infoPtr->hwndChild) … … 627 659 PAGER_SetPos(hwnd, 0, FALSE); 628 660 } 629 else 661 else 630 662 { 631 663 PAGER_UpdateBtns(hwnd, infoPtr, scrollRange, TRUE); … … 645 677 646 678 infoPtr->clrBk = (COLORREF)lParam; 647 TRACE("[% 04x] %06lx\n", hwnd, infoPtr->clrBk);679 TRACE("[%p] %06lx\n", hwnd, infoPtr->clrBk); 648 680 649 681 /* the native control seems to do things this way */ 650 SetWindowPos(hwnd, 0,0,0,0,0, 682 SetWindowPos(hwnd, 0,0,0,0,0, 651 683 SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | 652 684 SWP_NOZORDER | SWP_NOACTIVATE); … … 665 697 666 698 infoPtr->nBorder = (INT)lParam; 667 TRACE("[% 04x] %d\n", hwnd, infoPtr->nBorder);699 TRACE("[%p] %d\n", hwnd, infoPtr->nBorder); 668 700 669 701 PAGER_RecalcSize(hwnd); … … 680 712 681 713 infoPtr->nButtonSize = (INT)lParam; 682 TRACE("[% 04x] %d\n", hwnd, infoPtr->nButtonSize);714 TRACE("[%p] %d\n", hwnd, infoPtr->nButtonSize); 683 715 684 716 PAGER_RecalcSize(hwnd); … … 698 730 if (infoPtr->hwndChild) 699 731 { 700 TRACE("[% 04x] hwndChild=%04x\n", hwnd, infoPtr->hwndChild);732 TRACE("[%p] hwndChild=%p\n", hwnd, infoPtr->hwndChild); 701 733 702 734 if (PAGER_IsHorizontal(hwnd)) { 703 735 hw = PAGER_SetFixedHeight(hwnd, infoPtr); 704 736 /* adjust non-scrollable dimension to fit the child */ 705 SetWindowPos(hwnd, 0, 0,0, hw, infoPtr->nHeight, 737 SetWindowPos(hwnd, 0, 0,0, hw, infoPtr->nHeight, 706 738 SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER | 707 739 SWP_NOSIZE | SWP_NOACTIVATE); … … 710 742 hw = PAGER_SetFixedWidth(hwnd, infoPtr); 711 743 /* adjust non-scrollable dimension to fit the child */ 712 SetWindowPos(hwnd, 0, 0,0, infoPtr->nWidth, hw, 744 SetWindowPos(hwnd, 0, 0,0, infoPtr->nWidth, hw, 713 745 SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER | 714 746 SWP_NOSIZE | SWP_NOACTIVATE); … … 741 773 nmpgScroll.hdr.code = PGN_SCROLL; 742 774 743 GetWindowRect(hwnd, &rcWnd); 744 GetClientRect(hwnd, &nmpgScroll.rcParent); 775 GetWindowRect(hwnd, &rcWnd); 776 GetClientRect(hwnd, &nmpgScroll.rcParent); 745 777 nmpgScroll.iXpos = nmpgScroll.iYpos = 0; 746 778 nmpgScroll.iDir = dir; … … 757 789 } 758 790 nmpgScroll.iScroll -= 2*infoPtr->nButtonSize; 759 760 SendMessageA ( hwnd, WM_NOTIFY,791 792 SendMessageA (GetParent(hwnd), WM_NOTIFY, 761 793 (WPARAM)nmpgScroll.hdr.idFrom, (LPARAM)&nmpgScroll); 762 763 TRACE("[% 04x] PGN_SCROLL returns iScroll=%d\n", hwnd, nmpgScroll.iScroll);794 795 TRACE("[%p] PGN_SCROLL returns iScroll=%d\n", hwnd, nmpgScroll.iScroll); 764 796 765 797 if (nmpgScroll.iScroll > 0) … … 783 815 784 816 /* initiate NCCalcSize to resize client wnd and get size */ 785 SetWindowPos(hwnd, 0, 0,0,0,0, 817 SetWindowPos(hwnd, 0, 0,0,0,0, 786 818 SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | 787 819 SWP_NOZORDER | SWP_NOACTIVATE); 788 820 789 SetWindowPos(infoPtr->hwndChild, 0, 790 0,0,infoPtr->nWidth,infoPtr->nHeight, 821 SetWindowPos(infoPtr->hwndChild, 0, 822 0,0,infoPtr->nWidth,infoPtr->nHeight, 791 823 0); 792 824 … … 814 846 infoPtr->nHeight = 0; 815 847 infoPtr->bForward = FALSE; 848 infoPtr->bCapture = FALSE; 816 849 infoPtr->TLbtnState = PGF_INVISIBLE; 817 850 infoPtr->BRbtnState = PGF_INVISIBLE; 818 851 infoPtr->direction = -1; 819 852 820 if (dwStyle & PGS_AUTOSCROLL)821 FIXME("[%04x] Autoscroll style is not implemented yet.\n", hwnd);822 853 if (dwStyle & PGS_DRAGNDROP) 823 FIXME("[% 04x] Drag and Drop style is not implemented yet.\n", hwnd);854 FIXME("[%p] Drag and Drop style is not implemented yet.\n", hwnd); 824 855 /* 825 856 * If neither horizontal nor vertical style specified, default to vertical. … … 852 883 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); 853 884 LPRECT lpRect = (LPRECT)lParam; 854 RECT rcChildw, rcmyw, wnrc, l brc, rbrc;885 RECT rcChildw, rcmyw, wnrc, ltrc, rbrc; 855 886 POINT cursor; 856 887 BOOL resizeClient = FALSE; … … 860 891 /* 861 892 * lParam points to a RECT struct. On entry, the struct 862 * contains the proposed wnd rectangle for the window. 893 * contains the proposed wnd rectangle for the window. 863 894 * On exit, the struct should contain the screen 864 895 * coordinates of the corresponding window's client area. 865 896 */ 866 897 867 898 DefWindowProcA (hwnd, WM_NCCALCSIZE, wParam, lParam); 868 899 … … 882 913 scrollRange = infoPtr->nWidth - (rcmyw.right - rcmyw.left); 883 914 884 TRACE("nPos=%d, scrollrange=%d, nWidth=%d, myw=(%d,%d)-(%d,%d)\n", 885 infoPtr->nPos, scrollRange, infoPtr->nWidth, 886 rcmyw.left, rcmyw.top, rcmyw.right, rcmyw.bottom); 915 TRACE("nPos=%d, scrollrange=%d, nHeigth=%d, myw=(%d,%d)-(%d,%d), cursor=(%ld,%ld)\n", 916 infoPtr->nPos, scrollRange, infoPtr->nHeight, 917 rcmyw.left, rcmyw.top, 918 rcmyw.right, rcmyw.bottom, 919 cursor.x, cursor.y); 887 920 PAGER_GrayAndRestoreBtns(infoPtr, scrollRange, &resizeClient, &repaintBtns); 888 921 PAGER_HideGrayBtns(infoPtr, &resizeClient); … … 890 923 if (PtInRect (&rcmyw, cursor)) { 891 924 GetWindowRect (hwnd, &wnrc); 892 l brc = wnrc;893 l brc.right = lbrc.left + infoPtr->nButtonSize;925 ltrc = wnrc; 926 ltrc.right = ltrc.left + infoPtr->nButtonSize; 894 927 rbrc = wnrc; 895 928 rbrc.left = rbrc.right - infoPtr->nButtonSize; 896 TRACE("horz l brect=(%d,%d)-(%d,%d), rb rect=(%d,%d)-(%d,%d)\n",897 l brc.left, lbrc.top, lbrc.right, lbrc.bottom,929 TRACE("horz lt rect=(%d,%d)-(%d,%d), rb rect=(%d,%d)-(%d,%d)\n", 930 ltrc.left, ltrc.top, ltrc.right, ltrc.bottom, 898 931 rbrc.left, rbrc.top, rbrc.right, rbrc.bottom); 899 if (PtInRect (&l brc, cursor) && infoPtr->TLbtnState)932 if (PtInRect (<rc, cursor) && infoPtr->TLbtnState) 900 933 RedrawWindow (hwnd, 0, 0, RDW_INVALIDATE | RDW_ERASE); 901 934 if (PtInRect (&rbrc, cursor) && infoPtr->BRbtnState) … … 909 942 else 910 943 { 911 /* native does: (from trace of IE4 opening "Favorites" frame) 944 /* native does: (from trace of IE4 opening "Favorites" frame) 912 945 * DefWindowProc 913 946 * WM_NOITFY PGN_CALCSIZE w/ dwFlag=2 … … 929 962 scrollRange = infoPtr->nHeight - (rcmyw.bottom - rcmyw.top); 930 963 931 TRACE("nPos=%d, scrollrange=%d, nHeigth=%d, myw=(%d,%d)-(%d,%d) \n",964 TRACE("nPos=%d, scrollrange=%d, nHeigth=%d, myw=(%d,%d)-(%d,%d), cursor=(%ld,%ld)\n", 932 965 infoPtr->nPos, scrollRange, infoPtr->nHeight, 933 966 rcmyw.left, rcmyw.top, 934 rcmyw.right, rcmyw.bottom); 967 rcmyw.right, rcmyw.bottom, 968 cursor.x, cursor.y); 935 969 PAGER_GrayAndRestoreBtns(infoPtr, scrollRange, &resizeClient, &repaintBtns); 936 970 PAGER_HideGrayBtns(infoPtr, &resizeClient); … … 949 983 950 984 GetWindowRect (hwnd, &wnrc); 951 l brc = wnrc;952 l brc.right = lbrc.left + infoPtr->nButtonSize;985 ltrc = wnrc; 986 ltrc.right = ltrc.left + infoPtr->nButtonSize; 953 987 rbrc = wnrc; 954 988 rbrc.left = rbrc.right - infoPtr->nButtonSize; 955 TRACE("vert l brect=(%d,%d)-(%d,%d), rb rect=(%d,%d)-(%d,%d)\n",956 l brc.left, lbrc.top, lbrc.right, lbrc.bottom,989 TRACE("vert lt rect=(%d,%d)-(%d,%d), rb rect=(%d,%d)-(%d,%d)\n", 990 ltrc.left, ltrc.top, ltrc.right, ltrc.bottom, 957 991 rbrc.left, rbrc.top, rbrc.right, rbrc.bottom); 958 if (PtInRect (&l brc, cursor) && infoPtr->TLbtnState)992 if (PtInRect (<rc, cursor) && infoPtr->TLbtnState) 959 993 RedrawWindow (hwnd, 0, 0, RDW_INVALIDATE | RDW_ERASE); 960 994 if (PtInRect (&rbrc, cursor) && infoPtr->BRbtnState) … … 970 1004 } 971 1005 972 TRACE("[% 04x] client rect set to %dx%d at (%d,%d) BtnState[%d,%d]\n",1006 TRACE("[%p] client rect set to %dx%d at (%d,%d) BtnState[%d,%d]\n", 973 1007 hwnd, lpRect->right-lpRect->left, lpRect->bottom-lpRect->top, 974 1008 lpRect->left, lpRect->top, … … 1013 1047 bHorizontal, TRUE, infoPtr->TLbtnState); 1014 1048 PAGER_DrawButton(hdc, infoPtr->clrBk, rcBottomRight, 1015 bHorizontal, FALSE, infoPtr->BRbtnState); 1049 bHorizontal, FALSE, infoPtr->BRbtnState); 1016 1050 1017 1051 ReleaseDC( hwnd, hdc ); … … 1019 1053 } 1020 1054 1021 static INT 1055 static INT 1022 1056 PAGER_HitTest (HWND hwnd, LPPOINT pt) 1023 1057 { … … 1030 1064 if (PtInRect(&clientRect, *pt)) 1031 1065 { 1032 /* TRACE("HTCLIENT\n"); */1066 TRACE("HTCLIENT\n"); 1033 1067 return HTCLIENT; 1034 1068 } … … 1040 1074 if (pt->x < clientRect.left) 1041 1075 { 1042 /* TRACE("HTLEFT\n"); */1076 TRACE("HTLEFT\n"); 1043 1077 return HTLEFT; 1044 1078 } … … 1048 1082 if (pt->y < clientRect.top) 1049 1083 { 1050 /* TRACE("HTTOP\n"); */1084 TRACE("HTTOP\n"); 1051 1085 return HTTOP; 1052 1086 } … … 1060 1094 if (pt->x > clientRect.right) 1061 1095 { 1062 /* TRACE("HTRIGHT\n"); */1096 TRACE("HTRIGHT\n"); 1063 1097 return HTRIGHT; 1064 1098 } … … 1068 1102 if (pt->y > clientRect.bottom) 1069 1103 { 1070 /* TRACE("HTBOTTOM\n"); */1104 TRACE("HTBOTTOM\n"); 1071 1105 return HTBOTTOM; 1072 1106 } … … 1074 1108 } 1075 1109 1076 /* TRACE("HTNOWHERE\n"); */1110 TRACE("HTNOWHERE\n"); 1077 1111 return HTNOWHERE; 1078 1112 } … … 1081 1115 PAGER_NCHitTest (HWND hwnd, WPARAM wParam, LPARAM lParam) 1082 1116 { 1083 POINT pt = { SLOWORD(lParam), SHIWORD(lParam) }; 1117 POINT pt; 1118 1119 pt.x = SLOWORD(lParam); 1120 pt.y = SHIWORD(lParam); 1121 1084 1122 ScreenToClient (hwnd, &pt); 1085 1123 return PAGER_HitTest(hwnd, &pt); … … 1110 1148 if (notCaptured) 1111 1149 { 1112 TRACKMOUSEEVENT trackinfo; 1113 1114 TRACE("[%04x] SetCapture\n", hwnd); 1115 SetCapture(hwnd); 1116 1117 trackinfo.cbSize = sizeof(TRACKMOUSEEVENT); 1118 trackinfo.dwFlags = TME_QUERY; 1119 trackinfo.hwndTrack = hwnd; 1120 trackinfo.dwHoverTime = HOVER_DEFAULT; 1121 1122 /* call _TrackMouseEvent to see if we are currently tracking for this hwnd */ 1123 _TrackMouseEvent(&trackinfo); 1124 1125 /* Make sure tracking is enabled so we receive a WM_MOUSELEAVE message */ 1126 if(!(trackinfo.dwFlags & TME_LEAVE)) { 1127 trackinfo.dwFlags = TME_LEAVE; /* notify upon leaving */ 1128 1129 /* call TRACKMOUSEEVENT so we receive a WM_MOUSELEAVE message */ 1130 /* and can properly deactivate the hot button */ 1131 _TrackMouseEvent(&trackinfo); 1132 } 1133 1134 SendMessageA(hwnd, WM_NCPAINT, 0, 0); 1150 PAGER_CaptureandTrack(infoPtr, hwnd); 1151 1152 SendMessageA(hwnd, WM_NCPAINT, 0, 0); 1135 1153 } 1136 1154 … … 1146 1164 KillTimer (hwnd, TIMERID2); 1147 1165 1148 TRACE("[% 04x] ReleaseCapture\n", hwnd);1166 TRACE("[%p] ReleaseCapture\n", hwnd); 1149 1167 ReleaseCapture(); 1168 infoPtr->bCapture = FALSE; 1150 1169 1151 1170 /* Notify parent of released mouse capture */ … … 1167 1186 1168 1187 static LRESULT 1188 PAGER_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam) 1189 { 1190 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); 1191 POINT clpt, pt; 1192 RECT wnrect, TLbtnrect, BRbtnrect, *btnrect = NULL; 1193 DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); 1194 BOOL topLeft = FALSE; 1195 INT btnstate = 0; 1196 INT hit; 1197 HDC hdc; 1198 1199 pt.x = SLOWORD(lParam); 1200 pt.y = SHIWORD(lParam); 1201 1202 TRACE("[%p] to (%ld,%ld)\n", hwnd, pt.x, pt.y); 1203 ClientToScreen(hwnd, &pt); 1204 GetWindowRect(hwnd, &wnrect); 1205 if (PtInRect(&wnrect, pt)) { 1206 TLbtnrect = wnrect; 1207 BRbtnrect = wnrect; 1208 if (dwStyle & PGS_HORZ) { 1209 TLbtnrect.right = TLbtnrect.left + infoPtr->nButtonSize; 1210 BRbtnrect.left = BRbtnrect.right - infoPtr->nButtonSize; 1211 } 1212 else { 1213 TLbtnrect.bottom = TLbtnrect.top + infoPtr->nButtonSize; 1214 BRbtnrect.top = BRbtnrect.bottom - infoPtr->nButtonSize; 1215 } 1216 1217 clpt = pt; 1218 MapWindowPoints(0, hwnd, &clpt, 1); 1219 hit = PAGER_HitTest(hwnd, &clpt); 1220 if (hit == HTLEFT || hit == HTTOP) { 1221 topLeft = TRUE; 1222 btnrect = &TLbtnrect; 1223 infoPtr->TLbtnState = PGF_DEPRESSED; 1224 btnstate = infoPtr->TLbtnState; 1225 } 1226 else if (hit == HTRIGHT || hit == HTBOTTOM) { 1227 topLeft = FALSE; 1228 btnrect = &BRbtnrect; 1229 infoPtr->BRbtnState = PGF_DEPRESSED; 1230 btnstate = infoPtr->BRbtnState; 1231 } 1232 1233 /* If in one of the buttons the capture and draw buttons */ 1234 if (btnrect) { 1235 TRACE("[%p] draw btn (%d,%d)-(%d,%d), Capture %s, style %08lx\n", 1236 hwnd, btnrect->left, btnrect->top, 1237 btnrect->right, btnrect->bottom, 1238 (infoPtr->bCapture) ? "TRUE" : "FALSE", 1239 dwStyle); 1240 if (!infoPtr->bCapture) 1241 PAGER_CaptureandTrack(infoPtr, hwnd); 1242 if (dwStyle & PGS_AUTOSCROLL) 1243 SetTimer(hwnd, TIMERID1, 0x3e, 0); 1244 MapWindowPoints(0, hwnd, (LPPOINT)btnrect, 2); 1245 hdc = GetWindowDC(hwnd); 1246 /* OffsetRect(wnrect, 0 | 1, 0 | 1) */ 1247 PAGER_DrawButton(hdc, infoPtr->clrBk, *btnrect, 1248 PAGER_IsHorizontal(hwnd), topLeft, btnstate); 1249 ReleaseDC(hwnd, hdc); 1250 return DefWindowProcA (hwnd, WM_MOUSEMOVE, wParam, lParam); 1251 } 1252 } 1253 1254 /* If we think we are captured, then do release */ 1255 if (infoPtr->bCapture) { 1256 infoPtr->bCapture = FALSE; 1257 1258 if (GetCapture() == hwnd) { 1259 ReleaseCapture(); 1260 /* Notify parent of released mouse capture */ 1261 { 1262 NMHDR nmhdr; 1263 ZeroMemory (&nmhdr, sizeof (NMHDR)); 1264 nmhdr.hwndFrom = hwnd; 1265 nmhdr.idFrom = GetWindowLongA (hwnd, GWL_ID); 1266 nmhdr.code = NM_RELEASEDCAPTURE; 1267 SendMessageA (GetParent(hwnd), WM_NOTIFY, 1268 (WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr); 1269 } 1270 } 1271 if (IsWindow(hwnd)) 1272 KillTimer(hwnd, TIMERID1); 1273 } 1274 return DefWindowProcA (hwnd, WM_MOUSEMOVE, wParam, lParam); 1275 } 1276 1277 static LRESULT 1169 1278 PAGER_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam) 1170 1279 { 1171 1280 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); 1172 1281 BOOL repaintBtns = FALSE; 1173 POINT pt = { SLOWORD(lParam), SHIWORD(lParam) };1282 POINT pt; 1174 1283 INT hit; 1175 1284 1176 TRACE("[%04x]\n", hwnd); 1177 1285 pt.x = SLOWORD(lParam); 1286 pt.y = SHIWORD(lParam); 1287 1288 TRACE("[%p] at (%d,%d)\n", hwnd, SLOWORD(lParam), SHIWORD(lParam)); 1289 1178 1290 hit = PAGER_HitTest(hwnd, &pt); 1179 1291 … … 1183 1295 repaintBtns = infoPtr->TLbtnState != PGF_DEPRESSED; 1184 1296 infoPtr->TLbtnState = PGF_DEPRESSED; 1185 SetTimer(hwnd, TIMERID1, INITIAL_DELAY, 0); 1297 SetTimer(hwnd, TIMERID1, INITIAL_DELAY, 0); 1186 1298 } 1187 1299 else if (hit == HTRIGHT || hit == HTBOTTOM) … … 1189 1301 repaintBtns = infoPtr->BRbtnState != PGF_DEPRESSED; 1190 1302 infoPtr->BRbtnState = PGF_DEPRESSED; 1191 SetTimer(hwnd, TIMERID1, INITIAL_DELAY, 0); 1303 SetTimer(hwnd, TIMERID1, INITIAL_DELAY, 0); 1192 1304 } 1193 1305 1194 1306 if (repaintBtns) 1195 SendMessageA(hwnd, WM_NCPAINT, 0, 0); 1307 SendMessageA(hwnd, WM_NCPAINT, 0, 0); 1196 1308 1197 1309 switch(hit) 1198 1310 { 1199 1311 case HTLEFT: 1200 TRACE("[% 04x] PGF_SCROLLLEFT\n", hwnd);1312 TRACE("[%p] PGF_SCROLLLEFT\n", hwnd); 1201 1313 PAGER_Scroll(hwnd, PGF_SCROLLLEFT); 1202 1314 break; 1203 1315 case HTTOP: 1204 TRACE("[% 04x] PGF_SCROLLUP\n", hwnd);1316 TRACE("[%p] PGF_SCROLLUP\n", hwnd); 1205 1317 PAGER_Scroll(hwnd, PGF_SCROLLUP); 1206 1318 break; 1207 1319 case HTRIGHT: 1208 TRACE("[% 04x] PGF_SCROLLRIGHT\n", hwnd);1320 TRACE("[%p] PGF_SCROLLRIGHT\n", hwnd); 1209 1321 PAGER_Scroll(hwnd, PGF_SCROLLRIGHT); 1210 1322 break; 1211 1323 case HTBOTTOM: 1212 TRACE("[% 04x] PGF_SCROLLDOWN\n", hwnd);1324 TRACE("[%p] PGF_SCROLLDOWN\n", hwnd); 1213 1325 PAGER_Scroll(hwnd, PGF_SCROLLDOWN); 1214 1326 break; … … 1224 1336 { 1225 1337 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); 1226 TRACE("[% 04x]\n", hwnd);1338 TRACE("[%p]\n", hwnd); 1227 1339 1228 1340 KillTimer (hwnd, TIMERID1); … … 1232 1344 PAGER_UpdateBtns(hwnd, infoPtr, -1, FALSE); 1233 1345 1346 return 0; 1347 } 1348 1349 static LRESULT 1350 PAGER_NCLButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam) 1351 { 1352 POINT pt; 1353 1354 pt.x = SLOWORD(lParam); 1355 pt.y = SHIWORD(lParam); 1356 1357 TRACE("[%p] at (%d,%d)\n", hwnd, SLOWORD(lParam), SHIWORD(lParam)); 1358 MapWindowPoints(0, hwnd, &pt, 1); 1359 lParam = MAKELONG(pt.x, pt.y); 1360 return PAGER_LButtonDown (hwnd, wParam, lParam); 1361 } 1362 1363 static LRESULT 1364 PAGER_Timer (HWND hwnd, WPARAM wParam) 1365 { 1366 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); 1367 DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); 1368 INT dir; 1369 1370 /* if initial timer, kill it and start the repeat timer */ 1371 if (wParam == TIMERID1) { 1372 if (PAGER_IsHorizontal(hwnd)) { 1373 dir = (infoPtr->TLbtnState & PGF_DEPRESSED) ? 1374 PGF_SCROLLLEFT : PGF_SCROLLRIGHT; 1375 } 1376 else { 1377 dir = (infoPtr->TLbtnState & PGF_DEPRESSED) ? 1378 PGF_SCROLLUP : PGF_SCROLLDOWN; 1379 } 1380 TRACE("[%p] TIMERID1: style=%08lx, dir=%d\n", hwnd, dwStyle, dir); 1381 KillTimer(hwnd, TIMERID1); 1382 SetTimer(hwnd, TIMERID1, REPEAT_DELAY, 0); 1383 if (dwStyle & PGS_AUTOSCROLL) { 1384 PAGER_Scroll(hwnd, dir); 1385 SetWindowPos(hwnd, 0,0,0,0,0, 1386 SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | 1387 SWP_NOZORDER | SWP_NOACTIVATE); 1388 } 1389 return 0; 1390 1391 } 1392 1393 TRACE("[%p] TIMERID2: dir=%d\n", hwnd, infoPtr->direction); 1394 KillTimer(hwnd, TIMERID2); 1395 if (infoPtr->direction > 0) { 1396 PAGER_Scroll(hwnd, infoPtr->direction); 1397 SetTimer(hwnd, TIMERID2, REPEAT_DELAY, 0); 1398 } 1234 1399 return 0; 1235 1400 } … … 1288 1453 1289 1454 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); 1290 TRACE("[% 04x] %dx%d\n", hwnd, LOWORD(lParam),HIWORD(lParam));1455 TRACE("[%p] %dx%d\n", hwnd, SLOWORD(lParam), SHIWORD(lParam)); 1291 1456 1292 1457 if (PAGER_IsHorizontal(hwnd)) 1293 infoPtr->nHeight = HIWORD(lParam);1458 infoPtr->nHeight = SHIWORD(lParam); 1294 1459 else 1295 infoPtr->nWidth = LOWORD(lParam);1460 infoPtr->nWidth = SLOWORD(lParam); 1296 1461 1297 1462 return PAGER_RecalcSize(hwnd); … … 1334 1499 case PGM_RECALCSIZE: 1335 1500 return PAGER_RecalcSize(hwnd); 1336 1501 1337 1502 case PGM_SETBKCOLOR: 1338 1503 return PAGER_SetBkColor (hwnd, wParam, lParam); … … 1382 1547 if (infoPtr->bForward && infoPtr->hwndChild) 1383 1548 PostMessageA(infoPtr->hwndChild, WM_MOUSEMOVE, wParam, lParam); 1384 return TRUE;1549 return PAGER_MouseMove (hwnd, wParam, lParam); 1385 1550 1386 1551 case WM_MOUSELEAVE: 1387 return PAGER_MouseLeave (hwnd, wParam, lParam); 1552 return PAGER_MouseLeave (hwnd, wParam, lParam); 1553 1554 case WM_NCLBUTTONDOWN: 1555 return PAGER_NCLButtonDown (hwnd, wParam, lParam); 1388 1556 1389 1557 case WM_LBUTTONDOWN: 1390 1558 return PAGER_LButtonDown (hwnd, wParam, lParam); 1391 1559 1560 case WM_NCLBUTTONUP: 1392 1561 case WM_LBUTTONUP: 1393 1562 return PAGER_LButtonUp (hwnd, wParam, lParam); … … 1397 1566 /* 1398 1567 case WM_PAINT: 1399 return PAGER_Paint (hwnd, wParam); 1568 return PAGER_Paint (hwnd, wParam); 1400 1569 */ 1401 1570 case WM_TIMER: 1402 /* if initial timer, kill it and start the repeat timer */ 1403 if (wParam == TIMERID1) 1404 { 1405 KillTimer(hwnd, TIMERID1); 1406 SetTimer(hwnd, TIMERID2, REPEAT_DELAY, 0); 1407 } 1408 1409 KillTimer(hwnd, TIMERID2); 1410 if (infoPtr->direction > 0) 1411 { 1412 PAGER_Scroll(hwnd, infoPtr->direction); 1413 SetTimer(hwnd, TIMERID2, REPEAT_DELAY, 0); 1414 } 1415 break; 1571 return PAGER_Timer (hwnd, wParam); 1416 1572 1417 1573 case WM_NOTIFY: … … 1440 1596 wndClass.hbrBackground = 0; 1441 1597 wndClass.lpszClassName = WC_PAGESCROLLERA; 1442 1598 1443 1599 RegisterClassA (&wndClass); 1444 1600 } … … 1450 1606 UnregisterClassA (WC_PAGESCROLLERA, (HINSTANCE)NULL); 1451 1607 } 1452 -
trunk/src/comctl32/progress.c
r8382 r9370 1 /* 1 /* 2 2 * Progress control 3 3 * … … 18 18 * License along with this library; if not, write to the Free Software 19 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * 21 * NOTE 22 * 23 * This code was audited for completeness against the documented features 24 * of Comctl32.dll version 6.0 on Sep. 9, 2002, by Dimitrie O. Paun. 25 * 26 * Unless otherwise noted, we belive this code to be complete, as per 27 * the specification mentioned above. 28 * If you discover missing features, or bugs, please note them below. 29 * 30 * TODO 31 * --support PBS_MARQUE 32 * 20 33 */ 21 34 … … 43 56 #define LED_GAP 2 44 57 45 #define UNKNOWN_PARAM(msg, wParam, lParam) WARN( \ 46 "Unknown parameter(s) for message " #msg \ 47 "(%04x): wp=%04x lp=%08lx\n", msg, wParam, lParam); 48 49 /*********************************************************************** 50 * PROGRESS_EraseBackground 51 */ 52 static void PROGRESS_EraseBackground(PROGRESS_INFO *infoPtr, WPARAM wParam) 53 { 58 /*********************************************************************** 59 * PROGRESS_Invalidate 60 * 61 * Invalide the range between old and new pos. 62 */ 63 static void PROGRESS_Invalidate( PROGRESS_INFO *infoPtr, INT old, INT new ) 64 { 65 LONG style = GetWindowLongW (infoPtr->Self, GWL_STYLE); 54 66 RECT rect; 55 HBRUSH hbrBk; 56 HDC hdc = wParam ? (HDC)wParam : GetDC(infoPtr->Self); 57 58 /* get the required background brush */ 59 if(infoPtr->ColorBk == CLR_DEFAULT) 60 hbrBk = GetSysColorBrush(COLOR_3DFACE); 67 int oldPos, newPos, ledWidth; 68 69 GetClientRect (infoPtr->Self, &rect); 70 InflateRect(&rect, -1, -1); 71 72 if (style & PBS_VERTICAL) 73 { 74 oldPos = rect.bottom - MulDiv (old - infoPtr->MinVal, rect.bottom - rect.top, 75 infoPtr->MaxVal - infoPtr->MinVal); 76 newPos = rect.bottom - MulDiv (new - infoPtr->MinVal, rect.bottom - rect.top, 77 infoPtr->MaxVal - infoPtr->MinVal); 78 ledWidth = MulDiv (rect.right - rect.left, 2, 3); 79 rect.top = min( oldPos, newPos ); 80 rect.bottom = max( oldPos, newPos ); 81 if (!(style & PBS_SMOOTH)) rect.top -= ledWidth; 82 InvalidateRect( infoPtr->Self, &rect, oldPos < newPos ); 83 } 61 84 else 62 hbrBk = CreateSolidBrush(infoPtr->ColorBk); 63 64 /* get client rectangle */ 65 GetClientRect(infoPtr->Self, &rect); 66 67 /* draw the background */ 68 FillRect(hdc, &rect, hbrBk); 69 70 /* delete background brush */ 71 if(infoPtr->ColorBk != CLR_DEFAULT) 72 DeleteObject (hbrBk); 73 74 if(!wParam) ReleaseDC(infoPtr->Self, hdc); 75 } 85 { 86 oldPos = rect.left + MulDiv (old - infoPtr->MinVal, rect.right - rect.left, 87 infoPtr->MaxVal - infoPtr->MinVal); 88 newPos = rect.left + MulDiv (new - infoPtr->MinVal, rect.right - rect.left, 89 infoPtr->MaxVal - infoPtr->MinVal); 90 ledWidth = MulDiv (rect.bottom - rect.top, 2, 3); 91 rect.left = min( oldPos, newPos ); 92 rect.right = max( oldPos, newPos ); 93 if (!(style & PBS_SMOOTH)) rect.right += ledWidth; 94 InvalidateRect( infoPtr->Self, &rect, oldPos > newPos ); 95 } 96 } 97 76 98 77 99 /*********************************************************************** … … 81 103 static LRESULT PROGRESS_Draw (PROGRESS_INFO *infoPtr, HDC hdc) 82 104 { 83 HBRUSH hbrBar ;105 HBRUSH hbrBar, hbrBk; 84 106 int rightBar, rightMost, ledWidth; 85 107 RECT rect; 86 108 DWORD dwStyle; 87 109 88 TRACE("(infoPtr=%p, hdc=% x)\n", infoPtr, hdc);110 TRACE("(infoPtr=%p, hdc=%p)\n", infoPtr, hdc); 89 111 90 112 /* get the required bar brush */ … … 94 116 hbrBar = CreateSolidBrush (infoPtr->ColorBar); 95 117 118 if (infoPtr->ColorBk == CLR_DEFAULT) 119 hbrBk = GetSysColorBrush(COLOR_3DFACE); 120 else 121 hbrBk = CreateSolidBrush(infoPtr->ColorBk); 122 96 123 /* get client rectangle */ 97 124 GetClientRect (infoPtr->Self, &rect); 98 125 FrameRect( hdc, &rect, hbrBk ); 99 126 InflateRect(&rect, -1, -1); 100 127 … … 104 131 /* compute extent of progress bar */ 105 132 if (dwStyle & PBS_VERTICAL) { 106 rightBar = rect.bottom - 133 rightBar = rect.bottom - 107 134 MulDiv (infoPtr->CurVal - infoPtr->MinVal, 108 135 rect.bottom - rect.top, … … 111 138 rightMost = rect.top; 112 139 } else { 113 rightBar = rect.left + 140 rightBar = rect.left + 114 141 MulDiv (infoPtr->CurVal - infoPtr->MinVal, 115 142 rect.right - rect.left, … … 120 147 121 148 /* now draw the bar */ 122 if (dwStyle & PBS_SMOOTH) { 123 if (dwStyle & PBS_VERTICAL) 124 rect.top = rightBar; 125 else 126 rect.right = rightBar; 127 FillRect(hdc, &rect, hbrBar); 149 if (dwStyle & PBS_SMOOTH) 150 { 151 if (dwStyle & PBS_VERTICAL) 152 { 153 INT old_top = rect.top; 154 rect.top = rightBar; 155 FillRect(hdc, &rect, hbrBar); 156 rect.bottom = rect.top; 157 rect.top = old_top; 158 FillRect(hdc, &rect, hbrBk); 159 } 160 else 161 { 162 INT old_right = rect.right; 163 rect.right = rightBar; 164 FillRect(hdc, &rect, hbrBar); 165 rect.left = rect.right; 166 rect.right = old_right; 167 FillRect(hdc, &rect, hbrBk); 168 } 128 169 } else { 129 170 if (dwStyle & PBS_VERTICAL) { 130 while(rect.bottom > rightBar) { 171 while(rect.bottom > rightBar) { 131 172 rect.top = rect.bottom - ledWidth; 132 173 if (rect.top < rightMost) 133 174 rect.top = rightMost; 134 175 FillRect(hdc, &rect, hbrBar); 135 rect.bottom = rect.top - LED_GAP; 176 rect.bottom = rect.top; 177 rect.top -= LED_GAP; 178 if (rect.top <= rightBar) break; 179 FillRect(hdc, &rect, hbrBk); 180 rect.bottom = rect.top; 136 181 } 182 rect.top = rightMost; 183 FillRect(hdc, &rect, hbrBk); 137 184 } else { 138 while(rect.left < rightBar) { 185 while(rect.left < rightBar) { 139 186 rect.right = rect.left + ledWidth; 140 187 if (rect.right > rightMost) 141 188 rect.right = rightMost; 142 189 FillRect(hdc, &rect, hbrBar); 143 rect.left = rect.right + LED_GAP; 190 rect.left = rect.right; 191 rect.right += LED_GAP; 192 if (rect.right >= rightBar) break; 193 FillRect(hdc, &rect, hbrBk); 194 rect.left = rect.right; 144 195 } 196 rect.right = rightMost; 197 FillRect(hdc, &rect, hbrBk); 145 198 } 146 199 } 147 200 148 201 /* delete bar brush */ 149 if (infoPtr->ColorBar != CLR_DEFAULT) 150 DeleteObject (hbrBar);202 if (infoPtr->ColorBar != CLR_DEFAULT) DeleteObject (hbrBar); 203 if (infoPtr->ColorBk != CLR_DEFAULT) DeleteObject (hbrBk); 151 204 152 205 return 0; … … 201 254 /* if nothing changes, simply return */ 202 255 if(infoPtr->MinVal == low && infoPtr->MaxVal == high) return res; 203 256 204 257 infoPtr->MinVal = low; 205 258 infoPtr->MaxVal = high; … … 211 264 * ProgressWindowProc 212 265 */ 213 static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message, 266 static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message, 214 267 WPARAM wParam, LPARAM lParam) 215 268 { 216 269 PROGRESS_INFO *infoPtr; 217 270 218 TRACE("hwnd=% xmsg=%04x wparam=%x lParam=%lx\n", hwnd, message, wParam, lParam);271 TRACE("hwnd=%p msg=%04x wparam=%x lParam=%lx\n", hwnd, message, wParam, lParam); 219 272 220 273 infoPtr = (PROGRESS_INFO *)GetWindowLongW(hwnd, 0); 221 274 222 275 if (!infoPtr && message != WM_CREATE) 223 return DefWindowProcW( hwnd, message, wParam, lParam ); 276 return DefWindowProcW( hwnd, message, wParam, lParam ); 224 277 225 278 switch(message) { … … 229 282 dwExStyle &= ~(WS_EX_CLIENTEDGE | WS_EX_WINDOWEDGE); 230 283 dwExStyle |= WS_EX_STATICEDGE; 231 SetWindowLongW (hwnd, GWL_EXSTYLE, dwExStyle | WS_EX_STATICEDGE);284 SetWindowLongW (hwnd, GWL_EXSTYLE, dwExStyle); 232 285 /* Force recalculation of a non-client area */ 233 286 SetWindowPos(hwnd, 0, 0, 0, 0, 0, … … 241 294 /* initialize the info struct */ 242 295 infoPtr->Self = hwnd; 243 infoPtr->MinVal = 0; 296 infoPtr->MinVal = 0; 244 297 infoPtr->MaxVal = 100; 245 infoPtr->CurVal = 0; 298 infoPtr->CurVal = 0; 246 299 infoPtr->Step = 10; 247 300 infoPtr->ColorBar = CLR_DEFAULT; 248 301 infoPtr->ColorBk = CLR_DEFAULT; 249 302 infoPtr->Font = 0; 250 TRACE("Progress Ctrl creation, hwnd=% 04x\n", hwnd);303 TRACE("Progress Ctrl creation, hwnd=%p\n", hwnd); 251 304 return 0; 252 305 } 253 306 254 307 case WM_DESTROY: 255 TRACE("Progress Ctrl destruction, hwnd=% 04x\n", hwnd);308 TRACE("Progress Ctrl destruction, hwnd=%p\n", hwnd); 256 309 COMCTL32_Free (infoPtr); 257 310 SetWindowLongW(hwnd, 0, 0); 258 311 return 0; 259 312 260 case WM_ERASEBKGND:261 PROGRESS_EraseBackground(infoPtr, wParam);262 return TRUE;263 264 313 case WM_GETFONT: 265 314 return (LRESULT)infoPtr->Font; 266 315 267 316 case WM_SETFONT: 268 return PROGRESS_SetFont(infoPtr, (HFONT)wParam, (BOOL)lParam);317 return (LRESULT)PROGRESS_SetFont(infoPtr, (HFONT)wParam, (BOOL)lParam); 269 318 270 319 case WM_PAINT: 271 320 return PROGRESS_Paint (infoPtr, (HDC)wParam); 272 321 273 322 case PBM_DELTAPOS: 274 323 { 275 324 INT oldVal; 276 if(lParam) UNKNOWN_PARAM(PBM_DELTAPOS, wParam, lParam);277 325 oldVal = infoPtr->CurVal; 278 326 if(wParam != 0) { 279 BOOL bErase;280 327 infoPtr->CurVal += (INT)wParam; 281 328 PROGRESS_CoercePos (infoPtr); 282 329 TRACE("PBM_DELTAPOS: current pos changed from %d to %d\n", oldVal, infoPtr->CurVal); 283 bErase = (oldVal > infoPtr->CurVal); 284 InvalidateRect(hwnd, NULL, bErase); 330 PROGRESS_Invalidate( infoPtr, oldVal, infoPtr->CurVal ); 285 331 } 286 332 return oldVal; … … 290 336 { 291 337 INT oldVal; 292 if (lParam) UNKNOWN_PARAM(PBM_SETPOS, wParam, lParam);293 338 oldVal = infoPtr->CurVal; 294 339 if(oldVal != wParam) { 295 BOOL bErase;296 340 infoPtr->CurVal = (INT)wParam; 297 341 PROGRESS_CoercePos(infoPtr); 298 342 TRACE("PBM_SETPOS: current pos changed from %d to %d\n", oldVal, infoPtr->CurVal); 299 bErase = (oldVal > infoPtr->CurVal); 300 InvalidateRect(hwnd, NULL, bErase); 343 PROGRESS_Invalidate( infoPtr, oldVal, infoPtr->CurVal ); 301 344 } 302 345 return oldVal; 303 346 } 304 347 305 348 case PBM_SETRANGE: 306 if (wParam) UNKNOWN_PARAM(PBM_SETRANGE, wParam, lParam);307 349 return PROGRESS_SetRange (infoPtr, (int)LOWORD(lParam), (int)HIWORD(lParam)); 308 350 … … 310 352 { 311 353 INT oldStep; 312 if (lParam) UNKNOWN_PARAM(PBM_SETSTEP, wParam, lParam);313 354 oldStep = infoPtr->Step; 314 355 infoPtr->Step = (INT)wParam; … … 319 360 { 320 361 INT oldVal; 321 if (wParam || lParam) UNKNOWN_PARAM(PBM_STEPIT, wParam, lParam); 322 oldVal = infoPtr->CurVal; 362 oldVal = infoPtr->CurVal; 323 363 infoPtr->CurVal += infoPtr->Step; 324 364 if(infoPtr->CurVal > infoPtr->MaxVal) … … 326 366 if(oldVal != infoPtr->CurVal) 327 367 { 328 BOOL bErase;329 368 TRACE("PBM_STEPIT: current pos changed from %d to %d\n", oldVal, infoPtr->CurVal); 330 bErase = (oldVal > infoPtr->CurVal); 331 InvalidateRect(hwnd, NULL, bErase); 369 PROGRESS_Invalidate( infoPtr, oldVal, infoPtr->CurVal ); 332 370 } 333 371 return oldVal; … … 336 374 case PBM_SETRANGE32: 337 375 return PROGRESS_SetRange (infoPtr, (int)wParam, (int)lParam); 338 376 339 377 case PBM_GETRANGE: 340 378 if (lParam) { … … 345 383 346 384 case PBM_GETPOS: 347 if (wParam || lParam) UNKNOWN_PARAM(PBM_STEPIT, wParam, lParam);348 385 return infoPtr->CurVal; 349 386 350 387 case PBM_SETBARCOLOR: 351 if (wParam) UNKNOWN_PARAM(PBM_SETBARCOLOR, wParam, lParam);352 388 infoPtr->ColorBar = (COLORREF)lParam; 353 389 InvalidateRect(hwnd, NULL, TRUE); … … 355 391 356 392 case PBM_SETBKCOLOR: 357 if (wParam) UNKNOWN_PARAM(PBM_SETBKCOLOR, wParam, lParam);358 393 infoPtr->ColorBk = (COLORREF)lParam; 359 394 InvalidateRect(hwnd, NULL, TRUE); 360 395 return 0; 361 396 362 default: 363 if ( message >= WM_USER)397 default: 398 if ((message >= WM_USER) && (message < WM_APP)) 364 399 ERR("unknown msg %04x wp=%04x lp=%08lx\n", message, wParam, lParam ); 365 return DefWindowProcW( hwnd, message, wParam, lParam ); 366 } 400 return DefWindowProcW( hwnd, message, wParam, lParam ); 401 } 367 402 } 368 403 … … 398 433 UnregisterClassW (PROGRESS_CLASSW, (HINSTANCE)NULL); 399 434 } 400 -
trunk/src/comctl32/propsheet.c
r8515 r9370 25 25 26 26 #include <string.h> 27 27 28 #include "winbase.h" 28 29 #include "commctrl.h" … … 30 31 #include "winnls.h" 31 32 #include "comctl32.h" 33 #include "heap.h" 34 32 35 #include "wine/debug.h" 33 #include "heap.h" 34 36 #include "wine/unicode.h" 35 37 36 38 /****************************************************************************** 37 39 * Data structures 38 40 */ 41 #include "pshpack2.h" 42 39 43 typedef struct 40 44 { … … 45 49 DWORD style; 46 50 } MyDLGTEMPLATEEX; 51 52 typedef struct 53 { 54 DWORD helpid; 55 DWORD exStyle; 56 DWORD style; 57 short x; 58 short y; 59 short cy; 60 DWORD id; 61 } MyDLGITEMTEMPLATEEX; 62 #include "poppack.h" 47 63 48 64 typedef struct tagPropPageInfo … … 89 105 */ 90 106 91 const WCHAR PropSheetInfoStr[] = 107 const WCHAR PropSheetInfoStr[] = 92 108 {'P','r','o','p','e','r','t','y','S','h','e','e','t','I','n','f','o',0 }; 93 109 … … 139 155 int skipdir, 140 156 HPROPSHEETPAGE hpage); 157 static void PROPSHEET_SetCurSelId(HWND hwndDlg, int id); 141 158 static LRESULT PROPSHEET_QuerySiblings(HWND hwndDlg, 142 159 WPARAM wParam, LPARAM lParam); … … 210 227 211 228 /****************************************************************************** 229 * PROPSHEET_GetPageRect 230 * 231 * Retrieve rect from tab control and map into the dialog for SetWindowPos 232 */ 233 static void PROPSHEET_GetPageRect(const PropSheetInfo * psInfo, HWND hwndDlg, RECT *rc) 234 { 235 HWND hwndTabCtrl = GetDlgItem(hwndDlg, IDC_TABCONTROL); 236 237 GetClientRect(hwndTabCtrl, rc); 238 SendMessageW(hwndTabCtrl, TCM_ADJUSTRECT, FALSE, (LPARAM)rc); 239 MapWindowPoints(hwndTabCtrl, hwndDlg, (LPPOINT)rc, 2); 240 } 241 242 /****************************************************************************** 212 243 * PROPSHEET_FindPageByResId 213 244 * … … 262 293 263 294 memcpy(&psInfo->ppshheader,lppsh,dwSize); 264 TRACE("\n** PROPSHEETHEADER **\ndwSize\t\t%ld\ndwFlags\t\t%08lx\nhwndParent\t% 04x\nhInstance\t%08x\npszCaption\t'%s'\nnPages\t\t%d\npfnCallback\t%p\n",295 TRACE("\n** PROPSHEETHEADER **\ndwSize\t\t%ld\ndwFlags\t\t%08lx\nhwndParent\t%p\nhInstance\t%p\npszCaption\t'%s'\nnPages\t\t%d\npfnCallback\t%p\n", 265 296 lppsh->dwSize, lppsh->dwFlags, lppsh->hwndParent, lppsh->hInstance, 266 297 debugstr_a(lppsh->pszCaption), lppsh->nPages, lppsh->pfnCallback); … … 313 344 314 345 memcpy(&psInfo->ppshheader,lppsh,dwSize); 315 TRACE("\n** PROPSHEETHEADER **\ndwSize\t\t%ld\ndwFlags\t\t%08lx\nhwndParent\t% 04x\nhInstance\t%08x\npszCaption\t'%s'\nnPages\t\t%d\npfnCallback\t%p\n",346 TRACE("\n** PROPSHEETHEADER **\ndwSize\t\t%ld\ndwFlags\t\t%08lx\nhwndParent\t%p\nhInstance\t%p\npszCaption\t'%s'\nnPages\t\t%d\npfnCallback\t%p\n", 316 347 lppsh->dwSize, lppsh->dwFlags, lppsh->hwndParent, lppsh->hInstance, debugstr_w(lppsh->pszCaption), lppsh->nPages, lppsh->pfnCallback); 317 348 … … 443 474 p += lstrlenW( (LPCWSTR)p ) + 1; 444 475 break; 445 } 476 } 446 477 447 478 /* class */ … … 492 523 * Build the image list for icons 493 524 */ 494 if ((dwFlags & PSP_USEHICON) || (dwFlags & PSP_USEICONID)) 525 if ((dwFlags & PSP_USEHICON) || (dwFlags & PSP_USEICONID)) 495 526 { 496 527 HICON hIcon; … … 499 530 500 531 if (dwFlags & PSP_USEICONID) 501 hIcon = LoadImageW(lppsp->hInstance, lppsp->u2.pszIcon, IMAGE_ICON, 532 hIcon = LoadImageW(lppsp->hInstance, lppsp->u2.pszIcon, IMAGE_ICON, 502 533 icon_cx, icon_cy, LR_DEFAULTCOLOR); 503 534 else … … 569 600 psInfo->ppshheader.hwndParent, 570 601 (DLGPROC) PROPSHEET_DialogProc, 571 (LPARAM)psInfo) ;602 (LPARAM)psInfo) ? TRUE : FALSE; 572 603 573 604 COMCTL32_Free(temp); … … 578 609 /****************************************************************************** 579 610 * PROPSHEET_SizeMismatch 580 * 611 * 581 612 * Verify that the tab control and the "largest" property sheet page dlg. template 582 613 * match in size. … … 702 733 psInfo->height = MulDiv((rc.bottom - rc.top),8,units.top); 703 734 } 704 735 705 736 if ((rc.right - rc.left) < (tabRect.right - tabRect.left)) 706 737 { … … 716 747 rc.right -= rc.left; 717 748 rc.bottom -= rc.top; 749 TRACE("setting tab %08lx, rc (0,0)-(%d,%d)\n", 750 (DWORD)hwndTabCtrl, rc.right, rc.bottom); 718 751 SetWindowPos(hwndTabCtrl, 0, 0, 0, rc.right, rc.bottom, 719 752 SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); … … 730 763 * Resize the property sheet. 731 764 */ 765 TRACE("setting dialog %08lx, rc (0,0)-(%d,%d)\n", 766 (DWORD)hwndDlg, rc.right, rc.bottom); 732 767 SetWindowPos(hwndDlg, 0, 0, 0, rc.right, rc.bottom, 733 768 SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); … … 779 814 psInfo->height = MulDiv((rc.bottom - rc.top), 8, units.top); 780 815 } 781 816 782 817 if ((rc.right - rc.left) < (tabRect.right - tabRect.left)) 783 818 { … … 787 822 788 823 TRACE("Biggest page %d %d %d %d\n", rc.left, rc.top, rc.right, rc.bottom); 824 TRACE(" constants padx=%d, pady=%d, butH=%d, lH=%d\n", 825 padding.x, padding.y, buttonHeight, lineHeight); 789 826 790 827 /* Make room */ … … 795 832 * Resize the property sheet. 796 833 */ 834 TRACE("setting dialog %08lx, rc (0,0)-(%d,%d)\n", 835 (DWORD)hwndDlg, rc.right, rc.bottom); 797 836 SetWindowPos(hwndDlg, 0, 0, 0, rc.right, rc.bottom, 798 837 SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); … … 829 868 /* 830 869 * Get the size of the property sheet. 831 */ 870 */ 832 871 GetClientRect(hwndParent, &rcSheet); 833 872 834 /* 873 /* 835 874 * All buttons will be at this y coordinate. 836 875 */ … … 868 907 else 869 908 x = rcSheet.right - (padding.x + buttonWidth); 870 909 871 910 SetWindowPos(hwndButton, 0, x, y, 0, 0, 872 911 SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); … … 885 924 { 886 925 x = rcSheet.right - (padding.x + buttonWidth); 887 926 888 927 SetWindowPos(hwndButton, 0, x, y, 0, 0, 889 928 SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); … … 1064 1103 } 1065 1104 } 1066 1105 1067 1106 hwndControl = GetDlgItem(hwndDlg, idButton); 1068 1107 GetWindowRect(hwndControl, &rc); … … 1136 1175 1137 1176 return TRUE; 1177 } 1178 /* 1179 * Get the size of an in-memory Template 1180 * 1181 *( Based on the code of PROPSHEET_CollectPageInfo) 1182 */ 1183 1184 static UINT GetTemplateSize(DLGTEMPLATE* pTemplate) 1185 1186 { 1187 const WORD* p = (const WORD *)pTemplate; 1188 BOOL istemplateex = (((MyDLGTEMPLATEEX*)pTemplate)->signature == 0xFFFF); 1189 WORD nrofitems; 1190 1191 if (istemplateex) 1192 { 1193 /* DIALOGEX template */ 1194 1195 p++; /* dlgVer */ 1196 p++; /* signature */ 1197 p += 2; /* help ID */ 1198 p += 2; /* ext style */ 1199 p += 2; /* style */ 1200 } 1201 else 1202 { 1203 /* DIALOG template */ 1204 1205 p += 2; /* style */ 1206 p += 2; /* ext style */ 1207 } 1208 1209 nrofitems = (WORD)*p; p++; /* nb items */ 1210 p++; /* x */ 1211 p++; /* y */ 1212 p++; /* width */ 1213 p++; /* height */ 1214 1215 /* menu */ 1216 switch ((WORD)*p) 1217 { 1218 case 0x0000: 1219 p++; 1220 break; 1221 case 0xffff: 1222 p += 2; 1223 break; 1224 default: 1225 TRACE("menu %s\n",debugstr_w((LPCWSTR)p)); 1226 p += lstrlenW( (LPCWSTR)p ) + 1; 1227 break; 1228 } 1229 1230 /* class */ 1231 switch ((WORD)*p) 1232 { 1233 case 0x0000: 1234 p++; 1235 break; 1236 case 0xffff: 1237 p += 2; 1238 break; 1239 default: 1240 TRACE("class %s\n",debugstr_w((LPCWSTR)p)); 1241 p += lstrlenW( (LPCWSTR)p ) + 1; 1242 break; 1243 } 1244 1245 /*title */ 1246 TRACE("title %s\n",debugstr_w((LPCWSTR)p)); 1247 p += lstrlenW((LPCWSTR)p) + 1; 1248 1249 /* font, if DS_FONT set */ 1250 if ((DS_SETFONT & ((istemplateex)? ((MyDLGTEMPLATEEX*)pTemplate)->style : 1251 pTemplate->style))) 1252 { 1253 p+=(istemplateex)?3:1; 1254 TRACE("font %s\n",debugstr_w((LPCWSTR)p)); 1255 p += lstrlenW( (LPCWSTR)p ) + 1; /* the font name*/ 1256 } 1257 1258 TRACE("%d items\n",nrofitems); 1259 while (nrofitems > 0) 1260 { 1261 p = (WORD*)(((DWORD)p + 3) & ~3); /* DWORD align */ 1262 1263 p += (istemplateex ? sizeof(MyDLGITEMTEMPLATEEX) : sizeof(DLGITEMTEMPLATE))/sizeof(WORD); 1264 1265 switch ((WORD)*p) 1266 { 1267 case 0x0000: 1268 p++; 1269 break; 1270 case 0xffff: 1271 TRACE("class ordinal 0x%08lx\n",*(DWORD*)p); 1272 p += 2; 1273 break; 1274 default: 1275 TRACE("class %s\n",debugstr_w((LPCWSTR)p)); 1276 p += lstrlenW( (LPCWSTR)p ) + 1; 1277 break; 1278 } 1279 switch ((WORD)*p) 1280 { 1281 case 0x0000: 1282 p++; 1283 break; 1284 case 0xffff: 1285 TRACE("text ordinal 0x%08lx\n",*(DWORD*)p); 1286 p += 2; 1287 break; 1288 default: 1289 TRACE("text %s\n",debugstr_w((LPCWSTR)p)); 1290 p += lstrlenW( (LPCWSTR)p ) + 1; 1291 break; 1292 } 1293 p += *p + 1; /* Skip extra data */ 1294 --nrofitems; 1295 } 1296 1297 TRACE("%p %p size 0x%08x\n",p, (WORD*)pTemplate,sizeof(WORD)*(p - (WORD*)pTemplate)); 1298 return (p - (WORD*)pTemplate)*sizeof(WORD); 1299 1138 1300 } 1139 1301 … … 1165 1327 1166 1328 if (ppshpage->dwFlags & PSP_DLGINDIRECT) 1167 pTemplate = (DLGTEMPLATE*)ppshpage->u.pResource; 1329 { 1330 pTemplate = (DLGTEMPLATE*)ppshpage->u.pResource; 1331 resSize = GetTemplateSize(pTemplate); 1332 } 1168 1333 else 1169 1334 { … … 1187 1352 * Make a copy of the dialog template to make it writable 1188 1353 */ 1189 temp = COMCTL32_Alloc(resSize);1190 if (!temp)1191 return FALSE;1192 1193 memcpy(temp, pTemplate, resSize);1194 pTemplate = temp;1195 }1354 } 1355 temp = COMCTL32_Alloc(resSize); 1356 if (!temp) 1357 return FALSE; 1358 1359 memcpy(temp, pTemplate, resSize); 1360 pTemplate = temp; 1196 1361 1197 1362 if (((MyDLGTEMPLATEEX*)pTemplate)->signature == 0xFFFF) … … 1234 1399 ppInfo[index].hwndPage = hwndPage; 1235 1400 1236 rc.left = psInfo->x; 1237 rc.top = psInfo->y; 1238 rc.right = psInfo->width; 1239 rc.bottom = psInfo->height; 1240 1241 MapDialogRect(hwndParent, &rc); 1242 1243 pageWidth = rc.right - rc.left; 1244 pageHeight = rc.bottom - rc.top; 1245 1246 if (psInfo->ppshheader.dwFlags & INTRNL_ANY_WIZARD) 1247 padding = PROPSHEET_GetPaddingInfoWizard(hwndParent, psInfo); 1248 else 1249 { 1250 /* 1251 * Ask the Tab control to fit this page in. 1252 */ 1253 1254 HWND hwndTabCtrl = GetDlgItem(hwndParent, IDC_TABCONTROL); 1255 SendMessageW(hwndTabCtrl, TCM_ADJUSTRECT, FALSE, (LPARAM)&rc); 1256 padding = PROPSHEET_GetPaddingInfo(hwndParent); 1257 } 1258 1259 SetWindowPos(hwndPage, HWND_TOP, 1260 rc.left + padding.x/2, 1261 rc.top + padding.y/2, 1262 pageWidth, pageHeight, 0); 1401 if (psInfo->ppshheader.dwFlags & INTRNL_ANY_WIZARD) { 1402 /* FIXME: This code may no longer be correct. 1403 * It was not for the non-wizard path. (GLA 6/02) 1404 */ 1405 rc.left = psInfo->x; 1406 rc.top = psInfo->y; 1407 rc.right = psInfo->width; 1408 rc.bottom = psInfo->height; 1409 1410 MapDialogRect(hwndParent, &rc); 1411 1412 pageWidth = rc.right - rc.left; 1413 pageHeight = rc.bottom - rc.top; 1414 1415 padding = PROPSHEET_GetPaddingInfoWizard(hwndParent, psInfo); 1416 TRACE("setting page %08lx, rc (%d,%d)-(%d,%d) w=%d, h=%d, padx=%d, pady=%d\n", 1417 (DWORD)hwndPage, rc.left, rc.top, rc.right, rc.bottom, 1418 pageWidth, pageHeight, padding.x, padding.y); 1419 SetWindowPos(hwndPage, HWND_TOP, 1420 rc.left + padding.x/2, 1421 rc.top + padding.y/2, 1422 pageWidth, pageHeight, 0); 1423 } 1424 else { 1425 /* 1426 * Ask the Tab control to reduce the client rectangle to that 1427 * it has available. 1428 */ 1429 PROPSHEET_GetPageRect(psInfo, hwndParent, &rc); 1430 pageWidth = rc.right - rc.left; 1431 pageHeight = rc.bottom - rc.top; 1432 TRACE("setting page %08lx, rc (%d,%d)-(%d,%d) w=%d, h=%d\n", 1433 (DWORD)hwndPage, rc.left, rc.top, rc.right, rc.bottom, 1434 pageWidth, pageHeight); 1435 SetWindowPos(hwndPage, HWND_TOP, 1436 rc.left, rc.top, 1437 pageWidth, pageHeight, 0); 1438 } 1263 1439 1264 1440 return TRUE; … … 1326 1502 psn.hdr.idFrom = 0; 1327 1503 psn.lParam = 0; 1328 1504 1329 1505 hwndPage = psInfo->proppage[psInfo->active_page].hwndPage; 1330 1506 … … 1365 1541 psn.hdr.idFrom = 0; 1366 1542 psn.lParam = 0; 1367 1543 1368 1544 hwndPage = psInfo->proppage[psInfo->active_page].hwndPage; 1369 1545 … … 1404 1580 psn.hdr.idFrom = 0; 1405 1581 psn.lParam = 0; 1406 1582 1407 1583 hwndPage = psInfo->proppage[psInfo->active_page].hwndPage; 1408 1584 … … 1441 1617 psn.hdr.idFrom = 0; 1442 1618 psn.lParam = 0; 1443 1619 1444 1620 1445 1621 /* … … 1458 1634 psn.hdr.code = PSN_APPLY; 1459 1635 psn.lParam = lParam; 1460 1636 1461 1637 for (i = 0; i < psInfo->nPages; i++) 1462 1638 { … … 1505 1681 psn.hdr.idFrom = 0; 1506 1682 psn.lParam = 0; 1507 1683 1508 1684 if (SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn)) 1509 1685 return; … … 1511 1687 psn.hdr.code = PSN_RESET; 1512 1688 psn.lParam = lParam; 1513 1689 1514 1690 for (i = 0; i < psInfo->nPages; i++) 1515 1691 { … … 1548 1724 psn.hdr.idFrom = 0; 1549 1725 psn.lParam = 0; 1550 1726 1551 1727 SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn); 1552 1728 } … … 1650 1826 1651 1827 /************************************************************************* 1652 * BOOL PROPSHEET_CanSetCurSel [Internal] 1828 * BOOL PROPSHEET_CanSetCurSel [Internal] 1653 1829 * 1654 1830 * Test whether the current page can be changed by sending a PSN_KILLACTIVE … … 1710 1886 PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwndDlg, PropSheetInfoStr); 1711 1887 HWND hwndHelp = GetDlgItem(hwndDlg, IDHELP); 1888 HWND hwndTabControl = GetDlgItem(hwndDlg, IDC_TABCONTROL); 1712 1889 1713 1890 TRACE("index %d, skipdir %d, hpage %p\n", index, skipdir, hpage); … … 1725 1902 int result; 1726 1903 PSHNOTIFY psn; 1904 1905 if (hwndTabControl) 1906 SendMessageW(hwndTabControl, TCM_SETCURSEL, index, 0); 1727 1907 1728 1908 psn.hdr.code = PSN_SETACTIVE; … … 1772 1952 1773 1953 /****************************************************************************** 1954 * PROPSHEET_SetCurSelId 1955 * 1956 * Selects the page, specified by resource id. 1957 */ 1958 static void PROPSHEET_SetCurSelId(HWND hwndDlg, int id) 1959 { 1960 int idx; 1961 PropSheetInfo* psInfo = 1962 (PropSheetInfo*) GetPropW(hwndDlg, PropSheetInfoStr); 1963 1964 idx = PROPSHEET_FindPageByResId(psInfo, id); 1965 if (idx < psInfo->nPages ) 1966 { 1967 if (PROPSHEET_CanSetCurSel(hwndDlg) != FALSE) 1968 PROPSHEET_SetCurSel(hwndDlg, idx, 1, 0); 1969 } 1970 } 1971 1972 /****************************************************************************** 1774 1973 * PROPSHEET_SetTitleA 1775 1974 */ … … 1779 1978 { 1780 1979 WCHAR szTitle[256]; 1781 MultiByteToWideChar(CP_ACP, 0, lpszText, -1, 1980 MultiByteToWideChar(CP_ACP, 0, lpszText, -1, 1782 1981 szTitle, sizeof szTitle); 1783 1982 PROPSHEET_SetTitleW(hwndDlg, dwStyle, szTitle); … … 1799 1998 TRACE("'%s' (style %08lx)\n", debugstr_w(lpszText), dwStyle); 1800 1999 if (HIWORD(lpszText) == 0) { 1801 if (!LoadStringW(psInfo->ppshheader.hInstance, 2000 if (!LoadStringW(psInfo->ppshheader.hInstance, 1802 2001 LOWORD(lpszText), szTitle, sizeof(szTitle)-sizeof(WCHAR))) 1803 2002 return; … … 1930 2129 item.pszText = (LPWSTR) psInfo->proppage[psInfo->nPages].pszText; 1931 2130 item.cchTextMax = MAX_TABTEXT_LENGTH; 2131 2132 if (psInfo->hImageList) 2133 { 2134 SendMessageW(hwndTabControl, TCM_SETIMAGELIST, 0, (LPARAM)psInfo->hImageList); 2135 } 2136 2137 if ( psInfo->proppage[psInfo->nPages].hasIcon ) 2138 { 2139 item.mask |= TCIF_IMAGE; 2140 item.iImage = psInfo->nPages; 2141 } 1932 2142 1933 2143 SendMessageW(hwndTabControl, TCM_INSERTITEMW, psInfo->nPages + 1, … … 2021 2231 DestroyPropertySheetPage(psInfo->proppage[index].hpage); 2022 2232 } 2023 2233 2024 2234 /* Remove the tab */ 2025 2235 SendMessageW(hwndTabControl, TCM_DELETEITEM, index, 0); … … 2028 2238 psInfo->proppage = COMCTL32_Alloc(sizeof(PropPageInfo) * psInfo->nPages); 2029 2239 2030 if (index > 0) 2240 if (index > 0) 2031 2241 memcpy(&psInfo->proppage[0], &oldPages[0], index * sizeof(PropPageInfo)); 2032 2242 … … 2156 2366 2157 2367 /****************************************************************************** 2158 * PropertySheet (COMCTL32. 87)2159 * PropertySheetA (COMCTL32. 88)2368 * PropertySheet (COMCTL32.@) 2369 * PropertySheetA (COMCTL32.@) 2160 2370 */ 2161 2371 INT WINAPI PropertySheetA(LPCPROPSHEETHEADERA lppsh) … … 2201 2411 2202 2412 /****************************************************************************** 2203 * PropertySheetW (COMCTL32. 89)2413 * PropertySheetW (COMCTL32.@) 2204 2414 */ 2205 2415 INT WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh) … … 2245 2455 2246 2456 /****************************************************************************** 2247 * CreatePropertySheetPage (COMCTL32. 18)2248 * CreatePropertySheetPageA (COMCTL32. 19)2457 * CreatePropertySheetPage (COMCTL32.@) 2458 * CreatePropertySheetPageA (COMCTL32.@) 2249 2459 */ 2250 2460 HPROPSHEETPAGE WINAPI CreatePropertySheetPageA( … … 2257 2467 if ( !(ppsp->dwFlags & PSP_DLGINDIRECT) && HIWORD( ppsp->u.pszTemplate ) ) 2258 2468 { 2259 PROPSHEET_AtoW(&ppsp->u.pszTemplate, lpPropSheetPage->u.pszTemplate); 2469 PROPSHEET_AtoW(&ppsp->u.pszTemplate, lpPropSheetPage->u.pszTemplate); 2260 2470 } 2261 2471 if ( (ppsp->dwFlags & PSP_USEICONID) && HIWORD( ppsp->u2.pszIcon ) ) 2262 2472 { 2263 PROPSHEET_AtoW(&ppsp->u2.pszIcon, lpPropSheetPage->u2.pszIcon); 2473 PROPSHEET_AtoW(&ppsp->u2.pszIcon, lpPropSheetPage->u2.pszIcon); 2264 2474 } 2265 2475 2266 2476 if ((ppsp->dwFlags & PSP_USETITLE) && HIWORD( ppsp->pszTitle )) 2267 2477 { 2268 PROPSHEET_AtoW(&ppsp->pszTitle, lpPropSheetPage->pszTitle); 2478 PROPSHEET_AtoW(&ppsp->pszTitle, lpPropSheetPage->pszTitle); 2269 2479 } 2270 2480 else if ( !(ppsp->dwFlags & PSP_USETITLE) ) … … 2275 2485 2276 2486 /****************************************************************************** 2277 * CreatePropertySheetPageW (COMCTL32. 20)2487 * CreatePropertySheetPageW (COMCTL32.@) 2278 2488 */ 2279 2489 HPROPSHEETPAGE WINAPI CreatePropertySheetPageW(LPCPROPSHEETPAGEW lpPropSheetPage) … … 2310 2520 2311 2521 /****************************************************************************** 2312 * DestroyPropertySheetPage (COMCTL32. 24)2522 * DestroyPropertySheetPage (COMCTL32.@) 2313 2523 */ 2314 2524 BOOL WINAPI DestroyPropertySheetPage(HPROPSHEETPAGE hPropPage) … … 2456 2666 PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) 2457 2667 { 2458 TRACE("hwnd=% x msg=%x wparam=%x lparam=%lx\n",2668 TRACE("hwnd=%p msg=%x wparam=%x lparam=%lx\n", 2459 2669 hwnd, uMsg, wParam, lParam); 2460 2670 … … 2472 2682 2473 2683 /* 2474 * psInfo->hwnd is not being used by WINE code - it exists 2475 * for compatibility with "real" Windoze. The same about 2684 * psInfo->hwnd is not being used by WINE code - it exists 2685 * for compatibility with "real" Windoze. The same about 2476 2686 * SetWindowLong - WINE is only using the PropSheetInfoStr 2477 2687 * property. … … 2499 2709 hIcon = psInfo->ppshheader.u.hIcon; 2500 2710 2501 SendMessageW(hwnd, WM_SETICON, 0, hIcon);2711 SendMessageW(hwnd, WM_SETICON, 0, (LPARAM)hIcon); 2502 2712 } 2503 2713 2504 2714 if (psInfo->ppshheader.dwFlags & PSH_USEHICON) 2505 SendMessageW(hwnd, WM_SETICON, 0, psInfo->ppshheader.u.hIcon);2715 SendMessageW(hwnd, WM_SETICON, 0, (LPARAM)psInfo->ppshheader.u.hIcon); 2506 2716 2507 2717 psInfo->strPropertiesFor = strCaption; … … 2528 2738 } 2529 2739 2530 if (psInfo->useCallback) 2531 (*(psInfo->ppshheader.pfnCallback))(hwnd, 2532 PSCB_INITIALIZED, (LPARAM)0); 2740 if (psInfo->useCallback) 2741 (*(psInfo->ppshheader.pfnCallback))(hwnd, 2742 PSCB_INITIALIZED, (LPARAM)0); 2533 2743 2534 2744 idx = psInfo->active_page; 2535 2745 ppshpage = (LPCPROPSHEETPAGEW)psInfo->proppage[idx].hpage; 2536 2746 psInfo->active_page = -1; 2537 2747 2538 2748 PROPSHEET_SetCurSel(hwnd, idx, 1, psInfo->proppage[idx].hpage); 2539 2749 … … 2548 2758 WCHAR szText[256]; 2549 2759 2550 if (LoadStringW(psInfo->ppshheader.hInstance, 2760 if (LoadStringW(psInfo->ppshheader.hInstance, 2551 2761 (UINT)psInfo->ppshheader.pszCaption, szText, 255)) 2552 2762 PROPSHEET_SetTitleW(hwnd, psInfo->ppshheader.dwFlags, szText); … … 2601 2811 hwndPage = psInfo->proppage[psInfo->active_page].hwndPage; 2602 2812 2603 SetWindowLongW(hwnd, DWL_MSGRESULT, hwndPage);2813 SetWindowLongW(hwnd, DWL_MSGRESULT, (LONG)hwndPage); 2604 2814 2605 2815 return TRUE; … … 2618 2828 HWND hwndTabCtrl = GetDlgItem(hwnd, IDC_TABCONTROL); 2619 2829 2620 SetWindowLongW(hwnd, DWL_MSGRESULT, hwndTabCtrl);2830 SetWindowLongW(hwnd, DWL_MSGRESULT, (LONG)hwndTabCtrl); 2621 2831 2622 2832 return TRUE; … … 2650 2860 if (LoadStringW(COMCTL32_hModule, IDS_CLOSE, buf, sizeof(buf))) 2651 2861 SetWindowTextW(hwndOK, buf); 2652 2862 2653 2863 return FALSE; 2654 2864 } … … 2665 2875 case PSM_REBOOTSYSTEM: 2666 2876 { 2667 PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwnd, 2877 PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwnd, 2668 2878 PropSheetInfoStr); 2669 2879 … … 2675 2885 PROPSHEET_SetTitleA(hwnd, (DWORD) wParam, (LPCSTR) lParam); 2676 2886 return TRUE; 2677 2887 2678 2888 case PSM_SETTITLEW: 2679 2889 PROPSHEET_SetTitleW(hwnd, (DWORD) wParam, (LPCWSTR) lParam); … … 2731 2941 2732 2942 case PSM_SETFINISHTEXTA: 2733 PROPSHEET_SetFinishTextA(hwnd, (LPCSTR) lParam); 2943 PROPSHEET_SetFinishTextA(hwnd, (LPCSTR) lParam); 2734 2944 return TRUE; 2735 2945 … … 2739 2949 2740 2950 case PSM_SETCURSELID: 2741 FIXME("Unimplemented msg PSM_SETCURSELID\n");2742 return FALSE;2951 PROPSHEET_SetCurSelId(hwnd, (int)lParam); 2952 return TRUE; 2743 2953 2744 2954 case PSM_SETFINISHTEXTW: 2745 PROPSHEET_SetFinishTextW(hwnd, (LPCWSTR) lParam); 2955 PROPSHEET_SetFinishTextW(hwnd, (LPCWSTR) lParam); 2746 2956 return FALSE; 2747 2957 … … 2749 2959 return FALSE; 2750 2960 } 2751 2961 2752 2962 return FALSE; 2753 2963 } 2754 -
trunk/src/comctl32/rebar.c
r8382 r9370 47 47 * - vertical placement 48 48 * - ComboBox and ComboBoxEx placement 49 * - center image 49 * - center image 50 50 * - Layout code. 51 51 * - Display code. … … 56 56 * rev 2,3,4 57 57 * - Implement initial version of row grouping, row separators, 58 * text and background colors. Support additional messages. 58 * text and background colors. Support additional messages. 59 59 * Support RBBS_BREAK. Implement ERASEBKGND and improve painting. 60 60 * rev 5 61 61 * - implement support for dragging Gripper left or right in a row. Supports 62 * WM_LBUTTONDOWN, WM_LBUTTONUP, and WM_MOUSEMOVE. Also support 62 * WM_LBUTTONDOWN, WM_LBUTTONUP, and WM_MOUSEMOVE. Also support 63 63 * RBS_BANDBORDERS. 64 64 * rev 6 … … 69 69 * rev 7 70 70 * - Fix algorithm for _Layout and _AdjustBand. 71 * - Fix or implement RBN_ENDDRAG, RB_MOVEBAND, WM_SETREDRAW, 71 * - Fix or implement RBN_ENDDRAG, RB_MOVEBAND, WM_SETREDRAW, 72 72 * WM_STYLECHANGED, RB_MINIMIZEBAND, RBBS_VARIABLEHEIGHT, RBS_VARHEIGHT, 73 73 * RBBS_HIDDEN, WM_NOTIFYFORMAT, NM_NCHITTEST, WM_SETREDRAW, RBS_AUTOSIZE, … … 88 88 * so that repainting is correct. 89 89 * 8. Implement RB_MAXIMIZEBAND for the "ideal=TRUE" case. 90 * 9. Implement item custom draw notifications partially. Only done for 90 * 9. Implement item custom draw notifications partially. Only done for 91 91 * ITEMPREPAINT and ITEMPOSTPAINT. (Used by IE4 for "Favorites" frame 92 92 * to draw the word "Favorites"). … … 97 97 * 12. Fix CCS_VERT errors in _ForceResize, _NCCalcSize, and _NCPaint. 98 98 * 13. Support some special cases of CCS_TOP (and therefore CCS_LEFT), 99 * CCS_BOTTOM (and therefore CCS_RIGHT) and CCS_NOPARENTALIGN. Not 99 * CCS_BOTTOM (and therefore CCS_RIGHT) and CCS_NOPARENTALIGN. Not 100 100 * at all sure whether this is all cases. 101 101 * 14. Handle returned value for the RBN_CHILDSIZE notify. … … 122 122 * RBBS_USECHEVRON, CCS_NORESIZE, 123 123 * CCS_NOMOVEX, CCS_NOMOVEY 124 * 3. Following are only partially handled: 124 * 3. Following are only partially handled: 125 125 * RBS_AUTOSIZE, RBBS_VARIABLEHEIGHT 126 126 * 5. Native uses (on each draw!!) SM_CYBORDER (or SM_CXBORDER for CCS_VERT) 127 * to set the size of the separator width (the value SEP_WIDTH_SIZE 127 * to set the size of the separator width (the value SEP_WIDTH_SIZE 128 128 * in here). Should be fixed!! 129 129 * 6. The following messages are not implemented: … … 237 237 BOOL NtfUnicode; /* TRUE if parent wants notify in W format */ 238 238 BOOL DoRedraw; /* TRUE to acutally draw bands */ 239 UINT fStatus; /* Status flags (see below) */ 239 UINT fStatus; /* Status flags (see below) */ 240 240 HCURSOR hcurArrow; /* handle to the arrow cursor */ 241 241 HCURSOR hcurHorz; /* handle to the EW cursor */ … … 317 317 318 318 /* The following defines adjust the right or left end of a rectangle */ 319 #define READJ(b,i) {if(infoPtr->dwStyle & CCS_VERT) b->rcBand.bottom+=(i); \320 else b->rcBand.right += (i); }321 #define LEADJ(b,i) {if(infoPtr->dwStyle & CCS_VERT) b->rcBand.top+=(i); \322 else b->rcBand.left += (i); }319 #define READJ(b,i) do { if(infoPtr->dwStyle & CCS_VERT) b->rcBand.bottom+=(i); \ 320 else b->rcBand.right += (i); } while(0) 321 #define LEADJ(b,i) do { if(infoPtr->dwStyle & CCS_VERT) b->rcBand.top+=(i); \ 322 else b->rcBand.left += (i); } while(0) 323 323 324 324 … … 400 400 { 401 401 if( !TRACE_ON(rebar) ) return; 402 TRACE("band info: ID=%u, size=%u, child=% 04x, clrF=0x%06lx, clrB=0x%06lx\n",403 pB->wID, pB->cbSize, pB->hwndChild, pB->clrFore, pB->clrBack); 402 TRACE("band info: ID=%u, size=%u, child=%p, clrF=0x%06lx, clrB=0x%06lx\n", 403 pB->wID, pB->cbSize, pB->hwndChild, pB->clrFore, pB->clrBack); 404 404 TRACE("band info: mask=0x%08x (%s)\n", pB->fMask, REBAR_FmtMask(pB->fMask)); 405 405 if (pB->fMask & RBBIM_STYLE) … … 419 419 if (pB->fMask & RBBIM_CHILDSIZE) 420 420 TRACE("band info: xMin=%u, yMin=%u, yChild=%u, yMax=%u, yIntgl=%u\n", 421 pB->cxMinChild, 421 pB->cxMinChild, 422 422 pB->cyMinChild, pB->cyChild, pB->cyMaxChild, pB->cyIntegral); 423 423 } … … 431 431 if(! TRACE_ON(rebar) ) return; 432 432 433 TRACE("hwnd=% 04x: color=%08lx/%08lx, bands=%u, rows=%u, cSize=%ld,%ld\n",433 TRACE("hwnd=%p: color=%08lx/%08lx, bands=%u, rows=%u, cSize=%ld,%ld\n", 434 434 iP->hwndSelf, iP->clrText, iP->clrBk, iP->uNumBands, iP->uNumRows, 435 435 iP->calcSize.cx, iP->calcSize.cy); 436 TRACE("hwnd=% 04x: flags=%08x, dragStart=%d,%d, dragNow=%d,%d, ihitBand=%d\n",436 TRACE("hwnd=%p: flags=%08x, dragStart=%d,%d, dragNow=%d,%d, ihitBand=%d\n", 437 437 iP->hwndSelf, iP->fStatus, iP->dragStart.x, iP->dragStart.y, 438 438 iP->dragNow.x, iP->dragNow.y, 439 439 iP->ihitBand); 440 TRACE("hwnd=% 04x: style=%08lx, I'm Unicode=%s, notify in Unicode=%s, redraw=%s\n",440 TRACE("hwnd=%p: style=%08lx, I'm Unicode=%s, notify in Unicode=%s, redraw=%s\n", 441 441 iP->hwndSelf, iP->dwStyle, (iP->bUnicode)?"TRUE":"FALSE", 442 442 (iP->NtfUnicode)?"TRUE":"FALSE", (iP->DoRedraw)?"TRUE":"FALSE"); 443 443 for (i = 0; i < iP->uNumBands; i++) { 444 444 pB = &iP->bands[i]; 445 TRACE("band # %u: ID=%u, child=% 04x, row=%u, clrF=0x%06lx, clrB=0x%06lx\n",445 TRACE("band # %u: ID=%u, child=%p, row=%u, clrF=0x%06lx, clrB=0x%06lx\n", 446 446 i, pB->wID, pB->hwndChild, pB->iRow, pB->clrFore, pB->clrBack); 447 447 TRACE("band # %u: mask=0x%08x (%s)\n", i, pB->fMask, REBAR_FmtMask(pB->fMask)); 448 448 if (pB->fMask & RBBIM_STYLE) 449 TRACE("band # %u: style=0x%08x (%s)\n", 449 TRACE("band # %u: style=0x%08x (%s)\n", 450 450 i, pB->fStyle, REBAR_FmtStyle(pB->fStyle)); 451 TRACE("band # %u: uMinH=%u xHeader=%u", 451 TRACE("band # %u: uMinH=%u xHeader=%u", 452 452 i, pB->uMinHeight, pB->cxHeader); 453 453 if (pB->fMask & (RBBIM_SIZE | RBBIM_IDEALSIZE | RBBIM_LPARAM )) { … … 507 507 nmhdr->code = code; 508 508 509 TRACE("window % 04x, code=%08x, %s\n", parent, code,509 TRACE("window %p, code=%08x, %s\n", parent, code, 510 510 (infoPtr->NtfUnicode) ? "via Unicode" : "via ANSI"); 511 511 … … 605 605 if (oldBkMode != TRANSPARENT) 606 606 SetBkMode (hdc, oldBkMode); 607 if (lpBand->clrFore != CLR_NONE) 607 if (lpBand->clrFore != CLR_NONE) 608 608 SetTextColor (hdc, oldcolor); 609 609 SelectObject (hdc, hOldFont); … … 636 636 lpBand = &infoPtr->bands[i]; 637 637 638 if (HIDDENBAND(lpBand)) continue; 638 if (HIDDENBAND(lpBand)) continue; 639 639 640 640 /* now draw the band */ 641 TRACE("[% 04x] drawing band %i, flags=%08x\n",641 TRACE("[%p] drawing band %i, flags=%08x\n", 642 642 infoPtr->hwndSelf, i, lpBand->fDraw); 643 643 REBAR_DrawBand (hdc, infoPtr, lpBand); … … 650 650 REBAR_FixVert (REBAR_INFO *infoPtr, UINT rowstart, UINT rowend, 651 651 INT mcy) 652 /* Function: */ 652 /* Function: */ 653 653 /* Cycle through bands in row and fix height of each band. */ 654 654 /* Also determine whether each band has changed. */ … … 719 719 /* or band's ->ccx reached. */ 720 720 /* If any band modified, add any space left to last band */ 721 /* adjusted. */ 721 /* adjusted. */ 722 722 /* */ 723 723 /* ****************************************************** */ … … 772 772 if ((x >= maxx) || (last_adjusted != -1)) { 773 773 if (x > maxx) { 774 ERR("Phase 1 failed, x=%d, maxx=%d, start=%u, end=%u\n", 774 ERR("Phase 1 failed, x=%d, maxx=%d, start=%u, end=%u\n", 775 775 x, maxx, rowstart, rowend); 776 776 } … … 842 842 if (x >= maxx) { 843 843 if (x > maxx) { 844 ERR("Phase 2 failed, x=%d, maxx=%d, start=%u, end=%u\n", 844 ERR("Phase 2 failed, x=%d, maxx=%d, start=%u, end=%u\n", 845 845 x, maxx, rowstart, rowend); 846 846 } … … 910 910 /* if no gripper but either image or text, then leave space */ 911 911 xoff = REBAR_ALWAYS_SPACE; 912 SetRect (&lpBand->rcCapImage, 912 SetRect (&lpBand->rcCapImage, 913 913 lpBand->rcBand.left+xoff, lpBand->rcBand.top, 914 914 lpBand->rcBand.left+xoff, lpBand->rcBand.bottom); … … 925 925 lpBand->rcCapImage.right+REBAR_POST_IMAGE, lpBand->rcBand.top+1, 926 926 lpBand->rcBand.left+lpBand->cxHeader, lpBand->rcBand.bottom-1); 927 /* update band height 927 /* update band height 928 928 if (lpBand->uMinHeight < infoPtr->imageSize.cy + 2) { 929 929 lpBand->uMinHeight = infoPtr->imageSize.cy + 2; … … 940 940 if (lpBand->fStatus & HAS_TEXT) { 941 941 lpBand->fDraw |= DRAW_TEXT; 942 lpBand->rcCapText.right = max(lpBand->rcCapText.left, 942 lpBand->rcCapText.right = max(lpBand->rcCapText.left, 943 943 lpBand->rcCapText.right-REBAR_POST_TEXT); 944 944 } … … 959 959 960 960 /* flag if notify required and invalidate rectangle */ 961 if (notify && 961 if (notify && 962 962 ((oldChild.right-oldChild.left != lpBand->rcChild.right-lpBand->rcChild.left) || 963 963 (oldChild.bottom-oldChild.top != lpBand->rcChild.bottom-lpBand->rcChild.top))) { … … 971 971 if (lpBand->fDraw & NTF_INVALIDATE) { 972 972 TRACE("invalidating (%d,%d)-(%d,%d)\n", 973 lpBand->rcBand.left, 973 lpBand->rcBand.left, 974 974 lpBand->rcBand.top, 975 lpBand->rcBand.right + ((lpBand->fDraw & DRAW_RIGHTSEP) ? SEP_WIDTH_SIZE : 0), 975 lpBand->rcBand.right + ((lpBand->fDraw & DRAW_RIGHTSEP) ? SEP_WIDTH_SIZE : 0), 976 976 lpBand->rcBand.bottom + ((lpBand->fDraw & DRAW_BOTTOMSEP) ? SEP_WIDTH_SIZE : 0)); 977 977 lpBand->fDraw &= ~NTF_INVALIDATE; … … 1047 1047 xoff = REBAR_ALWAYS_SPACE; 1048 1048 /* initialize Caption image rectangle */ 1049 SetRect (&lpBand->rcCapImage, 1049 SetRect (&lpBand->rcCapImage, 1050 1050 lpBand->rcBand.left, lpBand->rcBand.top+xoff, 1051 1051 lpBand->rcBand.right, lpBand->rcBand.top+xoff); … … 1060 1060 1061 1061 /* set initial caption text rectangle */ 1062 SetRect (&lpBand->rcCapText, 1062 SetRect (&lpBand->rcCapText, 1063 1063 lpBand->rcBand.left, lpBand->rcCapImage.bottom+REBAR_POST_IMAGE, 1064 1064 lpBand->rcBand.right, lpBand->rcBand.top+lpBand->cxHeader); … … 1071 1071 else { 1072 1072 /* set initial caption text rectangle */ 1073 SetRect (&lpBand->rcCapText, 1073 SetRect (&lpBand->rcCapText, 1074 1074 lpBand->rcBand.left, lpBand->rcCapImage.bottom, 1075 1075 lpBand->rcBand.right, lpBand->rcBand.top+lpBand->cxHeader); … … 1098 1098 1099 1099 /* flag if notify required and invalidate rectangle */ 1100 if (notify && 1100 if (notify && 1101 1101 ((oldChild.right-oldChild.left != lpBand->rcChild.right-lpBand->rcChild.left) || 1102 1102 (oldChild.bottom-oldChild.top != lpBand->rcChild.bottom-lpBand->rcChild.top))) { … … 1110 1110 if (lpBand->fDraw & NTF_INVALIDATE) { 1111 1111 TRACE("invalidating (%d,%d)-(%d,%d)\n", 1112 lpBand->rcBand.left, 1112 lpBand->rcBand.left, 1113 1113 lpBand->rcBand.top, 1114 lpBand->rcBand.right + ((lpBand->fDraw & DRAW_BOTTOMSEP) ? SEP_WIDTH_SIZE : 0), 1114 lpBand->rcBand.right + ((lpBand->fDraw & DRAW_BOTTOMSEP) ? SEP_WIDTH_SIZE : 0), 1115 1115 lpBand->rcBand.bottom + ((lpBand->fDraw & DRAW_RIGHTSEP) ? SEP_WIDTH_SIZE : 0)); 1116 1116 lpBand->fDraw &= ~NTF_INVALIDATE; … … 1225 1225 } 1226 1226 1227 TRACE("hwnd % 08x, style=%08lx, setting at (%d,%d) for (%d,%d)\n",1227 TRACE("hwnd %p, style=%08lx, setting at (%d,%d) for (%d,%d)\n", 1228 1228 infoPtr->hwndSelf, infoPtr->dwStyle, 1229 1229 x, y, width, height); … … 1251 1251 if (HIDDENBAND(lpBand)) continue; 1252 1252 if (lpBand->hwndChild) { 1253 TRACE("hwndChild = % x\n", lpBand->hwndChild);1253 TRACE("hwndChild = %p\n", lpBand->hwndChild); 1254 1254 1255 1255 /* Always geterate the RBN_CHILDSIZE even it child … … 1259 1259 rbcz.rcChild = lpBand->rcChild; 1260 1260 rbcz.rcBand = lpBand->rcBand; 1261 if (infoPtr->dwStyle & CCS_VERT) 1261 if (infoPtr->dwStyle & CCS_VERT) 1262 1262 rbcz.rcBand.top += lpBand->cxHeader; 1263 1263 else … … 1297 1297 1298 1298 /* center combo box inside child area */ 1299 TRACE("moving child (Combo(Ex)) % 04xto (%d,%d) for (%d,%d)\n",1299 TRACE("moving child (Combo(Ex)) %p to (%d,%d) for (%d,%d)\n", 1300 1300 lpBand->hwndChild, 1301 1301 lpBand->rcChild.left, yPos, … … 1312 1312 } 1313 1313 else { 1314 TRACE("moving child (Other) % 04xto (%d,%d) for (%d,%d)\n",1314 TRACE("moving child (Other) %p to (%d,%d) for (%d,%d)\n", 1315 1315 lpBand->hwndChild, 1316 1316 lpBand->rcChild.left, lpBand->rcChild.top, … … 1401 1401 1402 1402 /* save height of original control */ 1403 if (infoPtr->dwStyle & CCS_VERT) 1403 if (infoPtr->dwStyle & CCS_VERT) 1404 1404 origheight = infoPtr->calcSize.cx; 1405 1405 else … … 1440 1440 1441 1441 /* separator from previous band */ 1442 cxsep = (cntonrow == 0) ? 0 : SEP_WIDTH; 1442 cxsep = (cntonrow == 0) ? 0 : SEP_WIDTH; 1443 1443 1444 1444 /* Header: includes gripper, text, image */ 1445 cx = lpBand->cxHeader; 1445 cx = lpBand->cxHeader; 1446 1446 if (lpBand->fStyle & RBBS_FIXEDSIZE) cx = lpBand->lcx; 1447 1447 … … 1485 1485 } 1486 1486 1487 if (mcy < lpBand->lcy + REBARSPACE(lpBand)) 1487 if (mcy < lpBand->lcy + REBARSPACE(lpBand)) 1488 1488 mcy = lpBand->lcy + REBARSPACE(lpBand); 1489 1489 … … 1514 1514 bottomy = (lpRect) ? min(clientcy, y+cxsep+cx) : y+cxsep+cx; 1515 1515 lpBand->rcBand.left = x; 1516 lpBand->rcBand.right = x + min(mcy, 1516 lpBand->rcBand.right = x + min(mcy, 1517 1517 lpBand->lcy+REBARSPACE(lpBand)); 1518 1518 lpBand->rcBand.top = min(bottomy, y + cxsep); … … 1528 1528 lpBand->rcBand.right = rightx; 1529 1529 lpBand->rcBand.top = y; 1530 lpBand->rcBand.bottom = y + min(mcy, 1530 lpBand->rcBand.bottom = y + min(mcy, 1531 1531 lpBand->lcy+REBARSPACE(lpBand)); 1532 1532 lpBand->uMinHeight = lpBand->lcy; … … 1616 1616 1617 1617 /* FIXME: problem # 2 */ 1618 if (((infoPtr->dwStyle & CCS_VERT) ? 1618 if (((infoPtr->dwStyle & CCS_VERT) ? 1619 1619 #if PROBLEM2 1620 1620 (x < adjcx) : (y < adjcy) … … 1698 1698 } 1699 1699 } 1700 if ((infoPtr->dwStyle & CCS_VERT) ? (x >= adjcx) : (y >= adjcy)) 1700 if ((infoPtr->dwStyle & CCS_VERT) ? (x >= adjcx) : (y >= adjcy)) 1701 1701 break; /* all done */ 1702 1702 } … … 1762 1762 if(HIDDENBAND(lpBand)) continue; 1763 1763 if (lpBand->fMask & RBBS_VARIABLEHEIGHT) continue; 1764 if (((INT)lpBand->cyMaxChild < 1) || 1764 if (((INT)lpBand->cyMaxChild < 1) || 1765 1765 ((INT)lpBand->cyIntegral < 1)) { 1766 1766 if (lpBand->cyMaxChild + lpBand->cyIntegral == 0) continue; … … 1770 1770 } 1771 1771 /* j is now the maximum height/width in the client area */ 1772 j = ((diff / lpBand->cyIntegral) * lpBand->cyIntegral) + 1772 j = ((diff / lpBand->cyIntegral) * lpBand->cyIntegral) + 1773 1773 ircBw(lpBand); 1774 if (j > lpBand->cyMaxChild + REBARSPACE(lpBand)) 1774 if (j > lpBand->cyMaxChild + REBARSPACE(lpBand)) 1775 1775 j = lpBand->cyMaxChild + REBARSPACE(lpBand); 1776 1776 diff -= (j - ircBw(lpBand)); … … 1828 1828 mcy = 0; 1829 1829 1830 TRACE("P3 processing row %d, starting band %d, ending band %d\n", 1830 TRACE("P3 processing row %d, starting band %d, ending band %d\n", 1831 1831 i, p->istartband, p->iendband); 1832 1832 … … 1840 1840 1841 1841 REBAR_AdjustBands (infoPtr, p->istartband, p->iendband, 1842 (infoPtr->dwStyle & CCS_VERT) ? 1842 (infoPtr->dwStyle & CCS_VERT) ? 1843 1843 clientcy : clientcx, mcy); 1844 1844 } … … 1850 1850 } 1851 1851 else { 1852 REBAR_CalcHorzBand (infoPtr, 0, infoPtr->uNumBands, 1852 REBAR_CalcHorzBand (infoPtr, 0, infoPtr->uNumBands, 1853 1853 notify); 1854 1854 } … … 1876 1876 TRACE("horz, notify=%d, y=%d, origheight=%d\n", 1877 1877 notify, y, origheight); 1878 if (notify && (y != origheight)) infoPtr->fStatus |= NTF_HGHTCHG; 1878 if (notify && (y != origheight)) infoPtr->fStatus |= NTF_HGHTCHG; 1879 1879 } 1880 1880 … … 1943 1943 /* calculate gripper rectangle */ 1944 1944 if ( (!(lpBand->fStyle & RBBS_NOGRIPPER)) && 1945 ( (lpBand->fStyle & RBBS_GRIPPERALWAYS) || 1945 ( (lpBand->fStyle & RBBS_GRIPPERALWAYS) || 1946 1946 ( !(lpBand->fStyle & RBBS_FIXEDSIZE) && (nonfixed > 1))) 1947 1947 ) { … … 2061 2061 } 2062 2062 else { 2063 TRACE("child: 0x%x prev parent: 0x%x\n",2063 TRACE("child: %p prev parent: %p\n", 2064 2064 lpBand->hwndChild, lpBand->hwndPrevParent); 2065 2065 lpBand->hwndChild = 0; … … 2186 2186 rect = lpBand->rcBand; 2187 2187 TRACE("%s background color=0x%06lx, band (%d,%d)-(%d,%d), clip (%d,%d)-(%d,%d)\n", 2188 (lpBand->clrBack == CLR_NONE) ? "none" : 2188 (lpBand->clrBack == CLR_NONE) ? "none" : 2189 2189 ((lpBand->clrBack == CLR_DEFAULT) ? "dft" : ""), 2190 2190 GetBkColor(hdc), … … 2393 2393 if (i < ihitBand) 2394 2394 LHeaderSum += (band->lcx + SEP_WIDTH); 2395 else 2395 else 2396 2396 RHeaderSum += (band->lcx + SEP_WIDTH); 2397 2397 … … 2426 2426 REBAR_DumpBand (infoPtr); 2427 2427 2428 if (movement < 0) { 2428 if (movement < 0) { 2429 2429 2430 2430 /* *** Drag left/up *** */ … … 2441 2441 if (HIDDENBAND(band)) continue; 2442 2442 if (i == ihitBand) { 2443 LEADJ(band, movement) 2443 LEADJ(band, movement); 2444 2444 } 2445 else 2445 else 2446 2446 movement = REBAR_Shrink (infoPtr, band, movement, i); 2447 2447 band->ccx = rcBw(band); … … 2464 2464 if (first) { 2465 2465 first = FALSE; 2466 READJ(band, movement) 2466 READJ(band, movement); 2467 2467 } 2468 else 2468 else 2469 2469 movement = REBAR_Shrink (infoPtr, band, movement, i); 2470 2470 band->ccx = rcBw(band); … … 2478 2478 } 2479 2479 else { 2480 REBAR_CalcHorzBand (infoPtr, imindBand, imaxdBand+1, 2480 REBAR_CalcHorzBand (infoPtr, imindBand, imaxdBand+1, 2481 2481 FALSE); 2482 2482 } … … 2486 2486 REBAR_DumpBand (infoPtr); 2487 2487 2488 SetRect (&newrect, 2488 SetRect (&newrect, 2489 2489 mindBand->rcBand.left, 2490 2490 mindBand->rcBand.top, … … 2653 2653 lprbbi->lpText[lprbbi->cch-1] = 0; 2654 2654 } 2655 else 2655 else 2656 2656 *lprbbi->lpText = 0; 2657 2657 } … … 2735 2735 if (lpBand->lpText && (lpBand->fMask & RBBIM_TEXT)) 2736 2736 lstrcpynW (lprbbi->lpText, lpBand->lpText, lprbbi->cch); 2737 else 2737 else 2738 2738 *lprbbi->lpText = 0; 2739 2739 } … … 2916 2916 REBAR_GetToolTips (REBAR_INFO *infoPtr) 2917 2917 { 2918 return infoPtr->hwndToolTip;2918 return (LRESULT)infoPtr->hwndToolTip; 2919 2919 } 2920 2920 … … 2923 2923 REBAR_GetUnicodeFormat (REBAR_INFO *infoPtr) 2924 2924 { 2925 TRACE("%s hwnd= 0x%x\n",2925 TRACE("%s hwnd=%p\n", 2926 2926 infoPtr->bUnicode ? "TRUE" : "FALSE", infoPtr->hwndSelf); 2927 2927 … … 2941 2941 REBAR_HitTest (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 2942 2942 { 2943 LPRBHITTESTINFO lprbht = (LPRBHITTESTINFO)lParam; 2943 LPRBHITTESTINFO lprbht = (LPRBHITTESTINFO)lParam; 2944 2944 2945 2945 if (!lprbht) … … 3250 3250 startBand = uBand; 3251 3251 endBand = iprevBand; 3252 SetRect (&newrect, 3252 SetRect (&newrect, 3253 3253 lpBand->rcBand.left, 3254 3254 lpBand->rcBand.top, … … 3276 3276 startBand = iprevBand; 3277 3277 endBand = uBand; 3278 SetRect (&newrect, 3278 SetRect (&newrect, 3279 3279 band->rcBand.left, 3280 3280 band->rcBand.top, … … 3291 3291 } 3292 3292 else { 3293 REBAR_CalcHorzBand (infoPtr, startBand, endBand+1, 3293 REBAR_CalcHorzBand (infoPtr, startBand, endBand+1, 3294 3294 FALSE); 3295 3295 } … … 3554 3554 BOOL bTemp = infoPtr->bUnicode; 3555 3555 3556 TRACE("to %s hwnd= 0x%04x, was %s\n",3556 TRACE("to %s hwnd=%p, was %s\n", 3557 3557 ((BOOL)wParam) ? "TRUE" : "FALSE", infoPtr->hwndSelf, 3558 3558 (bTemp) ? "TRUE" : "FALSE"); 3559 3559 3560 3560 infoPtr->bUnicode = (BOOL)wParam; 3561 3561 3562 3562 return bTemp; 3563 3563 } … … 3879 3879 /* issue WM_NOTIFYFORMAT to get unicode status of parent */ 3880 3880 i = SendMessageA(REBAR_GetNotifyParent (infoPtr), 3881 WM_NOTIFYFORMAT, hwnd, NF_QUERY);3881 WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_QUERY); 3882 3882 if ((i < NFR_ANSI) || (i > NFR_UNICODE)) { 3883 3883 ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n", … … 3893 3893 /* get font handle for Caption Font */ 3894 3894 ncm.cbSize = sizeof(NONCLIENTMETRICSA); 3895 SystemParametersInfoA (SPI_GETNONCLIENTMETRICS, 3895 SystemParametersInfoA (SPI_GETNONCLIENTMETRICS, 3896 3896 ncm.cbSize, &ncm, 0); 3897 3897 /* if the font is bold, set to normal */ … … 3953 3953 clpt = pt; 3954 3954 ScreenToClient (infoPtr->hwndSelf, &clpt); 3955 REBAR_InternalHitTest (infoPtr, &clpt, &scrap, 3955 REBAR_InternalHitTest (infoPtr, &clpt, &scrap, 3956 3956 (INT *)&nmmouse.dwItemSpec); 3957 3957 nmmouse.dwItemData = 0; … … 3960 3960 if ((i = REBAR_Notify((NMHDR *) &nmmouse, infoPtr, NM_NCHITTEST))) { 3961 3961 TRACE("notify changed return value from %ld to %d\n", 3962 ret, i); 3962 ret, i); 3963 3963 ret = (LRESULT) i; 3964 3964 } … … 4002 4002 if (lParam == NF_REQUERY) { 4003 4003 i = SendMessageA(REBAR_GetNotifyParent (infoPtr), 4004 WM_NOTIFYFORMAT, infoPtr->hwndSelf, NF_QUERY);4004 WM_NOTIFYFORMAT, (WPARAM)infoPtr->hwndSelf, NF_QUERY); 4005 4005 if ((i < NFR_ANSI) || (i > NFR_UNICODE)) { 4006 4006 ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n", … … 4102 4102 * 4103 4103 * Documentation: 4104 * According to testing V4.71 of COMCTL32 returns the 4104 * According to testing V4.71 of COMCTL32 returns the 4105 4105 * *previous* status of the redraw flag (either 0 or -1) 4106 4106 * instead of the MSDN documented value of 0 if handled … … 4110 4110 BOOL oldredraw = infoPtr->DoRedraw; 4111 4111 4112 TRACE("set to %s, fStatus=%08x\n", 4112 TRACE("set to %s, fStatus=%08x\n", 4113 4113 (wParam) ? "TRUE" : "FALSE", infoPtr->fStatus); 4114 4114 infoPtr->DoRedraw = (BOOL) wParam; … … 4153 4153 rcWin.left, rcWin.top, rcWin.right, rcWin.bottom); 4154 4154 4155 if ((lParam == 0) && (rcWin.right-rcWin.left == 0) && 4155 if ((lParam == 0) && (rcWin.right-rcWin.left == 0) && 4156 4156 (rcWin.bottom-rcWin.top == 0)) { 4157 4157 /* native control seems to do this */ 4158 4158 GetClientRect (GetParent(infoPtr->hwndSelf), &rcClient); 4159 TRACE("sizing rebar, message and client zero, parent client (%d,%d)\n", 4159 TRACE("sizing rebar, message and client zero, parent client (%d,%d)\n", 4160 4160 rcClient.right, rcClient.bottom); 4161 4161 } … … 4171 4171 /* do the actual WM_SIZE request */ 4172 4172 GetClientRect (infoPtr->hwndSelf, &rcClient); 4173 TRACE("sizing rebar from (%ld,%ld) to (%d,%d), client (%d,%d)\n", 4173 TRACE("sizing rebar from (%ld,%ld) to (%d,%d), client (%d,%d)\n", 4174 4174 infoPtr->calcSize.cx, infoPtr->calcSize.cy, 4175 4175 LOWORD(lParam), HIWORD(lParam), … … 4191 4191 /* native seems to use the current client rect for the size */ 4192 4192 infoPtr->fStatus |= BAND_NEEDS_LAYOUT; 4193 TRACE("sizing rebar to client (%d,%d) size is zero but AUTOSIZE set\n", 4193 TRACE("sizing rebar to client (%d,%d) size is zero but AUTOSIZE set\n", 4194 4194 rcClient.right, rcClient.bottom); 4195 4195 } 4196 4196 else { 4197 TRACE("sizing rebar from (%ld,%ld) to (%d,%d), client (%d,%d)\n", 4197 TRACE("sizing rebar from (%ld,%ld) to (%d,%d), client (%d,%d)\n", 4198 4198 infoPtr->calcSize.cx, infoPtr->calcSize.cy, 4199 4199 LOWORD(lParam), HIWORD(lParam), … … 4209 4209 autosize.rcActual = autosize.rcTarget; /* ??? */ 4210 4210 REBAR_Notify((NMHDR *) &autosize, infoPtr, RBN_AUTOSIZE); 4211 TRACE("RBN_AUTOSIZE client=(%d,%d), lp=%08lx\n", 4211 TRACE("RBN_AUTOSIZE client=(%d,%d), lp=%08lx\n", 4212 4212 autosize.rcTarget.right, autosize.rcTarget.bottom, lParam); 4213 4213 } … … 4247 4247 infoPtr->origin.x = lpwp->x; 4248 4248 infoPtr->origin.y = lpwp->y; 4249 ret = DefWindowProcA(infoPtr->hwndSelf, WM_WINDOWPOSCHANGED, 4249 ret = DefWindowProcA(infoPtr->hwndSelf, WM_WINDOWPOSCHANGED, 4250 4250 wParam, lParam); 4251 4251 GetWindowRect(infoPtr->hwndSelf, &rc); 4252 TRACE("hwnd % 08xnew pos (%d,%d)-(%d,%d)\n",4252 TRACE("hwnd %p new pos (%d,%d)-(%d,%d)\n", 4253 4253 infoPtr->hwndSelf, rc.left, rc.top, rc.right, rc.bottom); 4254 4254 return ret; … … 4261 4261 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 4262 4262 4263 TRACE("hwnd=% x msg=%x wparam=%x lparam=%lx\n",4263 TRACE("hwnd=%p msg=%x wparam=%x lparam=%lx\n", 4264 4264 hwnd, uMsg, /* SPY_GetMsgName(uMsg), */ wParam, lParam); 4265 4265 if (!infoPtr && (uMsg != WM_NCCREATE)) … … 4463 4463 /* case WM_SYSCOLORCHANGE: supported according to ControlSpy */ 4464 4464 /* "Applications that have brushes using the existing system colors 4465 should delete those brushes and recreate them using the new 4465 should delete those brushes and recreate them using the new 4466 4466 system colors." per MSDN */ 4467 4467 … … 4473 4473 4474 4474 default: 4475 if ( uMsg >= WM_USER)4475 if ((uMsg >= WM_USER) && (uMsg < WM_APP)) 4476 4476 ERR("unknown msg %04x wp=%08x lp=%08lx\n", 4477 4477 uMsg, wParam, lParam); … … 4498 4498 #endif 4499 4499 wndClass.lpszClassName = REBARCLASSNAMEA; 4500 4500 4501 4501 RegisterClassA (&wndClass); 4502 4502 … … 4512 4512 UnregisterClassA (REBARCLASSNAMEA, (HINSTANCE)NULL); 4513 4513 } 4514 -
trunk/src/comctl32/tab.c
r8382 r9370 46 46 LPARAM lParam; 47 47 RECT rect; /* bounding rectangle of the item relative to the 48 * leftmost item (the leftmost item, 0, would have a 49 * "left" member of 0 in this rectangle) 50 * 48 * leftmost item (the leftmost item, 0, would have a 49 * "left" member of 0 in this rectangle) 50 * 51 51 * additionally the top member hold the row number 52 52 * and bottom is unused and should be 0 */ … … 70 70 TAB_ITEM* items; /* pointer to an array of TAB_ITEM's */ 71 71 BOOL DoRedraw; /* flag for redrawing when tab contents is changed*/ 72 BOOL needsScrolling; /* TRUE if the size of the tabs is greater than 72 BOOL needsScrolling; /* TRUE if the size of the tabs is greater than 73 73 * the size of the control */ 74 74 BOOL fSizeSet; /* was the size of the tabs explicitly set? */ … … 81 81 */ 82 82 #define SELECTED_TAB_OFFSET 2 83 #define HORIZONTAL_ITEM_PADDING 583 #define HORIZONTAL_ITEM_PADDING 6 84 84 #define VERTICAL_ITEM_PADDING 3 85 85 #define ROUND_CORNER_SIZE 2 … … 88 88 #define CONTROL_BORDER_SIZEX 2 89 89 #define CONTROL_BORDER_SIZEY 2 90 #define BUTTON_SPACINGX 4 90 #define BUTTON_SPACINGX 4 91 91 #define BUTTON_SPACINGY 4 92 92 #define FLAT_BTN_SPACINGX 8 … … 140 140 } 141 141 142 static void 143 TAB_DumpItemExternalA(TCITEMA *pti, UINT iItem) 144 { 145 if (TRACE_ON(tab)) { 146 TRACE("external tab %d, mask=0x%08x, dwState=0x%08x, dwStateMask=0x%08x, cchTextMax=0x%08x\n", 147 iItem, pti->mask, pti->dwState, pti->dwStateMask, pti->cchTextMax); 148 TRACE("external tab %d, iImage=%d, lParam=0x%08lx, pszTextA=%s\n", 149 iItem, pti->iImage, pti->lParam, debugstr_a(pti->pszText)); 150 } 151 } 152 153 154 static void 155 TAB_DumpItemExternalW(TCITEMW *pti, UINT iItem) 156 { 157 if (TRACE_ON(tab)) { 158 TRACE("external tab %d, mask=0x%08x, dwState=0x%08lx, dwStateMask=0x%08lx, cchTextMax=0x%08x\n", 159 iItem, pti->mask, pti->dwState, pti->dwStateMask, pti->cchTextMax); 160 TRACE("external tab %d, iImage=%d, lParam=0x%08lx, pszTextW=%s\n", 161 iItem, pti->iImage, pti->lParam, debugstr_w(pti->pszText)); 162 } 163 } 164 165 static void 166 TAB_DumpItemInternal(TAB_INFO *infoPtr, UINT iItem) 167 { 168 if (TRACE_ON(tab)) { 169 TAB_ITEM *ti; 170 171 ti = &infoPtr->items[iItem]; 172 TRACE("tab %d, mask=0x%08x, dwState=0x%08lx, pszText=%s, iImage=%d\n", 173 iItem, ti->mask, ti->dwState, debugstr_w(ti->pszText), 174 ti->iImage); 175 TRACE("tab %d, lParam=0x%08lx, rect.left=%d, rect.top(row)=%d\n", 176 iItem, ti->lParam, ti->rect.left, ti->rect.top); 177 } 178 } 179 142 180 static LRESULT 143 181 TAB_GetCurSel (HWND hwnd) 144 182 { 145 183 TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd); 146 184 147 185 return infoPtr->iSelected; 148 186 } … … 152 190 { 153 191 TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd); 154 192 155 193 return infoPtr->uFocus; 156 194 } … … 162 200 163 201 if (infoPtr == NULL) return 0; 164 return infoPtr->hwndToolTip;202 return (LRESULT)infoPtr->hwndToolTip; 165 203 } 166 204 … … 171 209 INT iItem = (INT)wParam; 172 210 INT prevItem; 173 211 174 212 prevItem = -1; 175 213 if ((iItem >= 0) && (iItem < infoPtr->uNumItem)) { … … 187 225 TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd); 188 226 INT iItem=(INT) wParam; 189 227 190 228 if ((iItem < 0) || (iItem >= infoPtr->uNumItem)) return 0; 191 229 192 230 if (GetWindowLongA(hwnd, GWL_STYLE) & TCS_BUTTONS) { 193 231 FIXME("Should set input focus\n"); 194 } else { 232 } else { 195 233 int oldFocus = infoPtr->uFocus; 196 234 if (infoPtr->iSelected != iItem || infoPtr->uFocus == -1 ) { … … 239 277 RECT tmpItemRect,clientRect; 240 278 LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); 241 279 242 280 /* Perform a sanity check and a trivial visibility check. */ 243 281 if ( (infoPtr->uNumItem <= 0) || … … 252 290 if (itemRect == NULL) 253 291 itemRect = &tmpItemRect; 254 292 255 293 /* Retrieve the unmodified item rect. */ 256 294 *itemRect = infoPtr->items[itemIndex].rect; … … 287 325 else if(!(lStyle & TCS_VERTICAL) && !(lStyle & TCS_BOTTOM)) /* not TCS_BOTTOM and not TCS_VERTICAL */ 288 326 { 289 itemRect->bottom = clientRect.top + 327 itemRect->bottom = clientRect.top + 290 328 infoPtr->tabHeight + 291 329 itemRect->top * (infoPtr->tabHeight - 2) + 292 330 ((lStyle & TCS_BUTTONS) ? itemRect->top * BUTTON_SPACINGY : 0); 293 itemRect->top = clientRect.top + 331 itemRect->top = clientRect.top + 294 332 SELECTED_TAB_OFFSET + 295 333 itemRect->top * (infoPtr->tabHeight - 2) + … … 298 336 299 337 /* 300 * "scroll" it to make sure the item at the very left of the 338 * "scroll" it to make sure the item at the very left of the 301 339 * tab control is the leftmost visible tab. 302 340 */ … … 318 356 { 319 357 OffsetRect(itemRect, 320 -infoPtr->items[infoPtr->leftmostVisible].rect.left, 358 -infoPtr->items[infoPtr->leftmostVisible].rect.left, 321 359 0); 322 360 … … 329 367 0); 330 368 } 369 TRACE("item %d tab h=%d, rect=(%d,%d)-(%d,%d)\n", 370 itemIndex, infoPtr->tabHeight, 371 itemRect->left, itemRect->top, itemRect->right, itemRect->bottom); 331 372 332 373 /* Now, calculate the position of the item as if it were selected. */ … … 343 384 /* If it also a bit higher. */ 344 385 if ((lStyle & TCS_BOTTOM) && !(lStyle & TCS_VERTICAL)) 345 { 386 { 346 387 selectedRect->top -= 2; /* the border is thicker on the bottom */ 347 388 selectedRect->bottom += SELECTED_TAB_OFFSET; … … 369 410 static BOOL TAB_GetItemRect(HWND hwnd, WPARAM wParam, LPARAM lParam) 370 411 { 371 return TAB_InternalGetItemRect(hwnd, TAB_GetInfoPtr(hwnd), (INT)wParam, 412 return TAB_InternalGetItemRect(hwnd, TAB_GetInfoPtr(hwnd), (INT)wParam, 372 413 (LPRECT)lParam, (LPRECT)NULL); 373 414 } … … 379 420 */ 380 421 static LRESULT TAB_KeyUp( 381 HWND hwnd, 422 HWND hwnd, 382 423 WPARAM keyCode) 383 424 { … … 394 435 break; 395 436 } 396 437 397 438 /* 398 439 * If we changed to a valid item, change the selection … … 423 464 */ 424 465 static LRESULT TAB_FocusChanging( 425 HWND hwnd, 426 UINT uMsg, 427 WPARAM wParam, 466 HWND hwnd, 467 UINT uMsg, 468 WPARAM wParam, 428 469 LPARAM lParam) 429 470 { … … 440 481 NULL, 441 482 &selectedRect); 442 483 443 484 /* 444 485 * If the rectangle is not completely invisible, invalidate that … … 447 488 if (isVisible) 448 489 { 490 TRACE("invalidate (%d,%d)-(%d,%d)\n", 491 selectedRect.left,selectedRect.top, 492 selectedRect.right,selectedRect.bottom); 449 493 InvalidateRect(hwnd, &selectedRect, TRUE); 450 494 } … … 456 500 } 457 501 458 static HWNDTAB_InternalHitTest (502 static INT TAB_InternalHitTest ( 459 503 HWND hwnd, 460 TAB_INFO* infoPtr, 461 POINT pt, 504 TAB_INFO* infoPtr, 505 POINT pt, 462 506 UINT* flags) 463 507 464 508 { 465 509 RECT rect; 466 int iCount;467 510 INT iCount; 511 468 512 for (iCount = 0; iCount < infoPtr->uNumItem; iCount++) 469 513 { … … 486 530 TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd); 487 531 LPTCHITTESTINFO lptest = (LPTCHITTESTINFO) lParam; 488 532 489 533 return TAB_InternalHitTest (hwnd, infoPtr, lptest->pt, &lptest->flags); 490 534 } … … 537 581 TAB_RelayEvent (infoPtr->hwndToolTip, hwnd, 538 582 WM_LBUTTONDOWN, wParam, lParam); 539 583 540 584 pt.x = (INT)LOWORD(lParam); 541 585 pt.y = (INT)HIWORD(lParam); 542 586 543 587 newItem = TAB_InternalHitTest (hwnd, infoPtr, pt, &dummy); 544 588 545 589 TRACE("On Tab, item %d\n", newItem); 546 590 … … 626 670 ** overlaps. Note also that the case where the cursor stayed within our 627 671 ** window but has moved off the hot-tracked tab will be handled by the 628 ** WM_MOUSEMOVE event. 672 ** WM_MOUSEMOVE event. 629 673 */ 630 674 if (!GetCursorPos(&pt) || WindowFromPoint(pt) != hwnd) … … 771 815 */ 772 816 static LRESULT TAB_AdjustRect( 773 HWND hwnd, 774 WPARAM fLarger, 817 HWND hwnd, 818 WPARAM fLarger, 775 819 LPRECT prc) 776 820 { … … 852 896 */ 853 897 static LRESULT TAB_OnHScroll( 854 HWND hwnd, 898 HWND hwnd, 855 899 int nScrollCode, 856 900 int nPos, … … 878 922 * TAB_SetupScrolling 879 923 * 880 * This method will check the current scrolling state and make sure the 924 * This method will check the current scrolling state and make sure the 881 925 * scrolling control is displayed (or not). 882 926 */ … … 943 987 controlPos.bottom - controlPos.top, 944 988 hwnd, 945 (HMENU)NULL, 946 (HINSTANCE)NULL, 947 NULL); 989 (HMENU)NULL, 990 (HINSTANCE)NULL, 991 NULL); 948 992 } 949 993 else 950 994 { 951 SetWindowPos(infoPtr->hwndUpDown, 995 SetWindowPos(infoPtr->hwndUpDown, 952 996 (HWND)NULL, 953 997 controlPos.left, controlPos.top, 954 998 controlPos.right - controlPos.left, 955 999 controlPos.bottom - controlPos.top, 956 SWP_SHOWWINDOW | SWP_NOZORDER); 1000 SWP_SHOWWINDOW | SWP_NOZORDER); 957 1001 } 958 1002 … … 1017 1061 * a font. 1018 1062 */ 1019 hdc = GetDC(hwnd); 1020 1063 hdc = GetDC(hwnd); 1064 1021 1065 hFont = infoPtr->hFont ? infoPtr->hFont : GetStockObject (SYSTEM_FONT); 1022 1066 hOldFont = SelectObject (hdc, hFont); … … 1029 1073 1030 1074 /* if TCS_VERTICAL then swap the height and width so this code places the 1031 tabs along the top of the rectangle and we can just rotate them after 1075 tabs along the top of the rectangle and we can just rotate them after 1032 1076 rather than duplicate all of the below code */ 1033 1077 if(lStyle & TCS_VERTICAL) … … 1061 1105 1062 1106 /* 1063 * Make sure there is enough space for the letters + icon + growing the 1064 * selected item + extra space for the selected item. 1107 * Make sure there is enough space for the letters + icon + growing the 1108 * selected item + extra space for the selected item. 1065 1109 */ 1066 infoPtr->tabHeight = item_height + 2 * VERTICAL_ITEM_PADDING + 1067 SELECTED_TAB_OFFSET; 1068 1069 } 1110 infoPtr->tabHeight = item_height + SELECTED_TAB_OFFSET + 1111 ((lStyle & TCS_BUTTONS) ? 2 : 1) * 1112 VERTICAL_ITEM_PADDING; 1113 1114 TRACE("tabH=%d, tmH=%ld, iconh=%d\n", 1115 infoPtr->tabHeight, fontMetrics.tmHeight, icon_height); 1116 } 1117 1118 TRACE("client right=%d\n", clientRect.right); 1070 1119 1071 1120 for (curItem = 0; curItem < infoPtr->uNumItem; curItem++) … … 1102 1151 1103 1152 infoPtr->items[curItem].rect.right = infoPtr->items[curItem].rect.left + 1104 size.cx + icon_width + 1153 size.cx + icon_width + 1105 1154 num * HORIZONTAL_ITEM_PADDING; 1155 TRACE("for <%s>, l,r=%d,%d, num=%d\n", 1156 debugstr_w(infoPtr->items[curItem].pszText), 1157 infoPtr->items[curItem].rect.left, 1158 infoPtr->items[curItem].rect.right, 1159 num); 1106 1160 } 1107 1161 … … 1123 1177 infoPtr->items[curItem].rect.left = 0; 1124 1178 curItemRowCount++; 1179 TRACE("wrapping <%s>, l,r=%d,%d\n", 1180 debugstr_w(infoPtr->items[curItem].pszText), 1181 infoPtr->items[curItem].rect.left, 1182 infoPtr->items[curItem].rect.right); 1125 1183 } 1126 1184 … … 1129 1187 1130 1188 TRACE("TextSize: %li\n", size.cx); 1131 TRACE("Rect: T %i, L %i, B %i, R %i\n", 1189 TRACE("Rect: T %i, L %i, B %i, R %i\n", 1132 1190 infoPtr->items[curItem].rect.top, 1133 1191 infoPtr->items[curItem].rect.left, 1134 1192 infoPtr->items[curItem].rect.bottom, 1135 infoPtr->items[curItem].rect.right); 1193 infoPtr->items[curItem].rect.right); 1136 1194 1137 1195 /* … … 1159 1217 /* Don't need scrolling, then update infoPtr->leftmostVisible */ 1160 1218 if(!infoPtr->needsScrolling) 1161 infoPtr->leftmostVisible = 0; 1219 infoPtr->leftmostVisible = 0; 1162 1220 1163 1221 TAB_SetupScrolling(hwnd, infoPtr, &clientRect); … … 1186 1244 iItm++,iCount++) 1187 1245 { 1246 /* normalize the current rect */ 1247 1248 /* shift the item to the left side of the clientRect */ 1249 infoPtr->items[iItm].rect.right -= 1250 infoPtr->items[iItm].rect.left; 1251 infoPtr->items[iItm].rect.left = 0; 1252 1253 TRACE("r=%d, cl=%d, cl.r=%d, iCount=%d, iRow=%d, uNumRows=%d, remTab=%d, tabPerRow=%d\n", 1254 infoPtr->items[iItm].rect.right, 1255 curItemLeftPos, clientRect.right, 1256 iCount, iRow, infoPtr->uNumRows, remTab, tabPerRow); 1257 1188 1258 /* if we have reached the maximum number of tabs on this row */ 1189 1259 /* move to the next row, reset our current item left position and */ 1190 1260 /* the count of items on this row */ 1191 if (iCount >= ((iRow<remTab)?tabPerRow + 1:tabPerRow)) 1192 { 1193 iRow++; 1194 curItemLeftPos = 0; 1195 iCount = 0; 1196 } 1197 1198 /* normalize the current rect */ 1199 1200 /* shift the item to the left side of the clientRect */ 1201 infoPtr->items[iItm].rect.right -= 1202 infoPtr->items[iItm].rect.left; 1203 infoPtr->items[iItm].rect.left = 0; 1261 1262 /* ************ FIXME FIXME FIXME *************** */ 1263 /* */ 1264 /* FIXME: */ 1265 /* if vertical, */ 1266 /* if item n and n+1 are in the same row, */ 1267 /* then the display has n+1 lower (toward the */ 1268 /* bottom) than n. We do it just the */ 1269 /* opposite!!! */ 1270 /* */ 1271 /* ************ FIXME FIXME FIXME *************** */ 1272 1273 if (lStyle & TCS_VERTICAL) { 1274 /* Vert: Add the remaining tabs in the *last* remainder rows */ 1275 if (iCount >= ((iRow>=(INT)infoPtr->uNumRows - remTab)?tabPerRow + 1:tabPerRow)) { 1276 iRow++; 1277 curItemLeftPos = 0; 1278 iCount = 0; 1279 } 1280 } else { 1281 /* Horz: Add the remaining tabs in the *first* remainder rows */ 1282 if (iCount >= ((iRow<remTab)?tabPerRow + 1:tabPerRow)) { 1283 iRow++; 1284 curItemLeftPos = 0; 1285 iCount = 0; 1286 } 1287 } 1204 1288 1205 1289 /* shift the item to the right to place it as the next item in this row */ … … 1215 1299 else 1216 1300 curItemLeftPos = infoPtr->items[iItm].rect.right; 1301 1302 TRACE("arranging <%s>, l,r=%d,%d, row=%d\n", 1303 debugstr_w(infoPtr->items[iItm].pszText), 1304 infoPtr->items[iItm].rect.left, 1305 infoPtr->items[iItm].rect.right, 1306 infoPtr->items[iItm].rect.top); 1217 1307 } 1218 1308 1219 1309 /* 1220 1310 * Justify the rows … … 1223 1313 while(iIndexStart < infoPtr->uNumItem) 1224 1314 { 1225 /* 1315 /* 1226 1316 * find the indexs of the row 1227 1317 */ 1228 1318 /* find the first item on the next row */ 1229 1319 for (iIndexEnd=iIndexStart; 1230 (iIndexEnd < infoPtr->uNumItem) && 1320 (iIndexEnd < infoPtr->uNumItem) && 1231 1321 (infoPtr->items[iIndexEnd].rect.top == 1232 1322 infoPtr->items[iIndexStart].rect.top) ; … … 1234 1324 /* intentionally blank */; 1235 1325 1236 /* 1326 /* 1237 1327 * we need to justify these tabs so they fill the whole given 1238 1328 * client area … … 1252 1342 widthDiff = widthDiff / iCount; 1253 1343 /* add widthDiff/iCount, or extra space/items on row, to each item on this row */ 1254 for (iIndex=iIndexStart,iCount=0; iIndex < iIndexEnd; 1344 for (iIndex=iIndexStart,iCount=0; iIndex < iIndexEnd; 1255 1345 iIndex++,iCount++) 1256 1346 { 1257 1347 infoPtr->items[iIndex].rect.left += iCount * widthDiff; 1258 1348 infoPtr->items[iIndex].rect.right += (iCount + 1) * widthDiff; 1349 1350 TRACE("adjusting 1 <%s>, l,r=%d,%d\n", 1351 debugstr_w(infoPtr->items[iIndex].pszText), 1352 infoPtr->items[iIndex].rect.left, 1353 infoPtr->items[iIndex].rect.right); 1354 1259 1355 } 1260 1356 infoPtr->items[iIndex - 1].rect.right += remainder; … … 1264 1360 infoPtr->items[iIndexStart].rect.left = clientRect.left; 1265 1361 infoPtr->items[iIndexStart].rect.right = clientRect.right - 4; 1362 1363 TRACE("adjusting 2 <%s>, l,r=%d,%d\n", 1364 debugstr_w(infoPtr->items[iIndexStart].pszText), 1365 infoPtr->items[iIndexStart].rect.left, 1366 infoPtr->items[iIndexStart].rect.right); 1367 1266 1368 } 1267 1369 … … 1303 1405 * This method is used to draw the interior (text and icon) of a single tab 1304 1406 * into the tab control. 1305 */ 1407 */ 1306 1408 static void 1307 1409 TAB_DrawItemInterior … … 1318 1420 RECT localRect; 1319 1421 1320 HPEN htextPen = GetSysColorPen (COLOR_BTNTEXT);1422 HPEN htextPen; 1321 1423 HPEN holdPen; 1322 1424 INT oldBkMode; … … 1369 1471 * Text pen 1370 1472 */ 1473 htextPen = CreatePen( PS_SOLID, 1, GetSysColor(COLOR_BTNTEXT) ); 1371 1474 holdPen = SelectObject(hdc, htextPen); 1372 1475 1373 1476 oldBkMode = SetBkMode(hdc, TRANSPARENT); 1374 SetTextColor(hdc, GetSysColor((iItem == infoPtr->iHotTracked) ? COLOR_HIGHLIGHT : COLOR_BTNTEXT)); 1477 SetTextColor(hdc, (iItem == infoPtr->iHotTracked) ? 1478 comctl32_color.clrHighlight : comctl32_color.clrBtnText); 1375 1479 1376 1480 /* … … 1396 1500 id = GetWindowLongA( hwnd, GWL_ID ); 1397 1501 1398 /* 1502 /* 1399 1503 * put together the DRAWITEMSTRUCT 1400 1504 */ 1401 dis.CtlType = ODT_TAB; 1402 dis.CtlID = id; 1403 dis.itemID = iItem; 1404 dis.itemAction = ODA_DRAWENTIRE; 1505 dis.CtlType = ODT_TAB; 1506 dis.CtlID = id; 1507 dis.itemID = iItem; 1508 dis.itemAction = ODA_DRAWENTIRE; 1405 1509 if ( iItem == infoPtr->iSelected ) 1406 dis.itemState = ODS_SELECTED; 1407 else 1408 dis.itemState = 0; 1510 dis.itemState = ODS_SELECTED; 1511 else 1512 dis.itemState = 0; 1409 1513 dis.hwndItem = hwnd; /* */ 1410 dis.hDC = hdc; 1514 dis.hDC = hdc; 1411 1515 dis.rcItem = *drawRect; /* */ 1412 1516 dis.itemData = infoPtr->items[iItem].lParam; … … 1441 1545 rcTemp = *drawRect; 1442 1546 1547 rcText.left = rcText.top = rcText.right = rcText.bottom = 0; 1548 1443 1549 /* 1444 1550 * Setup for text output 1445 1551 */ 1446 1552 oldBkMode = SetBkMode(hdc, TRANSPARENT); 1447 SetTextColor(hdc, GetSysColor((iItem == infoPtr->iHotTracked) ? COLOR_HIGHLIGHT : COLOR_BTNTEXT)); 1553 SetTextColor(hdc, (iItem == infoPtr->iHotTracked) ? 1554 comctl32_color.clrHighlight : comctl32_color.clrBtnText); 1448 1555 1449 1556 /* get the rectangle that the text fits in */ … … 1461 1568 1462 1569 if(lStyle & TCS_VERTICAL) 1463 center_offset = ((drawRect->bottom - drawRect->top) - (cy + VERTICAL_ITEM_PADDING + (rcText.right - rcText.left))) / 2;1570 center_offset = ((drawRect->bottom - drawRect->top) - (cy + HORIZONTAL_ITEM_PADDING + (rcText.right - rcText.left))) / 2; 1464 1571 else 1465 1572 center_offset = ((drawRect->right - drawRect->left) - (cx + HORIZONTAL_ITEM_PADDING + (rcText.right - rcText.left))) / 2; 1466 1573 1574 TRACE("for <%s>, c_o=%d, draw=(%d,%d)-(%d,%d), textlen=%d\n", 1575 debugstr_w(infoPtr->items[iItem].pszText), center_offset, 1576 drawRect->left, drawRect->top, drawRect->right, drawRect->bottom, 1577 (rcText.right-rcText.left)); 1578 1467 1579 if((lStyle & TCS_VERTICAL) && (lStyle & TCS_BOTTOM)) 1468 1580 { 1469 /* rcImage.left = drawRect->left; */ /* explicit from above rcImage = *drawRect */1470 1581 rcImage.top = drawRect->top + center_offset; 1471 1582 rcImage.left = drawRect->right - cx; /* if tab is TCS_VERTICAL and TCS_BOTTOM, the text is drawn from the */ 1472 1583 /* right side of the tab, but the image still uses the left as its x position */ 1473 1584 /* this keeps the image always drawn off of the same side of the tab */ 1474 drawRect->top = rcImage.top + (cx + VERTICAL_ITEM_PADDING);1585 drawRect->top = rcImage.top + (cx + HORIZONTAL_ITEM_PADDING); 1475 1586 } 1476 1587 else if(lStyle & TCS_VERTICAL) 1477 1588 { 1478 /* rcImage.left = drawRect->left; */ /* explicit from above rcImage = *drawRect */1479 1589 rcImage.top = drawRect->bottom - cy - center_offset; 1480 1481 drawRect->bottom = rcImage.top - VERTICAL_ITEM_PADDING;1590 rcImage.left--; 1591 drawRect->bottom = rcImage.top - HORIZONTAL_ITEM_PADDING; 1482 1592 } 1483 1593 else /* normal style, whether TCS_BOTTOM or not */ 1484 1594 { 1485 rcImage.left = drawRect->left + center_offset; 1486 /* rcImage.top = drawRect->top; */ /* explicit from above rcImage = *drawRect */ 1487 1595 rcImage.left = drawRect->left + center_offset + 3; 1488 1596 drawRect->left = rcImage.left + cx + HORIZONTAL_ITEM_PADDING; 1597 rcImage.top -= (lStyle & TCS_BOTTOM) ? 2 : 1; 1489 1598 } 1490 1599 1600 TRACE("drawing image=%d, left=%d, top=%d\n", 1601 infoPtr->items[iItem].iImage, rcImage.left, rcImage.top-1); 1491 1602 ImageList_Draw 1492 1603 ( … … 1495 1606 hdc, 1496 1607 rcImage.left, 1497 rcImage.top + 1,1608 rcImage.top, 1498 1609 ILD_NORMAL 1499 1610 ); … … 1544 1655 if(lStyle & TCS_VERTICAL) 1545 1656 { 1546 if (!GetObjectA((infoPtr->hFont) ? 1657 if (!GetObjectA((infoPtr->hFont) ? 1547 1658 infoPtr->hFont : GetStockObject(SYSTEM_FONT), 1548 1659 sizeof(LOGFONTA),&logfont)) … … 1551 1662 1552 1663 lstrcpyA(logfont.lfFaceName, "Arial"); 1553 logfont.lfHeight = -MulDiv(iPointSize, GetDeviceCaps(hdc, LOGPIXELSY), 1664 logfont.lfHeight = -MulDiv(iPointSize, GetDeviceCaps(hdc, LOGPIXELSY), 1554 1665 72); 1555 1666 logfont.lfWeight = FW_NORMAL; … … 1604 1715 SetBkMode(hdc, oldBkMode); 1605 1716 SelectObject(hdc, holdPen); 1717 DeleteObject( htextPen ); 1606 1718 } 1607 1719 … … 1610 1722 * 1611 1723 * This method is used to draw a single tab into the tab control. 1612 */ 1724 */ 1613 1725 static void TAB_DrawItem( 1614 HWND hwnd, 1615 HDC hdc, 1726 HWND hwnd, 1727 HDC hdc, 1616 1728 INT iItem) 1617 1729 { … … 1621 1733 RECT selectedRect; 1622 1734 BOOL isVisible; 1623 RECT r; 1735 RECT r, fillRect, r1; 1736 INT clRight = 0; 1737 INT clBottom = 0; 1738 COLORREF bkgnd, corner; 1624 1739 1625 1740 /* … … 1634 1749 if (isVisible) 1635 1750 { 1636 HBRUSH hbr = CreateSolidBrush (GetSysColor(COLOR_BTNFACE));1637 HPEN hwPen = GetSysColorPen (COLOR_3DHILIGHT);1638 HPEN hbPen = GetSysColorPen (COLOR_3DDKSHADOW);1639 HPEN hShade = GetSysColorPen (COLOR_BTNSHADOW);1640 1641 HPEN holdPen;1642 BOOL deleteBrush = TRUE;1751 /* If you need to see what the control is doing, 1752 * then override these variables. They will change what 1753 * fill colors are used for filling the tabs, and the 1754 * corners when drawing the edge. 1755 */ 1756 bkgnd = comctl32_color.clrBtnFace; 1757 corner = comctl32_color.clrBtnFace; 1643 1758 1644 1759 if (lStyle & TCS_BUTTONS) 1645 1760 { 1761 HBRUSH hbr = CreateSolidBrush (bkgnd); 1762 BOOL deleteBrush = TRUE; 1763 1646 1764 /* Get item rectangle */ 1647 1765 r = itemRect; 1648 1766 1649 holdPen = SelectObject (hdc, hwPen);1650 1651 1767 /* Separators between flat buttons */ 1652 /* FIXME: test and correct this if necessary for TCS_FLATBUTTONS style */ 1653 if (lStyle & TCS_FLATBUTTONS) 1768 if (lStyle & TCS_FLATBUTTONS) 1654 1769 { 1655 int x = r.right + FLAT_BTN_SPACINGX - 2; 1656 1657 /* highlight */ 1658 MoveToEx (hdc, x, r.bottom - 1, NULL); 1659 LineTo (hdc, x, r.top - 1); 1660 x--; 1661 1662 /* shadow */ 1663 SelectObject(hdc, hbPen); 1664 MoveToEx (hdc, x, r.bottom - 1, NULL); 1665 LineTo (hdc, x, r.top - 1); 1666 1667 /* shade */ 1668 SelectObject (hdc, hShade ); 1669 MoveToEx (hdc, x - 1, r.bottom - 1, NULL); 1670 LineTo (hdc, x - 1, r.top - 1); 1770 r1 = r; 1771 r1.right += (FLAT_BTN_SPACINGX -2); 1772 DrawEdge(hdc, &r1, EDGE_ETCHED, BF_RIGHT); 1671 1773 } 1672 1774 … … 1676 1778 if (!((lStyle & TCS_OWNERDRAWFIXED) && infoPtr->fSizeSet)) 1677 1779 { 1678 COLORREF bk = GetSysColor(COLOR_3DHILIGHT);1679 1780 DeleteObject(hbr); 1680 1781 hbr = GetSysColorBrush(COLOR_SCROLLBAR); 1681 1782 1682 SetTextColor(hdc, GetSysColor(COLOR_3DFACE));1683 SetBkColor(hdc, bk);1783 SetTextColor(hdc, comctl32_color.clr3dFace); 1784 SetBkColor(hdc, comctl32_color.clr3dHilight); 1684 1785 1685 1786 /* if COLOR_WINDOW happens to be the same as COLOR_3DHILIGHT … … 1687 1788 * look different from the window background. 1688 1789 */ 1689 if ( bk == GetSysColor(COLOR_WINDOW))1790 if (comctl32_color.clr3dHilight == comctl32_color.clrWindow) 1690 1791 hbr = COMCTL32_hPattern55AABrush; 1691 1792 … … 1693 1794 } 1694 1795 1695 /* Erase the background*/1796 /* Clear interior */ 1696 1797 FillRect(hdc, &r, hbr); 1697 1798 1698 /* 1699 * Draw the tab now. 1700 * The rectangles calculated exclude the right and bottom 1701 * borders of the rectangle. To simplify the following code, those 1702 * borders are shaved-off beforehand. 1703 */ 1704 r.right--; 1705 r.bottom--; 1706 1707 /* highlight */ 1708 SelectObject(hdc, hwPen); 1709 MoveToEx (hdc, r.left, r.bottom, NULL); 1710 LineTo (hdc, r.right, r.bottom); 1711 LineTo (hdc, r.right, r.top + 1); 1712 1713 /* shadow */ 1714 SelectObject(hdc, hbPen); 1715 LineTo (hdc, r.left + 1, r.top + 1); 1716 LineTo (hdc, r.left + 1, r.bottom); 1717 1718 /* shade */ 1719 SelectObject (hdc, hShade ); 1720 MoveToEx (hdc, r.right, r.top, NULL); 1721 LineTo (hdc, r.left, r.top); 1722 LineTo (hdc, r.left, r.bottom); 1799 DrawEdge(hdc, &r, EDGE_SUNKEN, BF_SOFT|BF_RECT); 1800 } 1801 else /* ! selected */ 1802 { 1803 if (!(lStyle & TCS_FLATBUTTONS)) 1804 { 1805 /* Clear interior */ 1806 FillRect(hdc, &r, hbr); 1807 1808 DrawEdge(hdc, &r, EDGE_RAISED, BF_SOFT|BF_RECT); 1809 } 1810 } 1811 1812 /* Cleanup */ 1813 if (deleteBrush) DeleteObject(hbr); 1814 } 1815 else /* !TCS_BUTTONS */ 1816 { 1817 /* We draw a rectangle of different sizes depending on the selection 1818 * state. */ 1819 if (iItem == infoPtr->iSelected) { 1820 RECT rect; 1821 GetClientRect (hwnd, &rect); 1822 clRight = rect.right; 1823 clBottom = rect.bottom; 1824 r = selectedRect; 1723 1825 } 1724 1826 else 1725 {1726 /* Erase the background */1727 FillRect(hdc, &r, hbr);1728 1729 if (!(lStyle & TCS_FLATBUTTONS))1730 {1731 /* highlight */1732 MoveToEx (hdc, r.left, r.bottom, NULL);1733 LineTo (hdc, r.left, r.top);1734 LineTo (hdc, r.right, r.top);1735 1736 /* shadow */1737 SelectObject(hdc, hbPen);1738 LineTo (hdc, r.right, r.bottom);1739 LineTo (hdc, r.left, r.bottom);1740 1741 /* shade */1742 SelectObject (hdc, hShade );1743 MoveToEx (hdc, r.right - 1, r.top, NULL);1744 LineTo (hdc, r.right - 1, r.bottom - 1);1745 LineTo (hdc, r.left + 1, r.bottom - 1);1746 }1747 }1748 }1749 else /* !TCS_BUTTONS */1750 {1751 /* Background color */1752 DeleteObject(hbr);1753 hbr = CreateSolidBrush(GetSysColor(COLOR_BTNFACE));1754 1755 /* We draw a rectangle of different sizes depending on the selection1756 * state. */1757 if (iItem == infoPtr->iSelected)1758 r = selectedRect;1759 else1760 1827 r = itemRect; 1761 1828 1762 1829 /* 1763 * Erase the background. 1764 * This is necessary when drawing the selected item since it is larger 1765 * than the others, it might overlap with stuff already drawn by the 1830 * Erase the background. (Delay it but setup rectangle.) 1831 * This is necessary when drawing the selected item since it is larger 1832 * than the others, it might overlap with stuff already drawn by the 1766 1833 * other tabs 1767 */1768 FillRect(hdc, &r, hbr);1769 1770 /*1771 * Draw the tab now.1772 * The rectangles calculated exclude the right and bottom1773 * borders of the rectangle. To simplify the following code, those1774 * borders are shaved-off beforehand.1775 1834 */ 1776 r.right--; 1777 r.bottom--; 1778 1779 holdPen = SelectObject (hdc, hwPen); 1835 fillRect = r; 1836 1780 1837 if(lStyle & TCS_VERTICAL) 1781 1838 { 1839 /* These are for adjusting the drawing of a Selected tab */ 1840 /* The initial values are for the normal case of non-Selected */ 1841 int ZZ = 1; /* Do not strech if selected */ 1842 if (iItem == infoPtr->iSelected) { 1843 ZZ = 0; 1844 1845 /* if leftmost draw the line longer */ 1846 if(selectedRect.top == 0) 1847 fillRect.top += 2; 1848 /* if rightmost draw the line longer */ 1849 if(selectedRect.bottom == clBottom) 1850 fillRect.bottom -= 2; 1851 } 1852 1782 1853 if (lStyle & TCS_BOTTOM) 1783 1854 { 1784 /* highlight */ 1785 MoveToEx (hdc, r.left, r.top, NULL); 1786 LineTo (hdc, r.right - ROUND_CORNER_SIZE, r.top); 1787 LineTo (hdc, r.right, r.top + ROUND_CORNER_SIZE); 1788 1789 /* shadow */ 1790 SelectObject(hdc, hbPen); 1791 LineTo (hdc, r.right, r.bottom - ROUND_CORNER_SIZE); 1792 LineTo (hdc, r.right - ROUND_CORNER_SIZE, r.bottom); 1793 LineTo (hdc, r.left - 1, r.bottom); 1794 1795 /* shade */ 1796 SelectObject (hdc, hShade ); 1797 MoveToEx (hdc, r.right - 1, r.top, NULL); 1798 LineTo (hdc, r.right - 1, r.bottom - 1); 1799 LineTo (hdc, r.left - 1, r.bottom - 1); 1855 /* Adjust both rectangles to match native */ 1856 r.left += (1-ZZ); 1857 1858 TRACE("<left> item=%d, fill=(%d,%d)-(%d,%d), edge=(%d,%d)-(%d,%d)\n", 1859 iItem, 1860 fillRect.left,fillRect.top,fillRect.right,fillRect.bottom, 1861 r.left,r.top,r.right,r.bottom); 1862 1863 /* Clear interior */ 1864 SetBkColor(hdc, bkgnd); 1865 ExtTextOutA(hdc, 0, 0, 2, &fillRect, NULL, 0, 0); 1866 1867 /* Draw rectangular edge around tab */ 1868 DrawEdge(hdc, &r, EDGE_RAISED, BF_SOFT|BF_RIGHT|BF_TOP|BF_BOTTOM); 1869 1870 /* Now erase the top corner and draw diagonal edge */ 1871 SetBkColor(hdc, corner); 1872 r1.left = r.right - ROUND_CORNER_SIZE - 1; 1873 r1.top = r.top; 1874 r1.right = r.right; 1875 r1.bottom = r1.top + ROUND_CORNER_SIZE; 1876 ExtTextOutA(hdc, 0, 0, 2, &r1, NULL, 0, 0); 1877 r1.right--; 1878 DrawEdge(hdc, &r1, EDGE_RAISED, BF_SOFT|BF_DIAGONAL_ENDTOPLEFT); 1879 1880 /* Now erase the bottom corner and draw diagonal edge */ 1881 r1.left = r.right - ROUND_CORNER_SIZE - 1; 1882 r1.bottom = r.bottom; 1883 r1.right = r.right; 1884 r1.top = r1.bottom - ROUND_CORNER_SIZE; 1885 ExtTextOutA(hdc, 0, 0, 2, &r1, NULL, 0, 0); 1886 r1.right--; 1887 DrawEdge(hdc, &r1, EDGE_RAISED, BF_SOFT|BF_DIAGONAL_ENDBOTTOMLEFT); 1888 1889 if ((iItem == infoPtr->iSelected) && (selectedRect.top == 0)) { 1890 r1 = r; 1891 r1.right = r1.left; 1892 r1.left--; 1893 DrawEdge(hdc, &r1, EDGE_RAISED, BF_SOFT|BF_TOP); 1894 } 1895 1800 1896 } 1801 1897 else 1802 1898 { 1803 /* highlight */ 1804 MoveToEx (hdc, r.right, r.top, NULL); 1805 LineTo (hdc, r.left + ROUND_CORNER_SIZE, r.top); 1806 LineTo (hdc, r.left, r.top + ROUND_CORNER_SIZE); 1807 LineTo (hdc, r.left, r.bottom - ROUND_CORNER_SIZE); 1808 1809 /* shadow */ 1810 SelectObject(hdc, hbPen); 1811 LineTo (hdc, r.left + ROUND_CORNER_SIZE, r.bottom); 1812 LineTo (hdc, r.right + 1, r.bottom); 1813 1814 /* shade */ 1815 SelectObject (hdc, hShade ); 1816 MoveToEx (hdc, r.left + ROUND_CORNER_SIZE - 1, r.bottom - 1, NULL); 1817 LineTo (hdc, r.right + 1, r.bottom - 1); 1899 /* Adjust both rectangles to match native */ 1900 fillRect.right += (1-ZZ); 1901 1902 TRACE("<left> item=%d, fill=(%d,%d)-(%d,%d), edge=(%d,%d)-(%d,%d)\n", 1903 iItem, 1904 fillRect.left,fillRect.top,fillRect.right,fillRect.bottom, 1905 r.left,r.top,r.right,r.bottom); 1906 1907 /* Clear interior */ 1908 SetBkColor(hdc, bkgnd); 1909 ExtTextOutA(hdc, 0, 0, 2, &fillRect, NULL, 0, 0); 1910 1911 /* Draw rectangular edge around tab */ 1912 DrawEdge(hdc, &r, EDGE_RAISED, BF_SOFT|BF_LEFT|BF_TOP|BF_BOTTOM); 1913 1914 /* Now erase the top corner and draw diagonal edge */ 1915 SetBkColor(hdc, corner); 1916 r1.left = r.left; 1917 r1.top = r.top; 1918 r1.right = r1.left + ROUND_CORNER_SIZE + 1; 1919 r1.bottom = r1.top + ROUND_CORNER_SIZE; 1920 ExtTextOutA(hdc, 0, 0, 2, &r1, NULL, 0, 0); 1921 r1.left++; 1922 DrawEdge(hdc, &r1, EDGE_RAISED, BF_SOFT|BF_DIAGONAL_ENDTOPRIGHT); 1923 1924 /* Now erase the bottom corner and draw diagonal edge */ 1925 r1.left = r.left; 1926 r1.bottom = r.bottom; 1927 r1.right = r1.left + ROUND_CORNER_SIZE + 1; 1928 r1.top = r1.bottom - ROUND_CORNER_SIZE; 1929 ExtTextOutA(hdc, 0, 0, 2, &r1, NULL, 0, 0); 1930 r1.left++; 1931 DrawEdge(hdc, &r1, EDGE_SUNKEN, BF_DIAGONAL_ENDTOPLEFT); 1818 1932 } 1819 1933 } 1820 else 1934 else /* ! TCS_VERTICAL */ 1821 1935 { 1936 /* These are for adjusting the drawing of a Selected tab */ 1937 /* The initial values are for the normal case of non-Selected */ 1938 int ZZ = 1; /* Do not strech if selected */ 1939 if (iItem == infoPtr->iSelected) { 1940 ZZ = 0; 1941 1942 /* if leftmost draw the line longer */ 1943 if(selectedRect.left == 0) 1944 fillRect.left += 2; 1945 /* if rightmost draw the line longer */ 1946 if(selectedRect.right == clRight) 1947 fillRect.right -= 2; 1948 } 1949 1822 1950 if (lStyle & TCS_BOTTOM) 1823 1951 { 1824 /* highlight */ 1825 MoveToEx (hdc, r.left, r.top, NULL); 1826 LineTo (hdc, r.left, r.bottom - ROUND_CORNER_SIZE); 1827 LineTo (hdc, r.left + ROUND_CORNER_SIZE, r.bottom); 1828 1829 /* shadow */ 1830 SelectObject(hdc, hbPen); 1831 LineTo (hdc, r.right - ROUND_CORNER_SIZE, r.bottom); 1832 LineTo (hdc, r.right, r.bottom - ROUND_CORNER_SIZE); 1833 LineTo (hdc, r.right, r.top - 1); 1834 1835 /* shade */ 1836 SelectObject (hdc, hShade ); 1837 MoveToEx (hdc, r.left, r.bottom - 1, NULL); 1838 LineTo (hdc, r.right - ROUND_CORNER_SIZE - 1, r.bottom - 1); 1839 LineTo (hdc, r.right - 1, r.bottom - ROUND_CORNER_SIZE - 1); 1840 LineTo (hdc, r.right - 1, r.top - 1); 1952 1953 /* Adjust both rectangles to match native */ 1954 fillRect.top--; 1955 fillRect.bottom--; 1956 r.bottom--; 1957 r.top -= ZZ; 1958 1959 TRACE("<bottom> item=%d, fill=(%d,%d)-(%d,%d), edge=(%d,%d)-(%d,%d)\n", 1960 iItem, 1961 fillRect.left,fillRect.top,fillRect.right,fillRect.bottom, 1962 r.left,r.top,r.right,r.bottom); 1963 1964 /* Clear interior */ 1965 SetBkColor(hdc, bkgnd); 1966 ExtTextOutA(hdc, 0, 0, 2, &fillRect, NULL, 0, 0); 1967 1968 /* Draw rectangular edge around tab */ 1969 DrawEdge(hdc, &r, EDGE_RAISED, BF_SOFT|BF_LEFT|BF_BOTTOM|BF_RIGHT); 1970 1971 /* Now erase the righthand corner and draw diagonal edge */ 1972 SetBkColor(hdc, corner); 1973 r1.left = r.right - ROUND_CORNER_SIZE; 1974 r1.bottom = r.bottom; 1975 r1.right = r.right; 1976 r1.top = r1.bottom - ROUND_CORNER_SIZE - 1; 1977 ExtTextOutA(hdc, 0, 0, 2, &r1, NULL, 0, 0); 1978 r1.bottom--; 1979 DrawEdge(hdc, &r1, EDGE_RAISED, BF_SOFT|BF_DIAGONAL_ENDBOTTOMLEFT); 1980 1981 /* Now erase the lefthand corner and draw diagonal edge */ 1982 r1.left = r.left; 1983 r1.bottom = r.bottom; 1984 r1.right = r1.left + ROUND_CORNER_SIZE; 1985 r1.top = r1.bottom - ROUND_CORNER_SIZE - 1; 1986 ExtTextOutA(hdc, 0, 0, 2, &r1, NULL, 0, 0); 1987 r1.bottom--; 1988 DrawEdge(hdc, &r1, EDGE_RAISED, BF_SOFT|BF_DIAGONAL_ENDTOPLEFT); 1989 1990 if ((iItem == infoPtr->iSelected) && (selectedRect.left == 0)) { 1991 r1 = r; 1992 r1.bottom = r1.top; 1993 r1.top--; 1994 DrawEdge(hdc, &r1, EDGE_RAISED, BF_SOFT|BF_LEFT); 1995 } 1996 1841 1997 } 1842 1998 else 1843 1999 { 1844 /* highlight */ 1845 if(infoPtr->items[iItem].rect.left == 0) /* if leftmost draw the line longer */ 1846 MoveToEx (hdc, r.left, r.bottom, NULL); 1847 else 1848 MoveToEx (hdc, r.left, r.bottom - 1, NULL); 1849 1850 LineTo (hdc, r.left, r.top + ROUND_CORNER_SIZE); 1851 LineTo (hdc, r.left + ROUND_CORNER_SIZE, r.top); 1852 LineTo (hdc, r.right - ROUND_CORNER_SIZE, r.top); 1853 1854 /* shadow */ 1855 SelectObject(hdc, hbPen); 1856 LineTo (hdc, r.right, r.top + ROUND_CORNER_SIZE); 1857 LineTo (hdc, r.right, r.bottom + 1); 1858 1859 1860 /* shade */ 1861 SelectObject (hdc, hShade ); 1862 MoveToEx (hdc, r.right - 1, r.top + ROUND_CORNER_SIZE, NULL); 1863 LineTo (hdc, r.right - 1, r.bottom + 1); 2000 2001 /* Adjust both rectangles to match native */ 2002 fillRect.bottom += (1-ZZ); 2003 2004 TRACE("<top> item=%d, fill=(%d,%d)-(%d,%d), edge=(%d,%d)-(%d,%d)\n", 2005 iItem, 2006 fillRect.left,fillRect.top,fillRect.right,fillRect.bottom, 2007 r.left,r.top,r.right,r.bottom); 2008 2009 /* Clear interior */ 2010 SetBkColor(hdc, bkgnd); 2011 ExtTextOutA(hdc, 0, 0, 2, &fillRect, NULL, 0, 0); 2012 2013 /* Draw rectangular edge around tab */ 2014 DrawEdge(hdc, &r, EDGE_RAISED, BF_SOFT|BF_LEFT|BF_TOP|BF_RIGHT); 2015 2016 /* Now erase the righthand corner and draw diagonal edge */ 2017 SetBkColor(hdc, corner); 2018 r1.left = r.right - ROUND_CORNER_SIZE; 2019 r1.top = r.top; 2020 r1.right = r.right; 2021 r1.bottom = r1.top + ROUND_CORNER_SIZE + 1; 2022 ExtTextOutA(hdc, 0, 0, 2, &r1, NULL, 0, 0); 2023 r1.top++; 2024 DrawEdge(hdc, &r1, EDGE_RAISED, BF_SOFT|BF_DIAGONAL_ENDBOTTOMRIGHT); 2025 2026 /* Now erase the lefthand corner and draw diagonal edge */ 2027 r1.left = r.left; 2028 r1.top = r.top; 2029 r1.right = r1.left + ROUND_CORNER_SIZE; 2030 r1.bottom = r1.top + ROUND_CORNER_SIZE + 1; 2031 ExtTextOutA(hdc, 0, 0, 2, &r1, NULL, 0, 0); 2032 r1.top++; 2033 DrawEdge(hdc, &r1, EDGE_RAISED, BF_SOFT|BF_DIAGONAL_ENDTOPRIGHT); 2034 1864 2035 } 1865 2036 } 1866 2037 } 1867 2038 2039 TAB_DumpItemInternal(infoPtr, iItem); 2040 1868 2041 /* This modifies r to be the text rectangle. */ 1869 2042 { … … 1883 2056 DrawFocusRect(hdc, &r); 1884 2057 } 1885 1886 /* Cleanup */1887 SelectObject(hdc, holdPen);1888 if (deleteBrush) DeleteObject(hbr);1889 2058 } 1890 2059 } … … 1895 2064 * This method is used to draw the raised border around the tab control 1896 2065 * "content" area. 1897 */ 2066 */ 1898 2067 static void TAB_DrawBorder (HWND hwnd, HDC hdc) 1899 2068 { 1900 2069 TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd); 1901 HPEN htmPen;1902 HPEN hwPen = GetSysColorPen (COLOR_3DHILIGHT);1903 HPEN hbPen = GetSysColorPen (COLOR_3DDKSHADOW);1904 HPEN hShade = GetSysColorPen (COLOR_BTNSHADOW);1905 2070 RECT rect; 1906 2071 DWORD lStyle = GetWindowLongA(hwnd, GWL_STYLE); … … 1916 2081 if ((lStyle & TCS_BOTTOM) && !(lStyle & TCS_VERTICAL)) 1917 2082 { 1918 rect.bottom -= (infoPtr->tabHeight - 2) * infoPtr->uNumRows + 2;2083 rect.bottom -= (infoPtr->tabHeight - 2) * infoPtr->uNumRows + 3; 1919 2084 } 1920 2085 else if((lStyle & TCS_BOTTOM) && (lStyle & TCS_VERTICAL)) … … 1928 2093 else /* not TCS_VERTICAL and not TCS_BOTTOM */ 1929 2094 { 1930 rect.top += (infoPtr->tabHeight - 2) * infoPtr->uNumRows + 1; 1931 } 1932 } 1933 1934 /* 1935 * Shave-off the right and bottom margins (exluded in the 1936 * rect) 1937 */ 1938 rect.right--; 1939 rect.bottom--; 1940 1941 /* highlight */ 1942 htmPen = SelectObject (hdc, hwPen); 1943 1944 MoveToEx (hdc, rect.left, rect.bottom, NULL); 1945 LineTo (hdc, rect.left, rect.top); 1946 LineTo (hdc, rect.right, rect.top); 1947 1948 /* Dark Shadow */ 1949 SelectObject (hdc, hbPen); 1950 LineTo (hdc, rect.right, rect.bottom ); 1951 LineTo (hdc, rect.left, rect.bottom); 1952 1953 /* shade */ 1954 SelectObject (hdc, hShade ); 1955 MoveToEx (hdc, rect.right - 1, rect.top, NULL); 1956 LineTo (hdc, rect.right - 1, rect.bottom - 1); 1957 LineTo (hdc, rect.left, rect.bottom - 1); 1958 1959 SelectObject(hdc, htmPen); 2095 rect.top += (infoPtr->tabHeight - 2) * infoPtr->uNumRows + 2; 2096 } 2097 } 2098 2099 TRACE("border=(%d,%d)-(%d,%d)\n", 2100 rect.left, rect.top, rect.right, rect.bottom); 2101 2102 DrawEdge(hdc, &rect, EDGE_RAISED, BF_SOFT|BF_RECT); 1960 2103 } 1961 2104 … … 1964 2107 * 1965 2108 * This method repaints the tab control.. 1966 */ 2109 */ 1967 2110 static void TAB_Refresh (HWND hwnd, HDC hdc) 1968 2111 { … … 1978 2121 if (GetWindowLongA(hwnd, GWL_STYLE) & TCS_BUTTONS) 1979 2122 { 1980 for (i = 0; i < infoPtr->uNumItem; i++) 2123 for (i = 0; i < infoPtr->uNumItem; i++) 1981 2124 TAB_DrawItem (hwnd, hdc, i); 1982 2125 } … … 1984 2127 { 1985 2128 /* Draw all the non selected item first */ 1986 for (i = 0; i < infoPtr->uNumItem; i++) 2129 for (i = 0; i < infoPtr->uNumItem; i++) 1987 2130 { 1988 2131 if (i != infoPtr->iSelected) … … 2018 2161 { 2019 2162 TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd); 2020 2163 2021 2164 infoPtr->DoRedraw=(BOOL) wParam; 2022 2165 return 0; … … 2024 2167 2025 2168 static LRESULT TAB_EraseBackground( 2026 HWND hwnd, 2169 HWND hwnd, 2027 2170 HDC givenDC) 2028 2171 { … … 2030 2173 RECT clientRect; 2031 2174 2032 HBRUSH brush = CreateSolidBrush( GetSysColor(COLOR_BTNFACE));2175 HBRUSH brush = CreateSolidBrush(comctl32_color.clrBtnFace); 2033 2176 2034 2177 hdc = givenDC ? givenDC : GetDC(hwnd); … … 2184 2327 infoPtr->tabHeight - 2185 2328 lastRow * (infoPtr->tabHeight - 2) - 2186 ((lStyle & TCS_BUTTONS) ? lastRow * BUTTON_SPACINGY : 0) - 2;2329 ((lStyle & TCS_BUTTONS) ? lastRow * BUTTON_SPACINGY : 0) - 3; 2187 2330 } 2188 2331 else if((lStyle & TCS_BOTTOM) && (lStyle & TCS_VERTICAL)) … … 2196 2339 clientRect.right = clientRect.left + infoPtr->tabHeight + 2197 2340 lastRow * (infoPtr->tabHeight - 2) - 2198 ((lStyle & TCS_BUTTONS) ? lastRow * BUTTON_SPACINGY : 0) + 1;2341 ((lStyle & TCS_BUTTONS) ? lastRow * BUTTON_SPACINGY : 0) + 2; 2199 2342 2200 2343 } … … 2203 2346 clientRect.bottom = clientRect.top + infoPtr->tabHeight + 2204 2347 lastRow * (infoPtr->tabHeight - 2) + 2205 ((lStyle & TCS_BUTTONS) ? lastRow * BUTTON_SPACINGY : 0) + 1; 2206 } 2207 2348 ((lStyle & TCS_BUTTONS) ? lastRow * BUTTON_SPACINGY : 0) + 2; 2349 } 2350 2351 TRACE("invalidate (%d,%d)-(%d,%d)\n", 2352 clientRect.left,clientRect.top, 2353 clientRect.right,clientRect.bottom); 2208 2354 InvalidateRect(hwnd, &clientRect, TRUE); 2209 2355 } … … 2214 2360 HDC hdc; 2215 2361 PAINTSTRUCT ps; 2216 2362 2217 2363 hdc = wParam== 0 ? BeginPaint (hwnd, &ps) : (HDC)wParam; 2364 2365 TRACE("erase %d, rect=(%d,%d)-(%d,%d)\n", 2366 ps.fErase, 2367 ps.rcPaint.left,ps.rcPaint.top,ps.rcPaint.right,ps.rcPaint.bottom); 2368 2369 if (ps.fErase) 2370 TAB_EraseBackground (hwnd, hdc); 2371 2218 2372 TAB_Refresh (hwnd, hdc); 2219 2373 2220 2374 if(!wParam) 2221 2375 EndPaint (hwnd, &ps); … … 2226 2380 static LRESULT 2227 2381 TAB_InsertItemA (HWND hwnd, WPARAM wParam, LPARAM lParam) 2228 { 2382 { 2229 2383 TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd); 2230 2384 TCITEMA *pti; 2231 2385 INT iItem; 2232 2386 RECT rect; 2233 2387 2234 2388 GetClientRect (hwnd, &rect); 2235 TRACE("Rect: % xT %i, L %i, B %i, R %i\n", hwnd,2236 rect.top, rect.left, rect.bottom, rect.right); 2237 2389 TRACE("Rect: %p T %i, L %i, B %i, R %i\n", hwnd, 2390 rect.top, rect.left, rect.bottom, rect.right); 2391 2238 2392 pti = (TCITEMA *)lParam; 2239 2393 iItem = (INT)wParam; 2240 2394 2241 2395 if (iItem < 0) return -1; 2242 2396 if (iItem > infoPtr->uNumItem) 2243 2397 iItem = infoPtr->uNumItem; 2244 2398 2399 TAB_DumpItemExternalA(pti, iItem); 2400 2401 2245 2402 if (infoPtr->uNumItem == 0) { 2246 2403 infoPtr->items = COMCTL32_Alloc (sizeof (TAB_ITEM)); … … 2250 2407 else { 2251 2408 TAB_ITEM *oldItems = infoPtr->items; 2252 2409 2253 2410 infoPtr->uNumItem++; 2254 2411 infoPtr->items = COMCTL32_Alloc (sizeof (TAB_ITEM) * infoPtr->uNumItem); 2255 2412 2256 2413 /* pre insert copy */ 2257 2414 if (iItem > 0) { … … 2259 2416 iItem * sizeof(TAB_ITEM)); 2260 2417 } 2261 2418 2262 2419 /* post insert copy */ 2263 2420 if (iItem < infoPtr->uNumItem - 1) { 2264 2421 memcpy (&infoPtr->items[iItem+1], &oldItems[iItem], 2265 2422 (infoPtr->uNumItem - iItem - 1) * sizeof(TAB_ITEM)); 2266 2423 2267 2424 } 2268 2425 … … 2272 2429 COMCTL32_Free (oldItems); 2273 2430 } 2274 2431 2275 2432 infoPtr->items[iItem].mask = pti->mask; 2276 2433 if (pti->mask & TCIF_TEXT) … … 2279 2436 if (pti->mask & TCIF_IMAGE) 2280 2437 infoPtr->items[iItem].iImage = pti->iImage; 2281 2438 2282 2439 if (pti->mask & TCIF_PARAM) 2283 2440 infoPtr->items[iItem].lParam = pti->lParam; 2284 2441 2285 2442 TAB_SetItemBounds(hwnd); 2286 TAB_InvalidateTabArea(hwnd, infoPtr); 2287 2288 TRACE("[%04x]: added item %d %s\n", 2443 if (infoPtr->uNumItem > 1) 2444 TAB_InvalidateTabArea(hwnd, infoPtr); 2445 else 2446 InvalidateRect(hwnd, NULL, TRUE); 2447 2448 TRACE("[%p]: added item %d %s\n", 2289 2449 hwnd, iItem, debugstr_w(infoPtr->items[iItem].pszText)); 2290 2450 … … 2302 2462 2303 2463 GetClientRect (hwnd, &rect); 2304 TRACE("Rect: % xT %i, L %i, B %i, R %i\n", hwnd,2464 TRACE("Rect: %p T %i, L %i, B %i, R %i\n", hwnd, 2305 2465 rect.top, rect.left, rect.bottom, rect.right); 2306 2466 … … 2311 2471 if (iItem > infoPtr->uNumItem) 2312 2472 iItem = infoPtr->uNumItem; 2473 2474 TAB_DumpItemExternalW(pti, iItem); 2313 2475 2314 2476 if (infoPtr->uNumItem == 0) { … … 2335 2497 2336 2498 } 2337 2499 2338 2500 if (iItem <= infoPtr->iSelected) 2339 2501 infoPtr->iSelected++; … … 2348 2510 if (pti->mask & TCIF_IMAGE) 2349 2511 infoPtr->items[iItem].iImage = pti->iImage; 2350 2512 2351 2513 if (pti->mask & TCIF_PARAM) 2352 2514 infoPtr->items[iItem].lParam = pti->lParam; 2353 2515 2354 2516 TAB_SetItemBounds(hwnd); 2355 TAB_InvalidateTabArea(hwnd, infoPtr); 2356 2357 TRACE("[%04x]: added item %d %s\n", 2517 if (infoPtr->uNumItem > 1) 2518 TAB_InvalidateTabArea(hwnd, infoPtr); 2519 else 2520 InvalidateRect(hwnd, NULL, TRUE); 2521 2522 TRACE("[%p]: added item %d %s\n", 2358 2523 hwnd, iItem, debugstr_w(infoPtr->items[iItem].pszText)); 2359 2524 … … 2362 2527 2363 2528 2364 static LRESULT 2529 static LRESULT 2365 2530 TAB_SetItemSize (HWND hwnd, WPARAM wParam, LPARAM lParam) 2366 2531 { … … 2369 2534 LONG lResult = 0; 2370 2535 2536 TRACE("\n"); 2371 2537 if ((lStyle & TCS_FIXEDWIDTH) || (lStyle & TCS_OWNERDRAWFIXED)) 2372 2538 { … … 2374 2540 infoPtr->tabWidth = (INT)LOWORD(lParam); 2375 2541 infoPtr->tabHeight = (INT)HIWORD(lParam); 2542 TRACE("was h=%d,w=%d, now h=%d,w=%d\n", 2543 HIWORD(lResult), LOWORD(lResult), 2544 infoPtr->tabHeight, infoPtr->tabWidth); 2376 2545 } 2377 2546 infoPtr->fSizeSet = TRUE; … … 2380 2549 } 2381 2550 2382 static LRESULT 2551 static LRESULT 2383 2552 TAB_SetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam) 2384 2553 { 2385 2554 TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd); 2386 TCITEMA *tabItem; 2555 TCITEMA *tabItem; 2387 2556 TAB_ITEM *wineItem; 2388 2557 INT iItem; … … 2394 2563 if ((iItem<0) || (iItem>=infoPtr->uNumItem)) return FALSE; 2395 2564 2565 TAB_DumpItemExternalA(tabItem, iItem); 2566 2396 2567 wineItem = &infoPtr->items[iItem]; 2397 2568 … … 2402 2573 wineItem->lParam = tabItem->lParam; 2403 2574 2404 if (tabItem->mask & TCIF_RTLREADING) 2575 if (tabItem->mask & TCIF_RTLREADING) 2405 2576 FIXME("TCIF_RTLREADING\n"); 2406 2577 2407 if (tabItem->mask & TCIF_STATE) 2578 if (tabItem->mask & TCIF_STATE) 2408 2579 wineItem->dwState = tabItem->dwState; 2409 2580 … … 2433 2604 if ((iItem<0) || (iItem>=infoPtr->uNumItem)) return FALSE; 2434 2605 2606 TAB_DumpItemExternalW(tabItem, iItem); 2607 2435 2608 wineItem = &infoPtr->items[iItem]; 2436 2609 … … 2458 2631 2459 2632 2460 static LRESULT 2633 static LRESULT 2461 2634 TAB_GetItemCount (HWND hwnd, WPARAM wParam, LPARAM lParam) 2462 2635 { … … 2467 2640 2468 2641 2469 static LRESULT 2642 static LRESULT 2470 2643 TAB_GetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam) 2471 2644 { … … 2483 2656 wineItem = &infoPtr->items[iItem]; 2484 2657 2485 if (tabItem->mask & TCIF_IMAGE) 2658 if (tabItem->mask & TCIF_IMAGE) 2486 2659 tabItem->iImage = wineItem->iImage; 2487 2660 2488 if (tabItem->mask & TCIF_PARAM) 2661 if (tabItem->mask & TCIF_PARAM) 2489 2662 tabItem->lParam = wineItem->lParam; 2490 2663 2491 if (tabItem->mask & TCIF_RTLREADING) 2664 if (tabItem->mask & TCIF_RTLREADING) 2492 2665 FIXME("TCIF_RTLREADING\n"); 2493 2666 2494 if (tabItem->mask & TCIF_STATE) 2667 if (tabItem->mask & TCIF_STATE) 2495 2668 tabItem->dwState = wineItem->dwState; 2496 2669 2497 if (tabItem->mask & TCIF_TEXT) 2670 if (tabItem->mask & TCIF_TEXT) 2498 2671 Str_GetPtrWtoA (wineItem->pszText, tabItem->pszText, tabItem->cchTextMax); 2499 2672 2673 TAB_DumpItemExternalA(tabItem, iItem); 2674 2500 2675 return TRUE; 2501 2676 } 2502 2677 2503 2678 2504 static LRESULT 2679 static LRESULT 2505 2680 TAB_GetItemW (HWND hwnd, WPARAM wParam, LPARAM lParam) 2506 2681 { … … 2533 2708 Str_GetPtrW (wineItem->pszText, tabItem->pszText, tabItem->cchTextMax); 2534 2709 2710 TAB_DumpItemExternalW(tabItem, iItem); 2711 2535 2712 return TRUE; 2536 2713 } 2537 2714 2538 2715 2539 static LRESULT 2716 static LRESULT 2540 2717 TAB_DeleteItem (HWND hwnd, WPARAM wParam, LPARAM lParam) 2541 2718 { … … 2547 2724 { 2548 2725 TAB_ITEM *oldItems = infoPtr->items; 2549 2726 2550 2727 infoPtr->uNumItem--; 2551 2728 infoPtr->items = COMCTL32_Alloc(sizeof (TAB_ITEM) * infoPtr->uNumItem); 2552 2553 if (iItem > 0) 2729 2730 if (iItem > 0) 2554 2731 memcpy(&infoPtr->items[0], &oldItems[0], iItem * sizeof(TAB_ITEM)); 2555 2556 if (iItem < infoPtr->uNumItem) 2732 2733 if (iItem < infoPtr->uNumItem) 2557 2734 memcpy(&infoPtr->items[iItem], &oldItems[iItem + 1], 2558 2735 (infoPtr->uNumItem - iItem) * sizeof(TAB_ITEM)); 2559 2736 2560 2737 COMCTL32_Free(oldItems); 2561 2738 … … 2563 2740 if ((iItem == infoPtr->iSelected) && (iItem > 0)) 2564 2741 infoPtr->iSelected--; 2565 2742 2566 2743 if (iItem < infoPtr->iSelected) 2567 2744 infoPtr->iSelected--; … … 2580 2757 } 2581 2758 2582 static LRESULT 2759 static LRESULT 2583 2760 TAB_DeleteAllItems (HWND hwnd, WPARAM wParam, LPARAM lParam) 2584 2761 { … … 2591 2768 KillTimer(hwnd, TAB_HOTTRACK_TIMER); 2592 2769 infoPtr->iHotTracked = -1; 2593 2770 2594 2771 TAB_SetItemBounds(hwnd); 2595 2772 TAB_InvalidateTabArea(hwnd,infoPtr); … … 2612 2789 { 2613 2790 TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd); 2614 2791 2615 2792 TRACE("%x %lx\n",wParam, lParam); 2616 2793 2617 2794 infoPtr->hFont = (HFONT)wParam; 2618 2795 2619 2796 TAB_SetItemBounds(hwnd); 2620 2797 … … 2683 2860 cx=LOWORD (lParam); 2684 2861 cy=HIWORD (lParam); 2685 if (GetWindowLongA(hwnd, GWL_STYLE) & CCS_NORESIZE) 2862 if (GetWindowLongA(hwnd, GWL_STYLE) & CCS_NORESIZE) 2686 2863 uPosFlags |= (SWP_NOSIZE | SWP_NOMOVE); 2687 2864 … … 2702 2879 2703 2880 2704 static LRESULT 2881 static LRESULT 2705 2882 TAB_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) 2706 2883 { … … 2714 2891 2715 2892 SetWindowLongA(hwnd, 0, (DWORD)infoPtr); 2716 2893 2717 2894 infoPtr->uNumItem = 0; 2718 2895 infoPtr->uNumRows = 0; … … 2722 2899 infoPtr->iSelected = -1; 2723 2900 infoPtr->iHotTracked = -1; 2724 infoPtr->uFocus = -1; 2901 infoPtr->uFocus = -1; 2725 2902 infoPtr->hwndToolTip = 0; 2726 2903 infoPtr->DoRedraw = TRUE; … … 2730 2907 infoPtr->fSizeSet = FALSE; 2731 2908 infoPtr->bUnicode = IsWindowUnicode (hwnd); 2732 2733 TRACE("Created tab control, hwnd [% 04x]\n", hwnd);2734 2735 /* The tab control always has the WS_CLIPSIBLINGS style. Even 2736 if you don't specify it in CreateWindow. This is necessary in 2909 2910 TRACE("Created tab control, hwnd [%p]\n", hwnd); 2911 2912 /* The tab control always has the WS_CLIPSIBLINGS style. Even 2913 if you don't specify it in CreateWindow. This is necessary in 2737 2914 order for paint to work correctly. This follows windows behaviour. */ 2738 2915 dwStyle = GetWindowLongA(hwnd, GWL_STYLE); … … 2746 2923 CW_USEDEFAULT, CW_USEDEFAULT, 2747 2924 hwnd, 0, 0, 0); 2748 2925 2749 2926 /* Send NM_TOOLTIPSCREATED notification */ 2750 2927 if (infoPtr->hwndToolTip) { 2751 2928 NMTOOLTIPSCREATED nmttc; 2752 2929 2753 2930 nmttc.hdr.hwndFrom = hwnd; 2754 2931 nmttc.hdr.idFrom = GetWindowLongA(hwnd, GWL_ID); 2755 2932 nmttc.hdr.code = NM_TOOLTIPSCREATED; 2756 2933 nmttc.hwndToolTips = infoPtr->hwndToolTip; 2757 2934 2758 2935 SendMessageA (GetParent (hwnd), WM_NOTIFY, 2759 2936 (WPARAM)GetWindowLongA(hwnd, GWL_ID), (LPARAM)&nmttc); 2760 2937 } 2761 } 2762 2938 } 2939 2763 2940 /* 2764 2941 * We need to get text information so we need a DC and we need to select 2765 2942 * a font. 2766 2943 */ 2767 hdc = GetDC(hwnd); 2944 hdc = GetDC(hwnd); 2768 2945 hOldFont = SelectObject (hdc, GetStockObject (SYSTEM_FONT)); 2769 2946 … … 2772 2949 2773 2950 /* 2774 * Make sure there is enough space for the letters + growing the 2775 * selected item + extra space for the selected item. 2951 * Make sure there is enough space for the letters + growing the 2952 * selected item + extra space for the selected item. 2776 2953 */ 2777 infoPtr->tabHeight = fontMetrics.tmHeight + 2 * VERTICAL_ITEM_PADDING + 2778 SELECTED_TAB_OFFSET; 2954 infoPtr->tabHeight = fontMetrics.tmHeight + SELECTED_TAB_OFFSET + 2955 ((dwStyle & TCS_BUTTONS) ? 2 : 1) * 2956 VERTICAL_ITEM_PADDING; 2779 2957 2780 2958 /* Initialize the width of a tab. */ 2781 2959 infoPtr->tabWidth = DEFAULT_TAB_WIDTH; 2960 2961 TRACE("tabH=%d, tabW=%d\n", infoPtr->tabHeight, infoPtr->tabWidth); 2782 2962 2783 2963 SelectObject (hdc, hOldFont); … … 2803 2983 COMCTL32_Free (infoPtr->items); 2804 2984 } 2805 2806 if (infoPtr->hwndToolTip) 2985 2986 if (infoPtr->hwndToolTip) 2807 2987 DestroyWindow (infoPtr->hwndToolTip); 2808 2988 2809 2989 if (infoPtr->hwndUpDown) 2810 2990 DestroyWindow(infoPtr->hwndUpDown); … … 2822 3002 { 2823 3003 2824 TRACE("hwnd=% xmsg=%x wParam=%x lParam=%lx\n", hwnd, uMsg, wParam, lParam);3004 TRACE("hwnd=%p msg=%x wParam=%x lParam=%lx\n", hwnd, uMsg, wParam, lParam); 2825 3005 if (!TAB_GetInfoPtr(hwnd) && (uMsg != WM_CREATE)) 2826 3006 return DefWindowProcA (hwnd, uMsg, wParam, lParam); … … 2830 3010 case TCM_GETIMAGELIST: 2831 3011 return TAB_GetImageList (hwnd, wParam, lParam); 2832 3012 2833 3013 case TCM_SETIMAGELIST: 2834 3014 return TAB_SetImageList (hwnd, wParam, lParam); 2835 3015 2836 3016 case TCM_GETITEMCOUNT: 2837 3017 return TAB_GetItemCount (hwnd, wParam, lParam); 2838 3018 2839 3019 case TCM_GETITEMA: 2840 3020 return TAB_GetItemA (hwnd, wParam, lParam); 2841 3021 2842 3022 case TCM_GETITEMW: 2843 3023 return TAB_GetItemW (hwnd, wParam, lParam); 2844 3024 2845 3025 case TCM_SETITEMA: 2846 3026 return TAB_SetItemA (hwnd, wParam, lParam); 2847 3027 2848 3028 case TCM_SETITEMW: 2849 3029 return TAB_SetItemW (hwnd, wParam, lParam); 2850 3030 2851 3031 case TCM_DELETEITEM: 2852 3032 return TAB_DeleteItem (hwnd, wParam, lParam); 2853 3033 2854 3034 case TCM_DELETEALLITEMS: 2855 3035 return TAB_DeleteAllItems (hwnd, wParam, lParam); 2856 3036 2857 3037 case TCM_GETITEMRECT: 2858 3038 return TAB_GetItemRect (hwnd, wParam, lParam); 2859 3039 2860 3040 case TCM_GETCURSEL: 2861 3041 return TAB_GetCurSel (hwnd); 2862 3042 2863 3043 case TCM_HITTEST: 2864 3044 return TAB_HitTest (hwnd, wParam, lParam); 2865 3045 2866 3046 case TCM_SETCURSEL: 2867 3047 return TAB_SetCurSel (hwnd, wParam); 2868 3048 2869 3049 case TCM_INSERTITEMA: 2870 3050 return TAB_InsertItemA (hwnd, wParam, lParam); 2871 3051 2872 3052 case TCM_INSERTITEMW: 2873 3053 return TAB_InsertItemW (hwnd, wParam, lParam); 2874 3054 2875 3055 case TCM_SETITEMEXTRA: 2876 3056 FIXME("Unimplemented msg TCM_SETITEMEXTRA\n"); 2877 3057 return 0; 2878 3058 2879 3059 case TCM_ADJUSTRECT: 2880 3060 return TAB_AdjustRect (hwnd, (BOOL)wParam, (LPRECT)lParam); 2881 3061 2882 3062 case TCM_SETITEMSIZE: 2883 3063 return TAB_SetItemSize (hwnd, wParam, lParam); 2884 3064 2885 3065 case TCM_REMOVEIMAGE: 2886 3066 FIXME("Unimplemented msg TCM_REMOVEIMAGE\n"); 2887 3067 return 0; 2888 3068 2889 3069 case TCM_SETPADDING: 2890 3070 FIXME("Unimplemented msg TCM_SETPADDING\n"); 2891 3071 return 0; 2892 3072 2893 3073 case TCM_GETROWCOUNT: 2894 3074 return TAB_GetRowCount(hwnd); … … 2903 3083 FIXME("Unimplemented msg TCM_HIGHLIGHTITEM\n"); 2904 3084 return 0; 2905 3085 2906 3086 case TCM_GETTOOLTIPS: 2907 3087 return TAB_GetToolTips (hwnd, wParam, lParam); 2908 3088 2909 3089 case TCM_SETTOOLTIPS: 2910 3090 return TAB_SetToolTips (hwnd, wParam, lParam); 2911 3091 2912 3092 case TCM_GETCURFOCUS: 2913 3093 return TAB_GetCurFocus (hwnd); 2914 3094 2915 3095 case TCM_SETCURFOCUS: 2916 3096 return TAB_SetCurFocus (hwnd, wParam); 2917 3097 2918 3098 case TCM_SETMINTABWIDTH: 2919 3099 FIXME("Unimplemented msg TCM_SETMINTABWIDTH\n"); 2920 3100 return 0; 2921 3101 2922 3102 case TCM_DESELECTALL: 2923 3103 FIXME("Unimplemented msg TCM_DESELECTALL\n"); 2924 3104 return 0; 2925 3105 2926 3106 case TCM_GETEXTENDEDSTYLE: 2927 3107 FIXME("Unimplemented msg TCM_GETEXTENDEDSTYLE\n"); … … 2934 3114 case WM_GETFONT: 2935 3115 return TAB_GetFont (hwnd, wParam, lParam); 2936 3116 2937 3117 case WM_SETFONT: 2938 3118 return TAB_SetFont (hwnd, wParam, lParam); 2939 3119 2940 3120 case WM_CREATE: 2941 3121 return TAB_Create (hwnd, wParam, lParam); 2942 3122 2943 3123 case WM_NCDESTROY: 2944 3124 return TAB_Destroy (hwnd, wParam, lParam); 2945 3125 2946 3126 case WM_GETDLGCODE: 2947 3127 return DLGC_WANTARROWS | DLGC_WANTCHARS; 2948 3128 2949 3129 case WM_LBUTTONDOWN: 2950 3130 return TAB_LButtonDown (hwnd, wParam, lParam); 2951 3131 2952 3132 case WM_LBUTTONUP: 2953 3133 return TAB_LButtonUp (hwnd, wParam, lParam); 2954 3134 2955 3135 case WM_NOTIFY: 2956 3136 return SendMessageA(GetParent(hwnd), WM_NOTIFY, wParam, lParam); 2957 3137 2958 3138 case WM_RBUTTONDOWN: 2959 3139 return TAB_RButtonDown (hwnd, wParam, lParam); 2960 3140 2961 3141 case WM_MOUSEMOVE: 2962 3142 return TAB_MouseMove (hwnd, wParam, lParam); 2963 3143 2964 3144 case WM_ERASEBKGND: 2965 3145 return TAB_EraseBackground (hwnd, (HDC)wParam); … … 2970 3150 case WM_SIZE: 2971 3151 return TAB_Size (hwnd, wParam, lParam); 2972 3152 2973 3153 case WM_SETREDRAW: 2974 3154 return TAB_SetRedraw (hwnd, wParam); … … 2981 3161 InvalidateRect(hwnd, NULL, TRUE); 2982 3162 return 0; 2983 3163 3164 case WM_SYSCOLORCHANGE: 3165 COMCTL32_RefreshSysColors(); 3166 return 0; 3167 2984 3168 case WM_KILLFOCUS: 2985 3169 case WM_SETFOCUS: … … 2992 3176 2993 3177 default: 2994 if ( uMsg >= WM_USER)3178 if ((uMsg >= WM_USER) && (uMsg < WM_APP)) 2995 3179 WARN("unknown msg %04x wp=%08x lp=%08lx\n", 2996 3180 uMsg, wParam, lParam); … … 3015 3199 wndClass.hbrBackground = (HBRUSH)NULL; 3016 3200 wndClass.lpszClassName = WC_TABCONTROLA; 3017 3201 3018 3202 RegisterClassA (&wndClass); 3019 3203 } -
trunk/src/comctl32/toolbar.c
r8382 r9370 86 86 INT nRow; 87 87 RECT rect; 88 } TBUTTON_INFO; 88 } TBUTTON_INFO; 89 89 90 90 typedef struct … … 171 171 #define TOP_BORDER 2 172 172 #define BOTTOM_BORDER 2 173 #define DDARROW_WIDTH 11 173 #define DDARROW_WIDTH 11 174 174 175 175 #define TOOLBAR_GetInfoPtr(hwnd) ((TOOLBAR_INFO *)GetWindowLongA(hwnd,0)) … … 197 197 else if ((btnPtr->iString >= 0) && (btnPtr->iString < infoPtr->nNumStrings)) 198 198 lpText = infoPtr->strings[btnPtr->iString]; 199 199 200 200 return lpText; 201 201 } … … 213 213 btn_num, bP->idCommand, 214 214 (bP->bHot) ? "TRUE":"FALSE", bP->nRow, 215 bP->rect.left, bP->rect.top, 215 bP->rect.left, bP->rect.top, 216 216 bP->rect.right, bP->rect.bottom); 217 217 } … … 227 227 228 228 dwStyle = GetWindowLongA (iP->hwndSelf, GWL_STYLE); 229 TRACE("toolbar % 08xat line %d, exStyle=%08lx, buttons=%d, bitmaps=%d, strings=%d, style=%08lx\n",229 TRACE("toolbar %p at line %d, exStyle=%08lx, buttons=%d, bitmaps=%d, strings=%d, style=%08lx\n", 230 230 iP->hwndSelf, line, 231 231 iP->dwExStyle, iP->nNumButtons, iP->nNumBitmaps, 232 232 iP->nNumStrings, dwStyle); 233 TRACE("toolbar % 08xat line %d, himlInt=%p, himlDef=%p, himlHot=%p, himlDis=%p, redrawable=%s\n",233 TRACE("toolbar %p at line %d, himlInt=%p, himlDef=%p, himlHot=%p, himlDis=%p, redrawable=%s\n", 234 234 iP->hwndSelf, line, 235 235 iP->himlInt, iP->himlDef, iP->himlHot, iP->himlDis, … … 253 253 { 254 254 if (dwStyle & TBSTYLE_ALTDRAG) 255 FIXME("[% 04x] TBSTYLE_ALTDRAG not implemented\n", hwnd);255 FIXME("[%p] TBSTYLE_ALTDRAG not implemented\n", hwnd); 256 256 if (dwStyle & TBSTYLE_REGISTERDROP) 257 FIXME("[% 04x] TBSTYLE_REGISTERDROP not implemented\n", hwnd);257 FIXME("[%p] TBSTYLE_REGISTERDROP not implemented\n", hwnd); 258 258 } 259 259 … … 264 264 if(!IsWindow(infoPtr->hwndSelf)) 265 265 return 0; /* we have just been destroyed */ 266 266 267 267 nmhdr->idFrom = GetDlgCtrlID (infoPtr->hwndSelf); 268 268 nmhdr->hwndFrom = infoPtr->hwndSelf; 269 269 nmhdr->code = code; 270 270 271 TRACE("to window % 04x, code=%08x, %s\n", infoPtr->hwndNotify, code,271 TRACE("to window %p, code=%08x, %s\n", infoPtr->hwndNotify, code, 272 272 (infoPtr->bNtfUnicode) ? "via Unicode" : "via ANSI"); 273 273 274 274 if (infoPtr->bNtfUnicode) 275 return SendMessageW (infoPtr->hwndNotify, WM_NOTIFY, 275 return SendMessageW (infoPtr->hwndNotify, WM_NOTIFY, 276 276 (WPARAM) nmhdr->idFrom, (LPARAM)nmhdr); 277 277 else 278 return SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, 278 return SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, 279 279 (WPARAM) nmhdr->idFrom, (LPARAM)nmhdr); 280 280 } … … 287 287 * is issued to retrieve the index. 288 288 */ 289 static INT 289 static INT 290 290 TOOLBAR_GetBitmapIndex(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr) 291 291 { … … 306 306 } 307 307 ret = nmgd.iImage; 308 TRACE("TBN_GETDISPINFOA returned bitmap id %d, mask=%08lx, nNumBitmaps=%d\n", 308 TRACE("TBN_GETDISPINFOA returned bitmap id %d, mask=%08lx, nNumBitmaps=%d\n", 309 309 ret, nmgd.dwMask, infoPtr->nNumBitmaps); 310 310 } … … 313 313 314 314 315 static BOOL 315 static BOOL 316 316 TOOLBAR_IsValidBitmapIndex(TOOLBAR_INFO *infoPtr, INT index) 317 317 { … … 329 329 * This function validates the bitmap index (including I_IMAGECALLBACK 330 330 * functionality). It then draws the image via the ImageList_Draw 331 * function. It returns TRUE if the image was drawn, FALSE otherwise. 331 * function. It returns TRUE if the image was drawn, FALSE otherwise. 332 332 */ 333 333 static BOOL … … 341 341 if (!TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) { 342 342 if (btnPtr->iBitmap == I_IMAGENONE) return FALSE; 343 ERR("index %d is not valid, max %d\n", 343 ERR("index %d is not valid, max %d\n", 344 344 btnPtr->iBitmap, infoPtr->nNumBitmaps); 345 345 return FALSE; … … 376 376 if (!TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) { 377 377 if (btnPtr->iBitmap == I_IMAGENONE) return FALSE; 378 ERR("index %d is not valid, max %d\n", 378 ERR("index %d is not valid, max %d\n", 379 379 btnPtr->iBitmap, infoPtr->nNumBitmaps); 380 380 return FALSE; … … 403 403 myrect.bottom = lpRect->bottom - 2; 404 404 405 newcolor = (infoPtr->clrBtnShadow == CLR_DEFAULT) ? 405 newcolor = (infoPtr->clrBtnShadow == CLR_DEFAULT) ? 406 406 comctl32_color.clrBtnShadow : infoPtr->clrBtnShadow; 407 407 oldcolor = SetBkColor (hdc, newcolor); … … 411 411 myrect.right = myrect.left + 1; 412 412 413 newcolor = (infoPtr->clrBtnHighlight == CLR_DEFAULT) ? 413 newcolor = (infoPtr->clrBtnHighlight == CLR_DEFAULT) ? 414 414 comctl32_color.clrBtnHighlight : infoPtr->clrBtnHighlight; 415 415 SetBkColor (hdc, newcolor); … … 447 447 myrect.left, myrect.top, myrect.right, myrect.bottom); 448 448 449 newcolor = (infoPtr->clrBtnShadow == CLR_DEFAULT) ? 449 newcolor = (infoPtr->clrBtnShadow == CLR_DEFAULT) ? 450 450 comctl32_color.clrBtnShadow : infoPtr->clrBtnShadow; 451 451 oldcolor = SetBkColor (hdc, newcolor); … … 455 455 myrect.bottom = myrect.top + 1; 456 456 457 newcolor = (infoPtr->clrBtnHighlight == CLR_DEFAULT) ? 457 newcolor = (infoPtr->clrBtnHighlight == CLR_DEFAULT) ? 458 458 comctl32_color.clrBtnHighlight : infoPtr->clrBtnHighlight; 459 459 SetBkColor (hdc, newcolor); … … 468 468 { 469 469 INT x, y; 470 SelectObject ( hdc, GetSysColorPen (colorRef)); 470 HPEN hPen, hOldPen; 471 472 if (!(hPen = CreatePen( PS_SOLID, 1, GetSysColor( colorRef )))) return; 473 hOldPen = SelectObject ( hdc, hPen ); 471 474 x = left + 2; 472 475 y = top + 8; … … 477 480 MoveToEx (hdc, x, y, NULL); 478 481 LineTo (hdc, x+1, y++); 482 SelectObject( hdc, hOldPen ); 483 DeleteObject( hPen ); 479 484 } 480 485 … … 627 632 else 628 633 rc.right = max(rc.left, rc.right - DDARROW_WIDTH - 2); 629 rcArrow.left = rc.right; 634 rcArrow.left = rc.right; 630 635 } 631 636 … … 641 646 rcBitmap.top+=(infoPtr->nButtonHeight - infoPtr->nBitmapHeight) / 2; 642 647 643 TRACE("iBitmap: %d, start=(%d,%d) w=%d, h=%d\n", 648 TRACE("iBitmap: %d, start=(%d,%d) w=%d, h=%d\n", 644 649 btnPtr->iBitmap, rcBitmap.left, rcBitmap.top, 645 650 infoPtr->nBitmapWidth, infoPtr->nBitmapHeight); … … 652 657 InflateRect (&rcText, -3, -3); 653 658 654 if (infoPtr->himlDef && 659 if (infoPtr->himlDef && 655 660 TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) { 656 661 /* The following test looked like this before … … 660 665 * ((btnPtr->fsStyle & TBSTYLE_AUTOSIZE) == 0) && 661 666 * (btnPtr->iBitmap != I_IMAGENONE)) 662 */ 667 */ 663 668 if (dwStyle & TBSTYLE_LIST) { 664 669 /* LIST style w/ ICON offset is by matching native. */ … … 707 712 tbcd.hpenLines = 0; 708 713 709 /* Issue Item Prepaint notify */ 714 /* Issue Item Prepaint notify */ 710 715 infoPtr->dwItemCustDraw = 0; 711 716 infoPtr->dwItemCDFlag = 0; … … 721 726 infoPtr->dwItemCustDraw = ntfret & 0xffff; 722 727 infoPtr->dwItemCDFlag = ntfret & 0xffff0000; 723 if (infoPtr->dwItemCustDraw & CDRF_SKIPDEFAULT) 728 if (infoPtr->dwItemCustDraw & CDRF_SKIPDEFAULT) 724 729 return; 725 730 /* save the only part of the rect that the user can change */ … … 761 766 BF_SOFT | BF_RECT | BF_MIDDLE | BF_ADJUST); 762 767 } 763 768 764 769 if (hasDropDownArrow) 765 770 { … … 769 774 770 775 if (!TOOLBAR_DrawImageList (infoPtr, btnPtr, infoPtr->himlDis, 771 hdc, rcBitmap.left, rcBitmap.top, 776 hdc, rcBitmap.left, rcBitmap.top, 772 777 ILD_NORMAL)) 773 778 TOOLBAR_DrawMasked (infoPtr, btnPtr, hdc, rcBitmap.left, rcBitmap.top); … … 800 805 801 806 TOOLBAR_DrawImageList (infoPtr, btnPtr, infoPtr->himlDef, 802 hdc, rcBitmap.left+offset, rcBitmap.top+offset, 807 hdc, rcBitmap.left+offset, rcBitmap.top+offset, 803 808 ILD_NORMAL); 804 809 … … 821 826 822 827 TOOLBAR_DrawPattern (hdc, &rc); 823 828 824 829 TOOLBAR_DrawImageList (infoPtr, btnPtr, infoPtr->himlDef, 825 hdc, rcBitmap.left+1, rcBitmap.top+1, 830 hdc, rcBitmap.left+1, rcBitmap.top+1, 826 831 ILD_NORMAL); 827 832 … … 830 835 } 831 836 832 /* indeterminate */ 837 /* indeterminate */ 833 838 if (btnPtr->fsState & TBSTATE_INDETERMINATE) { 834 839 if (!(infoPtr->dwItemCDFlag & TBCDRF_NOEDGES)) … … 884 889 if (btnPtr->bHot) { 885 890 /* if hot, attempt to draw with himlHot, if fails, use himlDef */ 886 if (!TOOLBAR_DrawImageList (infoPtr, btnPtr, 891 if (!TOOLBAR_DrawImageList (infoPtr, btnPtr, 887 892 infoPtr->himlHot, 888 hdc, rcBitmap.left, 893 hdc, rcBitmap.left, 889 894 rcBitmap.top, ILD_NORMAL)) 890 895 TOOLBAR_DrawImageList (infoPtr, btnPtr, infoPtr->himlDef, … … 914 919 hdc, rcBitmap.left, rcBitmap.top, 915 920 ILD_NORMAL);} 916 921 917 922 918 923 TOOLBAR_DrawString (infoPtr, btnPtr, hdc, btnPtr->fsState, dwStyle, &rcText, lpText, &tbcd); … … 998 1003 */ 999 1004 static void 1000 TOOLBAR_MeasureString(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, 1005 TOOLBAR_MeasureString(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, 1001 1006 HDC hdc, LPSIZE lpSize) 1002 1007 { … … 1006 1011 lpSize->cy = 0; 1007 1012 1008 if (!(btnPtr->fsState & TBSTATE_HIDDEN) ) 1013 if (!(btnPtr->fsState & TBSTATE_HIDDEN) ) 1009 1014 { 1010 1015 LPWSTR lpText = TOOLBAR_GetText(infoPtr, btnPtr); … … 1076 1081 * TOOLBAR_WrapToolbar 1077 1082 * 1078 * This function walks through the buttons and seperators in the 1079 * toolbar, and sets the TBSTATE_WRAP flag only on those items where 1080 * wrapping should occur based on the width of the toolbar window. 1081 * It does *not* calculate button placement itself. That task 1082 * takes place in TOOLBAR_CalcToolbar. If the program wants to manage 1083 * the toolbar wrapping on its own, it can use the TBSTYLE_WRAPABLE 1083 * This function walks through the buttons and seperators in the 1084 * toolbar, and sets the TBSTATE_WRAP flag only on those items where 1085 * wrapping should occur based on the width of the toolbar window. 1086 * It does *not* calculate button placement itself. That task 1087 * takes place in TOOLBAR_CalcToolbar. If the program wants to manage 1088 * the toolbar wrapping on its own, it can use the TBSTYLE_WRAPABLE 1084 1089 * flag, and set the TBSTATE_WRAP flags manually on the appropriate items. 1085 1090 * 1086 * Note: TBSTYLE_WRAPABLE or TBSTYLE_EX_UNDOC1 can be used also to allow 1087 * vertical toolbar lists. 1088 */ 1091 * Note: TBSTYLE_WRAPABLE or TBSTYLE_EX_UNDOC1 can be used also to allow 1092 * vertical toolbar lists. 1093 */ 1089 1094 1090 1095 static void … … 1097 1102 BOOL bWrap, bButtonWrap; 1098 1103 1099 /* When the toolbar window style is not TBSTYLE_WRAPABLE, */ 1104 /* When the toolbar window style is not TBSTYLE_WRAPABLE, */ 1100 1105 /* no layout is necessary. Applications may use this style */ 1101 1106 /* to perform their own layout on the toolbar. */ 1102 if( !(dwStyle & TBSTYLE_WRAPABLE) && 1107 if( !(dwStyle & TBSTYLE_WRAPABLE) && 1103 1108 !(infoPtr->dwExStyle & TBSTYLE_EX_UNDOC1) ) return; 1104 1109 … … 1122 1127 bWrap = FALSE; 1123 1128 btnPtr[i].fsState &= ~TBSTATE_WRAP; 1124 1129 1125 1130 if (btnPtr[i].fsState & TBSTATE_HIDDEN) 1126 1131 continue; … … 1134 1139 if ((btnPtr[i].fsStyle & TBSTYLE_SEP) && 1135 1140 !(btnPtr[i].fsStyle & TBSTYLE_DROPDOWN)) 1136 cx = (btnPtr[i].iBitmap > 0) ? 1141 cx = (btnPtr[i].iBitmap > 0) ? 1137 1142 btnPtr[i].iBitmap : SEPARATOR_WIDTH; 1138 1143 else 1139 1144 cx = infoPtr->nButtonWidth; 1140 1145 1141 /* Two or more adjacent separators form a separator group. */ 1146 /* Two or more adjacent separators form a separator group. */ 1142 1147 /* The first separator in a group should be wrapped to the */ 1143 1148 /* next row if the previous wrapping is on a button. */ 1144 1149 if( bButtonWrap && 1145 (btnPtr[i].fsStyle & TBSTYLE_SEP) && 1150 (btnPtr[i].fsStyle & TBSTYLE_SEP) && 1146 1151 (i + 1 < infoPtr->nNumButtons ) && 1147 (btnPtr[i + 1].fsStyle & TBSTYLE_SEP) ) 1152 (btnPtr[i + 1].fsStyle & TBSTYLE_SEP) ) 1148 1153 { 1149 1154 TRACE("wrap point 1 btn %d style %02x\n", i, btnPtr[i].fsStyle); … … 1158 1163 /* Test added to also wrap after a button that starts a row but */ 1159 1164 /* is bigger than the area. - GA 8/01 */ 1160 if (( x + cx - (infoPtr->nButtonWidth - infoPtr->nBitmapWidth) / 2 1165 if (( x + cx - (infoPtr->nButtonWidth - infoPtr->nBitmapWidth) / 2 1161 1166 > infoPtr->nWidth ) || 1162 1167 ((x == infoPtr->nIndent) && (cx > infoPtr->nWidth))) … … 1164 1169 BOOL bFound = FALSE; 1165 1170 1166 /* If the current button is a separator and not hidden, */ 1171 /* If the current button is a separator and not hidden, */ 1167 1172 /* go to the next until it reaches a non separator. */ 1168 1173 /* Wrap the last separator if it is before a button. */ 1169 1174 while( ( ((btnPtr[i].fsStyle & TBSTYLE_SEP) && 1170 !(btnPtr[i].fsStyle & TBSTYLE_DROPDOWN)) || 1175 !(btnPtr[i].fsStyle & TBSTYLE_DROPDOWN)) || 1171 1176 (btnPtr[i].fsState & TBSTATE_HIDDEN) ) && 1172 1177 i < infoPtr->nNumButtons ) … … 1175 1180 bFound = TRUE; 1176 1181 } 1177 1182 1178 1183 if( bFound && i < infoPtr->nNumButtons ) 1179 1184 { 1180 1185 i--; 1181 TRACE("wrap point 2 btn %d style %02x, x=%d, cx=%d\n", 1186 TRACE("wrap point 2 btn %d style %02x, x=%d, cx=%d\n", 1182 1187 i, btnPtr[i].fsStyle, x, cx); 1183 1188 btnPtr[i].fsState |= TBSTATE_WRAP; … … 1189 1194 break; 1190 1195 1191 /* If the current button is not a separator, find the last */ 1196 /* If the current button is not a separator, find the last */ 1192 1197 /* separator and wrap it. */ 1193 1198 for ( j = i - 1; j >= 0 && !(btnPtr[j].fsState & TBSTATE_WRAP); j--) … … 1196 1201 !(btnPtr[j].fsState & TBSTATE_HIDDEN)) 1197 1202 { 1198 bFound = TRUE; 1199 i = j; 1200 TRACE("wrap point 3 btn %d style %02x, x=%d, cx=%d\n", 1203 bFound = TRUE; 1204 i = j; 1205 TRACE("wrap point 3 btn %d style %02x, x=%d, cx=%d\n", 1201 1206 i, btnPtr[i].fsStyle, x, cx); 1202 1207 x = infoPtr->nIndent; 1203 1208 btnPtr[j].fsState |= TBSTATE_WRAP; 1204 bButtonWrap = FALSE; 1209 bButtonWrap = FALSE; 1205 1210 break; 1206 1211 } … … 1211 1216 if (!bFound) 1212 1217 { 1213 for ( j = i - 1; 1218 for ( j = i - 1; 1214 1219 j >= 0 && !(btnPtr[j].fsState & TBSTATE_WRAP); j--) 1215 1220 { 1216 if (btnPtr[j].fsState & TBSTATE_HIDDEN) 1221 if (btnPtr[j].fsState & TBSTATE_HIDDEN) 1217 1222 continue; 1218 1223 1219 bFound = TRUE; 1220 i = j; 1221 TRACE("wrap point 4 btn %d style %02x, x=%d, cx=%d\n", 1224 bFound = TRUE; 1225 i = j; 1226 TRACE("wrap point 4 btn %d style %02x, x=%d, cx=%d\n", 1222 1227 i, btnPtr[i].fsStyle, x, cx); 1223 1228 x = infoPtr->nIndent; … … 1229 1234 1230 1235 /* If all above failed, wrap the current button. */ 1231 if (!bFound) 1236 if (!bFound) 1232 1237 { 1233 1238 TRACE("wrap point 5 btn %d style %02x, x=%d, cx=%d\n", … … 1240 1245 else 1241 1246 bButtonWrap = TRUE; 1242 } 1247 } 1243 1248 } 1244 1249 else { 1245 TRACE("wrap point 6 btn %d style %02x, x=%d, cx=%d\n", 1250 TRACE("wrap point 6 btn %d style %02x, x=%d, cx=%d\n", 1246 1251 i, btnPtr[i].fsStyle, x, cx); 1247 1252 x += cx; … … 1254 1259 * TOOLBAR_CalcToolbar 1255 1260 * 1256 * This function calculates button and separator placement. It first 1257 * calculates the button sizes, gets the toolbar window width and then 1258 * calls TOOLBAR_WrapToolbar to determine which buttons we need to wrap 1261 * This function calculates button and separator placement. It first 1262 * calculates the button sizes, gets the toolbar window width and then 1263 * calls TOOLBAR_WrapToolbar to determine which buttons we need to wrap 1259 1264 * on. It assigns a new location to each item and sends this location to 1260 * the tooltip window if appropriate. Finally, it updates the rcBound 1261 * rect and calculates the new required toolbar window height. 1262 */ 1265 * the tooltip window if appropriate. Finally, it updates the rcBound 1266 * rect and calculates the new required toolbar window height. 1267 */ 1263 1268 1264 1269 static void … … 1297 1302 { 1298 1303 if (usesBitmaps) 1299 infoPtr->nButtonHeight = sizeString.cy + 1304 infoPtr->nButtonHeight = sizeString.cy + 1300 1305 2 + /* this is the space to separate text from bitmap */ 1301 1306 infoPtr->nBitmapHeight + 6; 1302 else 1307 else 1303 1308 infoPtr->nButtonHeight = sizeString.cy + 6; 1304 1309 } … … 1323 1328 1324 1329 /* 1325 * We will set the height below, and we set the width on entry 1326 * so we do not reset them here.. 1330 * We will set the height below, and we set the width on entry 1331 * so we do not reset them here.. 1327 1332 */ 1328 1333 #if 0 … … 1385 1390 else 1386 1391 { 1387 if (btnPtr->fsStyle & TBSTYLE_AUTOSIZE) 1392 if (btnPtr->fsStyle & TBSTYLE_AUTOSIZE) 1388 1393 { 1389 1394 SIZE sz; … … 1402 1407 /* toolbars with native control (v4.71). - GA 8/01 */ 1403 1408 cx = sz.cx + 6 + 5 + 5; 1404 if ((dwStyle & TBSTYLE_LIST) && 1409 if ((dwStyle & TBSTYLE_LIST) && 1405 1410 (TOOLBAR_TestImageExist (infoPtr, btnPtr, infoPtr->himlDef))) 1406 1411 cx += infoPtr->nBitmapWidth; … … 1410 1415 1411 1416 if (hasDropDownArrows && (btnPtr->fsStyle & TBSTYLE_DROPDOWN)) 1412 cx += DDARROW_WIDTH; 1417 cx += DDARROW_WIDTH; 1413 1418 } 1414 1419 if (btnPtr->fsState & TBSTATE_WRAP ) … … 1425 1430 1426 1431 /* Set the toolTip only for non-hidden, non-separator button */ 1427 if (infoPtr->hwndToolTip && !(btnPtr->fsStyle & TBSTYLE_SEP )) 1432 if (infoPtr->hwndToolTip && !(btnPtr->fsStyle & TBSTYLE_SEP )) 1428 1433 { 1429 1434 TTTOOLINFOA ti; … … 1450 1455 if ( !(btnPtr->fsStyle & TBSTYLE_SEP) ) 1451 1456 y += cy; 1452 else 1453 { 1457 else 1458 { 1454 1459 /* UNDOCUMENTED: If a separator has a non zero bitmap index, */ 1455 1460 /* it is the actual width of the separator. This is used for */ … … 1457 1462 if ( !(btnPtr->fsStyle & TBSTYLE_DROPDOWN)) 1458 1463 y += cy + ( (btnPtr->iBitmap > 0 ) ? 1459 btnPtr->iBitmap : SEPARATOR_WIDTH) * 2 /3; 1464 btnPtr->iBitmap : SEPARATOR_WIDTH) * 2 /3; 1460 1465 else 1461 1466 y += cy; 1462 1467 1463 1468 /* nSepRows is used to calculate the extra height follwoing */ 1464 1469 /* the last row. */ … … 1491 1496 /* nSepRows * (infoPtr->nBitmapHeight + 1) is the space following */ 1492 1497 /* the last row. */ 1493 infoPtr->nHeight = TOP_BORDER + (nRows + 1) * infoPtr->nButtonHeight + 1498 infoPtr->nHeight = TOP_BORDER + (nRows + 1) * infoPtr->nButtonHeight + 1494 1499 nSepRows * (SEPARATOR_WIDTH * 2 / 3) + 1495 nSepRows * (infoPtr->nBitmapHeight + 1) + 1496 BOTTOM_BORDER; 1500 nSepRows * (infoPtr->nBitmapHeight + 1) + 1501 BOTTOM_BORDER; 1497 1502 #endif 1498 1503 … … 1509 1514 TBUTTON_INFO *btnPtr; 1510 1515 INT i; 1511 1516 1512 1517 btnPtr = infoPtr->buttons; 1513 1518 for (i = 0; i < infoPtr->nNumButtons; i++, btnPtr++) { … … 1589 1594 nRunIndex = nIndex + 1; 1590 1595 while (nRunIndex < infoPtr->nNumButtons) { 1591 btnPtr = &infoPtr->buttons[nRunIndex]; 1596 btnPtr = &infoPtr->buttons[nRunIndex]; 1592 1597 if ((btnPtr->fsStyle & TBSTYLE_CHECKGROUP) == TBSTYLE_CHECKGROUP) { 1593 1598 if (btnPtr->fsState & TBSTATE_CHECKED) … … 1644 1649 int i = 0; 1645 1650 int index; 1646 1651 1647 1652 infoPtr = custInfo->tbInfo; 1648 1653 … … 1664 1669 /* send TBN_QUERYDELETE notification */ 1665 1670 nmtb.iItem = i; 1666 btnInfo->bRemovable = TOOLBAR_SendNotify ((NMHDR *) &nmtb, 1667 infoPtr, 1671 btnInfo->bRemovable = TOOLBAR_SendNotify ((NMHDR *) &nmtb, 1672 infoPtr, 1668 1673 TBN_QUERYDELETE); 1669 1674 … … 1693 1698 break; 1694 1699 1695 TRACE("style: %x\n", nmtb.tbButton.fsStyle); 1700 TRACE("style: %x\n", nmtb.tbButton.fsStyle); 1696 1701 1697 1702 /* insert button into the apropriate list */ … … 1769 1774 /* send TBN_QUERYINSERT notification */ 1770 1775 nmtb.iItem = index; 1771 TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr, 1776 TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr, 1772 1777 TBN_QUERYINSERT); 1773 1778 … … 1987 1992 RECT rcButton; 1988 1993 RECT rcText; 1989 HPEN h OldPen;1994 HPEN hPen, hOldPen; 1990 1995 HBRUSH hOldBrush; 1991 1996 COLORREF oldText = 0; … … 2006 2011 else 2007 2012 oldText = SetTextColor (lpdis->hDC, (lpdis->itemState & ODS_FOCUS)?comctl32_color.clrHighlightText:comctl32_color.clrWindowText); 2008 hOldPen = SelectObject (lpdis->hDC, GetSysColorPen ((lpdis->itemState & ODS_SELECTED)?COLOR_HIGHLIGHT:COLOR_WINDOW)); 2013 hPen = CreatePen( PS_SOLID, 1, 2014 GetSysColor( (lpdis->itemState & ODS_SELECTED)?COLOR_HIGHLIGHT:COLOR_WINDOW)); 2015 hOldPen = SelectObject (lpdis->hDC, hPen ); 2009 2016 hOldBrush = SelectObject (lpdis->hDC, GetSysColorBrush ((lpdis->itemState & ODS_FOCUS)?COLOR_HIGHLIGHT:COLOR_WINDOW)); 2010 2017 … … 2039 2046 SetBkColor (lpdis->hDC, oldBk); 2040 2047 SetTextColor (lpdis->hDC, oldText); 2041 2048 DeleteObject( hPen ); 2042 2049 return TRUE; 2043 2050 } … … 2076 2083 HBITMAP hbmLoad; 2077 2084 2078 TRACE("hwnd=% xwParam=%x lParam=%lx\n", hwnd, wParam, lParam);2085 TRACE("hwnd=%p wParam=%x lParam=%lx\n", hwnd, wParam, lParam); 2079 2086 if (!lpAddBmp) 2080 2087 return -1; … … 2094 2101 2095 2102 /* Windows resize all the buttons to the size of a newly added standard image */ 2096 if (lpAddBmp->nID & 1) 2103 if (lpAddBmp->nID & 1) 2097 2104 { 2098 2105 /* large icons */ 2099 /* FIXME: on windows the size of the images is 25x24 but the size of the bitmap 2100 * in rsrc is only 24x24. Fix the bitmap (how?) and then fix this 2106 /* FIXME: on windows the size of the images is 25x24 but the size of the bitmap 2107 * in rsrc is only 24x24. Fix the bitmap (how?) and then fix this 2101 2108 */ 2102 2109 SendMessageA (hwnd, TB_SETBITMAPSIZE, 0, … … 2104 2111 SendMessageA (hwnd, TB_SETBUTTONSIZE, 0, 2105 2112 MAKELPARAM((WORD)31, (WORD)30)); 2106 } 2107 else 2113 } 2114 else 2108 2115 { 2109 2116 /* small icons */ … … 2113 2120 MAKELPARAM((WORD)22, (WORD)22)); 2114 2121 } 2115 2122 2116 2123 TOOLBAR_CalcToolbar (hwnd); 2117 2124 } … … 2121 2128 if (nButtons <= 0) 2122 2129 return -1; 2123 2130 2124 2131 TRACE ("adding %d bitmaps!\n", nButtons); 2125 2132 } 2126 2133 2127 2134 if (!(infoPtr->himlDef)) { 2128 2135 /* create new default image list */ … … 2140 2147 if (lpAddBmp->hInst == (HINSTANCE)0) 2141 2148 { 2142 nIndex = 2149 nIndex = 2143 2150 ImageList_AddMasked (infoPtr->himlDef, (HBITMAP)lpAddBmp->nID, 2144 2151 CLR_DEFAULT); … … 2470 2477 { 2471 2478 PWSTR p = szString + 1; 2472 2473 nIndex = infoPtr->nNumStrings; 2474 while (*p != L'|') { 2475 2476 if (infoPtr->nNumStrings == 0) { 2477 infoPtr->strings = 2478 COMCTL32_Alloc (sizeof(LPWSTR)); 2479 } 2480 else { 2481 LPWSTR *oldStrings = infoPtr->strings; 2482 infoPtr->strings = 2483 COMCTL32_Alloc (sizeof(LPWSTR) * (infoPtr->nNumStrings + 1)); 2484 memcpy (&infoPtr->strings[0], &oldStrings[0], 2485 sizeof(LPWSTR) * infoPtr->nNumStrings); 2486 COMCTL32_Free (oldStrings); 2487 } 2488 2489 len = COMCTL32_StrChrW (p, L'|') - p; 2490 TRACE("len=%d %s\n", len, debugstr_w(p)); 2491 infoPtr->strings[infoPtr->nNumStrings] = 2492 COMCTL32_Alloc (sizeof(WCHAR)*(len+1)); 2493 lstrcpynW (infoPtr->strings[infoPtr->nNumStrings], p, len+1); 2494 infoPtr->nNumStrings++; 2495 2496 p += (len+1); 2497 } 2479 2480 nIndex = infoPtr->nNumStrings; 2481 while (*p != L'|' && *p != L'\0') { 2482 PWSTR np; 2483 2484 if (infoPtr->nNumStrings == 0) { 2485 infoPtr->strings = COMCTL32_Alloc (sizeof(LPWSTR)); 2486 } 2487 else 2488 { 2489 LPWSTR *oldStrings = infoPtr->strings; 2490 infoPtr->strings = COMCTL32_Alloc(sizeof(LPWSTR) * (infoPtr->nNumStrings + 1)); 2491 memcpy(&infoPtr->strings[0], &oldStrings[0], 2492 sizeof(LPWSTR) * infoPtr->nNumStrings); 2493 COMCTL32_Free(oldStrings); 2494 } 2495 2496 np=COMCTL32_StrChrW (p, L'|'); 2497 if (np!=NULL) { 2498 len = np - p; 2499 np++; 2500 } else { 2501 len = strlenW(p); 2502 np = p + len; 2503 } 2504 TRACE("len=%d %s\n", len, debugstr_w(p)); 2505 infoPtr->strings[infoPtr->nNumStrings] = 2506 COMCTL32_Alloc (sizeof(WCHAR)*(len+1)); 2507 lstrcpynW (infoPtr->strings[infoPtr->nNumStrings], p, len+1); 2508 infoPtr->nNumStrings++; 2509 2510 p = np; 2511 } 2498 2512 } 2499 2513 else … … 2635 2649 2636 2650 if (infoPtr == NULL) { 2637 ERR("( 0x%x, 0x%x, 0x%lx)\n", hwnd, wParam, lParam);2651 ERR("(%p, 0x%x, 0x%lx)\n", hwnd, wParam, lParam); 2638 2652 ERR("infoPtr == NULL!\n"); 2639 2653 return 0; … … 2692 2706 else { 2693 2707 if (btnPtr->fsStyle & TBSTYLE_GROUP) { 2694 nOldIndex = 2708 nOldIndex = 2695 2709 TOOLBAR_GetCheckedGroupButtonIndex (infoPtr, nIndex); 2696 2710 if (nOldIndex == nIndex) … … 2752 2766 return FALSE; 2753 2767 2754 ret = DialogBoxIndirectParamA ( GetWindowLongA(hwnd, GWL_HINSTANCE),2768 ret = DialogBoxIndirectParamA ((HINSTANCE)GetWindowLongA(hwnd, GWL_HINSTANCE), 2755 2769 (LPDLGTEMPLATEA)template, 2756 2770 hwnd, … … 2775 2789 return FALSE; 2776 2790 2777 if ((infoPtr->hwndToolTip) && 2791 if ((infoPtr->hwndToolTip) && 2778 2792 !(infoPtr->buttons[nIndex].fsStyle & TBSTYLE_SEP)) { 2779 2793 TTTOOLINFOA ti; … … 2970 2984 return -1; 2971 2985 2972 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, 2986 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, 2973 2987 lpTbInfo->dwMask & 0x80000000); 2974 2988 if (nIndex == -1) … … 2976 2990 2977 2991 btnPtr = &infoPtr->buttons[nIndex]; 2992 2993 if(!btnPtr) 2994 return -1; 2978 2995 2979 2996 if (lpTbInfo->dwMask & TBIF_COMMAND) … … 3128 3145 if (btnPtr->fsState & TBSTATE_HIDDEN) 3129 3146 return FALSE; 3130 3147 3131 3148 lpRect->left = btnPtr->rect.left; 3132 3149 lpRect->right = btnPtr->rect.right; … … 3189 3206 if (lpRect == NULL) 3190 3207 return FALSE; 3191 3208 3192 3209 lpRect->left = btnPtr->rect.left; 3193 3210 lpRect->right = btnPtr->rect.right; … … 3258 3275 if (infoPtr == NULL) 3259 3276 return 0; 3260 return infoPtr->hwndToolTip;3277 return (LRESULT)infoPtr->hwndToolTip; 3261 3278 } 3262 3279 … … 3267 3284 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 3268 3285 3269 TRACE("%s hwnd= 0x%x stub!\n",3286 TRACE("%s hwnd=%p stub!\n", 3270 3287 infoPtr->bUnicode ? "TRUE" : "FALSE", hwnd); 3271 3288 … … 3465 3482 return FALSE; 3466 3483 3467 /* If the string passed is not an index, assume address of string 3484 /* If the string passed is not an index, assume address of string 3468 3485 and do our own AddString */ 3469 3486 if ((HIWORD(lpTbb->iString) != 0) && (lpTbb->iString != -1)) { … … 3663 3680 int i = 0, nOldButtons = 0, pos = 0; 3664 3681 3665 TRACE("hInstOld % x nIDOld %x hInstNew %xnIDNew %x nButtons %x\n",3682 TRACE("hInstOld %p nIDOld %x hInstNew %p nIDNew %x nButtons %x\n", 3666 3683 lpReplace->hInstOld, lpReplace->nIDOld, lpReplace->hInstNew, lpReplace->nIDNew, 3667 3684 lpReplace->nButtons); 3668 3685 3669 if (lpReplace->hInstOld == -1)3686 if (lpReplace->hInstOld == HINST_COMMCTRL) 3670 3687 { 3671 3688 FIXME("changing standard bitmaps not implemented\n"); … … 3682 3699 } 3683 3700 3684 TRACE("To be replaced hInstOld % xnIDOld %x\n", lpReplace->hInstOld, lpReplace->nIDOld);3701 TRACE("To be replaced hInstOld %p nIDOld %x\n", lpReplace->hInstOld, lpReplace->nIDOld); 3685 3702 for (i = 0; i < infoPtr->nNumBitmapInfos; i++) { 3686 3703 TBITMAP_INFO *tbi = &infoPtr->bitmaps[i]; 3687 TRACE("tbimapinfo %d hInstOld % xnIDOld %x\n", i, tbi->hInst, tbi->nID);3704 TRACE("tbimapinfo %d hInstOld %p nIDOld %x\n", i, tbi->hInst, tbi->nID); 3688 3705 if (tbi->hInst == lpReplace->hInstOld && tbi->nID == lpReplace->nIDOld) 3689 3706 { 3690 TRACE("Found: nButtons %d hInst % xnID %x\n", tbi->nButtons, tbi->hInst, tbi->nID);3707 TRACE("Found: nButtons %d hInst %p nID %x\n", tbi->nButtons, tbi->hInst, tbi->nID); 3691 3708 nOldButtons = tbi->nButtons; 3692 3709 tbi->nButtons = lpReplace->nButtons; 3693 3710 tbi->hInst = lpReplace->hInstNew; 3694 3711 tbi->nID = lpReplace->nIDNew; 3695 TRACE("tbimapinfo changed %d hInstOld % xnIDOld %x\n", i, tbi->hInst, tbi->nID);3712 TRACE("tbimapinfo changed %d hInstOld %p nIDOld %x\n", i, tbi->hInst, tbi->nID); 3696 3713 break; 3697 3714 } … … 3701 3718 if (nOldButtons == 0) 3702 3719 { 3703 WARN("No hinst/bitmap found! hInst % xnID %x\n", lpReplace->hInstOld, lpReplace->nIDOld);3720 WARN("No hinst/bitmap found! hInst %p nID %x\n", lpReplace->hInstOld, lpReplace->nIDOld); 3704 3721 return FALSE; 3705 3722 } … … 3833 3850 if (lptbbi->cbSize < sizeof(TBBUTTONINFOA)) 3834 3851 return FALSE; 3835 3852 3836 3853 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, 3837 3854 lptbbi->dwMask & 0x80000000); … … 3857 3874 /* iString is index, zero it to make Str_SetPtr succeed */ 3858 3875 btnPtr->iString=0; 3859 3876 3860 3877 Str_SetPtrAtoW ((LPWSTR *)&btnPtr->iString, lptbbi->pszText); 3861 3878 } … … 3919 3936 3920 3937 /* The documentation claims you can only change the button size before 3921 * any button has been added. But this is wrong. 3922 * WINZIP32.EXE (ver 8) calls this on one of its buttons after adding 3938 * any button has been added. But this is wrong. 3939 * WINZIP32.EXE (ver 8) calls this on one of its buttons after adding 3923 3940 * it to the toolbar, and it checks that the return value is nonzero - mjm 3924 3941 * Further testing shows that we must actually perform the change too. … … 3927 3944 * The documentation also does not mention that if 0 is supplied for 3928 3945 * either size, the system changes it to the default of 24 wide and 3929 * 22 high. Demonstarted in ControlSpy Toolbar. GLA 3/02 3946 * 22 high. Demonstarted in ControlSpy Toolbar. GLA 3/02 3930 3947 */ 3931 3948 infoPtr->nButtonWidth = (cx) ? cx : 24; … … 3950 3967 TRACE("matches current width, min=%d, max=%d, no recalc\n", 3951 3968 infoPtr->cxMin, infoPtr->cxMax); 3952 return TRUE; 3969 return TRUE; 3953 3970 } 3954 3971 … … 3959 3976 /* if both values are 0 then we are done */ 3960 3977 if (lParam == 0) { 3961 TRACE("setting both min and max to 0, norecalc\n"); 3978 TRACE("setting both min and max to 0, norecalc\n"); 3962 3979 return TRUE; 3963 3980 } … … 3966 3983 recalc the bounding rectangle (does DrawText w/ DT_CALCRECT 3967 3984 which doesn't actually draw - GA). */ 3968 TRACE("number of buttons %d, cx=%d, cy=%d, recalcing\n", 3985 TRACE("number of buttons %d, cx=%d, cy=%d, recalcing\n", 3969 3986 infoPtr->nNumButtons, infoPtr->cxMin, infoPtr->cxMax); 3970 3987 … … 4015 4032 /* FIXME: redraw ? */ 4016 4033 4017 return (LRESULT)himlTemp; 4034 return (LRESULT)himlTemp; 4018 4035 } 4019 4036 … … 4054 4071 (infoPtr->dwExStyle & ~TBSTYLE_EX_ALL)); 4055 4072 4056 return (LRESULT)dwTemp; 4073 return (LRESULT)dwTemp; 4057 4074 } 4058 4075 … … 4074 4091 /* FIXME: redraw ? */ 4075 4092 4076 return (LRESULT)himlTemp; 4093 return (LRESULT)himlTemp; 4077 4094 } 4078 4095 … … 4133 4150 ImageList_GetIconSize(infoPtr->himlDef, &infoPtr->nBitmapWidth, 4134 4151 &infoPtr->nBitmapHeight); 4135 TRACE("hwnd % 08x, new himl=%08x, count=%d, bitmap w=%d, h=%d\n",4152 TRACE("hwnd %p, new himl=%08x, count=%d, bitmap w=%d, h=%d\n", 4136 4153 hwnd, (INT)infoPtr->himlDef, infoPtr->nNumBitmaps, 4137 4154 infoPtr->nBitmapWidth, infoPtr->nBitmapHeight); … … 4140 4157 InvalidateRect(hwnd, NULL, TRUE); 4141 4158 4142 return (LRESULT)himlTemp; 4159 return (LRESULT)himlTemp; 4143 4160 } 4144 4161 … … 4223 4240 infoPtr->hwndNotify = (HWND)wParam; 4224 4241 4225 return hwndOldNotify;4242 return (LRESULT)hwndOldNotify; 4226 4243 } 4227 4244 … … 4342 4359 BOOL bTemp; 4343 4360 4344 TRACE("%s hwnd= 0x%04x stub!\n",4361 TRACE("%s hwnd=%p stub!\n", 4345 4362 ((BOOL)wParam) ? "TRUE" : "FALSE", hwnd); 4346 4363 … … 4357 4374 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 4358 4375 4359 lParam->clrBtnHighlight = (infoPtr->clrBtnHighlight == CLR_DEFAULT) ? 4360 comctl32_color.clrBtnHighlight : 4376 lParam->clrBtnHighlight = (infoPtr->clrBtnHighlight == CLR_DEFAULT) ? 4377 comctl32_color.clrBtnHighlight : 4361 4378 infoPtr->clrBtnHighlight; 4362 lParam->clrBtnShadow = (infoPtr->clrBtnShadow == CLR_DEFAULT) ? 4379 lParam->clrBtnShadow = (infoPtr->clrBtnShadow == CLR_DEFAULT) ? 4363 4380 comctl32_color.clrBtnShadow : infoPtr->clrBtnShadow; 4364 4381 return 1; … … 4420 4437 infoPtr->buttons[nOldHotItem].idCommand : 0; 4421 4438 if ( !(nmhotitem.dwFlags & HICF_LEAVING) ) 4422 nmhotitem.idNew = (infoPtr->nHotItem >= 0) ? 4439 nmhotitem.idNew = (infoPtr->nHotItem >= 0) ? 4423 4440 infoPtr->buttons[infoPtr->nHotItem].idCommand : 0; 4424 4441 no_hi = TOOLBAR_SendNotify((NMHDR*)&nmhotitem, infoPtr, TBN_HOTITEMCHANGE); … … 4629 4646 4630 4647 /* FIXME: in general the return flags *can* be or'ed together */ 4631 switch (infoPtr->dwBaseCustDraw) 4648 switch (infoPtr->dwBaseCustDraw) 4632 4649 { 4633 4650 case CDRF_DODEFAULT: … … 4636 4653 return TRUE; 4637 4654 default: 4638 FIXME("[% 04x] response %ld not handled to NM_CUSTOMDRAW (CDDS_PREERASE)\n",4655 FIXME("[%p] response %ld not handled to NM_CUSTOMDRAW (CDDS_PREERASE)\n", 4639 4656 hwnd, ntfret); 4640 4657 } 4641 4658 } 4642 4659 4643 /* If the toolbar is "transparent" then pass the WM_ERASEBKGND up 4660 /* If the toolbar is "transparent" then pass the WM_ERASEBKGND up 4644 4661 * to my parent for processing. 4645 4662 */ … … 4660 4677 ret = DefWindowProcA (hwnd, WM_ERASEBKGND, wParam, lParam); 4661 4678 4662 if ((dwStyle & TBSTYLE_CUSTOMERASE) && 4663 (infoPtr->dwBaseCustDraw & CDRF_NOTIFYPOSTERASE)) { 4679 if ((dwStyle & TBSTYLE_CUSTOMERASE) && 4680 (infoPtr->dwBaseCustDraw & CDRF_NOTIFYPOSTERASE)) { 4664 4681 ZeroMemory (&tbcd, sizeof(NMTBCUSTOMDRAW)); 4665 4682 tbcd.nmcd.dwDrawStage = CDDS_POSTERASE; … … 4667 4684 ntfret = TOOLBAR_SendNotify ((NMHDR *)&tbcd, infoPtr, NM_CUSTOMDRAW); 4668 4685 infoPtr->dwBaseCustDraw = ntfret & 0xffff; 4669 switch (infoPtr->dwBaseCustDraw) 4686 switch (infoPtr->dwBaseCustDraw) 4670 4687 { 4671 4688 case CDRF_DODEFAULT: … … 4674 4691 return TRUE; 4675 4692 default: 4676 FIXME("[% 04x] response %ld not handled to NM_CUSTOMDRAW (CDDS_PREERASE)\n",4693 FIXME("[%p] response %ld not handled to NM_CUSTOMDRAW (CDDS_PREERASE)\n", 4677 4694 hwnd, ntfret); 4678 4695 } … … 4687 4704 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 4688 4705 4689 return infoPtr->hFont;4706 return (LRESULT)infoPtr->hFont; 4690 4707 } 4691 4708 … … 4743 4760 RECT arrowRect; 4744 4761 btnPtr = &infoPtr->buttons[nHit]; 4745 if (!(btnPtr->fsState & TBSTATE_ENABLED))4746 return 0;4747 4748 4762 infoPtr->nOldHit = nHit; 4749 4763 … … 4752 4766 4753 4767 /* for EX_DRAWDDARROWS style, click must be in the drop-down arrow rect */ 4754 if ((btnPtr->fsSt yle & TBSTYLE_DROPDOWN) &&4768 if ((btnPtr->fsState & TBSTATE_ENABLED) && (btnPtr->fsStyle & TBSTYLE_DROPDOWN) && 4755 4769 ((TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle) && PtInRect(&arrowRect, pt)) || 4756 4770 (!TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle)))) … … 4783 4797 btnPtr->bHot = FALSE; 4784 4798 4785 InvalidateRect(hwnd, &btnPtr->rect, 4786 4799 if (btnPtr->fsState & TBSTATE_ENABLED) 4800 InvalidateRect(hwnd, &btnPtr->rect, TOOLBAR_HasText(infoPtr, btnPtr)); 4787 4801 UpdateWindow(hwnd); 4788 4802 SetCapture (hwnd); … … 4840 4854 if (nOldIndex == nHit) 4841 4855 bSendMessage = FALSE; 4842 if ((nOldIndex != nHit) && 4856 if ((nOldIndex != nHit) && 4843 4857 (nOldIndex != -1)) 4844 4858 infoPtr->buttons[nOldIndex].fsState &= ~TBSTATE_CHECKED; … … 4862 4876 * now we can ReleaseCapture, which triggers CAPTURECHANGED msg, 4863 4877 * that resets bCaptured and btn TBSTATE_PRESSED flags, 4864 * and obliterates nButtonDown and nOldHit (see TOOLBAR_CaptureChanged) 4878 * and obliterates nButtonDown and nOldHit (see TOOLBAR_CaptureChanged) 4865 4879 */ 4866 4880 if ((infoPtr->bCaptured) && (infoPtr->nButtonDown >= 0)) 4867 4881 ReleaseCapture (); 4882 infoPtr->nButtonDown = -1; 4868 4883 4869 4884 /* Issue NM_RELEASEDCAPTURE to parent to let him know it is released */ … … 4871 4886 NM_RELEASEDCAPTURE); 4872 4887 4873 /* native issues TBN_ENDDRAG here, if _LBUTTONDOWN issued the 4888 /* native issues TBN_ENDDRAG here, if _LBUTTONDOWN issued the 4874 4889 * TBN_BEGINDRAG 4875 4890 */ … … 4886 4901 TBN_ENDDRAG); 4887 4902 4888 SendMessageA (infoPtr->hwndNotify, WM_COMMAND, 4889 MAKEWPARAM(infoPtr->buttons[nHit].idCommand, 0), (LPARAM)hwnd); 4890 4891 /* !!! Undocumented - toolbar at 4.71 level and above sends 4892 * either NMRCLICK or NM_CLICK with the NMMOUSE structure. 4893 * Only NM_RCLICK is documented. 4894 */ 4895 nmmouse.dwItemSpec = btnPtr->idCommand; 4896 nmmouse.dwItemData = btnPtr->dwData; 4897 TOOLBAR_SendNotify ((NMHDR *) &nmmouse, infoPtr, 4898 NM_CLICK); 4903 if (btnPtr->fsState & TBSTATE_ENABLED) 4904 { 4905 SendMessageA (infoPtr->hwndNotify, WM_COMMAND, 4906 MAKEWPARAM(infoPtr->buttons[nHit].idCommand, 0), (LPARAM)hwnd); 4907 4908 /* !!! Undocumented - toolbar at 4.71 level and above sends 4909 * either NMRCLICK or NM_CLICK with the NMMOUSE structure. 4910 * Only NM_RCLICK is documented. 4911 */ 4912 nmmouse.dwItemSpec = btnPtr->idCommand; 4913 nmmouse.dwItemData = btnPtr->dwData; 4914 TOOLBAR_SendNotify ((NMHDR *) &nmmouse, infoPtr, NM_CLICK); 4915 } 4899 4916 return 0; 4900 4917 } … … 4913 4930 btnPtr->fsState &= ~TBSTATE_PRESSED; 4914 4931 4915 infoPtr->nButtonDown = -1;4916 4932 infoPtr->nOldHit = -1; 4917 4933 4918 InvalidateRect(hwnd, &btnPtr->rect, TOOLBAR_HasText(infoPtr, 4919 btnPtr)); 4934 if (btnPtr->fsState & TBSTATE_ENABLED) 4935 InvalidateRect(hwnd, &btnPtr->rect, TOOLBAR_HasText(infoPtr, 4936 btnPtr)); 4920 4937 } 4921 4938 return 0; … … 4986 5003 if(!(trackinfo.dwFlags & TME_LEAVE)) { 4987 5004 trackinfo.dwFlags = TME_LEAVE; /* notify upon leaving */ 4988 5005 4989 5006 /* call TRACKMOUSEEVENT so we receive a WM_MOUSELEAVE message */ 4990 5007 /* and can properly deactivate the hot toolbar button */ … … 5005 5022 /* Remove the effect of an old hot button if the button was enabled and was 5006 5023 drawn with the hot button effect */ 5007 if(infoPtr->nOldHit >= 0 && infoPtr->nOldHit == infoPtr->nHotItem && 5024 if(infoPtr->nOldHit >= 0 && infoPtr->nOldHit == infoPtr->nHotItem && 5008 5025 (infoPtr->buttons[infoPtr->nOldHit].fsState & TBSTATE_ENABLED)) 5009 5026 { … … 5019 5036 infoPtr->nHotItem = nHit; 5020 5037 5021 /* only enabled buttons show hot effect */ 5038 /* only enabled buttons show hot effect */ 5022 5039 if(infoPtr->buttons[nHit].fsState & TBSTATE_ENABLED) 5023 5040 { … … 5110 5127 * hdc = GetDC(toolbar) 5111 5128 * GetSystemMetrics(0x48) 5112 * fnt2=CreateFontA(0xe, 0, 0, 0, 0x190, 0, 0, 0, 0, 2, 5129 * fnt2=CreateFontA(0xe, 0, 0, 0, 0x190, 0, 0, 0, 0, 2, 5113 5130 * 0, 0, 0, 0, "MARLETT") 5114 5131 * oldfnt = SelectObject(hdc, fnt2) … … 5199 5216 if (lppgc->dwFlag == PGF_CALCWIDTH) { 5200 5217 lppgc->iWidth = infoPtr->rcBound.right - infoPtr->rcBound.left; 5201 TRACE("processed PGN_CALCSIZE, returning horz size = %d\n", 5218 TRACE("processed PGN_CALCSIZE, returning horz size = %d\n", 5202 5219 lppgc->iWidth); 5203 5220 } 5204 5221 else { 5205 5222 lppgc->iHeight = infoPtr->rcBound.bottom - infoPtr->rcBound.top; 5206 TRACE("processed PGN_CALCSIZE, returning vert size = %d\n", 5223 TRACE("processed PGN_CALCSIZE, returning vert size = %d\n", 5207 5224 lppgc->iHeight); 5208 5225 } 5226 return 0; 5227 } 5228 5229 if (lpnmh->code == PGN_SCROLL) { 5230 LPNMPGSCROLL lppgs = (LPNMPGSCROLL)lParam; 5231 5232 lppgs->iScroll = (lppgs->iDir & (PGF_SCROLLLEFT | PGF_SCROLLRIGHT)) ? 5233 infoPtr->nButtonWidth : infoPtr->nButtonHeight; 5234 TRACE("processed PGN_SCROLL, returning scroll=%d, dir=%d\n", 5235 lppgs->iScroll, lppgs->iDir); 5209 5236 return 0; 5210 5237 } … … 5215 5242 if ((infoPtr->hwndToolTip) && (lpnmh->hwndFrom == infoPtr->hwndToolTip)) { 5216 5243 if (infoPtr->bNtfUnicode) 5217 return SendMessageW (infoPtr->hwndNotify, WM_NOTIFY, 5244 return SendMessageW (infoPtr->hwndNotify, WM_NOTIFY, 5218 5245 wParam, lParam); 5219 5246 else 5220 return SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, 5247 return SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, 5221 5248 wParam, lParam); 5222 5249 … … 5259 5286 if (lParam == NF_REQUERY) { 5260 5287 i = SendMessageA(GetParent(infoPtr->hwndSelf), 5261 WM_NOTIFYFORMAT, infoPtr->hwndSelf, NF_QUERY);5288 WM_NOTIFYFORMAT, (WPARAM)infoPtr->hwndSelf, NF_QUERY); 5262 5289 if ((i < NFR_ANSI) || (i > NFR_UNICODE)) { 5263 5290 ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n", … … 5280 5307 5281 5308 /* fill ps.rcPaint with a default rect */ 5282 memcpy(&(ps.rcPaint), &(infoPtr->rcBound), sizeof(infoPtr->rcBound)); 5309 memcpy(&(ps.rcPaint), &(infoPtr->rcBound), sizeof(infoPtr->rcBound)); 5283 5310 5284 5311 hdc = wParam==0 ? BeginPaint(hwnd, &ps) : (HDC)wParam; … … 5303 5330 * 5304 5331 * Documentation: 5305 * According to testing V4.71 of COMCTL32 returns the 5332 * According to testing V4.71 of COMCTL32 returns the 5306 5333 * *previous* status of the redraw flag (either 0 or 1) 5307 5334 * instead of the MSDN documented value of 0 if handled. … … 5314 5341 BOOL oldredraw = infoPtr->bDoRedraw; 5315 5342 5316 TRACE("set to %s\n", 5343 TRACE("set to %s\n", 5317 5344 (wParam) ? "TRUE" : "FALSE"); 5318 5345 infoPtr->bDoRedraw = (BOOL) wParam; … … 5368 5395 * Calc Toolbar will not adjust it, only the height 5369 5396 */ 5370 infoPtr->nWidth = parent_rect.right - parent_rect.left; 5397 infoPtr->nWidth = parent_rect.right - parent_rect.left; 5371 5398 cy = infoPtr->nHeight; 5372 5399 cx = infoPtr->nWidth; … … 5424 5451 } 5425 5452 infoPtr->bTransparent = (lpStyle->styleNew & TBSTYLE_TRANSPARENT); 5426 infoPtr->bBtnTranspnt = (lpStyle->styleNew & 5453 infoPtr->bBtnTranspnt = (lpStyle->styleNew & 5427 5454 (TBSTYLE_FLAT | TBSTYLE_LIST)); 5428 5455 TOOLBAR_CheckStyle (hwnd, lpStyle->styleNew); … … 5450 5477 ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) 5451 5478 { 5452 TRACE("hwnd=% x msg=%x wparam=%x lparam=%lx\n",5479 TRACE("hwnd=%p msg=%x wparam=%x lparam=%lx\n", 5453 5480 hwnd, uMsg, /* SPY_GetMsgName(uMsg), */ wParam, lParam); 5454 5481 … … 5758 5785 5759 5786 case WM_MOUSELEAVE: 5760 return TOOLBAR_MouseLeave (hwnd, wParam, lParam); 5787 return TOOLBAR_MouseLeave (hwnd, wParam, lParam); 5761 5788 5762 5789 case WM_CAPTURECHANGED: 5763 return TOOLBAR_CaptureChanged(hwnd); 5790 return TOOLBAR_CaptureChanged(hwnd); 5764 5791 5765 5792 case WM_NCACTIVATE: … … 5816 5843 5817 5844 default: 5818 if ( uMsg >= WM_USER)5845 if ((uMsg >= WM_USER) && (uMsg < WM_APP)) 5819 5846 ERR("unknown msg %04x wp=%08x lp=%08lx\n", 5820 5847 uMsg, wParam, lParam); … … 5838 5865 wndClass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1); 5839 5866 wndClass.lpszClassName = TOOLBARCLASSNAMEA; 5840 5867 5841 5868 RegisterClassA (&wndClass); 5842 5869 } -
trunk/src/comctl32/updown.c
r8382 r9370 1 /* 1 /* 2 2 * Updown control 3 3 * … … 18 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 * 20 * NOTE 21 * 22 * This code was audited for completeness against the documented features 23 * of Comctl32.dll version 6.0 on Sep. 9, 2002, by Dimitrie O. Paun. 24 * 25 * Unless otherwise noted, we believe this code to be complete, as per 26 * the specification mentioned above. 27 * If you discover missing features, or bugs, please note them below. 28 * 20 29 */ 21 30 … … 30 39 #include "commctrl.h" 31 40 #include "winnls.h" 32 #include " ntddk.h"41 #include "wine/unicode.h" 33 42 #include "wine/debug.h" 34 #ifdef __WIN32OS2__35 #include "comctl32.h"36 #endif37 43 38 44 WINE_DEFAULT_DEBUG_CHANNEL(updown); … … 87 93 #define BUDDY_SUPERCLASS_WNDPROC "buddySupperClassWndProc" 88 94 89 #define UNKNOWN_PARAM(msg, wParam, lParam) WARN(\90 "Unknown parameter(s) for message " #msg \91 "(%04x): wp=%04x lp=%08lx\n", msg, wParam, lParam);92 93 95 #define UPDOWN_GetInfoPtr(hwnd) ((UPDOWN_INFO *)GetWindowLongA (hwnd,0)) 94 96 #define COUNT_OF(a) (sizeof(a)/sizeof(a[0])) … … 155 157 */ 156 158 static BOOL UPDOWN_HasBuddyBorder(UPDOWN_INFO* infoPtr) 157 { 159 { 158 160 DWORD dwStyle = GetWindowLongW (infoPtr->Self, GWL_STYLE); 159 161 … … 185 187 else 186 188 rect->right -= DEFAULT_BUDDYBORDER; 187 189 188 190 InflateRect(rect, 0, -DEFAULT_BUDDYBORDER); 189 191 } … … 194 196 else rect->left += DEFAULT_BUDDYSPACER; 195 197 } 196 198 197 199 /* 198 200 * We're calculating the midpoint to figure-out where the … … 203 205 int len = rect->right - rect->left + 1; /* compute the width */ 204 206 if (arrow & FLAG_INCR) 205 rect->left = rect->left + len/2; 207 rect->left = rect->left + len/2; 206 208 if (arrow & FLAG_DECR) 207 209 rect->right = rect->left + len/2 - 1; … … 271 273 if (!GetWindowTextW(infoPtr->Buddy, txt, COUNT_OF(txt))) return FALSE; 272 274 273 sep = UPDOWN_GetThousandSep(); 275 sep = UPDOWN_GetThousandSep(); 274 276 275 277 /* now get rid of the separators */ … … 279 281 280 282 /* try to convert the number and validate it */ 281 newVal = wcstol(txt, &src, infoPtr->Base);283 newVal = strtolW(txt, &src, infoPtr->Base); 282 284 if(*src || !UPDOWN_InBounds (infoPtr, newVal)) return FALSE; 283 285 } 284 286 285 287 TRACE("new value(%d) from buddy (old=%d)\n", newVal, infoPtr->CurVal); 286 288 infoPtr->CurVal = newVal; … … 310 312 return SendMessageW(infoPtr->Buddy, LB_SETCURSEL, infoPtr->CurVal, 0) != LB_ERR; 311 313 } 312 314 313 315 /* Regular window, so set caption to the number */ 314 316 if (infoPtr->Base == 16) fmt[1] = 'X'; 315 len = swprintf(txt, fmt, infoPtr->CurVal);317 len = wsprintfW(txt, fmt, infoPtr->CurVal); 316 318 317 319 … … 321 323 WCHAR sep = UPDOWN_GetThousandSep(); 322 324 int start = len % 3; 323 325 324 326 memcpy(tmp, txt, sizeof(txt)); 325 327 if (start == 0) start = 3; … … 332 334 *dst = 0; 333 335 } 334 336 335 337 return SetWindowTextW(infoPtr->Buddy, txt); 336 } 338 } 337 339 338 340 /*********************************************************************** … … 350 352 if (UPDOWN_HasBuddyBorder(infoPtr)) { 351 353 GetClientRect(infoPtr->Self, &rect); 352 DrawEdge(hdc, &rect, EDGE_SUNKEN, 353 BF_BOTTOM | BF_TOP | 354 DrawEdge(hdc, &rect, EDGE_SUNKEN, 355 BF_BOTTOM | BF_TOP | 354 356 (dwStyle & UDS_ALIGNLEFT ? BF_LEFT : BF_RIGHT)); 355 357 } 356 358 357 359 /* Draw the incr button */ 358 360 UPDOWN_GetArrowRect (infoPtr, &rect, FLAG_INCR); 359 361 pressed = (infoPtr->Flags & FLAG_PRESSED) && (infoPtr->Flags & FLAG_INCR); 360 362 hot = (infoPtr->Flags & FLAG_INCR) && (infoPtr->Flags & FLAG_MOUSEIN); 361 DrawFrameControl(hdc, &rect, DFC_SCROLL, 363 DrawFrameControl(hdc, &rect, DFC_SCROLL, 362 364 (dwStyle & UDS_HORZ ? DFCS_SCROLLRIGHT : DFCS_SCROLLUP) | 363 365 ((dwStyle & UDS_HOTTRACK) && hot ? DFCS_HOT : 0) | … … 369 371 pressed = (infoPtr->Flags & FLAG_PRESSED) && (infoPtr->Flags & FLAG_DECR); 370 372 hot = (infoPtr->Flags & FLAG_DECR) && (infoPtr->Flags & FLAG_MOUSEIN); 371 DrawFrameControl(hdc, &rect, DFC_SCROLL, 373 DrawFrameControl(hdc, &rect, DFC_SCROLL, 372 374 (dwStyle & UDS_HORZ ? DFCS_SCROLLLEFT : DFCS_SCROLLDOWN) | 373 375 ((dwStyle & UDS_HOTTRACK) && hot ? DFCS_HOT : 0) | … … 402 404 { 403 405 int arrow; 404 406 405 407 if (key == VK_UP) arrow = FLAG_INCR; 406 408 else if (key == VK_DOWN) arrow = FLAG_DECR; 407 409 else return 1; 408 410 409 411 UPDOWN_GetBuddyInt (infoPtr); 410 412 infoPtr->Flags &= ~FLAG_ARROW; … … 417 419 418 420 /*********************************************************************** 419 * UPDOWN_Buddy_SubclassProc used to handle messages sent to the buddy 421 * UPDOWN_Buddy_SubclassProc used to handle messages sent to the buddy 420 422 * control. 421 423 */ 422 static LRESULT CALLBACK 424 static LRESULT CALLBACK 423 425 UPDOWN_Buddy_SubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) 424 426 { 425 427 WNDPROC superClassWndProc = (WNDPROC)GetPropA(hwnd, BUDDY_SUPERCLASS_WNDPROC); 426 TRACE("hwnd=% 04x, wndProc=%d, uMsg=%04x, wParam=%d, lParam=%d\n",428 TRACE("hwnd=%p, wndProc=%d, uMsg=%04x, wParam=%d, lParam=%d\n", 427 429 hwnd, (INT)superClassWndProc, uMsg, wParam, (UINT)lParam); 428 430 429 431 if (uMsg == WM_KEYDOWN) { 430 432 HWND upDownHwnd = GetPropA(hwnd, BUDDY_UPDOWN_HWND); 431 433 432 434 UPDOWN_KeyPressed(UPDOWN_GetInfoPtr(upDownHwnd), (int)wParam); 433 435 } … … 440 442 * Tests if 'bud' is a valid window handle. If not, returns FALSE. 441 443 * Else, sets it as a new Buddy. 442 * Then, it should subclass the buddy 444 * Then, it should subclass the buddy 443 445 * If window has the UDS_ARROWKEYS, it subcalsses the buddy window to 444 446 * process the UP/DOWN arrow keys. … … 451 453 RECT budRect; /* new coord for the buddy */ 452 454 int x, width; /* new x position and width for the up-down */ 453 WNDPROC baseWndProc , currWndProc;455 WNDPROC baseWndProc; 454 456 CHAR buddyClass[40]; 455 457 456 458 /* Is it a valid bud? */ 457 459 if(!IsWindow(bud)) return FALSE; 458 460 459 TRACE("(hwnd=% 04x, bud=%04x)\n", infoPtr->Self, bud);460 461 TRACE("(hwnd=%p, bud=%p)\n", infoPtr->Self, bud); 462 461 463 /* there is already a body assigned */ 462 464 if (infoPtr->Buddy) RemovePropA(infoPtr->Buddy, BUDDY_UPDOWN_HWND); 463 465 464 466 /* Store buddy window handle */ 465 infoPtr->Buddy = bud; 466 467 /* keep upDown ctrl hwnd in a buddy property */ 468 SetPropA( bud, BUDDY_UPDOWN_HWND, infoPtr->Self); 467 infoPtr->Buddy = bud; 468 469 /* keep upDown ctrl hwnd in a buddy property */ 470 SetPropA( bud, BUDDY_UPDOWN_HWND, infoPtr->Self); 469 471 470 472 /* Store buddy window class type */ … … 478 480 479 481 if(dwStyle & UDS_ARROWKEYS){ 480 /* Note that I don't clear the BUDDY_SUPERCLASS_WNDPROC property 481 when we reset the upDown ctrl buddy to another buddy because it is not 482 /* Note that I don't clear the BUDDY_SUPERCLASS_WNDPROC property 483 when we reset the upDown ctrl buddy to another buddy because it is not 482 484 good to break the window proc chain. */ 483 currWndProc = (WNDPROC) GetWindowLongW(bud, GWL_WNDPROC); 484 if (currWndProc != UPDOWN_Buddy_SubclassProc) { 485 baseWndProc = (WNDPROC)SetWindowLongW(bud, GWL_WNDPROC, (LPARAM)UPDOWN_Buddy_SubclassProc); 485 if (!GetPropA(bud, BUDDY_SUPERCLASS_WNDPROC)) { 486 baseWndProc = (WNDPROC)SetWindowLongW(bud, GWL_WNDPROC, (LPARAM)UPDOWN_Buddy_SubclassProc); 486 487 SetPropA(bud, BUDDY_SUPERCLASS_WNDPROC, (HANDLE)baseWndProc); 487 488 } … … 505 506 /* first adjust the buddy to accomodate the up/down */ 506 507 SetWindowPos(infoPtr->Buddy, 0, budRect.left, budRect.top, 507 budRect.right - budRect.left, budRect.bottom - budRect.top, 508 budRect.right - budRect.left, budRect.bottom - budRect.top, 508 509 SWP_NOACTIVATE|SWP_NOZORDER); 509 510 … … 515 516 /* 516 517 * If the updown has a buddy border, it has to overlap with the buddy 517 * to look as if it is integrated with the buddy control. 518 * to look as if it is integrated with the buddy control. 518 519 * We nudge the control or change it size to overlap. 519 520 */ … … 525 526 } 526 527 527 SetWindowPos(infoPtr->Self, infoPtr->Buddy, x, 528 budRect.top - DEFAULT_ADDTOP, width, 528 SetWindowPos(infoPtr->Self, infoPtr->Buddy, x, 529 budRect.top - DEFAULT_ADDTOP, width, 529 530 budRect.bottom - budRect.top + DEFAULT_ADDTOP + DEFAULT_ADDBOT, 530 531 SWP_NOACTIVATE); 531 532 532 533 return TRUE; 533 } 534 } 534 535 535 536 /*********************************************************************** 536 537 * UPDOWN_DoAction 537 538 * 538 * This function increments/decrements the CurVal by the 539 * This function increments/decrements the CurVal by the 539 540 * 'delta' amount according to the 'action' flag which can be a 540 541 * combination of FLAG_INCR and FLAG_DECR … … 559 560 ni.hdr.hwndFrom = infoPtr->Self; 560 561 ni.hdr.idFrom = GetWindowLongW (infoPtr->Self, GWL_ID); 561 ni.hdr.code = UDN_DELTAPOS; 562 ni.hdr.code = UDN_DELTAPOS; 562 563 if (!SendMessageW(GetParent (infoPtr->Self), WM_NOTIFY, 563 564 (WPARAM)ni.hdr.idFrom, (LPARAM)&ni)) { … … 570 571 } 571 572 } 572 573 573 574 /* Also, notify it. This message is sent in any case. */ 574 SendMessageW( GetParent(infoPtr->Self), 575 dwStyle & UDS_HORZ ? WM_HSCROLL : WM_VSCROLL, 576 MAKELONG(SB_THUMBPOSITION, infoPtr->CurVal), infoPtr->Self); 575 SendMessageW( GetParent(infoPtr->Self), 576 dwStyle & UDS_HORZ ? WM_HSCROLL : WM_VSCROLL, 577 MAKELONG(SB_THUMBPOSITION, infoPtr->CurVal), 578 (LPARAM)infoPtr->Self); 577 579 } 578 580 … … 597 599 * Deletes any timers, releases the mouse and does redraw if necessary. 598 600 * If the control is not in "capture" mode, it does nothing. 599 * If the control was not in cancel mode, it returns FALSE. 601 * If the control was not in cancel mode, it returns FALSE. 600 602 * If the control was in cancel mode, it returns TRUE. 601 603 */ … … 603 605 { 604 606 if (!(infoPtr->Flags & FLAG_PRESSED)) return FALSE; 605 607 606 608 KillTimer (infoPtr->Self, TIMER_AUTOREPEAT); 607 609 KillTimer (infoPtr->Self, TIMER_ACCEL); 608 610 KillTimer (infoPtr->Self, TIMER_AUTOPRESS); 609 611 610 612 if (GetCapture() == infoPtr->Self) { 611 613 NMHDR hdr; … … 616 618 ReleaseCapture(); 617 619 } 618 620 619 621 infoPtr->Flags &= ~FLAG_PRESSED; 620 622 InvalidateRect (infoPtr->Self, NULL, FALSE); 621 623 622 624 return TRUE; 623 625 } … … 628 630 * Handle a mouse event for the updown. 629 631 * 'pt' is the location of the mouse event in client or 630 * windows coordinates. 631 */ 632 static void UPDOWN_HandleMouseEvent (UPDOWN_INFO *infoPtr, UINT msg, POINT pt)632 * windows coordinates. 633 */ 634 static void UPDOWN_HandleMouseEvent (UPDOWN_INFO *infoPtr, UINT msg, POINTS pts) 633 635 { 634 636 DWORD dwStyle = GetWindowLongW (infoPtr->Self, GWL_STYLE); 637 POINT pt = { pts.x, pts.y }; 635 638 RECT rect; 636 639 int temp, arrow; … … 650 653 /* Update the CurVal if necessary */ 651 654 if (dwStyle & UDS_SETBUDDYINT) UPDOWN_GetBuddyInt (infoPtr); 652 655 653 656 /* Set up the correct flags */ 654 infoPtr->Flags |= FLAG_PRESSED; 655 657 infoPtr->Flags |= FLAG_PRESSED; 658 656 659 /* repaint the control */ 657 660 InvalidateRect (infoPtr->Self, NULL, FALSE); … … 682 685 if(infoPtr->AccelIndex != -1) infoPtr->AccelIndex = 0; 683 686 } 684 687 685 688 /* If state changed, redraw the control */ 686 689 if(temp != infoPtr->Flags) … … 703 706 DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE); 704 707 int temp; 705 708 706 709 if (!infoPtr && (message != WM_CREATE)) 707 return DefWindowProcW (hwnd, message, wParam, lParam); 710 return DefWindowProcW (hwnd, message, wParam, lParam); 708 711 709 712 switch(message) … … 719 722 infoPtr->AccelVect = 0; 720 723 infoPtr->AccelIndex = -1; 721 infoPtr->CurVal = 0; 722 infoPtr->MinVal = 0; 724 infoPtr->CurVal = 0; 725 infoPtr->MinVal = 0; 723 726 infoPtr->MaxVal = 9999; 724 727 infoPtr->Base = 10; /* Default to base 10 */ … … 729 732 if (dwStyle & UDS_AUTOBUDDY) 730 733 UPDOWN_SetBuddy (infoPtr, GetWindow (hwnd, GW_HWNDPREV)); 731 732 TRACE("UpDown Ctrl creation, hwnd=% 04x\n", hwnd);733 break; 734 734 735 TRACE("UpDown Ctrl creation, hwnd=%p\n", hwnd); 736 break; 737 735 738 case WM_DESTROY: 736 739 if(infoPtr->AccelVect) COMCTL32_Free (infoPtr->AccelVect); … … 740 743 COMCTL32_Free (infoPtr); 741 744 SetWindowLongW (hwnd, 0, 0); 742 TRACE("UpDown Ctrl destruction, hwnd=% 04x\n", hwnd);743 break; 744 745 TRACE("UpDown Ctrl destruction, hwnd=%p\n", hwnd); 746 break; 747 745 748 case WM_ENABLE: 746 749 if (dwStyle & WS_DISABLED) UPDOWN_CancelMode (infoPtr); … … 774 777 temp = infoPtr->AccelIndex == -1 ? 1 : infoPtr->AccelVect[infoPtr->AccelIndex].nInc; 775 778 UPDOWN_DoAction(infoPtr, temp, infoPtr->Flags & FLAG_ARROW); 776 779 777 780 if(infoPtr->AccelIndex != -1 && infoPtr->AccelIndex < infoPtr->AccelCount-1) { 778 781 KillTimer(hwnd, TIMER_ACCEL); … … 780 783 temp = infoPtr->AccelVect[infoPtr->AccelIndex].nSec * 1000 + 1; 781 784 /* make sure we have at least 1ms intervals */ 782 SetTimer(hwnd, TIMER_ACCEL, temp, 0); 785 SetTimer(hwnd, TIMER_ACCEL, temp, 0); 783 786 } 784 787 } … … 790 793 case WM_LBUTTONUP: 791 794 if (GetCapture() != infoPtr->Self) break; 792 795 793 796 if ( (infoPtr->Flags & FLAG_MOUSEIN) && 794 797 (infoPtr->Flags & FLAG_ARROW) ) { 795 796 SendMessageW( GetParent(hwnd), 798 799 SendMessageW( GetParent(hwnd), 797 800 dwStyle & UDS_HORZ ? WM_HSCROLL : WM_VSCROLL, 798 MAKELONG(SB_ENDSCROLL, infoPtr->CurVal), hwnd); 801 MAKELONG(SB_ENDSCROLL, infoPtr->CurVal), 802 (LPARAM)hwnd); 799 803 if (UPDOWN_IsBuddyEdit(infoPtr)) 800 804 SendMessageW(infoPtr->Buddy, EM_SETSEL, 0, MAKELONG(0, -1)); … … 802 806 UPDOWN_CancelMode(infoPtr); 803 807 break; 804 808 805 809 case WM_LBUTTONDOWN: 806 810 case WM_MOUSEMOVE: 807 if(UPDOWN_IsEnabled(infoPtr)){ 808 POINT pt; 809 pt.x = SLOWORD(lParam); 810 pt.y = SHIWORD(lParam); 811 UPDOWN_HandleMouseEvent (infoPtr, message, pt ); 812 } 811 if(UPDOWN_IsEnabled(infoPtr)) 812 UPDOWN_HandleMouseEvent (infoPtr, message, MAKEPOINTS(lParam)); 813 813 break; 814 814 815 815 case WM_KEYDOWN: 816 if((dwStyle & UDS_ARROWKEYS) && UPDOWN_IsEnabled(infoPtr)) {816 if((dwStyle & UDS_ARROWKEYS) && UPDOWN_IsEnabled(infoPtr)) 817 817 return UPDOWN_KeyPressed(infoPtr, (int)wParam); 818 } 819 break; 820 818 break; 819 821 820 case WM_PAINT: 822 821 return UPDOWN_Paint (infoPtr, (HDC)wParam); 823 822 824 823 case UDM_GETACCEL: 825 824 if (wParam==0 && lParam==0) return infoPtr->AccelCount; … … 829 828 return temp; 830 829 } 831 UNKNOWN_PARAM(UDM_GETACCEL, wParam, lParam);832 830 return 0; 833 831 834 832 case UDM_SETACCEL: 835 TRACE("UpDown Ctrl new accel info, hwnd=% 04x\n", hwnd);833 TRACE("UpDown Ctrl new accel info, hwnd=%p\n", hwnd); 836 834 if(infoPtr->AccelVect) { 837 835 COMCTL32_Free (infoPtr->AccelVect); … … 846 844 847 845 case UDM_GETBASE: 848 if (wParam || lParam) UNKNOWN_PARAM(UDM_GETBASE, wParam, lParam);849 846 return infoPtr->Base; 850 847 851 848 case UDM_SETBASE: 852 TRACE("UpDown Ctrl new base(%d), hwnd=%04x\n", wParam, hwnd); 853 if ( !(wParam==10 || wParam==16) || lParam) 854 UNKNOWN_PARAM(UDM_SETBASE, wParam, lParam); 849 TRACE("UpDown Ctrl new base(%d), hwnd=%p\n", wParam, hwnd); 855 850 if (wParam==10 || wParam==16) { 856 851 temp = infoPtr->Base; … … 861 856 862 857 case UDM_GETBUDDY: 863 if (wParam || lParam) UNKNOWN_PARAM(UDM_GETBUDDY, wParam, lParam); 864 return infoPtr->Buddy; 858 return (LRESULT)infoPtr->Buddy; 865 859 866 860 case UDM_SETBUDDY: 867 if (lParam) UNKNOWN_PARAM(UDM_SETBUDDY, wParam, lParam); 868 temp = infoPtr->Buddy; 869 UPDOWN_SetBuddy (infoPtr, wParam); 861 temp = (int)infoPtr->Buddy; 862 UPDOWN_SetBuddy (infoPtr, (HWND)wParam); 870 863 return temp; 871 864 872 865 case UDM_GETPOS: 873 if (wParam || lParam) UNKNOWN_PARAM(UDM_GETPOS, wParam, lParam);874 866 temp = UPDOWN_GetBuddyInt (infoPtr); 875 867 return MAKELONG(infoPtr->CurVal, temp ? 0 : 1); 876 868 877 869 case UDM_SETPOS: 878 if (wParam || HIWORD(lParam)) UNKNOWN_PARAM(UDM_GETPOS, wParam, lParam);879 870 temp = SLOWORD(lParam); 880 TRACE("UpDown Ctrl new value(%d), hwnd=% 04x\n", temp, hwnd);871 TRACE("UpDown Ctrl new value(%d), hwnd=%p\n", temp, hwnd); 881 872 if(!UPDOWN_InBounds(infoPtr, temp)) { 882 873 if(temp < infoPtr->MinVal) temp = infoPtr->MinVal; … … 887 878 if(dwStyle & UDS_SETBUDDYINT) UPDOWN_SetBuddyInt (infoPtr); 888 879 return wParam; /* return prev value */ 889 880 890 881 case UDM_GETRANGE: 891 if (wParam || lParam) UNKNOWN_PARAM(UDM_GETRANGE, wParam, lParam);892 882 return MAKELONG(infoPtr->MaxVal, infoPtr->MinVal); 893 883 894 884 case UDM_SETRANGE: 895 if (wParam) UNKNOWN_PARAM(UDM_SETRANGE, wParam, lParam);896 885 /* we must have: */ 897 886 infoPtr->MaxVal = SLOWORD(lParam); /* UD_MINVAL <= Max <= UD_MAXVAL */ 898 887 infoPtr->MinVal = SHIWORD(lParam); /* UD_MINVAL <= Min <= UD_MAXVAL */ 899 888 /* |Max-Min| <= UD_MAXVAL */ 900 TRACE("UpDown Ctrl new range(%d to %d), hwnd=% 04x\n",889 TRACE("UpDown Ctrl new range(%d to %d), hwnd=%p\n", 901 890 infoPtr->MinVal, infoPtr->MaxVal, hwnd); 902 break; 891 break; 903 892 904 893 case UDM_GETRANGE32: … … 912 901 if (infoPtr->MaxVal <= infoPtr->MinVal) 913 902 infoPtr->MaxVal = infoPtr->MinVal + 1; 914 TRACE("UpDown Ctrl new range(%d to %d), hwnd=% 04x\n",903 TRACE("UpDown Ctrl new range(%d to %d), hwnd=%p\n", 915 904 infoPtr->MinVal, infoPtr->MaxVal, hwnd); 916 905 break; … … 931 920 932 921 case UDM_GETUNICODEFORMAT: 933 if (wParam || lParam) UNKNOWN_PARAM(UDM_GETUNICODEFORMAT, wParam, lParam);934 922 /* we lie a bit here, we're always using Unicode internally */ 935 923 return infoPtr->UnicodeFormat; 936 924 937 925 case UDM_SETUNICODEFORMAT: 938 if (lParam) UNKNOWN_PARAM(UDM_SETUNICODEFORMAT, wParam, lParam);939 926 /* do we really need to honour this flag? */ 940 927 temp = infoPtr->UnicodeFormat; 941 928 infoPtr->UnicodeFormat = (BOOL)wParam; 942 929 return temp; 943 944 default: 945 if ( message >= WM_USER)930 931 default: 932 if ((message >= WM_USER) && (message < WM_APP)) 946 933 ERR("unknown msg %04x wp=%04x lp=%08lx\n", message, wParam, lParam); 947 return DefWindowProcW (hwnd, message, wParam, lParam); 948 } 934 return DefWindowProcW (hwnd, message, wParam, lParam); 935 } 949 936 950 937 return 0; … … 956 943 * Registers the updown window class. 957 944 */ 958 959 VOID 960 UPDOWN_Register(void) 945 void UPDOWN_Register(void) 961 946 { 962 947 WNDCLASSW wndClass; … … 970 955 wndClass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1); 971 956 wndClass.lpszClassName = UPDOWN_CLASSW; 972 957 973 958 RegisterClassW( &wndClass ); 974 959 } … … 980 965 * Unregisters the updown window class. 981 966 */ 982 983 VOID 984 UPDOWN_Unregister (void) 967 void UPDOWN_Unregister (void) 985 968 { 986 969 UnregisterClassW (UPDOWN_CLASSW, (HINSTANCE)NULL); 987 970 } 988
Note:
See TracChangeset
for help on using the changeset viewer.