Changeset 5416
- Timestamp:
- Mar 31, 2001, 3:25:59 PM (24 years ago)
- Location:
- trunk/src/comctl32
- Files:
-
- 2 added
- 2 deleted
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/src/comctl32/CCBase.h ¶
r4627 r5416 1 /* $Id: CCBase.h,v 1.1 1 2000-11-19 11:51:47sandervl Exp $ */1 /* $Id: CCBase.h,v 1.12 2001-03-31 13:25:25 sandervl Exp $ */ 2 2 /* 3 3 * COMCTL32 Base Functions and Macros for all Controls … … 7 7 #ifndef __CCBASE_H 8 8 #define __CCBASE_H 9 10 #include <heapstring.h> 9 11 10 12 #define getInfoPtr(hwnd) ((COMCTL32_HEADER*)GetWindowLongA(hwnd,0)) … … 20 22 } COMCTL32_HEADER; 21 23 22 PVOID initControl(HWND hwnd,DWORD dwSize);23 VOID doneControl(HWND hwnd);24 25 26 24 #ifdef __cplusplus 27 25 extern "C" { 28 26 #endif 27 28 PVOID initControl(HWND hwnd,DWORD dwSize); 29 VOID doneControl(HWND hwnd); 29 30 30 31 LRESULT defComCtl32ProcA(HWND hwnd,UINT Msg,WPARAM wParam,LPARAM lParam); … … 65 66 INT lstrcmpAW(WCHAR *textA,BOOL textaunicode,WCHAR *textB,BOOL textbunicode); 66 67 68 67 69 //read note in CCBase.cpp!! 68 70 INT lstrcmpniA(CHAR *textA,CHAR *textB,INT len); 69 71 INT lstrcmpniAtoW(CHAR *textA,WCHAR* textB,INT len); 70 INT lstrcmpniW(WCHAR *textA,WCHAR *textB,INT len);72 ////INT lstrcmpniW(WCHAR *textA,WCHAR *textB,INT len); 71 73 INT lstrcmpniAW(WCHAR *textA,BOOL unicodeA,WCHAR *textB,BOOL unicodeB,INT len); 72 74 -
TabularUnified trunk/src/comctl32/animate.c ¶
r4627 r5416 30 30 typedef struct 31 31 { 32 #ifdef __WIN32OS2__ 33 COMCTL32_HEADER header; 34 #endif 35 32 36 /* pointer to msvideo functions. it's easier to put them here. 33 37 * to be correct, they should be defined on a per process basis, but … … 819 823 820 824 /* allocate memory for info structure */ 825 #ifdef __WIN32OS2__ 826 infoPtr = (ANIMATE_INFO*)initControl(hWnd,sizeof(ANIMATE_INFO)); 827 #else 821 828 infoPtr = (ANIMATE_INFO *)COMCTL32_Alloc(sizeof(ANIMATE_INFO)); 829 #endif 822 830 if (!infoPtr) { 823 831 ERR("could not allocate info memory!\n"); -
TabularUnified trunk/src/comctl32/comboex.c ¶
r4627 r5416 1 1 /* 2 * ComboBoxEx control 2 * TODO <------------- 3 * 1. The following extended styles need to be implemented, use will 4 * result in a FIXME: 5 * CBES_EX_NOEDITIMAGEINDENT 6 * CBES_EX_PATHWORDBREAKPROC 7 * CBES_EX_NOSIZELIMIT 8 * CBES_EX_CASESENSITIVE 9 * 2. None of the following callback items are implemented. Therefor 10 * no CBEN_GETDISPINFO notifies are issued. Use in either CBEM_INSERTITEM 11 * or CBEM_SETITEM will result in a FIXME: 12 * LPSTR_TEXTCALLBACK 13 * I_IMAGECALLBACK 14 * I_INDENTCALLBACK 15 * 3. No use is made of the iOverlay image. 16 * 4. Notify CBEN_DRAGBEGIN is not implemented. 17 */ 18 19 20 /* 21 * ComboBoxEx control v2 (mod4) 3 22 * 4 23 * Copyright 1998, 1999 Eric Kohl … … 9 28 * Eric <ekohl@abo.rhein-zeitung.de> 10 29 * 11 * TODO: 12 * - All messages. 13 * - All notifications. 30 31 * Changes Guy Albertelli <galberte@neo.lrun.com> 32 * v1 Implemented messages: CB_SETITEMHEIGHT, WM_WINDOWPOSCHANGING, 33 * WM_DRAWITEM, and WM_MEASUREITEM. Fixed WM_CREATE. Fixed height 34 * of window rect reported fixing rebar control. 35 * v2 36 * 1. Rewrite of WM_Create for own created EDIT control. Also try to 37 * generate message sequence similar to native DLL. 38 * 2. Handle case where CBEM_SETITEM is called to display data in EDIT 39 * Control. 40 * 3. Add override for WNDPROC for the EDIT control (reqed for VK_RETURN). 41 * 4. Dump input data for things using COMBOBOXEXITEM{A|W}. 42 * 5. Handle positioning EDIT control based on whether icon present. 43 * 6. Make InsertItemA use InsertItemW, and store all data in ..W form. 44 * 7. Implement CBEM_DELETEITEM, CBEM_GETITEM{A|W}, CB_SETCURSEL, 45 * CBEM_{GET|SET}UNICODEFORMAT. 46 * 8. Add override for WNDPROC for the COMBO control. 47 * 9. Support extended style CBES_EX_NOEDITIMAGE and warn others are not 48 * supported. 49 * 10. Implement CB_FINDSTRINGEXACT in both the Combo and ComboEx window 50 * procs to match the items. This eliminates dup entries in the listbox. 14 51 * 15 * FIXME: 16 * - should include "combo.h" 17 18 * Changes Guy Albertelli <galberte@neo.lrun.com> 19 * 1. Implemented message CB_SETITEMHEIGHT 20 * 2. Implemented message WM_WINDOWPOSCHANGING 21 * 3. Implemented message WM_MEASUREITEM 22 * 4. Add code to WM_CREATE processing to set font of COMBOBOX and 23 * issue the CB_SETITEMHEIGHT to start the correct sizing process. 24 * The above 4 changes allow the window rect for the comboboxex 25 * to be set properly, which in turn allows the height of the 26 * rebar control it *may* be imbeded in to be correct. 27 * 5. Rewrite CBEM_INSERTITEMA to save the information. 28 * 6. Implemented message WM_DRAWITEM. The code will handle images 29 * but not "overlays" yet. 30 * 7. Fixed code in CBEM_SETIMAGELIST to resize control. 31 * 8. Add debugging code. 52 * mod 4 53 * 1. Implemented CBN_SELCHANGE, CBN_KILLFOCUS, and CBN_SELENDOK. 54 * 2. Fix putting text in CBEN_ENDEDIT notifys for CBN_DROPDOWN case. 55 * 3. Lock image selected status to focus state of edit control if 56 * edit control exists. Mimics native actions. 57 * 4. Implemented WM_SETFOCUS in EditWndProc to track status of 58 * focus for 3 above. 59 * 5. The LBN_SELCHANGE is just for documentation purposes. 32 60 * 33 * Test vehicals were the ControlSpy modules (rebar.exe and comboboxex.exe) 61 * Test vehicals were the ControlSpy modules (rebar.exe and comboboxex.exe), 62 * and IE 4.0. 34 63 * 35 64 */ 36 65 37 #ifdef __WIN32OS2__38 #include <odin.h>39 66 #include <string.h> 40 #define inline41 #endif42 43 67 #include "winbase.h" 44 #include "wine/winestring.h"45 68 #include "commctrl.h" 46 69 #include "debugtools.h" 47 70 #include "wine/unicode.h" 48 71 72 #ifdef __WIN32OS2__ 73 #include "ccbase.h" 74 #define inline 75 #endif 76 49 77 DEFAULT_DEBUG_CHANNEL(comboex); 78 /* 79 * The following is necessary for the test done in COMBOEX_DrawItem 80 * to determine whether to dump out the DRAWITEM structure or not. 81 */ 50 82 DECLARE_DEBUG_CHANNEL(message); 51 83 … … 53 85 typedef struct 54 86 { 55 VOID *next;56 UINT mask;57 LPWSTR pszText;58 int cchTextMax;59 int iImage;60 int iSelectedImage;61 int iOverlay;62 int iIndent;63 LPARAM lParam;87 VOID *next; 88 UINT mask; 89 LPWSTR pszText; 90 int cchTextMax; 91 int iImage; 92 int iSelectedImage; 93 int iOverlay; 94 int iIndent; 95 LPARAM lParam; 64 96 } CBE_ITEMDATA; 65 97 … … 67 99 typedef struct 68 100 { 101 #ifdef __WIN32OS2__ 102 COMCTL32_HEADER header; 103 #endif 69 104 HIMAGELIST himl; 105 HWND hwndSelf; /* my own hwnd */ 70 106 HWND hwndCombo; 107 HWND hwndEdit; 108 WNDPROC prevEditWndProc; /* previous Edit WNDPROC value */ 109 WNDPROC prevComboWndProc; /* previous Combo WNDPROC value */ 71 110 DWORD dwExtStyle; 111 DWORD flags; /* WINE internal flags */ 72 112 HFONT font; 73 113 INT nb_items; /* Number of items */ 114 BOOL bUnicode; /* ASCII (FALSE) or Unicode (TRUE)? */ 115 CBE_ITEMDATA *edit; /* item data for edit item */ 74 116 CBE_ITEMDATA *items; /* Array of items */ 75 117 } COMBOEX_INFO; 76 118 119 /* internal flags in the COMBOEX_INFO structure */ 120 #define WCBE_ACTEDIT 0x00000001 /* Edit active i.e. 121 * CBEN_BEGINEDIT issued 122 * but CBEN_ENDEDIT{A|W} 123 * not yet issued. */ 124 #define WCBE_EDITCHG 0x00000002 /* Edit issued EN_CHANGE */ 125 #define WCBE_EDITFOCUSED 0x00000004 /* Edit control has focus */ 126 127 77 128 #define ID_CB_EDIT 1001 129 130 131 /* 132 * Special flag set in DRAWITEMSTRUCT itemState field. It is set by 133 * the ComboEx version of the Combo Window Proc so that when the 134 * WM_DRAWITEM message is then passed to ComboEx, we know that this 135 * particular WM_DRAWITEM message is for listbox only items. Any messasges 136 * without this flag is then for the Edit control field. 137 * 138 * We really cannot use the ODS_COMBOBOXEDIT flag because MSDN states that 139 * only version 4.0 applications will have ODS_COMBOBOXEDIT set. 140 */ 141 #define ODS_COMBOEXLBOX 0x4000 142 143 78 144 79 145 /* Height in pixels of control over the amount of the selected font */ … … 89 155 #define CBE_SEP 4 90 156 91 #define COMBOEX_GetInfoPtr(wndPtr) ((COMBOEX_INFO *)GetWindowLongA (hwnd, 0)) 92 157 #define COMBOEX_GetInfoPtr(hwnd) ((COMBOEX_INFO *)GetWindowLongA (hwnd, 0)) 158 159 160 /* Things common to the entire DLL */ 161 static ATOM ComboExInfo; 162 static LRESULT WINAPI 163 COMBOEX_EditWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); 164 static LRESULT WINAPI 165 COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); 93 166 94 167 static void … … 97 170 if (TRACE_ON(comboex)){ 98 171 TRACE("item %p - mask=%08x, pszText=%p, cchTM=%d, iImage=%d\n", 99 100 172 item, item->mask, item->pszText, item->cchTextMax, 173 item->iImage); 101 174 TRACE("item %p - iSelectedImage=%d, iOverlay=%d, iIndent=%d, lParam=%08lx\n", 102 item, item->iSelectedImage, item->iOverlay, item->iIndent, item->lParam); 175 item, item->iSelectedImage, item->iOverlay, item->iIndent, item->lParam); 176 if ((item->mask & CBEIF_TEXT) && item->pszText) 177 TRACE("item %p - pszText=%s\n", 178 item, debugstr_w((const WCHAR *)item->pszText)); 179 } 180 } 181 182 183 static void 184 COMBOEX_DumpInput (COMBOBOXEXITEMA *input, BOOL true_for_w) 185 { 186 if (TRACE_ON(comboex)){ 187 TRACE("input - mask=%08x, iItem=%d, pszText=%p, cchTM=%d, iImage=%d\n", 188 input->mask, input->iItem, input->pszText, input->cchTextMax, 189 input->iImage); 190 if ((input->mask & CBEIF_TEXT) && input->pszText) { 191 if (true_for_w) 192 TRACE("input - pszText=<%s>\n", 193 debugstr_w((const WCHAR *)input->pszText)); 194 else 195 TRACE("input - pszText=<%s>\n", 196 debugstr_a((const char *)input->pszText)); 197 } 198 TRACE("input - iSelectedImage=%d, iOverlay=%d, iIndent=%d, lParam=%08lx\n", 199 input->iSelectedImage, input->iOverlay, input->iIndent, input->lParam); 103 200 } 104 201 } … … 110 207 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd); 111 208 112 FIXME("(0x%x 0x%x 0x%lx): stub\n", uMsg, wParam, lParam); 113 114 if (infoPtr->hwndCombo) 115 return SendMessageA (infoPtr->hwndCombo, uMsg, wParam, lParam); 209 if (infoPtr->hwndCombo) 210 return SendMessageA (infoPtr->hwndCombo, uMsg, wParam, lParam); 116 211 117 212 return 0; 213 } 214 215 216 static INT 217 COMBOEX_Notify (COMBOEX_INFO *infoPtr, INT code, NMHDR *hdr, BOOL doW) 218 { 219 220 hdr->idFrom = GetDlgCtrlID (infoPtr->hwndSelf); 221 hdr->hwndFrom = infoPtr->hwndSelf; 222 hdr->code = code; 223 if (doW) 224 return SendMessageW (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0, 225 (LPARAM)hdr); 226 else 227 return SendMessageA (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0, 228 (LPARAM)hdr); 229 } 230 231 232 static void 233 COMBOEX_GetComboFontSize (COMBOEX_INFO *infoPtr, SIZE *size) 234 { 235 HFONT nfont, ofont; 236 HDC mydc; 237 238 mydc = GetDC (0); /* why the entire screen???? */ 239 nfont = SendMessageW (infoPtr->hwndCombo, WM_GETFONT, 0, 0); 240 ofont = (HFONT) SelectObject (mydc, nfont); 241 GetTextExtentPointA (mydc, "A", 1, size); 242 SelectObject (mydc, ofont); 243 ReleaseDC (0, mydc); 244 TRACE("selected font hwnd=%08x, height=%ld\n", nfont, size->cy); 245 } 246 247 248 static void 249 COMBOEX_CopyItem (COMBOEX_INFO *infoPtr, CBE_ITEMDATA *item, COMBOBOXEXITEMW *cit) 250 { 251 if (cit->mask & CBEIF_TEXT) { 252 cit->pszText = item->pszText; 253 cit->cchTextMax = item->cchTextMax; 254 } 255 if (cit->mask & CBEIF_IMAGE) 256 cit->iImage = item->iImage; 257 if (cit->mask & CBEIF_SELECTEDIMAGE) 258 cit->iSelectedImage = item->iSelectedImage; 259 if (cit->mask & CBEIF_OVERLAY) 260 cit->iOverlay = item->iOverlay; 261 if (cit->mask & CBEIF_INDENT) 262 cit->iIndent = item->iIndent; 263 if (cit->mask & CBEIF_LPARAM) 264 cit->lParam = item->lParam; 265 266 } 267 268 269 static void 270 COMBOEX_AdjustEditPos (COMBOEX_INFO *infoPtr) 271 { 272 SIZE mysize; 273 IMAGEINFO iinfo; 274 INT x, y, w, h, xoff = 0; 275 RECT rect; 276 277 if (!infoPtr->hwndEdit) return; 278 iinfo.rcImage.left = iinfo.rcImage.right = 0; 279 if (infoPtr->himl) { 280 ImageList_GetImageInfo(infoPtr->himl, 0, &iinfo); 281 xoff = iinfo.rcImage.right - iinfo.rcImage.left + CBE_SEP; 282 } 283 GetClientRect (infoPtr->hwndCombo, &rect); 284 InflateRect (&rect, -2, -2); 285 InvalidateRect (infoPtr->hwndCombo, &rect, TRUE); 286 287 /* reposition the Edit control based on whether icon exists */ 288 COMBOEX_GetComboFontSize (infoPtr, &mysize); 289 TRACE("Combo font x=%ld, y=%ld\n", mysize.cx, mysize.cy); 290 x = xoff + CBE_STARTOFFSET + 1; 291 y = CBE_EXTRA + 1; 292 w = rect.right-rect.left - x - GetSystemMetrics(SM_CXVSCROLL) - 1; 293 h = mysize.cy + 1; 294 295 TRACE("Combo client (%d,%d)-(%d,%d), setting Edit to (%d,%d)-(%d,%d)\n", 296 rect.left, rect.top, rect.right, rect.bottom, 297 x, y, x + w, y + h); 298 SetWindowPos(infoPtr->hwndEdit, HWND_TOP, 299 x, y, 300 w, h, 301 SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOZORDER); 118 302 } 119 303 … … 122 306 COMBOEX_ReSize (HWND hwnd, COMBOEX_INFO *infoPtr) 123 307 { 124 HFONT nfont, ofont;125 HDC mydc;126 308 SIZE mysize; 127 309 UINT cy; 128 310 IMAGEINFO iinfo; 129 311 130 mydc = GetDC (0); /* why the entire screen???? */ 131 nfont = SendMessageA (infoPtr->hwndCombo, WM_GETFONT, 0, 0); 132 ofont = (HFONT) SelectObject (mydc, nfont); 133 GetTextExtentPointA (mydc, "A", 1, &mysize); 134 SelectObject (mydc, ofont); 135 ReleaseDC (0, mydc); 312 COMBOEX_GetComboFontSize (infoPtr, &mysize); 136 313 cy = mysize.cy + CBE_EXTRA; 137 314 if (infoPtr->himl) { 138 139 140 } 141 TRACE("selected font hwnd=%08x, height=%d\n", nfont, cy);142 SendMessage A(hwnd, CB_SETITEMHEIGHT, (WPARAM) -1, (LPARAM) cy);315 ImageList_GetImageInfo(infoPtr->himl, 0, &iinfo); 316 cy = max (iinfo.rcImage.bottom - iinfo.rcImage.top, cy); 317 TRACE("upgraded height due to image: height=%d\n", cy); 318 } 319 SendMessageW (hwnd, CB_SETITEMHEIGHT, (WPARAM) -1, (LPARAM) cy); 143 320 if (infoPtr->hwndCombo) 144 SendMessageA (infoPtr->hwndCombo, CB_SETITEMHEIGHT, 145 (WPARAM) 0, (LPARAM) cy); 321 SendMessageW (infoPtr->hwndCombo, CB_SETITEMHEIGHT, 322 (WPARAM) 0, (LPARAM) cy); 323 } 324 325 326 static void 327 COMBOEX_SetEditText (COMBOEX_INFO *infoPtr, CBE_ITEMDATA *item) 328 { 329 if (!infoPtr->hwndEdit) return; 330 /* native issues the following messages to the {Edit} control */ 331 /* WM_SETTEXT (0,addr) */ 332 /* EM_SETSEL32 (0,0) */ 333 /* EM_SETSEL32 (0,-1) */ 334 if (item->mask & CBEIF_TEXT) { 335 SendMessageW (infoPtr->hwndEdit, WM_SETTEXT, 0, (LPARAM)item->pszText); 336 SendMessageW (infoPtr->hwndEdit, EM_SETSEL, 0, 0); 337 SendMessageW (infoPtr->hwndEdit, EM_SETSEL, 0, -1); 338 } 339 } 340 341 342 static CBE_ITEMDATA * 343 COMBOEX_FindItem(COMBOEX_INFO *infoPtr, INT index) 344 { 345 CBE_ITEMDATA *item; 346 INT i; 347 348 if ((index > infoPtr->nb_items) || (index < -1)) 349 return 0; 350 if (index == -1) 351 return infoPtr->edit; 352 item = infoPtr->items; 353 i = infoPtr->nb_items - 1; 354 355 /* find the item in the list */ 356 while (item && (i > index)) { 357 item = (CBE_ITEMDATA *)item->next; 358 i--; 359 } 360 if (!item || (i != index)) { 361 FIXME("COMBOBOXEX item structures broken. Please report!\n"); 362 return 0; 363 } 364 return item; 365 } 366 367 368 static void 369 COMBOEX_WarnCallBack (CBE_ITEMDATA *item) 370 { 371 if (item->pszText == LPSTR_TEXTCALLBACKW) 372 FIXME("Callback not implemented yet for pszText\n"); 373 if (item->iImage == I_IMAGECALLBACK) 374 FIXME("Callback not implemented yet for iImage\n"); 375 if (item->iSelectedImage == I_IMAGECALLBACK) 376 FIXME("Callback not implemented yet for iSelectedImage\n"); 377 if (item->iOverlay == I_IMAGECALLBACK) 378 FIXME("Callback not implemented yet for iOverlay\n"); 379 if (item->iIndent == I_INDENTCALLBACK) 380 FIXME("Callback not implemented yet for iIndent\n"); 146 381 } 147 382 … … 150 385 151 386 152 /* << COMBOEX_DeleteItem >> */ 387 static LRESULT 388 COMBOEX_DeleteItem (HWND hwnd, WPARAM wParam, LPARAM lParam) 389 { 390 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd); 391 INT index = (INT) wParam; 392 CBE_ITEMDATA *item; 393 394 TRACE("(0x%08x 0x%08lx)\n", wParam, lParam); 395 396 /* if item number requested does not exist then return failure */ 397 if ((index > infoPtr->nb_items) || (index < 0)) { 398 ERR("attempt to delete item that does not exist\n"); 399 return CB_ERR; 400 } 401 402 if (!(item = COMBOEX_FindItem(infoPtr, index))) { 403 ERR("attempt to delete item that was not found!\n"); 404 return CB_ERR; 405 } 406 407 /* doing this will result in WM_DELETEITEM being issued */ 408 SendMessageW (infoPtr->hwndCombo, CB_DELETESTRING, (WPARAM)index, 0); 409 410 return infoPtr->nb_items; 411 } 153 412 154 413 … … 170 429 171 430 if ((GetWindowLongA (hwnd, GWL_STYLE) & CBS_DROPDOWNLIST) != CBS_DROPDOWN) 172 173 174 TRACE("-- 0x%x\n", GetDlgItem (infoPtr->hwndCombo, ID_CB_EDIT));175 176 return (LRESULT) GetDlgItem (infoPtr->hwndCombo, ID_CB_EDIT);431 return 0; 432 433 TRACE("-- 0x%x\n", infoPtr->hwndEdit); 434 435 return (LRESULT)infoPtr->hwndEdit; 177 436 } 178 437 … … 183 442 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd); 184 443 444 TRACE("-- 0x%08lx\n", infoPtr->dwExtStyle); 445 185 446 return (LRESULT)infoPtr->dwExtStyle; 186 447 } … … 192 453 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd); 193 454 194 TRACE(" (0x%08x 0x%08lx)\n", wParam, lParam);455 TRACE("-- 0x%p\n", infoPtr->himl); 195 456 196 457 return (LRESULT)infoPtr->himl; … … 198 459 199 460 200 /* << COMBOEX_GetItemA >> */201 202 /* << COMBOEX_GetItemW >> */203 204 /* << COMBOEX_GetUniCodeFormat >> */205 206 /* << COMBOEX_HasEditChanged >> */207 208 209 461 static LRESULT 210 COMBOEX_ InsertItemA(HWND hwnd, WPARAM wParam, LPARAM lParam)462 COMBOEX_GetItemW (HWND hwnd, WPARAM wParam, LPARAM lParam) 211 463 { 212 464 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd); 213 COMBOBOXEXITEM A *cit = (COMBOBOXEXITEMA*) lParam;465 COMBOBOXEXITEMW *cit = (COMBOBOXEXITEMW *) lParam; 214 466 INT index; 215 467 CBE_ITEMDATA *item; 216 468 469 TRACE("(0x%08x 0x%08lx)\n", wParam, lParam); 470 471 /* get real index of item to insert */ 472 index = cit->iItem; 473 474 /* if item number requested does not exist then return failure */ 475 if ((index > infoPtr->nb_items) || (index < -1)) { 476 ERR("attempt to get item that does not exist\n"); 477 return 0; 478 } 479 480 /* if the item is the edit control and there is no edit control, skip */ 481 if ((index == -1) && 482 ((GetWindowLongA (hwnd, GWL_STYLE) & CBS_DROPDOWNLIST) != CBS_DROPDOWN)) 483 return 0; 484 485 if (!(item = COMBOEX_FindItem(infoPtr, index))) { 486 ERR("attempt to get item that was not found!\n"); 487 return 0; 488 } 489 490 COMBOEX_CopyItem (infoPtr, item, cit); 491 492 return TRUE; 493 } 494 495 496 inline static LRESULT 497 COMBOEX_GetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam) 498 { 499 COMBOBOXEXITEMA *cit = (COMBOBOXEXITEMA *) lParam; 500 COMBOBOXEXITEMW tmpcit; 501 INT len; 502 503 TRACE("(0x%08x 0x%08lx)\n", wParam, lParam); 504 505 tmpcit.mask = cit->mask; 506 tmpcit.iItem = cit->iItem; 507 COMBOEX_GetItemW (hwnd, wParam, (LPARAM) &tmpcit); 508 509 len = WideCharToMultiByte (CP_ACP, 0, tmpcit.pszText, -1, 0, 0, NULL, NULL); 510 if (len > 0) 511 WideCharToMultiByte (CP_ACP, 0, tmpcit.pszText, -1, 512 cit->pszText, cit->cchTextMax, NULL, NULL); 513 514 cit->iImage = tmpcit.iImage; 515 cit->iSelectedImage = tmpcit.iSelectedImage; 516 cit->iOverlay = tmpcit.iOverlay; 517 cit->iIndent = tmpcit.iIndent; 518 cit->lParam = tmpcit.lParam; 519 520 return TRUE; 521 } 522 523 524 inline static LRESULT 525 COMBOEX_GetUnicodeFormat (HWND hwnd, WPARAM wParam, LPARAM lParam) 526 { 527 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd); 528 529 TRACE("%s hwnd=0x%x stub!\n", 530 infoPtr->bUnicode ? "TRUE" : "FALSE", hwnd); 531 532 return infoPtr->bUnicode; 533 } 534 535 536 inline static LRESULT 537 COMBOEX_HasEditChanged (HWND hwnd, WPARAM wParam, LPARAM lParam) 538 { 539 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd); 540 541 if ((GetWindowLongA (hwnd, GWL_STYLE) & CBS_DROPDOWNLIST) != CBS_DROPDOWN) 542 return FALSE; 543 if ((infoPtr->flags & (WCBE_ACTEDIT | WCBE_EDITCHG)) == 544 (WCBE_ACTEDIT | WCBE_EDITCHG)) 545 return TRUE; 546 return FALSE; 547 } 548 549 550 static LRESULT 551 COMBOEX_InsertItemW (HWND hwnd, WPARAM wParam, LPARAM lParam) 552 { 553 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd); 554 COMBOBOXEXITEMW *cit = (COMBOBOXEXITEMW *) lParam; 555 INT index; 556 CBE_ITEMDATA *item; 557 NMCOMBOBOXEXW nmcit; 558 559 TRACE("\n"); 560 561 COMBOEX_DumpInput ((COMBOBOXEXITEMA *) cit, TRUE); 217 562 218 563 /* get real index of item to insert */ … … 230 575 /* fast path for iItem = -1 */ 231 576 item->next = infoPtr->items; 232 577 infoPtr->items = item; 233 578 } 234 579 else { 235 int i = infoPtr->nb_items-1; 236 CBE_ITEMDATA *moving = infoPtr->items; 237 238 while (i > index && moving) { 239 moving = (CBE_ITEMDATA *)moving->next; 240 } 241 if (!moving) { 242 FIXME("COMBOBOXEX item structures broken. Please report!\n"); 243 COMCTL32_Free(item); 244 return -1; 245 } 246 item->next = moving->next; 247 moving->next = item; 580 INT i = infoPtr->nb_items-1; 581 CBE_ITEMDATA *moving = infoPtr->items; 582 583 while ((i > index) && moving) { 584 moving = (CBE_ITEMDATA *)moving->next; 585 i--; 586 } 587 if (!moving) { 588 FIXME("COMBOBOXEX item structures broken. Please report!\n"); 589 COMCTL32_Free(item); 590 return -1; 591 } 592 item->next = moving->next; 593 moving->next = item; 248 594 } 249 595 … … 251 597 item->mask = cit->mask; 252 598 if (item->mask & CBEIF_TEXT) { 253 LP STR str;254 599 LPWSTR str; 600 INT len; 255 601 256 602 str = cit->pszText; 257 if (!str) str ="";258 len = MultiByteToWideChar (CP_ACP, 0, str, -1, NULL, 0);259 260 261 MultiByteToWideChar (CP_ACP, 0, str, -1, item->pszText, len);262 603 if (!str) str = (LPWSTR) L""; 604 len = strlenW (str); 605 if (len > 0) { 606 item->pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR)); 607 strcpyW (item->pszText, str); 608 } 263 609 item->cchTextMax = cit->cchTextMax; 264 610 } … … 275 621 infoPtr->nb_items++; 276 622 623 COMBOEX_WarnCallBack (item); 624 277 625 COMBOEX_DumpItem (item); 278 626 279 SendMessageA (infoPtr->hwndCombo, CB_INSERTSTRING, 280 (WPARAM)cit->iItem, (LPARAM)item); 627 SendMessageW (infoPtr->hwndCombo, CB_INSERTSTRING, 628 (WPARAM)cit->iItem, (LPARAM)item); 629 630 COMBOEX_CopyItem (infoPtr, item, &nmcit.ceItem); 631 COMBOEX_Notify (infoPtr, CBEN_INSERTITEM, (NMHDR *)&nmcit, TRUE); 281 632 282 633 return index; … … 286 637 287 638 static LRESULT 288 COMBOEX_InsertItemW (HWND hwnd, WPARAM wParam, LPARAM lParam) 639 COMBOEX_InsertItemA (HWND hwnd, WPARAM wParam, LPARAM lParam) 640 { 641 COMBOBOXEXITEMA *cit = (COMBOBOXEXITEMA *) lParam; 642 COMBOBOXEXITEMW citW; 643 LRESULT ret; 644 645 memcpy(&citW,cit,sizeof(COMBOBOXEXITEMA)); 646 if (cit->mask & CBEIF_TEXT) { 647 LPSTR str; 648 INT len; 649 650 str = cit->pszText; 651 if (!str) str=""; 652 len = MultiByteToWideChar (CP_ACP, 0, str, -1, NULL, 0); 653 if (len > 0) { 654 citW.pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR)); 655 MultiByteToWideChar (CP_ACP, 0, str, -1, citW.pszText, len); 656 } 657 } 658 ret = COMBOEX_InsertItemW(hwnd,wParam,(LPARAM)&citW);; 659 660 if (cit->mask & CBEIF_TEXT) 661 COMCTL32_Free(citW.pszText); 662 return ret; 663 } 664 665 666 static LRESULT 667 COMBOEX_SetExtendedStyle (HWND hwnd, WPARAM wParam, LPARAM lParam) 668 { 669 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd); 670 DWORD dwTemp; 671 672 TRACE("(0x%08x 0x%08lx)\n", wParam, lParam); 673 674 dwTemp = infoPtr->dwExtStyle; 675 676 if (lParam & (CBES_EX_NOEDITIMAGEINDENT | 677 CBES_EX_PATHWORDBREAKPROC | 678 CBES_EX_NOSIZELIMIT | 679 CBES_EX_CASESENSITIVE)) 680 FIXME("Extended style not implemented %08lx\n", lParam); 681 682 if ((DWORD)wParam) { 683 infoPtr->dwExtStyle = (infoPtr->dwExtStyle & ~(DWORD)wParam) | (DWORD)lParam; 684 } 685 else 686 infoPtr->dwExtStyle = (DWORD)lParam; 687 688 /* 689 * native does this for CBES_EX_NOEDITIMAGE state change 690 */ 691 if ((infoPtr->dwExtStyle & CBES_EX_NOEDITIMAGE) ^ 692 (dwTemp & CBES_EX_NOEDITIMAGE)) { 693 /* if state of EX_NOEDITIMAGE changes, invalidate all */ 694 TRACE("EX_NOEDITIMAGE state changed to %ld\n", 695 infoPtr->dwExtStyle & CBES_EX_NOEDITIMAGE); 696 InvalidateRect (hwnd, NULL, TRUE); 697 COMBOEX_AdjustEditPos (infoPtr); 698 if (infoPtr->hwndEdit) 699 InvalidateRect (infoPtr->hwndEdit, NULL, TRUE); 700 } 701 702 return (LRESULT)dwTemp; 703 } 704 705 706 inline static LRESULT 707 COMBOEX_SetImageList (HWND hwnd, WPARAM wParam, LPARAM lParam) 708 { 709 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd); 710 HIMAGELIST himlTemp; 711 712 TRACE("(0x%08x 0x%08lx)\n", wParam, lParam); 713 714 himlTemp = infoPtr->himl; 715 infoPtr->himl = (HIMAGELIST)lParam; 716 717 COMBOEX_ReSize (hwnd, infoPtr); 718 InvalidateRect (infoPtr->hwndCombo, NULL, TRUE); 719 720 /* reposition the Edit control based on whether icon exists */ 721 COMBOEX_AdjustEditPos (infoPtr); 722 return (LRESULT)himlTemp; 723 } 724 725 static LRESULT 726 COMBOEX_SetItemW (HWND hwnd, WPARAM wParam, LPARAM lParam) 289 727 { 290 728 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd); … … 293 731 CBE_ITEMDATA *item; 294 732 733 COMBOEX_DumpInput ((COMBOBOXEXITEMA *) cit, TRUE); 734 295 735 /* get real index of item to insert */ 296 736 index = cit->iItem; 297 if (index == -1) index = infoPtr->nb_items;298 if (index > infoPtr->nb_items) index = infoPtr->nb_items;299 300 /* get space and chain it in */301 item = (CBE_ITEMDATA *)COMCTL32_Alloc (sizeof (CBE_ITEMDATA));302 item->next = NULL;303 item->pszText = NULL;304 305 /* locate position to insert new item in */306 if (index == infoPtr->nb_items) {307 /* fast path for iItem = -1 */308 item->next = infoPtr->items;309 infoPtr->items = item;310 }311 else {312 INT i = infoPtr->nb_items-1;313 CBE_ITEMDATA *moving = infoPtr->items;314 315 while ((i > index) && moving) {316 moving = (CBE_ITEMDATA *)moving->next;317 i--;318 }319 if (!moving) {320 FIXME("COMBOBOXEX item structures broken. Please report!\n");321 COMCTL32_Free(item);322 return -1;323 }324 item->next = moving->next;325 moving->next = item;326 }327 328 /* fill in our hidden item structure */329 item->mask = cit->mask;330 if (item->mask & CBEIF_TEXT) {331 LPWSTR str;332 INT len;333 334 str = cit->pszText;335 if (!str) str = (LPWSTR) L"";336 len = strlenW (str);337 if (len > 0) {338 item->pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));339 strcpyW (item->pszText, str);340 }341 item->cchTextMax = cit->cchTextMax;342 }343 if (item->mask & CBEIF_IMAGE)344 item->iImage = cit->iImage;345 if (item->mask & CBEIF_SELECTEDIMAGE)346 item->iSelectedImage = cit->iSelectedImage;347 if (item->mask & CBEIF_OVERLAY)348 item->iOverlay = cit->iOverlay;349 if (item->mask & CBEIF_INDENT)350 item->iIndent = cit->iIndent;351 if (item->mask & CBEIF_LPARAM)352 item->lParam = cit->lParam;353 infoPtr->nb_items++;354 355 COMBOEX_DumpItem (item);356 357 SendMessageA (infoPtr->hwndCombo, CB_INSERTSTRING,358 (WPARAM)cit->iItem, (LPARAM)item);359 360 return index;361 362 }363 364 365 static LRESULT366 COMBOEX_SetExtendedStyle (HWND hwnd, WPARAM wParam, LPARAM lParam)367 {368 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);369 DWORD dwTemp;370 371 TRACE("(0x%08x 0x%08lx)\n", wParam, lParam);372 373 dwTemp = infoPtr->dwExtStyle;374 375 if ((DWORD)wParam) {376 infoPtr->dwExtStyle = (infoPtr->dwExtStyle & ~(DWORD)wParam) | (DWORD)lParam;377 }378 else379 infoPtr->dwExtStyle = (DWORD)lParam;380 381 /* FIXME: repaint?? */382 383 return (LRESULT)dwTemp;384 }385 386 387 inline static LRESULT388 COMBOEX_SetImageList (HWND hwnd, WPARAM wParam, LPARAM lParam)389 {390 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);391 HIMAGELIST himlTemp;392 393 TRACE("(0x%08x 0x%08lx)\n", wParam, lParam);394 395 himlTemp = infoPtr->himl;396 infoPtr->himl = (HIMAGELIST)lParam;397 398 COMBOEX_ReSize (hwnd, infoPtr);399 InvalidateRect (hwnd, NULL, TRUE);400 401 return (LRESULT)himlTemp;402 }403 404 static LRESULT405 COMBOEX_SetItemW (HWND hwnd, WPARAM wParam, LPARAM lParam)406 {407 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);408 COMBOBOXEXITEMW *cit = (COMBOBOXEXITEMW *) lParam;409 INT index;410 INT i;411 CBE_ITEMDATA *item;412 413 /* get real index of item to insert */414 index = cit->iItem;415 if (index == -1) {416 FIXME("NYI setting data for item in edit control\n");417 return 0;418 }419 737 420 738 /* if item number requested does not exist then return failure */ 421 if ((index > infoPtr->nb_items) || (index < 0)) return 0; 422 423 /* find the item in the list */ 424 item = infoPtr->items; 425 i = infoPtr->nb_items - 1; 426 while (item && (i > index)) { 427 item = (CBE_ITEMDATA *)item->next; 428 i--; 429 } 430 if (!item || (i != index)) { 431 FIXME("COMBOBOXEX item structures broken. Please report!\n"); 432 return 0; 433 } 434 435 /* add/change stuff to the internal item structure */ 739 if ((index > infoPtr->nb_items) || (index < -1)) { 740 ERR("attempt to set item that does not exist yet!\n"); 741 return 0; 742 } 743 744 /* if the item is the edit control and there is no edit control, skip */ 745 if ((index == -1) && 746 ((GetWindowLongA (hwnd, GWL_STYLE) & CBS_DROPDOWNLIST) != CBS_DROPDOWN)) 747 return 0; 748 749 if (!(item = COMBOEX_FindItem(infoPtr, index))) { 750 ERR("attempt to set item that was not found!\n"); 751 return 0; 752 } 753 754 /* add/change stuff to the internal item structure */ 436 755 item->mask |= cit->mask; 437 756 if (cit->mask & CBEIF_TEXT) { 438 757 LPWSTR str; 439 440 758 INT len; 759 WCHAR emptystr[1] = {0}; 441 760 442 761 str = cit->pszText; 443 762 if (!str) str=emptystr; 444 445 446 447 448 763 len = strlenW(str); 764 if (len > 0) { 765 item->pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR)); 766 strcpyW(item->pszText,str); 767 } 449 768 item->cchTextMax = cit->cchTextMax; 450 769 } … … 460 779 cit->lParam = cit->lParam; 461 780 781 COMBOEX_WarnCallBack (item); 782 462 783 COMBOEX_DumpItem (item); 463 784 785 /* if original request was to update edit control, do some fast foot work */ 786 if (cit->iItem == -1) { 787 COMBOEX_SetEditText (infoPtr, item); 788 RedrawWindow (infoPtr->hwndCombo, 0, 0, RDW_ERASE | RDW_INVALIDATE); 789 } 464 790 return TRUE; 465 791 } … … 468 794 COMBOEX_SetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam) 469 795 { 470 COMBOBOXEXITEMA 471 COMBOBOXEXITEMW 472 LRESULT 796 COMBOBOXEXITEMA *cit = (COMBOBOXEXITEMA *) lParam; 797 COMBOBOXEXITEMW citW; 798 LRESULT ret; 473 799 474 800 memcpy(&citW,cit,sizeof(COMBOBOXEXITEMA)); 475 801 if (cit->mask & CBEIF_TEXT) { 476 802 LPSTR str; 477 803 INT len; 478 804 479 805 str = cit->pszText; 480 806 if (!str) str=""; 481 482 483 484 485 807 len = MultiByteToWideChar (CP_ACP, 0, str, -1, NULL, 0); 808 if (len > 0) { 809 citW.pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR)); 810 MultiByteToWideChar (CP_ACP, 0, str, -1, citW.pszText, len); 811 } 486 812 } 487 813 ret = COMBOEX_SetItemW(hwnd,wParam,(LPARAM)&citW);; 488 814 489 815 if (cit->mask & CBEIF_TEXT) 490 816 COMCTL32_Free(citW.pszText); 491 817 return ret; 492 818 } 493 819 494 820 495 /* << COMBOEX_SetUniCodeFormat >> */ 821 inline static LRESULT 822 COMBOEX_SetUnicodeFormat (HWND hwnd, WPARAM wParam, LPARAM lParam) 823 { 824 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd); 825 BOOL bTemp; 826 827 TRACE("%s hwnd=0x%04x stub!\n", 828 ((BOOL)wParam) ? "TRUE" : "FALSE", hwnd); 829 830 bTemp = infoPtr->bUnicode; 831 infoPtr->bUnicode = (BOOL)wParam; 832 833 return bTemp; 834 } 835 496 836 497 837 498 838 /* *** CB_xxx message support *** */ 839 840 841 static LRESULT 842 COMBOEX_FindStringExact (COMBOEX_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 843 { 844 INT i, count; 845 CBE_ITEMDATA *item; 846 LPWSTR desired = NULL; 847 INT start = (INT) wParam; 848 849 i = MultiByteToWideChar (CP_ACP, 0, (LPSTR)lParam, -1, NULL, 0); 850 if (i > 0) { 851 desired = (LPWSTR)COMCTL32_Alloc ((i + 1)*sizeof(WCHAR)); 852 MultiByteToWideChar (CP_ACP, 0, (LPSTR)lParam, -1, desired, i); 853 } 854 855 count = SendMessageW (infoPtr->hwndCombo, CB_GETCOUNT, 0 , 0); 856 857 /* now search from after starting loc and wrapping back to start */ 858 for(i=start+1; i<count; i++) { 859 item = (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo, 860 CB_GETITEMDATA, (WPARAM)i, 0); 861 TRACE("desired=%s, item=%s\n", 862 debugstr_w(desired), debugstr_w(item->pszText)); 863 if (lstrcmpiW(item->pszText, desired) == 0) { 864 COMCTL32_Free (desired); 865 return i; 866 } 867 } 868 for(i=0; i<=start; i++) { 869 item = (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo, 870 CB_GETITEMDATA, (WPARAM)i, 0); 871 TRACE("desired=%s, item=%s\n", 872 debugstr_w(desired), debugstr_w(item->pszText)); 873 if (lstrcmpiW(item->pszText, desired) == 0) { 874 COMCTL32_Free (desired); 875 return i; 876 } 877 } 878 COMCTL32_Free(desired); 879 return CB_ERR; 880 } 881 882 883 static LRESULT 884 COMBOEX_SetCursel (HWND hwnd, WPARAM wParam, LPARAM lParam) 885 { 886 INT index = wParam; 887 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd); 888 CBE_ITEMDATA *item; 889 LRESULT lret; 890 891 if (!(item = COMBOEX_FindItem(infoPtr, index))) { 892 /* FIXME: need to clear selection */ 893 return CB_ERR; 894 } 895 896 TRACE("selecting item %d text=%s\n", index, (item->pszText) ? 897 debugstr_w(item->pszText) : "<null>"); 898 899 lret = SendMessageW (infoPtr->hwndCombo, CB_SETCURSEL, wParam, lParam); 900 COMBOEX_SetEditText (infoPtr, item); 901 return lret; 902 } 499 903 500 904 … … 509 913 /* First, lets forward the message to the normal combo control 510 914 just like Windows. */ 511 if (infoPtr->hwndCombo) 512 SendMessageA (infoPtr->hwndCombo, CB_SETITEMHEIGHT, wParam, lParam); 513 514 /* *** new *** */ 915 if (infoPtr->hwndCombo) 916 SendMessageW (infoPtr->hwndCombo, CB_SETITEMHEIGHT, wParam, lParam); 917 515 918 GetWindowRect (infoPtr->hwndCombo, &cb_wrect); 516 919 GetWindowRect (hwnd, &cbx_wrect); 517 920 GetClientRect (hwnd, &cbx_crect); 518 /* the height of comboex as height of the combo + comboex border */ 921 /* the height of comboex as height of the combo + comboex border */ 519 922 height = cb_wrect.bottom-cb_wrect.top 520 923 + cbx_wrect.bottom-cbx_wrect.top 521 924 - (cbx_crect.bottom-cbx_crect.top); 522 925 TRACE("EX window=(%d,%d)-(%d,%d), client=(%d,%d)-(%d,%d)\n", 523 524 926 cbx_wrect.left, cbx_wrect.top, cbx_wrect.right, cbx_wrect.bottom, 927 cbx_crect.left, cbx_crect.top, cbx_crect.right, cbx_crect.bottom); 525 928 TRACE("CB window=(%d,%d)-(%d,%d), EX setting=(0,0)-(%d,%d)\n", 526 527 929 cb_wrect.left, cb_wrect.top, cb_wrect.right, cb_wrect.bottom, 930 cbx_wrect.right-cbx_wrect.left, height); 528 931 SetWindowPos (hwnd, HWND_TOP, 0, 0, 529 cbx_wrect.right-cbx_wrect.left, 530 height, 531 SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE); 532 /* *** end new *** */ 932 cbx_wrect.right-cbx_wrect.left, 933 height, 934 SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE); 533 935 534 936 return ret; … … 546 948 DWORD dwComboStyle; 547 949 LOGFONTA mylogfont; 950 CBE_ITEMDATA *item; 951 RECT wnrc1, clrc1, cmbwrc; 952 LONG test; 548 953 549 954 /* allocate memory for info structure */ 955 #ifdef __WIN32OS2__ 956 infoPtr = (COMBOEX_INFO*)initControl(hwnd,sizeof(COMBOEX_INFO)); 957 #else 550 958 infoPtr = (COMBOEX_INFO *)COMCTL32_Alloc (sizeof(COMBOEX_INFO)); 959 #endif 551 960 if (infoPtr == NULL) { 552 ERR("could not allocate info memory!\n"); 553 return 0; 554 } 961 ERR("could not allocate info memory!\n"); 962 return 0; 963 } 964 965 /* initialize info structure */ 966 555 967 infoPtr->items = NULL; 556 968 infoPtr->nb_items = 0; 969 infoPtr->hwndSelf = hwnd; 557 970 558 971 SetWindowLongA (hwnd, 0, (DWORD)infoPtr); 559 560 561 /* initialize info structure */562 563 972 564 973 /* create combo box */ 565 974 dwComboStyle = GetWindowLongA (hwnd, GWL_STYLE) & 566 (CBS_SIMPLE|CBS_DROPDOWN|CBS_DROPDOWNLIST|WS_CHILD); 975 (CBS_SIMPLE|CBS_DROPDOWN|CBS_DROPDOWNLIST|WS_CHILD); 976 977 TRACE("combo style=%08lx, additional style=%08lx\n", dwComboStyle, 978 WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VSCROLL | 979 CBS_NOINTEGRALHEIGHT | CBS_DROPDOWNLIST | 980 WS_CHILD | WS_VISIBLE | CBS_OWNERDRAWFIXED); 981 982 /* Native version of ComboEx creates the ComboBox with DROPDOWNLIST */ 983 /* specified. It then creates it's own version of the EDIT control */ 984 /* and makes the ComboBox the parent. This is because a normal */ 985 /* DROPDOWNLIST does not have a EDIT control, but we need one. */ 986 /* We also need to place the edit control at the proper location */ 987 /* (allow space for the icons). */ 567 988 568 989 infoPtr->hwndCombo = CreateWindowA ("ComboBox", "", 569 /* following line added to match native */ 570 WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VSCROLL | CBS_NOINTEGRALHEIGHT | 571 /* was base and is necessary */ 572 WS_CHILD | WS_VISIBLE | CBS_OWNERDRAWFIXED | dwComboStyle, 573 cs->y, cs->x, cs->cx, cs->cy, hwnd, (HMENU)0, 574 GetWindowLongA (hwnd, GWL_HINSTANCE), NULL); 575 576 /* *** new *** */ 577 SystemParametersInfoA (SPI_GETICONTITLELOGFONT, sizeof(mylogfont), &mylogfont, 0); 578 infoPtr->font = CreateFontIndirectA (&mylogfont); 579 SendMessageA (infoPtr->hwndCombo, WM_SETFONT, (WPARAM)infoPtr->font, 0); 990 /* following line added to match native */ 991 WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VSCROLL | 992 CBS_NOINTEGRALHEIGHT | CBS_DROPDOWNLIST | 993 /* was base and is necessary */ 994 WS_CHILD | WS_VISIBLE | CBS_OWNERDRAWFIXED | dwComboStyle, 995 cs->y, cs->x, cs->cx, cs->cy, hwnd, 996 (HMENU) GetWindowLongA (hwnd, GWL_ID), 997 GetWindowLongA (hwnd, GWL_HINSTANCE), NULL); 998 999 /* 1000 * native does the following at this point according to trace: 1001 * GetWindowThreadProcessId(hwndCombo,0) 1002 * GetCurrentThreadId() 1003 * GetWindowThreadProcessId(hwndCombo, &???) 1004 * GetCurrentProcessId() 1005 */ 1006 1007 /* 1008 * Setup a property to hold the pointer to the COMBOBOXEX 1009 * data structure. 1010 */ 1011 test = GetPropA(infoPtr->hwndCombo, (LPCSTR)(LONG)ComboExInfo); 1012 if (!test || ((COMBOEX_INFO *)test != infoPtr)) { 1013 SetPropA(infoPtr->hwndCombo, "CC32SubclassInfo", (LONG)infoPtr); 1014 } 1015 infoPtr->prevComboWndProc = (WNDPROC)SetWindowLongA(infoPtr->hwndCombo, 1016 GWL_WNDPROC, (LONG)COMBOEX_ComboWndProc); 1017 infoPtr->font = SendMessageW (infoPtr->hwndCombo, WM_GETFONT, 0, 0); 1018 1019 1020 /* 1021 * Now create our own EDIT control so we can position it. 1022 * It is created only for CBS_DROPDOWN style 1023 */ 1024 if ((cs->style & CBS_DROPDOWNLIST) == CBS_DROPDOWN) { 1025 infoPtr->hwndEdit = CreateWindowExA (0, "EDIT", "", 1026 WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | ES_AUTOHSCROLL, 1027 0, 0, 0, 0, /* will set later */ 1028 infoPtr->hwndCombo, 1029 (HMENU) GetWindowLongA (hwnd, GWL_ID), 1030 GetWindowLongA (hwnd, GWL_HINSTANCE), 1031 NULL); 1032 1033 /* native does the following at this point according to trace: 1034 * GetWindowThreadProcessId(hwndEdit,0) 1035 * GetCurrentThreadId() 1036 * GetWindowThreadProcessId(hwndEdit, &???) 1037 * GetCurrentProcessId() 1038 */ 1039 1040 /* 1041 * Setup a property to hold the pointer to the COMBOBOXEX 1042 * data structure. 1043 */ 1044 test = GetPropA(infoPtr->hwndEdit, (LPCSTR)(LONG)ComboExInfo); 1045 if (!test || ((COMBOEX_INFO *)test != infoPtr)) { 1046 SetPropA(infoPtr->hwndEdit, "CC32SubclassInfo", (LONG)infoPtr); 1047 } 1048 infoPtr->prevEditWndProc = (WNDPROC)SetWindowLongA(infoPtr->hwndEdit, 1049 GWL_WNDPROC, (LONG)COMBOEX_EditWndProc); 1050 infoPtr->font = SendMessageW (infoPtr->hwndCombo, WM_GETFONT, 0, 0); 1051 } 1052 else { 1053 infoPtr->hwndEdit = 0; 1054 infoPtr->font = 0; 1055 } 1056 1057 /* 1058 * Locate the default font if necessary and then set it in 1059 * all associated controls 1060 */ 1061 if (!infoPtr->font) { 1062 SystemParametersInfoA (SPI_GETICONTITLELOGFONT, sizeof(mylogfont), 1063 &mylogfont, 0); 1064 infoPtr->font = CreateFontIndirectA (&mylogfont); 1065 } 1066 SendMessageW (infoPtr->hwndCombo, WM_SETFONT, (WPARAM)infoPtr->font, 0); 1067 if (infoPtr->hwndEdit) { 1068 SendMessageW (infoPtr->hwndEdit, WM_SETFONT, (WPARAM)infoPtr->font, 0); 1069 SendMessageW (infoPtr->hwndEdit, EM_SETMARGINS, (WPARAM)EC_USEFONTINFO, 0); 1070 } 1071 580 1072 COMBOEX_ReSize (hwnd, infoPtr); 581 /* *** end new *** */ 1073 1074 /* Above is fairly certain, below is much less certain. */ 1075 1076 GetWindowRect(hwnd, &wnrc1); 1077 GetClientRect(hwnd, &clrc1); 1078 GetWindowRect(infoPtr->hwndCombo, &cmbwrc); 1079 TRACE("Ex wnd=(%d,%d)-(%d,%d) Ex clt=(%d,%d)-(%d,%d) Cb wnd=(%d,%d)-(%d,%d)\n", 1080 wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom, 1081 clrc1.left, clrc1.top, clrc1.right, clrc1.bottom, 1082 cmbwrc.left, cmbwrc.top, cmbwrc.right, cmbwrc.bottom); 1083 SetWindowPos(infoPtr->hwndCombo, HWND_TOP, 1084 0, 0, wnrc1.right-wnrc1.left, wnrc1.bottom-wnrc1.top, 1085 SWP_NOACTIVATE | SWP_NOREDRAW); 1086 1087 GetWindowRect(infoPtr->hwndCombo, &cmbwrc); 1088 TRACE("Ex wnd=(%d,%d)-(%d,%d)\n", 1089 cmbwrc.left, cmbwrc.top, cmbwrc.right, cmbwrc.bottom); 1090 SetWindowPos(hwnd, HWND_TOP, 1091 0, 0, cmbwrc.right-cmbwrc.left, cmbwrc.bottom-cmbwrc.top, 1092 SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE); 1093 1094 COMBOEX_AdjustEditPos (infoPtr); 1095 1096 /* 1097 * Create an item structure to represent the data in the 1098 * EDIT control. 1099 */ 1100 item = (CBE_ITEMDATA *)COMCTL32_Alloc (sizeof (CBE_ITEMDATA)); 1101 item->next = NULL; 1102 item->pszText = NULL; 1103 item->mask = 0; 1104 infoPtr->edit = item; 582 1105 583 1106 return 0; 1107 } 1108 1109 1110 inline static LRESULT 1111 COMBOEX_Command (HWND hwnd, WPARAM wParam, LPARAM lParam) 1112 { 1113 LRESULT lret; 1114 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd); 1115 INT command = HIWORD(wParam); 1116 CBE_ITEMDATA *item = 0; 1117 WCHAR wintext[520]; 1118 INT cursel, n, oldItem; 1119 NMCBEENDEDITA cbeend; 1120 1121 TRACE("for command %d\n", command); 1122 1123 switch (command) 1124 { 1125 case CBN_DROPDOWN: 1126 SendMessageW (GetParent (hwnd), WM_COMMAND, wParam, 1127 (LPARAM)hwnd); 1128 /* 1129 * from native trace of first dropdown after typing in URL in IE4 1130 * CB_GETCURSEL(Combo) 1131 * GetWindowText(Edit) 1132 * CB_GETCURSEL(Combo) 1133 * CB_GETCOUNT(Combo) 1134 * CB_GETITEMDATA(Combo, n) 1135 * WM_NOTIFY(parent, CBEN_ENDEDITA|W) 1136 * CB_GETCURSEL(Combo) 1137 * CB_SETCURSEL(COMBOEX, n) 1138 * SetFocus(Combo) 1139 * the rest is supposition 1140 */ 1141 cursel = SendMessageW (infoPtr->hwndCombo, CB_GETCURSEL, 0, 0); 1142 if (cursel == -1) { 1143 /* find match from edit against those in Combobox */ 1144 GetWindowTextW (infoPtr->hwndEdit, wintext, 520); 1145 n = SendMessageW (infoPtr->hwndCombo, CB_GETCOUNT, 0, 0); 1146 for (cursel = 0; cursel < n; cursel++){ 1147 item = (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo, 1148 CB_GETITEMDATA, 1149 cursel, 0); 1150 if ((INT)item == CB_ERR) break; 1151 if (lstrcmpiW(item->pszText, wintext) == 0) break; 1152 } 1153 if ((cursel == n) || ((INT)item == CB_ERR)) { 1154 TRACE("failed to find match??? item=%p cursel=%d\n", 1155 item, cursel); 1156 if (infoPtr->hwndEdit) 1157 SetFocus(infoPtr->hwndEdit); 1158 return 0; 1159 } 1160 } 1161 else { 1162 item = (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo, 1163 CB_GETITEMDATA, 1164 cursel, 0); 1165 if ((INT)item == CB_ERR) { 1166 TRACE("failed to find match??? item=%p cursel=%d\n", 1167 item, cursel); 1168 if (infoPtr->hwndEdit) 1169 SetFocus(infoPtr->hwndEdit); 1170 return 0; 1171 } 1172 } 1173 if (infoPtr->flags & WCBE_ACTEDIT) { 1174 WideCharToMultiByte (CP_ACP, 0, item->pszText, -1, 1175 cbeend.szText, sizeof(cbeend.szText), 1176 NULL, NULL); 1177 cbeend.fChanged = (infoPtr->flags & WCBE_EDITCHG); 1178 cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo, 1179 CB_GETCURSEL, 0, 0); 1180 cbeend.iWhy = CBENF_DROPDOWN; 1181 1182 infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG); 1183 if (COMBOEX_Notify (infoPtr, CBEN_ENDEDITA, 1184 (NMHDR *)&cbeend, FALSE)) { 1185 /* abort the change */ 1186 TRACE("Notify requested abort of change\n"); 1187 return 0; 1188 } 1189 } 1190 SendMessageW (hwnd, CB_SETCURSEL, cursel, 0); 1191 SetFocus(infoPtr->hwndCombo); 1192 return 0; 1193 1194 case CBN_SELCHANGE: 1195 /* 1196 * CB_GETCURSEL(Combo) 1197 * CB_GETITEMDATA(Combo) < simulated by COMBOEX_FindItem 1198 * lstrlenA 1199 * WM_SETTEXT(Edit) 1200 * WM_GETTEXTLENGTH(Edit) 1201 * WM_GETTEXT(Edit) 1202 * EM_SETSEL(Edit, 0,0) 1203 * WM_GETTEXTLENGTH(Edit) 1204 * WM_GETTEXT(Edit) 1205 * EM_SETSEL(Edit, 0,len) 1206 * return WM_COMMAND to parent 1207 */ 1208 oldItem = SendMessageW (infoPtr->hwndCombo, CB_GETCURSEL, 0, 0); 1209 if (!(item = COMBOEX_FindItem(infoPtr, oldItem))) { 1210 ERR("item %d not found. Problem!\n", oldItem); 1211 break; 1212 } 1213 COMBOEX_SetEditText (infoPtr, item); 1214 return SendMessageW (GetParent (hwnd), WM_COMMAND, wParam, 1215 (LPARAM)hwnd); 1216 1217 case CBN_SELENDOK: 1218 /* 1219 * We have to change the handle since we are the control 1220 * issuing the message. IE4 depends on this. 1221 */ 1222 return SendMessageW (GetParent (hwnd), WM_COMMAND, wParam, 1223 (LPARAM)hwnd); 1224 1225 case CBN_KILLFOCUS: 1226 /* 1227 * from native trace: 1228 * 1229 * pass to parent 1230 * WM_GETTEXT(Edit, 104) 1231 * CB_GETCURSEL(Combo) rets -1 1232 * WM_NOTIFY(CBEN_ENDEDITA) with CBENF_KILLFOCUS 1233 * CB_GETCURSEL(Combo) 1234 * InvalidateRect(Combo, 0, 0) 1235 * return 0 1236 */ 1237 SendMessageW (GetParent (hwnd), WM_COMMAND, wParam, 1238 (LPARAM)hwnd); 1239 if (infoPtr->flags & WCBE_ACTEDIT) { 1240 GetWindowTextA (infoPtr->hwndEdit, cbeend.szText, 260); 1241 cbeend.fChanged = (infoPtr->flags & WCBE_EDITCHG); 1242 cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo, 1243 CB_GETCURSEL, 0, 0); 1244 cbeend.iWhy = CBENF_KILLFOCUS; 1245 1246 infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG); 1247 if (COMBOEX_Notify (infoPtr, CBEN_ENDEDITA, 1248 (NMHDR *)&cbeend, FALSE)) { 1249 /* abort the change */ 1250 TRACE("Notify requested abort of change\n"); 1251 return 0; 1252 } 1253 } 1254 /* possible CB_GETCURSEL */ 1255 InvalidateRect (infoPtr->hwndCombo, 0, 0); 1256 return 0; 1257 1258 case CBN_CLOSEUP: 1259 default: 1260 /* 1261 * We have to change the handle since we are the control 1262 * issuing the message. IE4 depends on this. 1263 * We also need to set the focus back to the Edit control 1264 * after passing the command to the parent of the ComboEx. 1265 */ 1266 lret = SendMessageW (GetParent (hwnd), WM_COMMAND, wParam, 1267 (LPARAM)hwnd); 1268 if (infoPtr->hwndEdit) 1269 SetFocus(infoPtr->hwndEdit); 1270 return lret; 1271 } 1272 return 0; 1273 } 1274 1275 1276 inline static LRESULT 1277 COMBOEX_WM_DeleteItem (HWND hwnd, WPARAM wParam, LPARAM lParam) 1278 { 1279 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd); 1280 DELETEITEMSTRUCT *dis = (DELETEITEMSTRUCT *)lParam; 1281 CBE_ITEMDATA *item, *olditem; 1282 INT i; 1283 NMCOMBOBOXEXW nmcit; 1284 1285 TRACE("CtlType=%08x, CtlID=%08x, itemID=%08x, hwnd=%x, data=%08lx\n", 1286 dis->CtlType, dis->CtlID, dis->itemID, dis->hwndItem, dis->itemData); 1287 1288 if ((dis->itemID >= infoPtr->nb_items) || (dis->itemID < 0)) return FALSE; 1289 1290 olditem = infoPtr->items; 1291 i = infoPtr->nb_items - 1; 1292 1293 if (i == dis->itemID) { 1294 infoPtr->items = infoPtr->items->next; 1295 } 1296 else { 1297 item = olditem; 1298 i--; 1299 1300 /* find the prior item in the list */ 1301 while (item->next && (i > dis->itemID)) { 1302 item = (CBE_ITEMDATA *)item->next; 1303 i--; 1304 } 1305 if (!item->next || (i != dis->itemID)) { 1306 FIXME("COMBOBOXEX item structures broken. Please report!\n"); 1307 return FALSE; 1308 } 1309 olditem = item->next; 1310 item->next = (CBE_ITEMDATA *)((CBE_ITEMDATA *)item->next)->next; 1311 } 1312 infoPtr->nb_items--; 1313 1314 COMBOEX_CopyItem (infoPtr, olditem, &nmcit.ceItem); 1315 COMBOEX_Notify (infoPtr, CBEN_DELETEITEM, (NMHDR *)&nmcit, TRUE); 1316 1317 COMCTL32_Free(olditem); 1318 1319 return TRUE; 1320 584 1321 } 585 1322 … … 590 1327 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd); 591 1328 DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)lParam; 592 CBE_ITEMDATA *item ;1329 CBE_ITEMDATA *item = 0; 593 1330 SIZE txtsize; 594 COLORREF nbkc, ntxc;595 1331 RECT rect; 596 int drawimage ;597 UINT x , xbase, y;1332 int drawimage, drawstate; 1333 UINT xbase; 598 1334 UINT xioff = 0; /* size and spacer of image if any */ 599 1335 IMAGEINFO iinfo; … … 614 1350 /* though the list box or combo box has the focus. */ 615 1351 if (dis->itemID == 0xffffffff) { 616 if ( ( (dis->itemAction & ODA_FOCUS) && (dis->itemState & ODS_SELECTED)) || 617 ( (dis->itemAction & (ODA_SELECT | ODA_DRAWENTIRE)) && (dis->itemState & ODS_FOCUS) ) ) { 618 TRACE("drawing item -1 special focus, rect=(%d,%d)-(%d,%d)\n", 619 dis->rcItem.left, dis->rcItem.top, 620 dis->rcItem.right, dis->rcItem.bottom); 621 DrawFocusRect(dis->hDC, &dis->rcItem); 622 return 0; 623 } 624 else { 625 TRACE("NOT drawing item -1 special focus, rect=(%d,%d)-(%d,%d), action=%08x, state=%08x\n", 626 dis->rcItem.left, dis->rcItem.top, 627 dis->rcItem.right, dis->rcItem.bottom, 628 dis->itemAction, dis->itemState); 629 return 0; 630 } 631 } 632 633 item = (CBE_ITEMDATA *)SendMessageA (infoPtr->hwndCombo, CB_GETITEMDATA, 634 (WPARAM)dis->itemID, 0); 635 if (item == (CBE_ITEMDATA *)CB_ERR) 636 { 637 FIXME("invalid item for id %d \n",dis->itemID); 638 return 0; 639 } 1352 if ( ( (dis->itemAction & ODA_FOCUS) && (dis->itemState & ODS_SELECTED)) || 1353 ( (dis->itemAction & (ODA_SELECT | ODA_DRAWENTIRE)) && (dis->itemState & ODS_FOCUS) ) ) { 1354 1355 TRACE("drawing item -1 special focus, rect=(%d,%d)-(%d,%d)\n", 1356 dis->rcItem.left, dis->rcItem.top, 1357 dis->rcItem.right, dis->rcItem.bottom); 1358 } 1359 else if ((dis->CtlType == ODT_COMBOBOX) && 1360 (dis->itemAction == ODA_DRAWENTIRE)) { 1361 /* draw of edit control data */ 1362 1363 /* testing */ 1364 { 1365 RECT exrc, cbrc, edrc; 1366 GetWindowRect (hwnd, &exrc); 1367 GetWindowRect (infoPtr->hwndCombo, &cbrc); 1368 edrc.left=edrc.top=edrc.right=edrc.bottom=-1; 1369 if (infoPtr->hwndEdit) 1370 GetWindowRect (infoPtr->hwndEdit, &edrc); 1371 TRACE("window rects ex=(%d,%d)-(%d,%d), cb=(%d,%d)-(%d,%d), ed=(%d,%d)-(%d,%d)\n", 1372 exrc.left, exrc.top, exrc.right, exrc.bottom, 1373 cbrc.left, cbrc.top, cbrc.right, cbrc.bottom, 1374 edrc.left, edrc.top, edrc.right, edrc.bottom); 1375 } 1376 } 1377 else { 1378 ERR("NOT drawing item -1 special focus, rect=(%d,%d)-(%d,%d), action=%08x, state=%08x\n", 1379 dis->rcItem.left, dis->rcItem.top, 1380 dis->rcItem.right, dis->rcItem.bottom, 1381 dis->itemAction, dis->itemState); 1382 return 0; 1383 } 1384 } 1385 1386 /* If draw item is -1 (edit control) setup the item pointer */ 1387 if (dis->itemID == 0xffffffff) { 1388 CHAR str[260]; 1389 INT wlen, alen; 1390 1391 if (!infoPtr->hwndEdit) { 1392 ERR("request to draw edit item, but no edit control exists!\n"); 1393 return 0; 1394 } 1395 1396 item = infoPtr->edit; 1397 /* free previous text of edit item */ 1398 if (item->pszText) { 1399 COMCTL32_Free(item->pszText); 1400 item->pszText = 0; 1401 item->mask &= ~CBEIF_TEXT; 1402 } 1403 alen = SendMessageA (infoPtr->hwndEdit, WM_GETTEXT, 260, (LPARAM)&str); 1404 TRACE("edit control hwndEdit=%0x, text len=%d str=<%s>\n", 1405 infoPtr->hwndEdit, alen, str); 1406 if (alen > 0) { 1407 item->mask |= CBEIF_TEXT; 1408 wlen = MultiByteToWideChar (CP_ACP, 0, str, -1, NULL, 0); 1409 if (wlen > 0) { 1410 item->pszText = (LPWSTR)COMCTL32_Alloc ((wlen + 1)*sizeof(WCHAR)); 1411 MultiByteToWideChar (CP_ACP, 0, str, -1, item->pszText, wlen); 1412 } 1413 } 1414 } 1415 1416 /* if the item pointer is not set, then get the data and locate it */ 1417 if (!item) { 1418 item = (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo, 1419 CB_GETITEMDATA, (WPARAM)dis->itemID, 0); 1420 if (item == (CBE_ITEMDATA *)CB_ERR) 1421 { 1422 FIXME("invalid item for id %d \n",dis->itemID); 1423 return 0; 1424 } 1425 } 1426 1427 /* dump the DRAWITEMSTRUCT if tracing "comboex" but not "message" */ 640 1428 if (!TRACE_ON(message)) { 641 TRACE("DRAWITEMSTRUCT: CtlType=0x%08x CtlID=0x%08x\n", 642 643 TRACE("itemID=0x%08x itemAction=0x%08x itemState=0x%08x\n", 644 645 646 dis->hwndItem, dis->hDC, dis->rcItem.left, 647 dis->rcItem.top, dis->rcItem.right, dis->rcItem.bottom, 648 1429 TRACE("DRAWITEMSTRUCT: CtlType=0x%08x CtlID=0x%08x\n", 1430 dis->CtlType, dis->CtlID); 1431 TRACE("itemID=0x%08x itemAction=0x%08x itemState=0x%08x\n", 1432 dis->itemID, dis->itemAction, dis->itemState); 1433 TRACE("hWnd=0x%04x hDC=0x%04x (%d,%d)-(%d,%d) itemData=0x%08lx\n", 1434 dis->hwndItem, dis->hDC, dis->rcItem.left, 1435 dis->rcItem.top, dis->rcItem.right, dis->rcItem.bottom, 1436 dis->itemData); 649 1437 } 650 1438 COMBOEX_DumpItem (item); 651 1439 652 1440 xbase = CBE_STARTOFFSET; 653 if ( item->mask & CBEIF_INDENT)1441 if ((item->mask & CBEIF_INDENT) && (dis->itemState & ODS_COMBOEXLBOX)) 654 1442 xbase += (item->iIndent * CBE_INDENT); 655 1443 if (item->mask & CBEIF_IMAGE) { 656 657 1444 ImageList_GetImageInfo(infoPtr->himl, item->iImage, &iinfo); 1445 xioff = (iinfo.rcImage.right - iinfo.rcImage.left + CBE_SEP); 658 1446 } 659 1447 … … 661 1449 case ODA_FOCUS: 662 1450 if (dis->itemState & ODS_SELECTED /*1*/) { 663 if ((item->mask & CBEIF_TEXT) && item->pszText) { 664 len = strlenW (item->pszText); 665 GetTextExtentPointW (dis->hDC, item->pszText, len, &txtsize); 666 rect.left = xbase + xioff - 1; 667 rect.top = dis->rcItem.top - 1 + 668 (dis->rcItem.bottom - dis->rcItem.top - txtsize.cy) / 2; 669 rect.right = rect.left + txtsize.cx + 2; 670 rect.bottom = rect.top + txtsize.cy + 2; 671 TRACE("drawing item %d focus, rect=(%d,%d)-(%d,%d)\n", 672 dis->itemID, rect.left, rect.top, 673 rect.right, rect.bottom); 674 DrawFocusRect(dis->hDC, &rect); 675 } 676 } 1451 if ((item->mask & CBEIF_TEXT) && item->pszText) { 1452 RECT rect2; 1453 1454 len = strlenW (item->pszText); 1455 GetTextExtentPointW (dis->hDC, item->pszText, len, &txtsize); 1456 rect.left = xbase + xioff - 1; 1457 rect.right = rect.left + txtsize.cx + 2; 1458 rect.top = dis->rcItem.top; 1459 rect.bottom = dis->rcItem.bottom; 1460 GetClipBox (dis->hDC, &rect2); 1461 TRACE("drawing item %d focus, rect=(%d,%d)-(%d,%d)\n", 1462 dis->itemID, rect.left, rect.top, 1463 rect.right, rect.bottom); 1464 TRACE(" clip=(%d,%d)-(%d,%d)\n", 1465 rect2.left, rect2.top, 1466 rect2.right, rect2.bottom); 1467 1468 DrawFocusRect(dis->hDC, &rect); 1469 } 1470 else { 1471 FIXME("ODA_FOCUS and ODS_SELECTED but no text\n"); 1472 } 1473 } 1474 else { 1475 FIXME("ODA_FOCUS but not ODS_SELECTED\n"); 1476 } 677 1477 break; 678 1478 case ODA_SELECT: 679 1479 case ODA_DRAWENTIRE: 680 1480 drawimage = -1; 681 if (item->mask & CBEIF_IMAGE) drawimage = item->iImage; 682 if ((dis->itemState & ODS_SELECTED) && 683 (item->mask & CBEIF_SELECTEDIMAGE)) 684 drawimage = item->iSelectedImage; 685 if (drawimage != -1) { 686 ImageList_Draw (infoPtr->himl, drawimage, dis->hDC, 687 xbase, dis->rcItem.top, 688 (dis->itemState & ODS_SELECTED) ? 689 ILD_SELECTED : ILD_NORMAL); 690 } 691 if ((item->mask & CBEIF_TEXT) && item->pszText) { 692 len = strlenW (item->pszText); 693 GetTextExtentPointW (dis->hDC, item->pszText, len, &txtsize); 694 nbkc = GetSysColor ((dis->itemState & ODS_SELECTED) ? 695 COLOR_HIGHLIGHT : COLOR_WINDOW); 696 SetBkColor (dis->hDC, nbkc); 697 ntxc = GetSysColor ((dis->itemState & ODS_SELECTED) ? 698 COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT); 699 SetTextColor (dis->hDC, ntxc); 700 x = xbase + xioff; 701 y = dis->rcItem.top + 702 (dis->rcItem.bottom - dis->rcItem.top - txtsize.cy) / 2; 703 rect.left = x; 704 rect.right = x + txtsize.cx; 705 rect.top = y; 706 rect.bottom = y + txtsize.cy; 707 TRACE("drawing item %d text, rect=(%d,%d)-(%d,%d)\n", 708 dis->itemID, rect.left, rect.top, rect.right, rect.bottom); 709 ExtTextOutW (dis->hDC, x, y, ETO_OPAQUE | ETO_CLIPPED, 710 &rect, item->pszText, len, 0); 711 if (dis->itemState & ODS_FOCUS) { 712 rect.top -= 1; 713 rect.bottom += 1; 714 rect.left -= 1; 715 rect.right += 2; 716 TRACE("drawing item %d focus, rect=(%d,%d)-(%d,%d)\n", 717 dis->itemID, rect.left, rect.top, rect.right, rect.bottom); 718 DrawFocusRect (dis->hDC, &rect); 719 } 720 } 721 break; 1481 drawstate = ILD_NORMAL; 1482 if (!(infoPtr->dwExtStyle & CBES_EX_NOEDITIMAGE)) { 1483 if (item->mask & CBEIF_IMAGE) 1484 drawimage = item->iImage; 1485 if (dis->itemState & ODS_COMBOEXLBOX) { 1486 /* drawing listbox entry */ 1487 if (dis->itemState & ODS_SELECTED) { 1488 if (item->mask & CBEIF_SELECTEDIMAGE) 1489 drawimage = item->iSelectedImage; 1490 drawstate = ILD_SELECTED; 1491 } 1492 } 1493 else { 1494 /* drawing combo/edit entry */ 1495 if (infoPtr->hwndEdit) { 1496 /* if we have an edit control, the slave the 1497 * selection state to the Edit focus state 1498 */ 1499 if (infoPtr->flags & WCBE_EDITFOCUSED) { 1500 if (item->mask & CBEIF_SELECTEDIMAGE) 1501 drawimage = item->iSelectedImage; 1502 drawstate = ILD_SELECTED; 1503 } 1504 } 1505 else { 1506 /* if we don't have an edit control, use 1507 * the requested state. 1508 */ 1509 if (dis->itemState & ODS_SELECTED) { 1510 if (item->mask & CBEIF_SELECTEDIMAGE) 1511 drawimage = item->iSelectedImage; 1512 drawstate = ILD_SELECTED; 1513 } 1514 } 1515 } 1516 } 1517 if (drawimage != -1) { 1518 TRACE("drawing image state=%d\n", dis->itemState & ODS_SELECTED); 1519 ImageList_Draw (infoPtr->himl, drawimage, dis->hDC, 1520 xbase, dis->rcItem.top, drawstate); 1521 } 1522 if ((item->mask & CBEIF_TEXT) && item->pszText) { 1523 UINT x, y; 1524 COLORREF nbkc, ntxc; 1525 1526 len = lstrlenW (item->pszText); 1527 GetTextExtentPointW (dis->hDC, item->pszText, len, &txtsize); 1528 nbkc = GetSysColor ((dis->itemState & ODS_SELECTED) ? 1529 COLOR_HIGHLIGHT : COLOR_WINDOW); 1530 SetBkColor (dis->hDC, nbkc); 1531 ntxc = GetSysColor ((dis->itemState & ODS_SELECTED) ? 1532 COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT); 1533 SetTextColor (dis->hDC, ntxc); 1534 x = xbase + xioff; 1535 y = dis->rcItem.top + 1536 (dis->rcItem.bottom - dis->rcItem.top - txtsize.cy) / 2; 1537 rect.left = x; 1538 rect.right = x + txtsize.cx; 1539 rect.top = dis->rcItem.top + 1; 1540 rect.bottom = dis->rcItem.bottom - 1; 1541 TRACE("drawing item %d text, rect=(%d,%d)-(%d,%d)\n", 1542 dis->itemID, rect.left, rect.top, rect.right, rect.bottom); 1543 ExtTextOutW (dis->hDC, x, y, ETO_OPAQUE | ETO_CLIPPED, 1544 &rect, item->pszText, len, 0); 1545 if (dis->itemState & ODS_FOCUS) { 1546 rect.top -= 1; 1547 rect.bottom += 1; 1548 rect.left -= 1; 1549 rect.right += 1; 1550 TRACE("drawing item %d focus after text, rect=(%d,%d)-(%d,%d)\n", 1551 dis->itemID, rect.left, rect.top, rect.right, rect.bottom); 1552 DrawFocusRect (dis->hDC, &rect); 1553 } 1554 } 1555 break; 722 1556 default: 723 FIXME("unknown action hwnd=%08x, wparam=%08x, lparam=%08lx, action=%d\n", 724 1557 FIXME("unknown action hwnd=%08x, wparam=%08x, lparam=%08lx, action=%d\n", 1558 hwnd, wParam, lParam, dis->itemAction); 725 1559 } 726 1560 … … 735 1569 736 1570 if (infoPtr->hwndCombo) 737 DestroyWindow (infoPtr->hwndCombo); 1571 DestroyWindow (infoPtr->hwndCombo); 1572 1573 if (infoPtr->edit) { 1574 COMCTL32_Free (infoPtr->edit); 1575 infoPtr->edit = 0; 1576 } 738 1577 739 1578 if (infoPtr->items) { 740 1579 CBE_ITEMDATA *this, *next; 741 1580 742 743 744 745 746 747 748 749 1581 this = infoPtr->items; 1582 while (this) { 1583 next = (CBE_ITEMDATA *)this->next; 1584 if ((this->mask & CBEIF_TEXT) && this->pszText) 1585 COMCTL32_Free (this->pszText); 1586 COMCTL32_Free (this); 1587 this = next; 1588 } 750 1589 } 751 1590 … … 773 1612 774 1613 TRACE("adjusted height hwnd=%08x, height=%d\n", 775 1614 hwnd, mis->itemHeight); 776 1615 777 1616 return 0; … … 785 1624 RECT rect; 786 1625 787 GetClientRect (hwnd, &rect); 1626 GetWindowRect (hwnd, &rect); 1627 TRACE("my rect (%d,%d)-(%d,%d)\n", 1628 rect.left, rect.top, rect.right, rect.bottom); 788 1629 789 1630 MoveWindow (infoPtr->hwndCombo, 0, 0, rect.right -rect.left, 790 rect.bottom - rect.top, TRUE); 1631 rect.bottom - rect.top, TRUE); 1632 1633 COMBOEX_AdjustEditPos (infoPtr); 791 1634 792 1635 return 0; … … 800 1643 LRESULT ret; 801 1644 RECT cbx_wrect, cbx_crect, cb_wrect; 802 UINT width ;1645 UINT width, height; 803 1646 WINDOWPOS *wp = (WINDOWPOS *)lParam; 804 1647 … … 810 1653 /* width is winpos value + border width of comboex */ 811 1654 width = wp->cx 812 + cbx_wrect.right-cbx_wrect.left 813 - (cbx_crect.right - cbx_crect.left);1655 + (cbx_wrect.right-cbx_wrect.left) 1656 - (cbx_crect.right-cbx_crect.left); 814 1657 815 1658 TRACE("EX window=(%d,%d)-(%d,%d), client=(%d,%d)-(%d,%d)\n", 816 817 1659 cbx_wrect.left, cbx_wrect.top, cbx_wrect.right, cbx_wrect.bottom, 1660 cbx_crect.left, cbx_crect.top, cbx_crect.right, cbx_crect.bottom); 818 1661 TRACE("CB window=(%d,%d)-(%d,%d), EX setting=(0,0)-(%d,%d)\n", 819 cb_wrect.left, cb_wrect.top, cb_wrect.right, cb_wrect.bottom, 820 width, cb_wrect.bottom-cb_wrect.top); 821 822 SetWindowPos (infoPtr->hwndCombo, HWND_TOP, 0, 0, 823 width, 824 cb_wrect.bottom-cb_wrect.top, 825 SWP_NOACTIVATE); 826 1662 cb_wrect.left, cb_wrect.top, cb_wrect.right, cb_wrect.bottom, 1663 width, cb_wrect.bottom-cb_wrect.top); 1664 1665 if (width) SetWindowPos (infoPtr->hwndCombo, HWND_TOP, 0, 0, 1666 width, 1667 cb_wrect.bottom-cb_wrect.top, 1668 SWP_NOACTIVATE); 1669 1670 GetWindowRect (infoPtr->hwndCombo, &cb_wrect); 1671 1672 /* height is combo window height plus border width of comboex */ 1673 height = (cb_wrect.bottom-cb_wrect.top) 1674 + (cbx_wrect.bottom-cbx_wrect.top) 1675 - (cbx_crect.bottom-cbx_crect.top); 1676 if (wp->cy < height) wp->cy = height; 1677 if (infoPtr->hwndEdit) { 1678 COMBOEX_AdjustEditPos (infoPtr); 1679 InvalidateRect (infoPtr->hwndCombo, 0, TRUE); 1680 } 1681 1682 return 0; 1683 } 1684 1685 1686 static LRESULT WINAPI 1687 COMBOEX_EditWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) 1688 { 1689 COMBOEX_INFO *infoPtr = (COMBOEX_INFO *)GetPropA (hwnd, (LPCSTR)(LONG) ComboExInfo); 1690 NMCBEENDEDITA cbeend; 1691 COLORREF nbkc, obkc; 1692 HDC hDC; 1693 RECT rect; 1694 LRESULT lret; 1695 1696 TRACE("hwnd=%x msg=%x wparam=%x lParam=%lx, info_ptr=%p\n", 1697 hwnd, uMsg, wParam, lParam, infoPtr); 1698 1699 if (!infoPtr) return 0; 1700 1701 switch (uMsg) 1702 { 1703 1704 case WM_CHAR: 1705 /* handle (ignore) the return character */ 1706 if (wParam == VK_RETURN) return 0; 1707 /* all other characters pass into the real Edit */ 1708 return CallWindowProcA (infoPtr->prevEditWndProc, 1709 hwnd, uMsg, wParam, lParam); 1710 1711 case WM_ERASEBKGND: 1712 /* 1713 * The following was determined by traces of the native 1714 */ 1715 hDC = (HDC) wParam; 1716 nbkc = GetSysColor (COLOR_WINDOW); 1717 obkc = SetBkColor (hDC, nbkc); 1718 GetClientRect (hwnd, &rect); 1719 TRACE("erasing (%d,%d)-(%d,%d)\n", 1720 rect.left, rect.top, rect.right, rect.bottom); 1721 ExtTextOutW (hDC, 0, 0, ETO_OPAQUE, &rect, 0, 0, 0); 1722 SetBkColor (hDC, obkc); 1723 return CallWindowProcA (infoPtr->prevEditWndProc, 1724 hwnd, uMsg, wParam, lParam); 1725 1726 case WM_KEYDOWN: { 1727 INT oldItem, selected; 1728 CBE_ITEMDATA *item; 1729 WCHAR edit_text[260]; 1730 1731 switch ((INT)wParam) 1732 { 1733 case VK_ESCAPE: 1734 /* native version seems to do following for COMBOEX */ 1735 /* 1736 * GetWindowTextA(Edit,&?, 0x104) x 1737 * CB_GETCURSEL to Combo rets -1 x 1738 * WM_NOTIFY to COMBOEX parent (rebar) x 1739 * (CBEN_ENDEDIT{A|W} 1740 * fChanged = FALSE x 1741 * inewSelection = -1 x 1742 * txt="www.hoho" x 1743 * iWhy = 3 x 1744 * CB_GETCURSEL to Combo rets -1 x 1745 * InvalidateRect(Combo, 0) x 1746 * WM_SETTEXT to Edit x 1747 * EM_SETSEL to Edit (0,0) x 1748 * EM_SETSEL to Edit (0,-1) x 1749 * RedrawWindow(Combo, 0, 0, 5) x 1750 */ 1751 TRACE("special code for VK_ESCAPE\n"); 1752 1753 GetWindowTextA (infoPtr->hwndEdit, cbeend.szText, 260); 1754 1755 infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG); 1756 cbeend.fChanged = FALSE; 1757 cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo, 1758 CB_GETCURSEL, 0, 0); 1759 cbeend.iWhy = CBENF_ESCAPE; 1760 1761 if (COMBOEX_Notify (infoPtr, CBEN_ENDEDITA, 1762 (NMHDR *)&cbeend, FALSE)) { 1763 /* abort the change */ 1764 TRACE("Notify requested abort of change\n"); 1765 return 0; 1766 } 1767 oldItem = SendMessageW (infoPtr->hwndCombo,CB_GETCURSEL, 0, 0); 1768 InvalidateRect (infoPtr->hwndCombo, 0, 0); 1769 if (!(item = COMBOEX_FindItem(infoPtr, oldItem))) { 1770 ERR("item %d not found. Problem!\n", oldItem); 1771 break; 1772 } 1773 1774 COMBOEX_SetEditText (infoPtr, item); 1775 RedrawWindow (infoPtr->hwndCombo, 0, 0, RDW_ERASE | 1776 RDW_INVALIDATE); 1777 break; 1778 1779 case VK_RETURN: 1780 /* native version seems to do following for COMBOEX */ 1781 /* 1782 * GetWindowTextA(Edit,&?, 0x104) x 1783 * CB_GETCURSEL to Combo rets -1 x 1784 * CB_GETCOUNT to Combo rets 0 1785 * if >0 loop 1786 * CB_GETITEMDATA to match 1787 * *** above 3 lines simulated by FindItem x 1788 * WM_NOTIFY to COMBOEX parent (rebar) x 1789 * (CBEN_ENDEDIT{A|W} x 1790 * fChanged = TRUE (-1) x 1791 * iNewSelection = -1 or selected x 1792 * txt= x 1793 * iWhy = 2 (CBENF_RETURN) x 1794 * CB_GETCURSEL to Combo rets -1 x 1795 * if -1 send CB_SETCURSEL to Combo -1 x 1796 * InvalidateRect(Combo, 0, 0) x 1797 * SetFocus(Edit) x 1798 * CallWindowProc(406615a8, Edit, 0x100, 0xd, 0x1c0001) 1799 */ 1800 1801 TRACE("special code for VK_RETURN\n"); 1802 1803 GetWindowTextW (infoPtr->hwndEdit, edit_text, 260); 1804 1805 infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG); 1806 selected = SendMessageW (infoPtr->hwndCombo, 1807 CB_GETCURSEL, 0, 0); 1808 1809 if (selected != -1) { 1810 item = COMBOEX_FindItem (infoPtr, selected); 1811 TRACE("handling VK_RETURN, selected = %d, selected_text=%s\n", 1812 selected, debugstr_w(item->pszText)); 1813 TRACE("handling VK_RETURN, edittext=%s\n", 1814 debugstr_w(edit_text)); 1815 if (lstrcmpiW (item->pszText, edit_text)) { 1816 /* strings not equal -- indicate edit has changed */ 1817 selected = -1; 1818 } 1819 } 1820 1821 cbeend.iNewSelection = selected; 1822 cbeend.fChanged = TRUE; 1823 cbeend.iWhy = CBENF_RETURN; 1824 WideCharToMultiByte (CP_ACP, 0, edit_text, -1, 1825 cbeend.szText, sizeof(cbeend.szText), 1826 NULL, NULL); 1827 1828 if (COMBOEX_Notify (infoPtr, CBEN_ENDEDITA, 1829 (NMHDR *)&cbeend, FALSE)) { 1830 /* abort the change, restore previous */ 1831 TRACE("Notify requested abort of change\n"); 1832 COMBOEX_SetEditText (infoPtr, infoPtr->edit); 1833 RedrawWindow (infoPtr->hwndCombo, 0, 0, RDW_ERASE | 1834 RDW_INVALIDATE); 1835 return 0; 1836 } 1837 oldItem = SendMessageW (infoPtr->hwndCombo,CB_GETCURSEL, 0, 0); 1838 if (oldItem != -1) { 1839 /* if something is selected, then deselect it */ 1840 SendMessageW (infoPtr->hwndCombo, CB_SETCURSEL, 1841 (WPARAM)-1, 0); 1842 } 1843 InvalidateRect (infoPtr->hwndCombo, 0, 0); 1844 SetFocus(infoPtr->hwndEdit); 1845 break; 1846 1847 default: 1848 return CallWindowProcA (infoPtr->prevEditWndProc, 1849 hwnd, uMsg, wParam, lParam); 1850 } 1851 return 0; 1852 } 1853 1854 case WM_SETFOCUS: 1855 /* remember the focus to set state of icon */ 1856 lret = CallWindowProcA (infoPtr->prevEditWndProc, 1857 hwnd, uMsg, wParam, lParam); 1858 infoPtr->flags |= WCBE_EDITFOCUSED; 1859 return lret; 1860 1861 case WM_KILLFOCUS: 1862 /* 1863 * do NOTIFY CBEN_ENDEDIT with CBENF_KILLFOCUS 1864 */ 1865 infoPtr->flags &= ~WCBE_EDITFOCUSED; 1866 if (infoPtr->flags & WCBE_ACTEDIT) { 1867 infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG); 1868 cbeend.fChanged = FALSE; 1869 cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo, 1870 CB_GETCURSEL, 0, 0); 1871 cbeend.iWhy = CBENF_KILLFOCUS; 1872 1873 COMBOEX_Notify (infoPtr, CBEN_ENDEDITA, 1874 (NMHDR *)&cbeend, FALSE); 1875 } 1876 /* fall through */ 1877 1878 default: 1879 return CallWindowProcA (infoPtr->prevEditWndProc, 1880 hwnd, uMsg, wParam, lParam); 1881 } 1882 return 0; 1883 } 1884 1885 1886 static LRESULT WINAPI 1887 COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) 1888 { 1889 COMBOEX_INFO *infoPtr = (COMBOEX_INFO *)GetPropA (hwnd, (LPCSTR)(LONG) ComboExInfo); 1890 NMCBEENDEDITA cbeend; 1891 NMMOUSE nmmse; 1892 COLORREF nbkc, obkc; 1893 HDC hDC; 1894 HWND focusedhwnd; 1895 RECT rect; 1896 1897 TRACE("hwnd=%x msg=%x wparam=%x lParam=%lx, info_ptr=%p\n", 1898 hwnd, uMsg, wParam, lParam, infoPtr); 1899 1900 if (!infoPtr) return 0; 1901 1902 switch (uMsg) 1903 { 1904 1905 case CB_FINDSTRINGEXACT: 1906 return COMBOEX_FindStringExact (infoPtr, wParam, lParam); 1907 1908 case WM_DRAWITEM: 1909 /* 1910 * The only way this message should come is from the 1911 * child Listbox issuing the message. Flag this so 1912 * that ComboEx knows this is listbox. 1913 */ 1914 ((DRAWITEMSTRUCT *)lParam)->itemState |= ODS_COMBOEXLBOX; 1915 return CallWindowProcA (infoPtr->prevComboWndProc, 1916 hwnd, uMsg, wParam, lParam); 1917 1918 case WM_ERASEBKGND: 1919 /* 1920 * The following was determined by traces of the native 1921 */ 1922 hDC = (HDC) wParam; 1923 nbkc = GetSysColor (COLOR_WINDOW); 1924 obkc = SetBkColor (hDC, nbkc); 1925 GetClientRect (hwnd, &rect); 1926 TRACE("erasing (%d,%d)-(%d,%d)\n", 1927 rect.left, rect.top, rect.right, rect.bottom); 1928 ExtTextOutW (hDC, 0, 0, ETO_OPAQUE, &rect, 0, 0, 0); 1929 SetBkColor (hDC, obkc); 1930 return CallWindowProcA (infoPtr->prevComboWndProc, 1931 hwnd, uMsg, wParam, lParam); 1932 1933 case WM_SETCURSOR: 1934 /* 1935 * WM_NOTIFY to comboex parent (rebar) 1936 * with NM_SETCURSOR with extra words of 0,0,0,0,0x02010001 1937 * CallWindowProc (previous) 1938 */ 1939 nmmse.dwItemSpec = 0; 1940 nmmse.dwItemData = 0; 1941 nmmse.pt.x = 0; 1942 nmmse.pt.y = 0; 1943 nmmse.dwHitInfo = lParam; 1944 COMBOEX_Notify (infoPtr, NM_SETCURSOR, (NMHDR *)&nmmse, FALSE); 1945 return CallWindowProcA (infoPtr->prevComboWndProc, 1946 hwnd, uMsg, wParam, lParam); 1947 1948 case WM_COMMAND: 1949 switch (HIWORD(wParam)) { 1950 1951 case EN_UPDATE: 1952 /* traces show that COMBOEX does not issue CBN_EDITUPDATE 1953 * on the EN_UPDATE 1954 */ 1955 return 0; 1956 1957 case EN_KILLFOCUS: 1958 /* 1959 * Native does: 1960 * 1961 * GetFocus() retns AA 1962 * GetWindowTextA(Edit) 1963 * CB_GETCURSEL(Combo) (got -1) 1964 * WM_NOTIFY(CBEN_ENDEDITA) with CBENF_KILLFOCUS 1965 * CB_GETCURSEL(Combo) (got -1) 1966 * InvalidateRect(Combo, 0, 0) 1967 * WM_KILLFOCUS(Combo, AA) 1968 * return 0; 1969 */ 1970 focusedhwnd = GetFocus(); 1971 if (infoPtr->flags & WCBE_ACTEDIT) { 1972 GetWindowTextA (infoPtr->hwndEdit, cbeend.szText, 260); 1973 cbeend.fChanged = (infoPtr->flags & WCBE_EDITCHG); 1974 cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo, 1975 CB_GETCURSEL, 0, 0); 1976 cbeend.iWhy = CBENF_KILLFOCUS; 1977 1978 infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG); 1979 if (COMBOEX_Notify (infoPtr, CBEN_ENDEDITA, 1980 (NMHDR *)&cbeend, FALSE)) { 1981 /* abort the change */ 1982 TRACE("Notify requested abort of change\n"); 1983 return 0; 1984 } 1985 } 1986 /* possible CB_GETCURSEL */ 1987 InvalidateRect (infoPtr->hwndCombo, 0, 0); 1988 if (focusedhwnd) 1989 SendMessageW (infoPtr->hwndCombo, WM_KILLFOCUS, 1990 (WPARAM)focusedhwnd, 0); 1991 return 0; 1992 1993 case EN_SETFOCUS: { 1994 /* 1995 * For EN_SETFOCUS this issues the same calls and messages 1996 * as the native seems to do. 1997 * 1998 * for some cases however native does the following: 1999 * (noticed after SetFocus during LBUTTONDOWN on 2000 * on dropdown arrow) 2001 * WM_GETTEXTLENGTH (Edit); 2002 * WM_GETTEXT (Edit, len+1, str); 2003 * EM_SETSEL (Edit, 0, 0); 2004 * WM_GETTEXTLENGTH (Edit); 2005 * WM_GETTEXT (Edit, len+1, str); 2006 * EM_SETSEL (Edit, 0, len); 2007 * WM_NOTIFY (parent, CBEN_BEGINEDIT) 2008 */ 2009 NMHDR hdr; 2010 2011 SendMessageW (infoPtr->hwndEdit, EM_SETSEL, 0, 0); 2012 SendMessageW (infoPtr->hwndEdit, EM_SETSEL, 0, -1); 2013 COMBOEX_Notify (infoPtr, CBEN_BEGINEDIT, &hdr, FALSE); 2014 infoPtr->flags |= WCBE_ACTEDIT; 2015 infoPtr->flags &= ~WCBE_EDITCHG; /* no change yet */ 2016 return 0; 2017 } 2018 2019 case EN_CHANGE: { 2020 /* 2021 * For EN_CHANGE this issues the same calls and messages 2022 * as the native seems to do. 2023 */ 2024 WCHAR edit_text[260]; 2025 WCHAR *lastwrk; 2026 INT selected, cnt; 2027 CBE_ITEMDATA *item; 2028 2029 selected = SendMessageW (infoPtr->hwndCombo, 2030 CB_GETCURSEL, 0, 0); 2031 2032 /* lstrlenA( lastworkingURL ) */ 2033 2034 GetWindowTextW (infoPtr->hwndEdit, edit_text, 260); 2035 if (selected == -1) { 2036 lastwrk = infoPtr->edit->pszText; 2037 cnt = lstrlenW (lastwrk); 2038 if (cnt >= 259) cnt = 259; 2039 } 2040 else { 2041 item = COMBOEX_FindItem (infoPtr, selected); 2042 cnt = lstrlenW (item->pszText); 2043 lastwrk = item->pszText; 2044 if (cnt >= 259) cnt = 259; 2045 } 2046 2047 TRACE("handling EN_CHANGE, selected = %d, selected_text=%s\n", 2048 selected, debugstr_w(lastwrk)); 2049 TRACE("handling EN_CHANGE, edittext=%s\n", 2050 debugstr_w(edit_text)); 2051 2052 /* lstrcmpiW is between lastworkingURL and GetWindowText */ 2053 2054 if (lstrcmpiW (lastwrk, edit_text)) { 2055 /* strings not equal -- indicate edit has changed */ 2056 infoPtr->flags |= WCBE_EDITCHG; 2057 } 2058 SendMessageW ( GetParent(infoPtr->hwndSelf), WM_COMMAND, 2059 MAKEWPARAM(GetDlgCtrlID (infoPtr->hwndSelf), 2060 CBN_EDITCHANGE), 2061 infoPtr->hwndSelf); 2062 return 0; 2063 } 2064 2065 case LBN_SELCHANGE: 2066 /* 2067 * Therefore from traces there is no additional code here 2068 */ 2069 2070 /* 2071 * Using native COMCTL32 gets the following: 2072 * 1 == SHDOCVW.DLL issues call/message 2073 * 2 == COMCTL32.DLL issues call/message 2074 * 3 == WINE issues call/message 2075 * 2076 * 2077 * for LBN_SELCHANGE: 2078 * 1 CB_GETCURSEL(ComboEx) 2079 * 1 CB_GETDROPPEDSTATE(ComboEx) 2080 * 1 CallWindowProc( *2* for WM_COMMAND(LBN_SELCHANGE) 2081 * 2 CallWindowProc( *3* for WM_COMMAND(LBN_SELCHANGE) 2082 ** call CBRollUp( xxx, TRUE for LBN_SELCHANGE, TRUE) 2083 * 3 WM_COMMAND(ComboEx, CBN_SELENDOK) 2084 * WM_USER+49(ComboLB, 1,0) <=============!!!!!!!!!!! 2085 * 3 ShowWindow(ComboLB, SW_HIDE) 2086 * 3 RedrawWindow(Combo, RDW_UPDATENOW) 2087 * 3 WM_COMMAND(ComboEX, CBN_CLOSEUP) 2088 ** end of CBRollUp 2089 * 3 WM_COMMAND(ComboEx, CBN_SELCHANGE) (echo to parent) 2090 * ? LB_GETCURSEL <==| 2091 * ? LB_GETTEXTLEN | 2092 * ? LB_GETTEXT | Needs to be added to 2093 * ? WM_CTLCOLOREDIT(ComboEx) | Combo processing 2094 * ? LB_GETITEMDATA | 2095 * ? WM_DRAWITEM(ComboEx) <==| 2096 */ 2097 default: 2098 break; 2099 }/* fall through */ 2100 default: 2101 return CallWindowProcA (infoPtr->prevComboWndProc, 2102 hwnd, uMsg, wParam, lParam); 2103 } 827 2104 return 0; 828 2105 } … … 838 2115 switch (uMsg) 839 2116 { 840 /* case CBEM_DELETEITEM: */ 841 842 case CBEM_GETCOMBOCONTROL: 843 return COMBOEX_GetComboControl (hwnd, wParam, lParam); 844 845 case CBEM_GETEDITCONTROL: 846 return COMBOEX_GetEditControl (hwnd, wParam, lParam); 847 848 case CBEM_GETEXTENDEDSTYLE: 849 return COMBOEX_GetExtendedStyle (hwnd, wParam, lParam); 850 851 case CBEM_GETIMAGELIST: 852 return COMBOEX_GetImageList (hwnd, wParam, lParam); 853 854 /* case CBEM_GETITEMA: 855 case CBEM_GETITEMW: 856 case CBEM_GETUNICODEFORMAT: 857 case CBEM_HASEDITCHANGED: 858 */ 859 860 case CBEM_INSERTITEMA: 861 return COMBOEX_InsertItemA (hwnd, wParam, lParam); 862 863 case CBEM_INSERTITEMW: 864 return COMBOEX_InsertItemW (hwnd, wParam, lParam); 865 866 case CBEM_SETEXSTYLE: /* FIXME: obsoleted, should be the same as: */ 867 case CBEM_SETEXTENDEDSTYLE: 868 return COMBOEX_SetExtendedStyle (hwnd, wParam, lParam); 869 870 case CBEM_SETIMAGELIST: 871 return COMBOEX_SetImageList (hwnd, wParam, lParam); 872 873 case CBEM_SETITEMA: 874 return COMBOEX_SetItemA (hwnd, wParam, lParam); 875 876 case CBEM_SETITEMW: 877 return COMBOEX_SetItemW (hwnd, wParam, lParam); 878 879 /* case CBEM_SETUNICODEFORMAT: 880 */ 881 882 case CB_DELETESTRING: 883 case CB_FINDSTRINGEXACT: 884 case CB_GETCOUNT: 885 case CB_GETCURSEL: 886 case CB_GETDROPPEDCONTROLRECT: 887 case CB_GETDROPPEDSTATE: 888 case CB_GETITEMDATA: 889 case CB_GETITEMHEIGHT: 890 case CB_GETLBTEXT: 891 case CB_GETLBTEXTLEN: 892 case CB_GETEXTENDEDUI: 893 case CB_LIMITTEXT: 894 case CB_RESETCONTENT: 895 case CB_SELECTSTRING: 896 case CB_SETCURSEL: 897 case CB_SETDROPPEDWIDTH: 898 case CB_SETEXTENDEDUI: 899 case CB_SETITEMDATA: 900 case CB_SHOWDROPDOWN: 901 case WM_SETTEXT: 902 case WM_GETTEXT: 903 return COMBOEX_Forward (hwnd, uMsg, wParam, lParam); 904 905 case CB_SETITEMHEIGHT: 906 return COMBOEX_SetItemHeight (hwnd, wParam, lParam); 907 908 909 case WM_CREATE: 910 return COMBOEX_Create (hwnd, wParam, lParam); 2117 case CBEM_DELETEITEM: /* maps to CB_DELETESTRING */ 2118 return COMBOEX_DeleteItem (hwnd, wParam, lParam); 2119 2120 case CBEM_GETCOMBOCONTROL: 2121 return COMBOEX_GetComboControl (hwnd, wParam, lParam); 2122 2123 case CBEM_GETEDITCONTROL: 2124 return COMBOEX_GetEditControl (hwnd, wParam, lParam); 2125 2126 case CBEM_GETEXTENDEDSTYLE: 2127 return COMBOEX_GetExtendedStyle (hwnd, wParam, lParam); 2128 2129 case CBEM_GETIMAGELIST: 2130 return COMBOEX_GetImageList (hwnd, wParam, lParam); 2131 2132 case CBEM_GETITEMA: 2133 return COMBOEX_GetItemA (hwnd, wParam, lParam); 2134 2135 case CBEM_GETITEMW: 2136 return COMBOEX_GetItemW (hwnd, wParam, lParam); 2137 2138 case CBEM_GETUNICODEFORMAT: 2139 return COMBOEX_GetUnicodeFormat (hwnd, wParam, lParam); 2140 2141 case CBEM_HASEDITCHANGED: 2142 return COMBOEX_HasEditChanged (hwnd, wParam, lParam); 2143 2144 case CBEM_INSERTITEMA: 2145 return COMBOEX_InsertItemA (hwnd, wParam, lParam); 2146 2147 case CBEM_INSERTITEMW: 2148 return COMBOEX_InsertItemW (hwnd, wParam, lParam); 2149 2150 case CBEM_SETEXSTYLE: /* FIXME: obsoleted, should be the same as: */ 2151 case CBEM_SETEXTENDEDSTYLE: 2152 return COMBOEX_SetExtendedStyle (hwnd, wParam, lParam); 2153 2154 case CBEM_SETIMAGELIST: 2155 return COMBOEX_SetImageList (hwnd, wParam, lParam); 2156 2157 case CBEM_SETITEMA: 2158 return COMBOEX_SetItemA (hwnd, wParam, lParam); 2159 2160 case CBEM_SETITEMW: 2161 return COMBOEX_SetItemW (hwnd, wParam, lParam); 2162 2163 case CBEM_SETUNICODEFORMAT: 2164 return COMBOEX_SetUnicodeFormat (hwnd, wParam, lParam); 2165 2166 2167 /* Combo messages we are not sure if we need to process or just forward */ 2168 case CB_GETDROPPEDCONTROLRECT: 2169 case CB_GETITEMDATA: 2170 case CB_GETITEMHEIGHT: 2171 case CB_GETLBTEXT: 2172 case CB_GETLBTEXTLEN: 2173 case CB_GETEXTENDEDUI: 2174 case CB_LIMITTEXT: 2175 case CB_RESETCONTENT: 2176 case CB_SELECTSTRING: 2177 case CB_SETITEMDATA: 2178 case WM_SETTEXT: 2179 case WM_GETTEXT: 2180 FIXME("(0x%x 0x%x 0x%lx): possible missing fucntion\n", 2181 uMsg, wParam, lParam); 2182 return COMBOEX_Forward (hwnd, uMsg, wParam, lParam); 2183 2184 /* Combo messages OK to just forward to the regular COMBO */ 2185 case CB_GETCOUNT: 2186 case CB_GETCURSEL: 2187 case CB_GETDROPPEDSTATE: 2188 case CB_SETDROPPEDWIDTH: 2189 case CB_SETEXTENDEDUI: 2190 case CB_SHOWDROPDOWN: 2191 return COMBOEX_Forward (hwnd, uMsg, wParam, lParam); 2192 2193 /* Combo messages we need to process specially */ 2194 case CB_FINDSTRINGEXACT: 2195 return COMBOEX_FindStringExact (COMBOEX_GetInfoPtr (hwnd), 2196 wParam, lParam); 2197 2198 case CB_SETCURSEL: 2199 return COMBOEX_SetCursel (hwnd, wParam, lParam); 2200 2201 case CB_SETITEMHEIGHT: 2202 return COMBOEX_SetItemHeight (hwnd, wParam, lParam); 2203 2204 2205 2206 /* Window messages passed to parent */ 2207 case WM_COMMAND: 2208 return COMBOEX_Command (hwnd, wParam, lParam); 2209 2210 case WM_NOTIFY: 2211 return SendMessageA (GetParent (hwnd), uMsg, wParam, lParam); 2212 2213 2214 /* Window messages we need to process */ 2215 case WM_CREATE: 2216 return COMBOEX_Create (hwnd, wParam, lParam); 2217 2218 case WM_DELETEITEM: 2219 return COMBOEX_WM_DeleteItem (hwnd, wParam, lParam); 911 2220 912 2221 case WM_DRAWITEM: 913 2222 return COMBOEX_DrawItem (hwnd, wParam, lParam); 914 2223 915 916 2224 case WM_DESTROY: 2225 return COMBOEX_Destroy (hwnd, wParam, lParam); 917 2226 918 2227 case WM_MEASUREITEM: 919 2228 return COMBOEX_MeasureItem (hwnd, wParam, lParam); 920 2229 921 922 2230 case WM_SIZE: 2231 return COMBOEX_Size (hwnd, wParam, lParam); 923 2232 924 2233 case WM_WINDOWPOSCHANGING: 925 926 927 928 929 930 2234 return COMBOEX_WindowPosChanging (hwnd, wParam, lParam); 2235 2236 default: 2237 if (uMsg >= WM_USER) 2238 ERR("unknown msg %04x wp=%08x lp=%08lx\n", 2239 uMsg, wParam, lParam); 931 2240 #ifdef __WIN32OS2__ 932 2241 return defComCtl32ProcA (hwnd, uMsg, wParam, lParam); 933 2242 #else 934 return DefWindowProcA (hwnd, uMsg, wParam, lParam);2243 return DefWindowProcA (hwnd, uMsg, wParam, lParam); 935 2244 #endif 936 2245 } … … 952 2261 wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); 953 2262 wndClass.lpszClassName = WC_COMBOBOXEXA; 954 2263 955 2264 RegisterClassA (&wndClass); 2265 2266 ComboExInfo = GlobalAddAtomA("CC32SubclassInfo"); 956 2267 } 957 2268 -
TabularUnified trunk/src/comctl32/comctl32.def ¶
r4809 r5416 1 ; $Id: comctl32.def,v 1.2 0 2000-12-16 22:53:18 birdExp $1 ; $Id: comctl32.def,v 1.21 2001-03-31 13:25:26 sandervl Exp $ 2 2 LIBRARY COMCTL32 INITINSTANCE 3 3 DESCRIPTION 'Odin32 System DLL - ComCtl32 - Common Controls Library' … … 9 9 GetEffectiveClientRect = _GetEffectiveClientRect@12 @4 10 10 DrawStatusTextA = _DrawStatusTextA@16 @5 11 DrawStatusText = _DrawStatusTextA@16 @2712 DrawStatusTextW = _DrawStatusTextW@16 @2813 11 CreateStatusWindowA = _CreateStatusWindowA@16 @6 14 CreateStatusWindow = _CreateStatusWindowA@16 @21 15 CreateStatusWindowW = _CreateStatusWindowW@16 @22 12 CreateToolbar = _CreateToolbar@32 @7 13 CreateMappedBitmap = _CreateMappedBitmap@20 @8 14 DPA_LoadStream = _DPA_LoadStream@16 @9 15 DPA_SaveStream = _DPA_SaveStream@16 @10 16 DPA_Merge = _DPA_Merge@24 @11 17 CreatePropertySheetPage = _CreatePropertySheetPageA@4 @12 18 MakeDragList = _MakeDragList@4 @13 19 LBItemFromPt = _LBItemFromPt@16 @14 20 DrawInsert = _DrawInsert@12 @15 16 21 CreateUpDownControl = _CreateUpDownControl@48 @16 17 22 InitCommonControls = _InitCommonControls@0 @17 18 InitCommonControlsEx = _InitCommonControlsEx@4 @81 19 CreateToolbarEx = _CreateToolbarEx@52 @32 20 CreateMappedBitmap = _CreateMappedBitmap@20 @8 21 CreateToolbar = _CreateToolbar@32 @7 22 DllGetVersion = _COMCTL32_DllGetVersion@4 @25 23 CreatePropertySheetPageA = _CreatePropertySheetPageA@4 @18 24 CreatePropertySheetPageW = _CreatePropertySheetPageW@4 @19 25 CreateStatusWindow = _CreateStatusWindowA@16 @20 26 CreateStatusWindowW = _CreateStatusWindowW@16 @21 27 CreateToolbarEx = _CreateToolbarEx@52 @22 28 DestroyPropertySheetPage = _DestroyPropertySheetPage@4 @23 29 DllGetVersion = _COMCTL32_DllGetVersion@4 @24 30 DllInstall = _COMCTL32_DllInstall@8 @25 31 DrawStatusText = _DrawStatusTextA@16 @26 32 DrawStatusTextW = _DrawStatusTextW@16 @27 33 34 FlatSB_EnableScrollBar = _FlatSB_EnableScrollBar@12 @28 35 FlatSB_GetScrollInfo = _FlatSB_GetScrollInfo@12 @29 36 FlatSB_GetScrollPos = _FlatSB_GetScrollPos@8 @30 37 FlatSB_GetScrollProp = _FlatSB_GetScrollProp@12 @31 38 FlatSB_GetScrollRange = _FlatSB_GetScrollRange@16 @32 39 FlatSB_SetScrollInfo = _FlatSB_SetScrollInfo@16 @33 40 FlatSB_SetScrollPos = _FlatSB_SetScrollPos@16 @34 41 FlatSB_SetScrollProp = _FlatSB_SetScrollProp@16 @35 42 FlatSB_SetScrollRange = _FlatSB_SetScrollRange@20 @36 43 FlatSB_ShowScrollBar = _FlatSB_ShowScrollBar@12 @37 44 GetMUILanguage = _GetMUILanguage@0 @38 23 45 24 46 ImageList_Add = _ImageList_Add@12 @39 … … 40 62 ImageList_GetBkColor = _ImageList_GetBkColor@4 @55 41 63 ImageList_GetDragImage = _ImageList_GetDragImage@8 @56 42 ImageList_GetIcon = _ImageList_GetIcon@12@5743 ImageList_GetIcon Size = _ImageList_GetIconSize@12@5844 ImageList_GetI mageCount = _ImageList_GetImageCount@4@5945 ImageList_GetImage Info = _ImageList_GetImageInfo@12@6046 ImageList_GetImage Rect = _ImageList_GetImageRect@12 @6147 ImageList_ LoadImageA = _ImageList_LoadImageA@28@6264 ;;stub ImageList_GetFlags @57 65 ImageList_GetIcon = _ImageList_GetIcon@12 @58 66 ImageList_GetIconSize = _ImageList_GetIconSize@12 @59 67 ImageList_GetImageCount = _ImageList_GetImageCount@4 @60 68 ImageList_GetImageInfo = _ImageList_GetImageInfo@12 @61 69 ImageList_GetImageRect = _ImageList_GetImageRect@12 @62 48 70 ImageList_LoadImage = _ImageList_LoadImageA@28 @63 49 ImageList_LoadImageW = _ImageList_LoadImageW@28 @64 50 ImageList_Merge = _ImageList_Merge@24 @65 51 ImageList_Read = _ImageList_Read@4 @66 71 ImageList_LoadImageA = _ImageList_LoadImageA@28 @64 72 ImageList_LoadImageW = _ImageList_LoadImageW@28 @65 73 ImageList_Merge = _ImageList_Merge@24 @66 74 ImageList_Read = _ImageList_Read@4 @67 75 ImageList_Remove = _ImageList_Remove@8 @68 76 ImageList_Replace = _ImageList_Replace@16 @69 77 ImageList_ReplaceIcon = _ImageList_ReplaceIcon@12 @70 78 Alloc = _COMCTL32_Alloc@4 @71 79 ReAlloc = _COMCTL32_ReAlloc@8 @72 80 Free = _COMCTL32_Free@4 @73 81 GetSize = _COMCTL32_GetSize@4 @74 82 ImageList_SetBkColor = _ImageList_SetBkColor@8 @75 83 ImageList_SetDragCursorImage = _ImageList_SetDragCursorImage@16 @76 84 ImageList_SetFilter = _ImageList_SetFilter@12 @77 85 ;;stub ImageList_SetFlags @78 86 ImageList_SetIconSize = _ImageList_SetIconSize@12 @79 87 ImageList_SetImageCount = _ImageList_SetImageCount@8 @80 88 ImageList_SetOverlayImage = _ImageList_SetOverlayImage@12 @81 89 ImageList_Write = _ImageList_Write@8 @82 52 90 53 ImageList_Remove = _ImageList_Remove@8 @67 54 ImageList_Replace = _ImageList_Replace@16 @68 55 ImageList_ReplaceIcon = _ImageList_ReplaceIcon@12 @69 56 ImageList_SetBkColor = _ImageList_SetBkColor@8 @70 57 ImageList_SetDragCursorImage = _ImageList_SetDragCursorImage@16 @75 58 ImageList_SetFilter = _ImageList_SetFilter@12 @76 59 ImageList_SetIconSize = _ImageList_SetIconSize@12 @77 60 ImageList_SetImageCount = _ImageList_SetImageCount@8 @78 61 ImageList_SetOverlayImage = _ImageList_SetOverlayImage@12 @79 62 ImageList_Write = _ImageList_Write@8 @80 91 InitCommonControlsEx = _InitCommonControlsEx@4 @83 92 InitMUILanguage = _InitMUILanguage@4 @84 93 InitializeFlatSB = _InitializeFlatSB@4 @85 94 PropertySheet = _PropertySheetA@4 @86 95 PropertySheetA = _PropertySheetA@4 @87 96 PropertySheetW = _PropertySheetW@4 @88 97 UninitializeFlatSB = _UninitializeFlatSB@4 @89 98 _TrackMouseEvent = __TrackMouseEvent@4 @90 63 99 64 PropertySheetA = _PropertySheetA@4 @8465 PropertySheet = _PropertySheetA@4 @8366 PropertySheetW = _PropertySheetW@4 @8567 CreatePropertySheetPageA = _CreatePropertySheetPageA@4 @1968 CreatePropertySheetPage = _CreatePropertySheetPageA@4 @1869 CreatePropertySheetPageW = _CreatePropertySheetPageW@4 @2070 DestroyPropertySheetPage = _DestroyPropertySheetPage@4 @2471 100 72 MakeDragList = _MakeDragList@4 @1373 DrawInsert = _DrawInsert@12 @1574 LBItemFromPt = _LBItemFromPt@16 @1475 76 _TrackMouseEvent = __TrackMouseEvent@4 @9177 78 _COMCTL32_9@16 @979 _COMCTL32_10@16 @1080 DPA_Merge = _DPA_Merge@24 @1181 82 COMCTL32_Alloc = _COMCTL32_Alloc@4 @7183 COMCTL32_ReAlloc = _COMCTL32_ReAlloc@8 @7284 COMCTL32_Free = _COMCTL32_Free@4 @7385 COMCTL32_GetSize = _COMCTL32_GetSize@4 @7486 101 87 102 CreateMRUListA = _CreateMRUListA@4 @151 … … 153 168 comctl32_412 = _comctl32_412@12 @412 154 169 comctl32_413 = _comctl32_413@16 @413 155 InitMUILanguage = _InitMUILanguage@4 @414 ;should be 70 -
TabularUnified trunk/src/comctl32/comctl32.h ¶
r4641 r5416 1 /* $Id: comctl32.h,v 1.1 8 2000-11-20 04:06:04 birdExp $ */1 /* $Id: comctl32.h,v 1.19 2001-03-31 13:25:26 sandervl Exp $ */ 2 2 /* 3 3 * Win32 common controls implementation … … 22 22 #include <win/commctrl.h> 23 23 #include "unicode.h" 24 #include "wineuni.h"25 24 26 25 #define _OS2WIN_H … … 158 157 #define IDI_DRAGARROW 150 159 158 159 #define COMCTL32_VERSION_MINOR 0 160 #define WINE_FILEVERSION 5, COMCTL32_VERSION_MINOR, 0, 0 161 #define WINE_FILEVERSIONSTR "5.00" 162 163 #define UINT_PTR DWORD 164 165 #ifdef __cplusplus 166 extern "C" { 167 #endif 168 169 void ANIMATE_Register(void); 170 void ANIMATE_Unregister(void); 171 void COMBOEX_Register(void); 172 void COMBOEX_Unregister(void); 173 void DATETIME_Register(void); 174 void DATETIME_Unregister(void); 175 void FLATSB_Register(void); 176 void FLATSB_Unregister(void); 177 void HEADER_Register(void); 178 void HEADER_Unregister(void); 179 void HOTKEY_Register(void); 180 void HOTKEY_Unregister(void); 181 void IPADDRESS_Register(void); 182 void IPADDRESS_Unregister(void); 183 void LISTVIEW_Register(void); 184 void LISTVIEW_Unregister(void); 185 void MONTHCAL_Register(void); 186 void MONTHCAL_Unregister(void); 187 void NATIVEFONT_Register(void); 188 void NATIVEFONT_Unregister(void); 189 void PAGER_Register(void); 190 void PAGER_Unregister(void); 191 void PROGRESS_Register(void); 192 void PROGRESS_Unregister(void); 193 void REBAR_Register(void); 194 void REBAR_Unregister(void); 195 void STATUS_Register(void); 196 void STATUS_Unregister(void); 197 void TAB_Register(void); 198 void TAB_Unregister(void); 199 void TOOLBAR_Register(void); 200 void TOOLBAR_Unregister(void); 201 void TOOLTIPS_Register(void); 202 void TOOLTIPS_Unregister(void); 203 void TRACKBAR_Register(void); 204 void TRACKBAR_Unregister(void); 205 void TREEVIEW_Register(void); 206 void TREEVIEW_Unregister(void); 207 void UPDOWN_Register(void); 208 void UPDOWN_Unregister(void); 209 210 #ifdef __cplusplus 211 } 212 #endif 213 160 214 #endif /* _H_COMCTL32 */ -
TabularUnified trunk/src/comctl32/comctl32undoc.cpp ¶
r3923 r5416 1 /* $Id: comctl32undoc.cpp,v 1. 7 2000-08-02 15:10:23 birdExp $ */1 /* $Id: comctl32undoc.cpp,v 1.8 2001-03-31 13:25:26 sandervl Exp $ */ 2 2 /* 3 3 * Undocumented functions from COMCTL32.DLL … … 2520 2520 } 2521 2521 2522 /*************************************************************************2523 * InitMUILanguage [COMCTL32.70]2524 *2525 * FIXME: What's this supposed to do? Apparently some i18n thing.2526 *2527 */2528 2529 BOOL WINAPI InitMUILanguage( LANGID uiLang)2530 {2531 dprintf(("COMCTL32: InitMUILanguage - empty stub!"));2532 2533 return TRUE;2534 }2535 2522 2536 2523 DWORD WINAPI COMCTL32_389(DWORD x1, DWORD x2) … … 2559 2546 2560 2547 2561 /*****************************************************************************2562 * Name :2563 * Purpose :2564 * Parameters:2565 * Variables :2566 * Result :2567 * Remark : COMCTL32.92568 * Likely to have something to do with COM object.2569 * Status : UNTESTED UNKNOWN STUB2570 *2571 * Author : Patrick Haller [Sun, 2000/06/09 09:00]2572 *****************************************************************************/2573 2574 DWORD WINAPI COMCTL32_9(DWORD arg0,2575 DWORD arg1,2576 DWORD arg2,2577 DWORD arg3)2578 {2579 dprintf(("COMCTL32: comctl32_9: %x %x %x %x not implemented!!",2580 arg0,2581 arg1,2582 arg2,2583 arg3));2584 2585 return 0;2586 }2587 2588 /*****************************************************************************2589 * Name :2590 * Purpose :2591 * Parameters:2592 * Variables :2593 * Result :2594 * Remark : COMCTL32.102595 * Likely to have something to do with COM object.2596 * Status : UNTESTED UNKNOWN STUB2597 *2598 * Author : Patrick Haller [Sun, 2000/06/09 09:00]2599 *****************************************************************************/2600 2601 DWORD WINAPI COMCTL32_10(DWORD arg0,2602 DWORD arg1,2603 DWORD arg2,2604 DWORD arg3)2605 {2606 dprintf(("COMCTL32: comctl32_10: %x %x %x %x not implemented!!",2607 arg0,2608 arg1,2609 arg2,2610 arg3));2611 2612 return 0;2613 } -
TabularUnified trunk/src/comctl32/datetime.c ¶
r4627 r5416 19 19 #include "winbase.h" 20 20 #include "wingdi.h" 21 #include "wine/winestring.h"22 21 #include "commctrl.h" 23 22 #include "debugtools.h" 24 23 24 #ifdef __WIN32OS2__ 25 #include "ccbase.h" 26 #define inline 27 #endif 28 25 29 DEFAULT_DEBUG_CHANNEL(datetime); 26 30 27 31 typedef struct 28 32 { 33 #ifdef __WIN32OS2__ 34 COMCTL32_HEADER header; 35 #endif 29 36 HWND hMonthCal; 30 37 HWND hUpdown; … … 308 315 LPSTR buf; 309 316 int retval; 310 int len = lstrlenW ((LPWSTR) lParam)+1;317 int len = WideCharToMultiByte( CP_ACP, 0, (LPWSTR)lParam, -1, NULL, 0, NULL, NULL ); 311 318 312 319 buf = (LPSTR) COMCTL32_Alloc (len); 313 lstrcpyWtoA (buf, (LPWSTR) lParam);320 WideCharToMultiByte( CP_ACP, 0, (LPWSTR)lParam, -1, buf, len, NULL, NULL ); 314 321 retval=DATETIME_SetFormat (hwnd, 0, (LPARAM) buf); 315 322 COMCTL32_Free (buf); … … 1112 1119 /* allocate memory for info structure */ 1113 1120 TRACE("%04x %08lx\n",wParam,lParam); 1121 #ifdef __WIN32OS2__ 1122 infoPtr = (DATETIME_INFO*)initControl(hwnd,sizeof(DATETIME_INFO)); 1123 #else 1114 1124 infoPtr = (DATETIME_INFO *)COMCTL32_Alloc (sizeof(DATETIME_INFO)); 1125 #endif 1115 1126 if (infoPtr == NULL) { 1116 1127 ERR("could not allocate info memory!\n"); … … 1166 1177 TRACE("\n"); 1167 1178 COMCTL32_Free (infoPtr); 1179 SetWindowLongA( hwnd, 0, 0 ); 1168 1180 return 0; 1169 1181 } … … 1173 1185 DATETIME_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) 1174 1186 { 1187 if (!DATETIME_GetInfoPtr(hwnd) && (uMsg != WM_CREATE)) 1188 return DefWindowProcA( hwnd, uMsg, wParam, lParam ); 1189 1175 1190 switch (uMsg) 1176 1191 { … … 1252 1267 uMsg, wParam, lParam); 1253 1268 #ifdef __WIN32OS2__ 1254 1269 return defComCtl32ProcA (hwnd, uMsg, wParam, lParam); 1255 1270 #else 1256 1271 return DefWindowProcA (hwnd, uMsg, wParam, lParam); -
TabularUnified trunk/src/comctl32/flatsb.c ¶
r4627 r5416 21 21 #include "debugtools.h" 22 22 23 #ifdef __WIN32OS2__ 24 #include "ccbase.h" 25 #endif 26 23 27 DEFAULT_DEBUG_CHANNEL(commctrl); 24 28 25 29 typedef struct 26 30 { 31 #ifdef __WIN32OS2__ 32 COMCTL32_HEADER header; 33 #endif 27 34 DWORD dwDummy; /* just to keep the compiler happy ;-) */ 28 35 } FLATSB_INFO, *LPFLATSB_INFO; … … 180 187 { 181 188 TRACE("[%04x] wParam=%04x lParam=%08lx\n", hwnd, wParam, lParam); 189 #ifdef __WIN32OS2__ 190 initControl(hwnd,sizeof(FLATSB_INFO)); 191 #endif 192 182 193 return 0; 183 194 } … … 188 199 { 189 200 TRACE("[%04x] wParam=%04x lParam=%08lx\n", hwnd, wParam, lParam); 201 #ifdef __WIN32OS2__ 202 /* free pager info data */ 203 doneControl(hwnd); 204 #endif 190 205 return 0; 191 206 } -
TabularUnified trunk/src/comctl32/hotkey.cpp ¶
r2895 r5416 1 /* $Id: hotkey.cpp,v 1. 2 2000-02-25 17:00:15 cbratschiExp $ */1 /* $Id: hotkey.cpp,v 1.3 2001-03-31 13:25:26 sandervl Exp $ */ 2 2 /* 3 3 * Hotkey control … … 16 16 #include "hotkey.h" 17 17 #include <string.h> 18 #include "comctl32.h" 18 19 19 20 #define HOTKEY_GetInfoPtr(hwnd) ((HOTKEY_INFO*)getInfoPtr(hwnd)) -
TabularUnified trunk/src/comctl32/initterm.cpp ¶
r5135 r5416 43 43 static HMODULE dllHandle = 0; 44 44 45 void CDECL RegisterCOMCTL32WindowClasses(unsigned long hinstDLL); 46 void CDECL UnregisterCOMCTL32WindowClasses(void); 45 BOOL WINAPI COMCTL32_LibMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved); 47 46 48 47 //****************************************************************************** … … 53 52 { 54 53 case DLL_PROCESS_ATTACH: 55 /* register Win32 window classes implemented in this DLL */56 RegisterCOMCTL32WindowClasses(hinstDLL);57 return TRUE;58 59 54 case DLL_THREAD_ATTACH: 60 55 case DLL_THREAD_DETACH: 61 return TRUE;56 return COMCTL32_LibMain(hinstDLL, fdwReason, fImpLoad); 62 57 63 58 case DLL_PROCESS_DETACH: 64 /* unregister Win32 window classes */65 UnregisterCOMCTL32WindowClasses();59 { 60 BOOL ret = COMCTL32_LibMain(hinstDLL, fdwReason, fImpLoad); 66 61 ctordtorTerm(); 67 return TRUE; 62 return ret; 63 } 68 64 } 69 65 return FALSE; -
TabularUnified trunk/src/comctl32/ipaddress.cpp ¶
r2895 r5416 1 /* $Id: ipaddress.cpp,v 1. 2 2000-02-25 17:00:16 cbratschiExp $ */1 /* $Id: ipaddress.cpp,v 1.3 2001-03-31 13:25:26 sandervl Exp $ */ 2 2 /* 3 3 * IP Address control … … 33 33 #include "ipaddress.h" 34 34 //#include "heap.h" 35 35 #include "comctl32.h" 36 36 37 37 #define IPADDRESS_GetInfoPtr(hwnd) ((IPADDRESS_INFO*)getInfoPtr(hwnd)) -
TabularUnified trunk/src/comctl32/monthcal.c ¶
r4627 r5416 5 5 * Copyright 1999 Alex Priem (alexp@sci.kun.nl) 6 6 * Copyright 1999 Chris Morgan <cmorgan@wpi.edu> and 7 * 7 * James Abbatiello <abbeyj@wpi.edu> 8 8 * Copyright 2000 Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de> 9 9 * … … 13 13 * 14 14 * FIXME: handle resources better (doesn't work now); also take care 15 of internationalization. 15 of internationalization. 16 16 * FIXME: keyboard handling. 17 17 */ … … 26 26 #include <stdio.h> 27 27 #include <stdlib.h> 28 #include <string.h> 28 29 29 30 #include "winbase.h" … … 31 32 #include "wingdi.h" 32 33 #include "winuser.h" 33 #include "win.h"34 34 #include "winnls.h" 35 35 #include "commctrl.h" … … 37 37 #include "debugtools.h" 38 38 39 #ifdef __WIN32OS2__ 40 #include "ccbase.h" 41 #endif 42 39 43 DEFAULT_DEBUG_CHANNEL(monthcal); 40 44 41 #define MC_SEL_LBUTUP 1/* Left button released */42 #define MC_SEL_LBUTDOWN 2/* Left button pressed in calendar */45 #define MC_SEL_LBUTUP 1 /* Left button released */ 46 #define MC_SEL_LBUTDOWN 2 /* Left button pressed in calendar */ 43 47 #define MC_PREVPRESSED 4 /* Prev month button pressed */ 44 48 #define MC_NEXTPRESSED 8 /* Next month button pressed */ 45 #define MC_NEXTMONTHDELAY 350 46 47 48 #define MC_NEXTMONTHTIMER 1 49 #define MC_PREVMONTHTIMER 2 49 #define MC_NEXTMONTHDELAY 350 /* when continuously pressing `next */ 50 /* month', wait 500 ms before going */ 51 /* to the next month */ 52 #define MC_NEXTMONTHTIMER 1 /* Timer ID's */ 53 #define MC_PREVMONTHTIMER 2 50 54 51 55 typedef struct 52 56 { 53 COLORREF bk; 54 COLORREF txt; 55 COLORREF titlebk; 56 COLORREF titletxt; 57 COLORREF monthbk; 58 COLORREF trailingtxt; 59 HFONT hFont; 60 HFONT hBoldFont; 61 int textHeight; 62 int textWidth; 63 int height_increment; 64 int width_increment; 65 int left_offset; 66 int top_offset; 67 int firstDayplace; /* place of the first day of the current month */ 68 int delta; /* scroll rate; # of months that the */ 57 #ifdef __WIN32OS2__ 58 COMCTL32_HEADER header; 59 #endif 60 COLORREF bk; 61 COLORREF txt; 62 COLORREF titlebk; 63 COLORREF titletxt; 64 COLORREF monthbk; 65 COLORREF trailingtxt; 66 HFONT hFont; 67 HFONT hBoldFont; 68 int textHeight; 69 int textWidth; 70 int height_increment; 71 int width_increment; 72 int left_offset; 73 int top_offset; 74 int firstDayplace; /* place of the first day of the current month */ 75 int delta; /* scroll rate; # of months that the */ 69 76 /* control moves when user clicks a scroll button */ 70 int visible;/* # of months visible */71 int firstDay;/* Start month calendar with firstDay's day */72 int 77 int visible; /* # of months visible */ 78 int firstDay; /* Start month calendar with firstDay's day */ 79 int monthRange; 73 80 MONTHDAYSTATE *monthdayState; 74 SYSTEMTIME 75 DWORD 76 DWORD 77 int status;/* See MC_SEL flags */78 int curSelDay;/* current selected day */79 int firstSelDay;/* first selected day */80 int 81 SYSTEMTIME 82 SYSTEMTIME 83 DWORD 84 SYSTEMTIME 85 SYSTEMTIME 86 87 RECT rcClient; 88 RECT rcDraw; 89 RECT title; 90 RECT titlebtnnext; 91 RECT titlebtnprev; /* the `prev month' button in the header */ 92 RECT titlemonth; 93 RECT titleyear; 94 RECT wdays; 95 RECT days; 96 RECT weeknums; 97 RECT todayrect; 81 SYSTEMTIME todaysDate; 82 DWORD currentMonth; 83 DWORD currentYear; 84 int status; /* See MC_SEL flags */ 85 int curSelDay; /* current selected day */ 86 int firstSelDay; /* first selected day */ 87 int maxSelCount; 88 SYSTEMTIME minSel; 89 SYSTEMTIME maxSel; 90 DWORD rangeValid; 91 SYSTEMTIME minDate; 92 SYSTEMTIME maxDate; 93 94 RECT rcClient; /* rect for whole client area */ 95 RECT rcDraw; /* rect for drawable portion of client area */ 96 RECT title; /* rect for the header above the calendar */ 97 RECT titlebtnnext; /* the `next month' button in the header */ 98 RECT titlebtnprev; /* the `prev month' button in the header */ 99 RECT titlemonth; /* the `month name' txt in the header */ 100 RECT titleyear; /* the `year number' txt in the header */ 101 RECT wdays; /* week days at top */ 102 RECT days; /* calendar area */ 103 RECT weeknums; /* week numbers at left side */ 104 RECT todayrect; /* `today: xx/xx/xx' text rect */ 98 105 HWND hWndYearEdit; /* Window Handle of edit box to handle years */ 99 106 HWND hWndYearUpDown;/* Window Handle of updown box to handle years */ … … 134 141 135 142 /* make sure that time is valid */ 136 static int MONTHCAL_ValidateTime(SYSTEMTIME time) 143 static int MONTHCAL_ValidateTime(SYSTEMTIME time) 137 144 { 138 145 if(time.wMonth > 12) return FALSE; 139 146 if(time.wDayOfWeek > 6) return FALSE; 140 147 if(time.wDay > MONTHCAL_MonthLength(time.wMonth, time.wYear)) 141 148 return FALSE; 142 149 if(time.wHour > 23) return FALSE; 143 150 if(time.wMinute > 59) return FALSE; … … 149 156 150 157 151 void MONTHCAL_CopyTime(const SYSTEMTIME *from, SYSTEMTIME *to) 158 void MONTHCAL_CopyTime(const SYSTEMTIME *from, SYSTEMTIME *to) 152 159 { 153 160 to->wYear = from->wYear; … … 162 169 163 170 164 /* Note:Depending on DST, this may be offset by a day. 171 /* Note:Depending on DST, this may be offset by a day. 165 172 Need to find out if we're on a DST place & adjust the clock accordingly. 166 173 Above function assumes we have a valid data. … … 175 182 year-=(month < 3); 176 183 177 return((year + year/4 - year/100 + year/400 + 184 return((year + year/4 - year/100 + year/400 + 178 185 DayOfWeekTable[month-1] + day - 1 ) % 7); 179 186 } … … 182 189 and day in the calendar. day== 0 mean the last day of tha last month 183 190 */ 184 static int MONTHCAL_CalcDayFromPos(MONTHCAL_INFO *infoPtr, int x, int y, 185 int *daypos,int *weekpos) 191 static int MONTHCAL_CalcDayFromPos(MONTHCAL_INFO *infoPtr, int x, int y, 192 int *daypos,int *weekpos) 186 193 { 187 194 int retval, firstDay; … … 195 202 *daypos = (x - infoPtr->days.left ) / infoPtr->width_increment; 196 203 *weekpos = (y - infoPtr->days.top ) / infoPtr->height_increment; 197 204 198 205 firstDay = (MONTHCAL_CalculateDayOfWeek(1, infoPtr->currentMonth, infoPtr->currentYear)+6 - infoPtr->firstDay)%7; 199 206 retval = *daypos + (7 * *weekpos) - firstDay; … … 204 211 /* sets x and y to be the position of the day */ 205 212 /* x == day, y == week where(0,0) == firstDay, 1st week */ 206 static void MONTHCAL_CalcDayXY(MONTHCAL_INFO *infoPtr, int day, int month, 213 static void MONTHCAL_CalcDayXY(MONTHCAL_INFO *infoPtr, int day, int month, 207 214 int *x, int *y) 208 215 { … … 220 227 if(prevMonth==0) 221 228 prevMonth = 12; 222 229 223 230 *x = (MONTHCAL_MonthLength(prevMonth, infoPtr->currentYear) - firstDay) % 7; 224 231 *y = 0; … … 233 240 234 241 /* x: column(day), y: row(week) */ 235 static void MONTHCAL_CalcDayRect(MONTHCAL_INFO *infoPtr, RECT *r, int x, int y) 242 static void MONTHCAL_CalcDayRect(MONTHCAL_INFO *infoPtr, RECT *r, int x, int y) 236 243 { 237 244 r->left = infoPtr->days.left + x * infoPtr->width_increment; … … 245 252 /* day is the day value of the month(1 == 1st), month is the month */ 246 253 /* value(january == 1, december == 12) */ 247 static inline void MONTHCAL_CalcPosFromDay(MONTHCAL_INFO *infoPtr, 254 static inline void MONTHCAL_CalcPosFromDay(MONTHCAL_INFO *infoPtr, 248 255 int day, int month, RECT *r) 249 256 { … … 271 278 x = day_rect.left; 272 279 y = day_rect.top; 273 280 274 281 points[0].x = x; 275 282 points[0].y = y - 1; … … 280 287 points[3].x = x + infoPtr->width_increment; 281 288 points[3].y = y + 0.5 * infoPtr->height_increment; 282 289 283 290 points[4].x = x + infoPtr->width_increment; 284 291 points[4].y = y + 0.9 * infoPtr->height_increment; … … 287 294 points[6].x = x + 0.5 * infoPtr->width_increment; 288 295 points[6].y = y + 0.9 * infoPtr->height_increment; /* bring the bottom up just 289 290 296 a hair to fit inside the day rectangle */ 297 291 298 points[7].x = x + 0.2 * infoPtr->width_increment; 292 299 points[7].y = y + 0.8 * infoPtr->height_increment; … … 302 309 points[12].x = x + 0.4 * infoPtr->width_increment; 303 310 points[12].y = y + 0.2 * infoPtr->height_increment; 304 311 305 312 PolyBezier(hdc, points, 13); 306 313 DeleteObject(hRedPen); … … 322 329 sprintf(buf, "%d", day); 323 330 324 /* No need to check styles: when selection is not valid, it is set to zero. 331 /* No need to check styles: when selection is not valid, it is set to zero. 325 332 * 1<day<31, so evertyhing's OK. 326 333 */ … … 342 349 343 350 /* FIXME: this may need to be changed now b/c of the other 344 351 drawing changes 11/3/99 CMM */ 345 352 r2.left = r.left - 0.25 * infoPtr->textWidth; 346 353 r2.top = r.top; … … 383 390 384 391 /* CHECKME: For `todays date', do we need to check the locale?*/ 385 static void MONTHCAL_Refresh(HWND hwnd, HDC hdc, PAINTSTRUCT* ps) 392 static void MONTHCAL_Refresh(HWND hwnd, HDC hdc, PAINTSTRUCT* ps) 386 393 { 387 394 MONTHCAL_INFO *infoPtr=MONTHCAL_GetInfoPtr(hwnd); … … 418 425 hbr = CreateSolidBrush (infoPtr->bk); 419 426 FillRect(hdc, rcClient, hbr); 420 DeleteObject(hbr); 427 DeleteObject(hbr); 421 428 422 429 /* draw header */ … … 427 434 DeleteObject(hbr); 428 435 } 429 436 430 437 /* if the previous button is pressed draw it depressed */ 431 438 if(IntersectRect(&rcTemp, &(ps->rcPaint), prev)) 432 { 439 { 433 440 if((infoPtr->status & MC_PREVPRESSED)) 434 441 DrawFrameControl(hdc, prev, DFC_SCROLL, 435 442 DFCS_SCROLLLEFT | DFCS_PUSHED | 436 443 (dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0)); 437 444 else /* if the previous button is pressed draw it depressed */ 438 445 DrawFrameControl(hdc, prev, DFC_SCROLL, 439 440 } 441 442 /* if next button is depressed draw it depressed */ 446 DFCS_SCROLLLEFT |(dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0)); 447 } 448 449 /* if next button is depressed draw it depressed */ 443 450 if(IntersectRect(&rcTemp, &(ps->rcPaint), next)) 444 451 { 445 452 if((infoPtr->status & MC_NEXTPRESSED)) 446 453 DrawFrameControl(hdc, next, DFC_SCROLL, 447 454 DFCS_SCROLLRIGHT | DFCS_PUSHED | 448 455 (dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0)); 449 456 else /* if the next button is pressed draw it depressed */ … … 459 466 titlemonth->left = title->left; 460 467 titlemonth->right = title->right; 461 468 462 469 GetLocaleInfoA( LOCALE_USER_DEFAULT,LOCALE_SMONTHNAME1+infoPtr->currentMonth -1, 463 470 buf1,sizeof(buf1)); 464 471 sprintf(buf, "%s %ld", buf1, infoPtr->currentYear); 465 472 466 473 if(IntersectRect(&rcTemp, &(ps->rcPaint), titlemonth)) 467 474 { 468 DrawTextA(hdc, buf, strlen(buf), titlemonth, 475 DrawTextA(hdc, buf, strlen(buf), titlemonth, 469 476 DT_CENTER | DT_VCENTER | DT_SINGLELINE); 470 477 } … … 474 481 /* titlemonth left/right contained rect for whole titletxt('June 1999') 475 482 * MCM_HitTestInfo wants month & year rects, so prepare these now. 476 *(no, we can't draw them separately; the whole text is centered) 483 *(no, we can't draw them separately; the whole text is centered) 477 484 */ 478 485 GetTextExtentPoint32A(hdc, buf, strlen(buf), &size); … … 482 489 titlemonth->right = titlemonth->left + size.cx; 483 490 titleyear->left = titlemonth->right; 484 491 485 492 /* draw month area */ 486 493 rcTemp.top=infoPtr->wdays.top; … … 494 501 DeleteObject(hbr); 495 502 } 496 503 497 504 /* draw line under day abbreviatons */ 498 505 499 506 MoveToEx(hdc, infoPtr->days.left + 3, title->bottom + textHeight + 1, NULL); 500 507 501 508 LineTo(hdc, rcDraw->right - 3, title->bottom + textHeight + 1); 502 509 503 510 prevMonth = infoPtr->currentMonth - 1; 504 511 if(prevMonth == 0) /* if currentMonth is january(1) prevMonth is */ … … 522 529 for(j=0; j<7; j++) { 523 530 GetLocaleInfoA( LOCALE_USER_DEFAULT,LOCALE_SABBREVDAYNAME1 + (i +j)%7, 524 531 buf,sizeof(buf)); 525 532 DrawTextA(hdc, buf, strlen(buf), days, 526 533 DT_CENTER | DT_VCENTER | DT_SINGLELINE ); … … 530 537 531 538 /* draw day numbers; first, the previous month */ 532 539 533 540 firstDay = MONTHCAL_CalculateDayOfWeek(1, infoPtr->currentMonth, infoPtr->currentYear); 534 535 day = MONTHCAL_MonthLength(prevMonth, infoPtr->currentYear) + 541 542 day = MONTHCAL_MonthLength(prevMonth, infoPtr->currentYear) + 536 543 (infoPtr->firstDay + 7 - firstDay)%7 + 1; 537 544 if (day > MONTHCAL_MonthLength(prevMonth, infoPtr->currentYear)) … … 546 553 if(IntersectRect(&rcTemp, &(ps->rcPaint), &rcDay)) 547 554 { 548 MONTHCAL_DrawDay(hdc, infoPtr, day, prevMonth, i, 0, 555 MONTHCAL_DrawDay(hdc, infoPtr, day, prevMonth, i, 0, 549 556 infoPtr->monthdayState[m] & mask); 550 557 } … … 570 577 { 571 578 572 MONTHCAL_DrawDay(hdc, infoPtr, day, infoPtr->currentMonth, i, 0, 573 579 MONTHCAL_DrawDay(hdc, infoPtr, day, infoPtr->currentMonth, i, 0, 580 infoPtr->monthdayState[m] & mask); 574 581 575 582 if((infoPtr->currentMonth==infoPtr->todaysDate.wMonth) && 576 583 (day==infoPtr->todaysDate.wDay) && 577 584 (infoPtr->currentYear == infoPtr->todaysDate.wYear)) { 578 585 if(!(dwStyle & MCS_NOTODAYCIRCLE)) 579 586 MONTHCAL_CircleDay(hdc, infoPtr, day, infoPtr->currentMonth); 580 587 } 581 588 } … … 588 595 j = 1; /* move to the 2nd week of the current month */ 589 596 i = 0; /* move back to sunday */ 590 while(day <= MONTHCAL_MonthLength(infoPtr->currentMonth, infoPtr->currentYear)) { 597 while(day <= MONTHCAL_MonthLength(infoPtr->currentMonth, infoPtr->currentYear)) { 591 598 MONTHCAL_CalcDayRect(infoPtr, &rcDay, i, j); 592 599 if(IntersectRect(&rcTemp, &(ps->rcPaint), &rcDay)) … … 597 604 if((infoPtr->currentMonth==infoPtr->todaysDate.wMonth) && 598 605 (day==infoPtr->todaysDate.wDay) && 599 (infoPtr->currentYear == infoPtr->todaysDate.wYear)) 600 if(!(dwStyle & MCS_NOTODAYCIRCLE)) 601 606 (infoPtr->currentYear == infoPtr->todaysDate.wYear)) 607 if(!(dwStyle & MCS_NOTODAYCIRCLE)) 608 MONTHCAL_CircleDay(hdc, infoPtr, day, infoPtr->currentMonth); 602 609 } 603 610 mask<<=1; … … 620 627 MONTHCAL_CalcDayRect(infoPtr, &rcDay, i, j); 621 628 if(IntersectRect(&rcTemp, &(ps->rcPaint), &rcDay)) 622 { 629 { 623 630 MONTHCAL_DrawDay(hdc, infoPtr, day, infoPtr->currentMonth + 1, i, j, 624 631 infoPtr->monthdayState[m] & mask); 625 632 } 626 633 627 634 mask<<=1; 628 635 day++; 629 i++; 636 i++; 630 637 if(i==7) { /* past saturday, go to next week's sunday */ 631 638 i = 0; … … 643 650 if(!(dwStyle & MCS_NOTODAYCIRCLE)) { 644 651 /*day is the number of days from nextmonth we put on the calendar */ 645 MONTHCAL_CircleDay(hdc, infoPtr, 646 day+MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear), 647 652 MONTHCAL_CircleDay(hdc, infoPtr, 653 day+MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear), 654 infoPtr->currentMonth); 648 655 offset+=textWidth; 649 656 } 650 657 if (!LoadStringA(COMCTL32_hModule,IDM_TODAY,buf1,sizeof(buf1))) 651 658 { 652 653 659 WARN("Can't load resource\n"); 660 strcpy(buf1,"Today:"); 654 661 } 655 662 MONTHCAL_CalcDayRect(infoPtr, &rtoday, 1, 6); … … 667 674 } 668 675 669 /*eventually draw week numbers*/ 676 /*eventually draw week numbers*/ 670 677 if(dwStyle & MCS_WEEKNUMBERS) { 671 678 /* display weeknumbers*/ … … 675 682 LOCALE_IFIRSTWEEKOFYEAR == 0 (e.g US?): 676 683 The week containing Jan 1 is the first week of year 677 LOCALE_IFIRSTWEEKOFYEAR == 2 (e.g. Germany): 684 LOCALE_IFIRSTWEEKOFYEAR == 2 (e.g. Germany): 678 685 First week of year must contain 4 days of the new year 679 686 LOCALE_IFIRSTWEEKOFYEAR == 1 (what contries?) … … 681 688 */ 682 689 GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_IFIRSTWEEKOFYEAR, 683 690 buf, sizeof(buf)); 684 691 sscanf(buf, "%d", &weeknum); 685 692 switch (weeknum) 686 693 { 687 694 case 1: mindays = 6; 688 695 break; 689 696 case 2: mindays = 3; 690 697 break; 691 698 case 0: 692 699 default: 693 700 mindays = 0; 694 701 } 695 702 if (infoPtr->currentMonth < 2) 696 703 { 697 698 699 if ((infoPtr->firstDay +7 - weeknum1)%7 > mindays) 700 701 702 703 704 for(i=0; i<11; i++) 705 706 707 708 709 710 711 704 /* calculate all those exceptions for january */ 705 weeknum1=MONTHCAL_CalculateDayOfWeek(1,1,infoPtr->currentYear); 706 if ((infoPtr->firstDay +7 - weeknum1)%7 > mindays) 707 weeknum =1; 708 else 709 { 710 weeknum = 0; 711 for(i=0; i<11; i++) 712 weeknum+=MONTHCAL_MonthLength(i+1, infoPtr->currentYear-1); 713 weeknum +=startofprescal+ 7; 714 weeknum /=7; 715 weeknum1=MONTHCAL_CalculateDayOfWeek(1,1,infoPtr->currentYear-1); 716 if ((infoPtr->firstDay + 7 - weeknum1)%7 > mindays) 717 weeknum++; 718 } 712 719 } 713 720 else 714 721 { 715 716 for(i=0; i<prevMonth-1; i++) 717 718 719 720 721 722 722 weeknum = 0; 723 for(i=0; i<prevMonth-1; i++) 724 weeknum+=MONTHCAL_MonthLength(i+1, infoPtr->currentYear); 725 weeknum +=startofprescal+ 7; 726 weeknum /=7; 727 weeknum1=MONTHCAL_CalculateDayOfWeek(1,1,infoPtr->currentYear); 728 if ((infoPtr->firstDay + 7 - weeknum1)%7 > mindays) 729 weeknum++; 723 730 } 724 731 days->left = infoPtr->weeknums.left; … … 728 735 for(i=0; i<6; i++) { 729 736 if((i==0)&&(weeknum>50)) 730 731 732 733 737 { 738 sprintf(buf, "%d", weeknum); 739 weeknum=0; 740 } 734 741 else if((i==5)&&(weeknum>47)) 735 736 737 742 { 743 sprintf(buf, "%d", 1); 744 } 738 745 else 739 746 sprintf(buf, "%d", weeknum + i); 740 747 DrawTextA(hdc, buf, -1, days, DT_CENTER | DT_VCENTER | DT_SINGLELINE ); 741 748 days->top+=infoPtr->height_increment; 742 749 days->bottom+=infoPtr->height_increment; 743 750 } 744 751 745 752 MoveToEx(hdc, infoPtr->weeknums.right, infoPtr->weeknums.top + 3 , NULL); 746 753 LineTo(hdc, infoPtr->weeknums.right, infoPtr->weeknums.bottom ); 747 754 748 755 } 749 756 /* currentFont was font at entering Refresh */ 750 757 751 758 SetBkColor(hdc, oldBkColor); 752 SelectObject(hdc, currentFont); 759 SelectObject(hdc, currentFont); 753 760 SetTextColor(hdc, oldTextColor); 754 761 } 755 762 756 763 757 static LRESULT 764 static LRESULT 758 765 MONTHCAL_GetMinReqRect(HWND hwnd, WPARAM wParam, LPARAM lParam) 759 766 { … … 761 768 LPRECT lpRect = (LPRECT) lParam; 762 769 TRACE("%x %lx\n", wParam, lParam); 763 770 764 771 /* validate parameters */ 765 772 … … 774 781 775 782 776 static LRESULT 783 static LRESULT 777 784 MONTHCAL_GetColor(HWND hwnd, WPARAM wParam, LPARAM lParam) 778 785 { … … 800 807 801 808 802 static LRESULT 809 static LRESULT 803 810 MONTHCAL_SetColor(HWND hwnd, WPARAM wParam, LPARAM lParam) 804 811 { … … 840 847 841 848 842 static LRESULT 849 static LRESULT 843 850 MONTHCAL_GetMonthDelta(HWND hwnd, WPARAM wParam, LPARAM lParam) 844 851 { … … 846 853 847 854 TRACE("%x %lx\n", wParam, lParam); 848 855 849 856 if(infoPtr->delta) 850 857 return infoPtr->delta; … … 854 861 855 862 856 static LRESULT 863 static LRESULT 857 864 MONTHCAL_SetMonthDelta(HWND hwnd, WPARAM wParam, LPARAM lParam) 858 865 { … … 861 868 862 869 TRACE("%x %lx\n", wParam, lParam); 863 870 864 871 infoPtr->delta = (int)wParam; 865 872 return prev; … … 867 874 868 875 869 static LRESULT 876 static LRESULT 870 877 MONTHCAL_GetFirstDayOfWeek(HWND hwnd, WPARAM wParam, LPARAM lParam) 871 878 { 872 879 MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd); 873 880 874 881 return infoPtr->firstDay; 875 882 } … … 880 887 /* FIXME: this needs to be implemented properly in MONTHCAL_Refresh() */ 881 888 /* FIXME: we need more error checking here */ 882 static LRESULT 889 static LRESULT 883 890 MONTHCAL_SetFirstDayOfWeek(HWND hwnd, WPARAM wParam, LPARAM lParam) 884 891 { … … 896 903 { 897 904 GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_IFIRSTDAYOFWEEK, 898 905 buf, sizeof(buf)); 899 906 TRACE("%s %d\n", buf, strlen(buf)); 900 907 if(sscanf(buf, "%d", &day) == 1) 901 908 infoPtr->firstDay = day; 902 909 else 903 910 infoPtr->firstDay = 0; 904 911 } 905 912 return prev; … … 909 916 /* FIXME: fill this in */ 910 917 static LRESULT 911 MONTHCAL_GetMonthRange(HWND hwnd, WPARAM wParam, LPARAM lParam) 918 MONTHCAL_GetMonthRange(HWND hwnd, WPARAM wParam, LPARAM lParam) 912 919 { 913 920 MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd); … … 930 937 931 938 /* FIXME: are validated times taken from current date/time or simply 932 * copied? 939 * copied? 933 940 * FIXME: check whether MCM_GETMONTHRANGE shows correct result after 934 941 * adjusting range with MCM_SETRANGE … … 943 950 944 951 TRACE("%x %lx\n", wParam, lParam); 945 952 946 953 if(wParam & GDTR_MAX) { 947 954 if(MONTHCAL_ValidateTime(lprgSysTimeArray[1])){ … … 966 973 infoPtr->monthRange = infoPtr->maxDate.wMonth - infoPtr->minDate.wMonth; 967 974 968 if(infoPtr->monthRange!=prev) { 969 COMCTL32_ReAlloc(infoPtr->monthdayState, 970 975 if(infoPtr->monthRange!=prev) { 976 COMCTL32_ReAlloc(infoPtr->monthdayState, 977 infoPtr->monthRange * sizeof(MONTHDAYSTATE)); 971 978 } 972 979 … … 976 983 977 984 /* CHECKME: At the moment, we copy ranges anyway,regardless of 978 * infoPtr->rangeValid; a invalid range is simply filled with zeros in 985 * infoPtr->rangeValid; a invalid range is simply filled with zeros in 979 986 * SetRange. Is this the right behavior? 980 987 */ … … 1008 1015 if(iMonths!=infoPtr->monthRange) return 0; 1009 1016 1010 for(i=0; i<iMonths; i++) 1017 for(i=0; i<iMonths; i++) 1011 1018 infoPtr->monthdayState[i] = dayStates[i]; 1012 1019 return 1; 1013 1020 } 1014 1021 1015 static LRESULT 1022 static LRESULT 1016 1023 MONTHCAL_GetCurSel(HWND hwnd, WPARAM wParam, LPARAM lParam) 1017 1024 { … … 1029 1036 /* FIXME: if the specified date is not visible, make it visible */ 1030 1037 /* FIXME: redraw? */ 1031 static LRESULT 1038 static LRESULT 1032 1039 MONTHCAL_SetCurSel(HWND hwnd, WPARAM wParam, LPARAM lParam) 1033 1040 { … … 1050 1057 1051 1058 1052 static LRESULT 1059 static LRESULT 1053 1060 MONTHCAL_GetMaxSelCount(HWND hwnd, WPARAM wParam, LPARAM lParam) 1054 1061 { … … 1060 1067 1061 1068 1062 static LRESULT 1069 static LRESULT 1063 1070 MONTHCAL_SetMaxSelCount(HWND hwnd, WPARAM wParam, LPARAM lParam) 1064 1071 { … … 1074 1081 1075 1082 1076 static LRESULT 1083 static LRESULT 1077 1084 MONTHCAL_GetSelRange(HWND hwnd, WPARAM wParam, LPARAM lParam) 1078 1085 { … … 1093 1100 return TRUE; 1094 1101 } 1095 1102 1096 1103 return FALSE; 1097 1104 } 1098 1105 1099 1106 1100 static LRESULT 1107 static LRESULT 1101 1108 MONTHCAL_SetSelRange(HWND hwnd, WPARAM wParam, LPARAM lParam) 1102 1109 { … … 1117 1124 return TRUE; 1118 1125 } 1119 1126 1120 1127 return FALSE; 1121 1128 } 1122 1129 1123 1130 1124 static LRESULT 1131 static LRESULT 1125 1132 MONTHCAL_GetToday(HWND hwnd, WPARAM wParam, LPARAM lParam) 1126 1133 { … … 1138 1145 1139 1146 1140 static LRESULT 1147 static LRESULT 1141 1148 MONTHCAL_SetToday(HWND hwnd, WPARAM wParam, LPARAM lParam) 1142 1149 { … … 1163 1170 DWORD retval; 1164 1171 int day,wday,wnum; 1165 1166 1172 1173 1167 1174 x = lpht->pt.x; 1168 1175 y = lpht->pt.y; 1169 1176 retval = MCHT_NOWHERE; 1170 1171 1172 /* Comment in for debugging... 1173 TRACE("%d %d wd[%d %d %d %d] d[%d %d %d %d] t[%d %d %d %d] wn[%d %d %d %d]\n", x, y, 1174 1175 1176 1177 1178 1179 1180 1181 1177 1178 1179 /* Comment in for debugging... 1180 TRACE("%d %d wd[%d %d %d %d] d[%d %d %d %d] t[%d %d %d %d] wn[%d %d %d %d]\n", x, y, 1181 infoPtr->wdays.left, infoPtr->wdays.right, 1182 infoPtr->wdays.top, infoPtr->wdays.bottom, 1183 infoPtr->days.left, infoPtr->days.right, 1184 infoPtr->days.top, infoPtr->days.bottom, 1185 infoPtr->todayrect.left, infoPtr->todayrect.right, 1186 infoPtr->todayrect.top, infoPtr->todayrect.bottom, 1187 infoPtr->weeknums.left, infoPtr->weeknums.right, 1188 infoPtr->weeknums.top, infoPtr->weeknums.bottom); 1182 1189 */ 1183 1190 1184 1191 /* are we in the header? */ 1185 1192 1186 1193 if(PtInRect(&infoPtr->title, lpht->pt)) { 1187 1194 if(PtInRect(&infoPtr->titlebtnprev, lpht->pt)) { … … 1201 1208 goto done; 1202 1209 } 1203 1210 1204 1211 retval = MCHT_TITLE; 1205 1212 goto done; 1206 1213 } 1207 1214 1208 1215 day = MONTHCAL_CalcDayFromPos(infoPtr,x,y,&wday,&wnum); 1209 1216 if(PtInRect(&infoPtr->wdays, lpht->pt)) { … … 1211 1218 lpht->st.wYear = infoPtr->currentYear; 1212 1219 lpht->st.wMonth = (day < 1)? infoPtr->currentMonth -1 : infoPtr->currentMonth; 1213 lpht->st.wDay = (day < 1)? 1220 lpht->st.wDay = (day < 1)? 1214 1221 MONTHCAL_MonthLength(infoPtr->currentMonth-1,infoPtr->currentYear) -day : day; 1215 1222 goto done; 1216 1223 } 1217 if(PtInRect(&infoPtr->weeknums, lpht->pt)) { 1218 retval = MCHT_CALENDARWEEKNUM; 1224 if(PtInRect(&infoPtr->weeknums, lpht->pt)) { 1225 retval = MCHT_CALENDARWEEKNUM; 1219 1226 lpht->st.wYear = infoPtr->currentYear; 1220 lpht->st.wMonth = (day < 1) ? infoPtr->currentMonth -1 : 1221 (day > MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear)) ? 1227 lpht->st.wMonth = (day < 1) ? infoPtr->currentMonth -1 : 1228 (day > MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear)) ? 1222 1229 infoPtr->currentMonth +1 :infoPtr->currentMonth; 1223 lpht->st.wDay = (day < 1 ) ? 1224 MONTHCAL_MonthLength(infoPtr->currentMonth-1,infoPtr->currentYear) -day : 1225 (day > MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear)) ? 1230 lpht->st.wDay = (day < 1 ) ? 1231 MONTHCAL_MonthLength(infoPtr->currentMonth-1,infoPtr->currentYear) -day : 1232 (day > MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear)) ? 1226 1233 day - MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear) : day; 1227 goto done; 1228 } 1229 if(PtInRect(&infoPtr->days, lpht->pt)) 1234 goto done; 1235 } 1236 if(PtInRect(&infoPtr->days, lpht->pt)) 1230 1237 { 1231 1238 lpht->st.wYear = infoPtr->currentYear; 1232 if ( day < 1) 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1239 if ( day < 1) 1240 { 1241 retval = MCHT_CALENDARDATEPREV; 1242 lpht->st.wMonth = infoPtr->currentMonth - 1; 1243 if (lpht->st.wMonth <1) 1244 { 1245 lpht->st.wMonth = 12; 1246 lpht->st.wYear--; 1247 } 1248 lpht->st.wDay = MONTHCAL_MonthLength(lpht->st.wMonth,lpht->st.wYear) -day; 1249 } 1243 1250 else if (day > MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear)) 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1251 { 1252 retval = MCHT_CALENDARDATENEXT; 1253 lpht->st.wMonth = infoPtr->currentMonth + 1; 1254 if (lpht->st.wMonth <12) 1255 { 1256 lpht->st.wMonth = 1; 1257 lpht->st.wYear++; 1258 } 1259 lpht->st.wDay = day - MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear) ; 1260 } 1254 1261 else { 1255 1256 1257 1262 retval = MCHT_CALENDARDATE; 1263 lpht->st.wMonth = infoPtr->currentMonth; 1264 lpht->st.wDay = day; 1258 1265 } 1259 1266 goto done; 1260 1267 } 1261 1268 if(PtInRect(&infoPtr->todayrect, lpht->pt)) { 1262 retval = MCHT_TODAYLINK; 1269 retval = MCHT_TODAYLINK; 1263 1270 goto done; 1264 1271 } 1265 1266 1272 1273 1267 1274 /* Hit nothing special? What's left must be background :-) */ 1268 1269 retval = MCHT_CALENDARBK; 1270 done: 1275 1276 retval = MCHT_CALENDARBK; 1277 done: 1271 1278 lpht->uHit = retval; 1272 1279 return retval; … … 1293 1300 nmds.nmhdr.idFrom = GetWindowLongA(hwnd, GWL_ID); 1294 1301 nmds.nmhdr.code = MCN_GETDAYSTATE; 1295 nmds.cDayState 1296 nmds.prgDayState 1302 nmds.cDayState = infoPtr->monthRange; 1303 nmds.prgDayState = COMCTL32_Alloc(infoPtr->monthRange * sizeof(MONTHDAYSTATE)); 1297 1304 1298 1305 SendMessageA(GetParent(hwnd), WM_NOTIFY, … … 1323 1330 nmds.nmhdr.idFrom = GetWindowLongA(hwnd, GWL_ID); 1324 1331 nmds.nmhdr.code = MCN_GETDAYSTATE; 1325 nmds.cDayState 1326 nmds.prgDayState = COMCTL32_Alloc1332 nmds.cDayState = infoPtr->monthRange; 1333 nmds.prgDayState = COMCTL32_Alloc 1327 1334 (infoPtr->monthRange * sizeof(MONTHDAYSTATE)); 1328 1335 … … 1341 1348 POINT menupoint; 1342 1349 char buf[32]; 1343 1350 1344 1351 hMenu = CreatePopupMenu(); 1345 1352 if (!LoadStringA(COMCTL32_hModule,IDM_GOTODAY,buf,sizeof(buf))) … … 1353 1360 ClientToScreen(hwnd, &menupoint); 1354 1361 if( TrackPopupMenu(hMenu,TPM_RIGHTBUTTON| TPM_NONOTIFY|TPM_RETURNCMD, 1355 1362 menupoint.x,menupoint.y,0,hwnd,NULL)) 1356 1363 { 1357 1364 infoPtr->currentMonth=infoPtr->todaysDate.wMonth; 1358 1365 infoPtr->currentYear=infoPtr->todaysDate.wYear; 1359 1366 InvalidateRect(hwnd, NULL, FALSE); 1360 } 1367 } 1361 1368 return 0; 1362 1369 } … … 1374 1381 POINT menupoint; 1375 1382 TRACE("%x %lx\n", wParam, lParam); 1376 1383 1377 1384 if (infoPtr->hWndYearUpDown) 1378 1385 { 1379 1386 infoPtr->currentYear=SendMessageA( infoPtr->hWndYearUpDown, UDM_SETPOS, (WPARAM) 0,(LPARAM)0); 1380 1387 if(!DestroyWindow(infoPtr->hWndYearUpDown)) 1381 1382 1383 1388 { 1389 FIXME("Can't destroy Updown Control\n"); 1390 } 1384 1391 else 1385 1392 infoPtr->hWndYearUpDown=0; 1386 1393 if(!DestroyWindow(infoPtr->hWndYearEdit)) 1387 1388 1389 1394 { 1395 FIXME("Can't destroy Updown Control\n"); 1396 } 1390 1397 else 1391 1398 infoPtr->hWndYearEdit=0; 1392 1399 InvalidateRect(hwnd, NULL, FALSE); 1393 1400 } 1394 1401 1395 1402 ht.pt.x = (INT)LOWORD(lParam); 1396 1403 ht.pt.y = (INT)HIWORD(lParam); … … 1407 1414 return TRUE; 1408 1415 } 1409 if(hit == MCHT_TITLEBTNPREV){ 1416 if(hit == MCHT_TITLEBTNPREV){ 1410 1417 MONTHCAL_GoToPrevMonth(hwnd, infoPtr); 1411 1418 infoPtr->status = MC_PREVPRESSED; … … 1417 1424 if(hit == MCHT_TITLEMONTH) { 1418 1425 hMenu = CreatePopupMenu(); 1419 1426 1420 1427 for (i=0; i<12;i++) 1421 1428 { 1422 1423 1424 1429 GetLocaleInfoA( LOCALE_USER_DEFAULT,LOCALE_SMONTHNAME1+i, 1430 buf,sizeof(buf)); 1431 AppendMenuA(hMenu, MF_STRING|MF_ENABLED,i+1, buf); 1425 1432 } 1426 1433 menupoint.x=infoPtr->titlemonth.right; … … 1428 1435 ClientToScreen(hwnd, &menupoint); 1429 1436 i= TrackPopupMenu(hMenu,TPM_LEFTALIGN | TPM_NONOTIFY | TPM_RIGHTBUTTON | TPM_RETURNCMD, 1430 1437 menupoint.x,menupoint.y,0,hwnd,NULL); 1431 1438 if ((i>0) && (i<13)) 1432 1439 { 1433 1434 1440 infoPtr->currentMonth=i; 1441 InvalidateRect(hwnd, NULL, FALSE); 1435 1442 } 1436 1443 } 1437 1444 if(hit == MCHT_TITLEYEAR) { 1438 1445 infoPtr->hWndYearEdit=CreateWindowExA(0, 1439 1440 1441 1442 1443 1444 1445 1446 (HMENU)NULL, 1447 (HINSTANCE)NULL, 1448 1446 "EDIT", 1447 0, 1448 WS_VISIBLE | WS_CHILD |UDS_SETBUDDYINT, 1449 infoPtr->titleyear.left+3,infoPtr->titlebtnnext.top, 1450 infoPtr->titleyear.right-infoPtr->titleyear.left, 1451 infoPtr->textHeight, 1452 hwnd, 1453 (HMENU)NULL, 1454 (HINSTANCE)NULL, 1455 NULL); 1449 1456 infoPtr->hWndYearUpDown=CreateWindowExA(0, 1450 1451 1452 1453 1454 1455 1456 1457 (HMENU)NULL, 1458 (HINSTANCE)NULL, 1459 1457 UPDOWN_CLASSA, 1458 0, 1459 WS_VISIBLE | WS_CHILD |UDS_SETBUDDYINT|UDS_NOTHOUSANDS|UDS_ARROWKEYS, 1460 infoPtr->titleyear.right+6,infoPtr->titlebtnnext.top, 1461 20, 1462 infoPtr->textHeight, 1463 hwnd, 1464 (HMENU)NULL, 1465 (HINSTANCE)NULL, 1466 NULL); 1460 1467 SendMessageA( infoPtr->hWndYearUpDown, UDM_SETRANGE, (WPARAM) 0, MAKELONG (9999, 1753)); 1461 1468 SendMessageA( infoPtr->hWndYearUpDown, UDM_SETBUDDY, (WPARAM) infoPtr->hWndYearEdit, (LPARAM)0 ); 1462 1469 SendMessageA( infoPtr->hWndYearUpDown, UDM_SETPOS, (WPARAM) 0,(LPARAM)infoPtr->currentYear ); 1463 1470 return TRUE; 1464 1471 1465 1472 } 1466 1473 if(hit == MCHT_TODAYLINK) { … … 1480 1487 MONTHCAL_CopyTime(&nmsc.stSelStart, &infoPtr->minSel); 1481 1488 MONTHCAL_CopyTime(&nmsc.stSelEnd, &infoPtr->maxSel); 1482 1489 1483 1490 SendMessageA(GetParent(hwnd), WM_NOTIFY, 1484 1491 (WPARAM)nmsc.nmhdr.idFrom,(LPARAM)&nmsc); … … 1486 1493 MONTHCAL_CopyTime(&ht.st, &selArray[0]); 1487 1494 MONTHCAL_CopyTime(&ht.st, &selArray[1]); 1488 MONTHCAL_SetSelRange(hwnd,0,(LPARAM) &selArray); 1495 MONTHCAL_SetSelRange(hwnd,0,(LPARAM) &selArray); 1489 1496 1490 1497 /* redraw both old and new days if the selected day changed */ … … 1539 1546 return TRUE; 1540 1547 } 1541 if(hit == MCHT_CALENDARDATEPREV){ 1548 if(hit == MCHT_CALENDARDATEPREV){ 1542 1549 MONTHCAL_GoToPrevMonth(hwnd, infoPtr); 1543 1550 InvalidateRect(hwnd, NULL, FALSE); … … 1557 1564 MONTHCAL_CopyTime(&nmsc.stSelStart, &infoPtr->minSel); 1558 1565 MONTHCAL_CopyTime(&nmsc.stSelEnd, &infoPtr->maxSel); 1559 1566 1560 1567 SendMessageA(GetParent(hwnd), WM_NOTIFY, 1561 1568 (WPARAM)nmsc.nmhdr.idFrom, (LPARAM)&nmsc); 1562 1569 1563 1570 /* redraw if necessary */ 1564 1571 if(redraw) 1565 1572 InvalidateRect(hwnd, NULL, FALSE); 1566 1573 1567 1574 return 0; 1568 1575 } … … 1579 1586 1580 1587 switch(wParam) { 1581 case MC_NEXTMONTHTIMER: 1588 case MC_NEXTMONTHTIMER: 1582 1589 redraw = TRUE; 1583 1590 MONTHCAL_GoToNextMonth(hwnd, infoPtr); … … 1611 1618 ht.pt.x = LOWORD(lParam); 1612 1619 ht.pt.y = HIWORD(lParam); 1613 1620 1614 1621 hit = MONTHCAL_HitTest(hwnd, (LPARAM)&ht); 1615 1622 1616 1623 /* not on the calendar date numbers? bail out */ 1617 1624 TRACE("hit:%x\n",hit); … … 1631 1638 if(infoPtr->firstSelDay==selArray[0].wDay) i=1; 1632 1639 TRACE("oldRange:%d %d %d %d\n", infoPtr->firstSelDay, selArray[0].wDay, selArray[1].wDay, i); 1633 if(infoPtr->firstSelDay==selArray[1].wDay) { 1640 if(infoPtr->firstSelDay==selArray[1].wDay) { 1634 1641 /* 1st time we get here: selArray[0]=selArray[1]) */ 1635 1642 /* if we're still at the first selected date, return */ … … 1637 1644 if(selday<infoPtr->firstSelDay) i = 0; 1638 1645 } 1639 1646 1640 1647 if(abs(infoPtr->firstSelDay - selday) >= infoPtr->maxSelCount) { 1641 1648 if(selday>infoPtr->firstSelDay) … … 1644 1651 selday = infoPtr->firstSelDay - infoPtr->maxSelCount; 1645 1652 } 1646 1653 1647 1654 if(selArray[i].wDay!=selday) { 1648 1655 TRACE("newRange:%d %d %d %d\n", infoPtr->firstSelDay, selArray[0].wDay, selArray[1].wDay, i); 1649 1656 1650 1657 selArray[i].wDay = selday; 1651 1658 … … 1705 1712 { 1706 1713 TRACE("\n"); 1707 1714 1708 1715 InvalidateRect(hwnd, NULL, FALSE); 1709 1716 … … 1762 1769 1763 1770 /* recalculate the height and width increments and offsets */ 1764 /* FIXME: We use up all available width. This will inhibit having multiple 1765 calendars in a row, like win doesn 1771 /* FIXME: We use up all available width. This will inhibit having multiple 1772 calendars in a row, like win doesn 1766 1773 */ 1767 1774 if(dwStyle & MCS_WEEKNUMBERS) … … 1769 1776 else 1770 1777 xdiv=7.0; 1771 infoPtr->width_increment = (infoPtr->rcDraw.right - infoPtr->rcDraw.left) / xdiv; 1772 infoPtr->height_increment = (infoPtr->rcDraw.bottom - infoPtr->rcDraw.top) / 10.0; 1778 infoPtr->width_increment = (infoPtr->rcDraw.right - infoPtr->rcDraw.left) / xdiv; 1779 infoPtr->height_increment = (infoPtr->rcDraw.bottom - infoPtr->rcDraw.top) / 10.0; 1773 1780 infoPtr->left_offset = (infoPtr->rcDraw.right - infoPtr->rcDraw.left) - (infoPtr->width_increment * xdiv); 1774 1781 infoPtr->top_offset = (infoPtr->rcDraw.bottom - infoPtr->rcDraw.top) - (infoPtr->height_increment * 10.0); … … 1783 1790 rcDraw->bottom = rcDraw->top + 9 * infoPtr->textHeight + 5; 1784 1791 }*/ 1785 1792 1786 1793 /* calculate title area */ 1787 1794 title->top = rcClient->top; … … 1798 1805 next->right = title->right - 6; 1799 1806 next->left = next->right - (title->bottom - title->top); 1800 1807 1801 1808 /* titlemonth->left and right change based upon the current month */ 1802 1809 /* and are recalculated in refresh as the current month may change */ … … 1804 1811 titlemonth->top = titleyear->top = title->top + (infoPtr->height_increment)/2; 1805 1812 titlemonth->bottom = titleyear->bottom = title->bottom - (infoPtr->height_increment)/2; 1806 1813 1807 1814 /* setup the dimensions of the rectangle we draw the names of the */ 1808 1815 /* days of the week in */ 1809 1816 weeknumrect->left =infoPtr->left_offset; 1810 if(dwStyle & MCS_WEEKNUMBERS) 1817 if(dwStyle & MCS_WEEKNUMBERS) 1811 1818 weeknumrect->right=prev->right; 1812 1819 else … … 1816 1823 wdays->top = title->bottom ; 1817 1824 wdays->bottom = wdays->top + infoPtr->height_increment; 1818 1825 1819 1826 days->top = weeknumrect->top = wdays->bottom ; 1820 1827 days->bottom = weeknumrect->bottom = days->top + 6 * infoPtr->height_increment; 1821 1828 1822 1829 todayrect->left = rcClient->left; 1823 1830 todayrect->right = rcClient->right; … … 1825 1832 todayrect->bottom = days->bottom + infoPtr->height_increment; 1826 1833 1827 /* uncomment for excessive debugging 1834 /* uncomment for excessive debugging 1828 1835 TRACE("dx=%d dy=%d rcC[%d %d %d %d] t[%d %d %d %d] wd[%d %d %d %d] w[%d %d %d %d] t[%d %d %d %d]\n", 1829 1830 1831 1832 1833 1834 1836 infoPtr->width_increment,infoPtr->height_increment, 1837 rcClient->left, rcClient->right, rcClient->top, rcClient->bottom, 1838 title->left, title->right, title->top, title->bottom, 1839 wdays->left, wdays->right, wdays->top, wdays->bottom, 1840 days->left, days->right, days->top, days->bottom, 1841 todayrect->left,todayrect->right,todayrect->top,todayrect->bottom); 1835 1842 */ 1836 1843 1837 1844 /* restore the originally selected font */ 1838 SelectObject(hdc, currentFont); 1845 SelectObject(hdc, currentFont); 1839 1846 1840 1847 ReleaseDC(hwnd, hdc); … … 1858 1865 { 1859 1866 MONTHCAL_INFO *infoPtr; 1860 LOGFONTA 1867 LOGFONTA logFont; 1861 1868 1862 1869 /* allocate memory for info structure */ 1870 #ifdef __WIN32OS2__ 1871 infoPtr =(MONTHCAL_INFO*)initControl(hwnd,sizeof(MONTHCAL_INFO)); 1872 #else 1863 1873 infoPtr =(MONTHCAL_INFO*)COMCTL32_Alloc(sizeof(MONTHCAL_INFO)); 1874 #endif 1864 1875 SetWindowLongA(hwnd, 0, (DWORD)infoPtr); 1865 1876 … … 1889 1900 infoPtr->maxSelCount = 7; 1890 1901 infoPtr->monthRange = 3; 1891 infoPtr->monthdayState = COMCTL32_Alloc 1902 infoPtr->monthdayState = COMCTL32_Alloc 1892 1903 (infoPtr->monthRange * sizeof(MONTHDAYSTATE)); 1893 1904 infoPtr->titlebk = GetSysColor(COLOR_ACTIVECAPTION); … … 1896 1907 infoPtr->trailingtxt = GetSysColor(COLOR_GRAYTEXT); 1897 1908 infoPtr->bk = GetSysColor(COLOR_WINDOW); 1898 infoPtr->txt 1909 infoPtr->txt = GetSysColor(COLOR_WINDOWTEXT); 1899 1910 1900 1911 /* call MONTHCAL_UpdateSize to set all of the dimensions */ … … 2051 2062 wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); 2052 2063 wndClass.lpszClassName = MONTHCAL_CLASSA; 2053 2064 2054 2065 RegisterClassA(&wndClass); 2055 2066 } -
TabularUnified trunk/src/comctl32/nativefont.cpp ¶
r3182 r5416 1 /* $Id: nativefont.cpp,v 1. 3 2000-03-21 17:30:43 cbratschiExp $ */1 /* $Id: nativefont.cpp,v 1.4 2001-03-31 13:25:26 sandervl Exp $ */ 2 2 /* 3 3 * Native Font control … … 21 21 #include "ccbase.h" 22 22 #include "nativefont.h" 23 #include "comctl32.h" 23 24 24 25 #define NATIVEFONT_GetInfoPtr(hwnd) ((NATIVEFONT_INFO*)getInfoPtr(hwnd)) -
TabularUnified trunk/src/comctl32/trackbar.cpp ¶
r3970 r5416 1 /* $Id: trackbar.cpp,v 1. 5 2000-08-08 17:05:01 cbratschiExp $ */1 /* $Id: trackbar.cpp,v 1.6 2001-03-31 13:25:27 sandervl Exp $ */ 2 2 /* 3 3 * Trackbar control … … 20 20 #include "ccbase.h" 21 21 #include "trackbar.h" 22 #include "comctl32.h" 22 23 #include <stdio.h> 23 24 -
TabularUnified trunk/src/comctl32/updown.cpp ¶
r3154 r5416 1 /* $Id: updown.cpp,v 1. 2 2000-03-18 16:17:35 cbratschiExp $ */1 /* $Id: updown.cpp,v 1.3 2001-03-31 13:25:27 sandervl Exp $ */ 2 2 /* 3 3 * Updown control … … 39 39 #include "ccbase.h" 40 40 #include "updown.h" 41 #include "comctl32.h" 41 42 42 43 /* Control configuration constants */
Note:
See TracChangeset
for help on using the changeset viewer.