source: trunk/src/comctl32/comboex.c@ 5416

Last change on this file since 5416 was 5416, checked in by sandervl, 24 years ago

Resync with Wine + previous merge fixes

File size: 66.2 KB
Line 
1/*
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)
22 *
23 * Copyright 1998, 1999 Eric Kohl
24 *
25 * NOTES
26 * This is just a dummy control. An author is needed! Any volunteers?
27 * I will only improve this control once in a while.
28 * Eric <ekohl@abo.rhein-zeitung.de>
29 *
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.
51 *
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.
60 *
61 * Test vehicals were the ControlSpy modules (rebar.exe and comboboxex.exe),
62 * and IE 4.0.
63 *
64 */
65
66#include <string.h>
67#include "winbase.h"
68#include "commctrl.h"
69#include "debugtools.h"
70#include "wine/unicode.h"
71
72#ifdef __WIN32OS2__
73#include "ccbase.h"
74#define inline
75#endif
76
77DEFAULT_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 */
82DECLARE_DEBUG_CHANNEL(message);
83
84/* Item structure */
85typedef struct
86{
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;
96} CBE_ITEMDATA;
97
98/* ComboBoxEx structure */
99typedef struct
100{
101#ifdef __WIN32OS2__
102 COMCTL32_HEADER header;
103#endif
104 HIMAGELIST himl;
105 HWND hwndSelf; /* my own hwnd */
106 HWND hwndCombo;
107 HWND hwndEdit;
108 WNDPROC prevEditWndProc; /* previous Edit WNDPROC value */
109 WNDPROC prevComboWndProc; /* previous Combo WNDPROC value */
110 DWORD dwExtStyle;
111 DWORD flags; /* WINE internal flags */
112 HFONT font;
113 INT nb_items; /* Number of items */
114 BOOL bUnicode; /* ASCII (FALSE) or Unicode (TRUE)? */
115 CBE_ITEMDATA *edit; /* item data for edit item */
116 CBE_ITEMDATA *items; /* Array of items */
117} COMBOEX_INFO;
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
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
144
145/* Height in pixels of control over the amount of the selected font */
146#define CBE_EXTRA 3
147
148/* Indent amount per MS documentation */
149#define CBE_INDENT 10
150
151/* Offset in pixels from left side for start of image or text */
152#define CBE_STARTOFFSET 6
153
154/* Offset between image and text */
155#define CBE_SEP 4
156
157#define COMBOEX_GetInfoPtr(hwnd) ((COMBOEX_INFO *)GetWindowLongA (hwnd, 0))
158
159
160/* Things common to the entire DLL */
161static ATOM ComboExInfo;
162static LRESULT WINAPI
163COMBOEX_EditWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
164static LRESULT WINAPI
165COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
166
167static void
168COMBOEX_DumpItem (CBE_ITEMDATA *item)
169{
170 if (TRACE_ON(comboex)){
171 TRACE("item %p - mask=%08x, pszText=%p, cchTM=%d, iImage=%d\n",
172 item, item->mask, item->pszText, item->cchTextMax,
173 item->iImage);
174 TRACE("item %p - iSelectedImage=%d, iOverlay=%d, iIndent=%d, lParam=%08lx\n",
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
183static void
184COMBOEX_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);
200 }
201}
202
203
204inline static LRESULT
205COMBOEX_Forward (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
206{
207 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
208
209 if (infoPtr->hwndCombo)
210 return SendMessageA (infoPtr->hwndCombo, uMsg, wParam, lParam);
211
212 return 0;
213}
214
215
216static INT
217COMBOEX_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
232static void
233COMBOEX_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
248static void
249COMBOEX_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
269static void
270COMBOEX_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);
302}
303
304
305static void
306COMBOEX_ReSize (HWND hwnd, COMBOEX_INFO *infoPtr)
307{
308 SIZE mysize;
309 UINT cy;
310 IMAGEINFO iinfo;
311
312 COMBOEX_GetComboFontSize (infoPtr, &mysize);
313 cy = mysize.cy + CBE_EXTRA;
314 if (infoPtr->himl) {
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);
320 if (infoPtr->hwndCombo)
321 SendMessageW (infoPtr->hwndCombo, CB_SETITEMHEIGHT,
322 (WPARAM) 0, (LPARAM) cy);
323}
324
325
326static void
327COMBOEX_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
342static CBE_ITEMDATA *
343COMBOEX_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
368static void
369COMBOEX_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");
381}
382
383
384/* *** CBEM_xxx message support *** */
385
386
387static LRESULT
388COMBOEX_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}
412
413
414inline static LRESULT
415COMBOEX_GetComboControl (HWND hwnd, WPARAM wParam, LPARAM lParam)
416{
417 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
418
419 TRACE("\n");
420
421 return (LRESULT)infoPtr->hwndCombo;
422}
423
424
425inline static LRESULT
426COMBOEX_GetEditControl (HWND hwnd, WPARAM wParam, LPARAM lParam)
427{
428 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
429
430 if ((GetWindowLongA (hwnd, GWL_STYLE) & CBS_DROPDOWNLIST) != CBS_DROPDOWN)
431 return 0;
432
433 TRACE("-- 0x%x\n", infoPtr->hwndEdit);
434
435 return (LRESULT)infoPtr->hwndEdit;
436}
437
438
439inline static LRESULT
440COMBOEX_GetExtendedStyle (HWND hwnd, WPARAM wParam, LPARAM lParam)
441{
442 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
443
444 TRACE("-- 0x%08lx\n", infoPtr->dwExtStyle);
445
446 return (LRESULT)infoPtr->dwExtStyle;
447}
448
449
450inline static LRESULT
451COMBOEX_GetImageList (HWND hwnd, WPARAM wParam, LPARAM lParam)
452{
453 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
454
455 TRACE("-- 0x%p\n", infoPtr->himl);
456
457 return (LRESULT)infoPtr->himl;
458}
459
460
461static LRESULT
462COMBOEX_GetItemW (HWND hwnd, WPARAM wParam, LPARAM lParam)
463{
464 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
465 COMBOBOXEXITEMW *cit = (COMBOBOXEXITEMW *) lParam;
466 INT index;
467 CBE_ITEMDATA *item;
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
496inline static LRESULT
497COMBOEX_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
524inline static LRESULT
525COMBOEX_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
536inline static LRESULT
537COMBOEX_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
550static LRESULT
551COMBOEX_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);
562
563 /* get real index of item to insert */
564 index = cit->iItem;
565 if (index == -1) index = infoPtr->nb_items;
566 if (index > infoPtr->nb_items) index = infoPtr->nb_items;
567
568 /* get space and chain it in */
569 item = (CBE_ITEMDATA *)COMCTL32_Alloc (sizeof (CBE_ITEMDATA));
570 item->next = NULL;
571 item->pszText = NULL;
572
573 /* locate position to insert new item in */
574 if (index == infoPtr->nb_items) {
575 /* fast path for iItem = -1 */
576 item->next = infoPtr->items;
577 infoPtr->items = item;
578 }
579 else {
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;
594 }
595
596 /* fill in our hidden item structure */
597 item->mask = cit->mask;
598 if (item->mask & CBEIF_TEXT) {
599 LPWSTR str;
600 INT len;
601
602 str = cit->pszText;
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 }
609 item->cchTextMax = cit->cchTextMax;
610 }
611 if (item->mask & CBEIF_IMAGE)
612 item->iImage = cit->iImage;
613 if (item->mask & CBEIF_SELECTEDIMAGE)
614 item->iSelectedImage = cit->iSelectedImage;
615 if (item->mask & CBEIF_OVERLAY)
616 item->iOverlay = cit->iOverlay;
617 if (item->mask & CBEIF_INDENT)
618 item->iIndent = cit->iIndent;
619 if (item->mask & CBEIF_LPARAM)
620 item->lParam = cit->lParam;
621 infoPtr->nb_items++;
622
623 COMBOEX_WarnCallBack (item);
624
625 COMBOEX_DumpItem (item);
626
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);
632
633 return index;
634
635}
636
637
638static LRESULT
639COMBOEX_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
666static LRESULT
667COMBOEX_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
706inline static LRESULT
707COMBOEX_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
725static LRESULT
726COMBOEX_SetItemW (HWND hwnd, WPARAM wParam, LPARAM lParam)
727{
728 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
729 COMBOBOXEXITEMW *cit = (COMBOBOXEXITEMW *) lParam;
730 INT index;
731 CBE_ITEMDATA *item;
732
733 COMBOEX_DumpInput ((COMBOBOXEXITEMA *) cit, TRUE);
734
735 /* get real index of item to insert */
736 index = cit->iItem;
737
738 /* if item number requested does not exist then return failure */
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 */
755 item->mask |= cit->mask;
756 if (cit->mask & CBEIF_TEXT) {
757 LPWSTR str;
758 INT len;
759 WCHAR emptystr[1] = {0};
760
761 str = cit->pszText;
762 if (!str) str=emptystr;
763 len = strlenW(str);
764 if (len > 0) {
765 item->pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
766 strcpyW(item->pszText,str);
767 }
768 item->cchTextMax = cit->cchTextMax;
769 }
770 if (cit->mask & CBEIF_IMAGE)
771 item->iImage = cit->iImage;
772 if (cit->mask & CBEIF_SELECTEDIMAGE)
773 item->iSelectedImage = cit->iSelectedImage;
774 if (cit->mask & CBEIF_OVERLAY)
775 item->iOverlay = cit->iOverlay;
776 if (cit->mask & CBEIF_INDENT)
777 item->iIndent = cit->iIndent;
778 if (cit->mask & CBEIF_LPARAM)
779 cit->lParam = cit->lParam;
780
781 COMBOEX_WarnCallBack (item);
782
783 COMBOEX_DumpItem (item);
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 }
790 return TRUE;
791}
792
793static LRESULT
794COMBOEX_SetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
795{
796 COMBOBOXEXITEMA *cit = (COMBOBOXEXITEMA *) lParam;
797 COMBOBOXEXITEMW citW;
798 LRESULT ret;
799
800 memcpy(&citW,cit,sizeof(COMBOBOXEXITEMA));
801 if (cit->mask & CBEIF_TEXT) {
802 LPSTR str;
803 INT len;
804
805 str = cit->pszText;
806 if (!str) str="";
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 }
812 }
813 ret = COMBOEX_SetItemW(hwnd,wParam,(LPARAM)&citW);;
814
815 if (cit->mask & CBEIF_TEXT)
816 COMCTL32_Free(citW.pszText);
817 return ret;
818}
819
820
821inline static LRESULT
822COMBOEX_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
836
837
838/* *** CB_xxx message support *** */
839
840
841static LRESULT
842COMBOEX_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
883static LRESULT
884COMBOEX_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}
903
904
905static LRESULT
906COMBOEX_SetItemHeight (HWND hwnd, WPARAM wParam, LPARAM lParam)
907{
908 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
909 RECT cb_wrect, cbx_wrect, cbx_crect;
910 LRESULT ret = 0;
911 UINT height;
912
913 /* First, lets forward the message to the normal combo control
914 just like Windows. */
915 if (infoPtr->hwndCombo)
916 SendMessageW (infoPtr->hwndCombo, CB_SETITEMHEIGHT, wParam, lParam);
917
918 GetWindowRect (infoPtr->hwndCombo, &cb_wrect);
919 GetWindowRect (hwnd, &cbx_wrect);
920 GetClientRect (hwnd, &cbx_crect);
921 /* the height of comboex as height of the combo + comboex border */
922 height = cb_wrect.bottom-cb_wrect.top
923 + cbx_wrect.bottom-cbx_wrect.top
924 - (cbx_crect.bottom-cbx_crect.top);
925 TRACE("EX window=(%d,%d)-(%d,%d), client=(%d,%d)-(%d,%d)\n",
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);
928 TRACE("CB window=(%d,%d)-(%d,%d), EX setting=(0,0)-(%d,%d)\n",
929 cb_wrect.left, cb_wrect.top, cb_wrect.right, cb_wrect.bottom,
930 cbx_wrect.right-cbx_wrect.left, height);
931 SetWindowPos (hwnd, HWND_TOP, 0, 0,
932 cbx_wrect.right-cbx_wrect.left,
933 height,
934 SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE);
935
936 return ret;
937}
938
939
940/* *** WM_xxx message support *** */
941
942
943static LRESULT
944COMBOEX_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
945{
946 LPCREATESTRUCTA cs = (LPCREATESTRUCTA) lParam;
947 COMBOEX_INFO *infoPtr;
948 DWORD dwComboStyle;
949 LOGFONTA mylogfont;
950 CBE_ITEMDATA *item;
951 RECT wnrc1, clrc1, cmbwrc;
952 LONG test;
953
954 /* allocate memory for info structure */
955#ifdef __WIN32OS2__
956 infoPtr = (COMBOEX_INFO*)initControl(hwnd,sizeof(COMBOEX_INFO));
957#else
958 infoPtr = (COMBOEX_INFO *)COMCTL32_Alloc (sizeof(COMBOEX_INFO));
959#endif
960 if (infoPtr == NULL) {
961 ERR("could not allocate info memory!\n");
962 return 0;
963 }
964
965 /* initialize info structure */
966
967 infoPtr->items = NULL;
968 infoPtr->nb_items = 0;
969 infoPtr->hwndSelf = hwnd;
970
971 SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
972
973 /* create combo box */
974 dwComboStyle = GetWindowLongA (hwnd, GWL_STYLE) &
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). */
988
989 infoPtr->hwndCombo = CreateWindowA ("ComboBox", "",
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
1072 COMBOEX_ReSize (hwnd, infoPtr);
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;
1105
1106 return 0;
1107}
1108
1109
1110inline static LRESULT
1111COMBOEX_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
1276inline static LRESULT
1277COMBOEX_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
1321}
1322
1323
1324inline static LRESULT
1325COMBOEX_DrawItem (HWND hwnd, WPARAM wParam, LPARAM lParam)
1326{
1327 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
1328 DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)lParam;
1329 CBE_ITEMDATA *item = 0;
1330 SIZE txtsize;
1331 RECT rect;
1332 int drawimage, drawstate;
1333 UINT xbase;
1334 UINT xioff = 0; /* size and spacer of image if any */
1335 IMAGEINFO iinfo;
1336 INT len;
1337
1338 if (!IsWindowEnabled(infoPtr->hwndCombo)) return 0;
1339
1340 /* MSDN says: */
1341 /* "itemID - Specifies the menu item identifier for a menu */
1342 /* item or the index of the item in a list box or combo box. */
1343 /* For an empty list box or combo box, this member can be -1. */
1344 /* This allows the application to draw only the focus */
1345 /* rectangle at the coordinates specified by the rcItem */
1346 /* member even though there are no items in the control. */
1347 /* This indicates to the user whether the list box or combo */
1348 /* box has the focus. How the bits are set in the itemAction */
1349 /* member determines whether the rectangle is to be drawn as */
1350 /* though the list box or combo box has the focus. */
1351 if (dis->itemID == 0xffffffff) {
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" */
1428 if (!TRACE_ON(message)) {
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);
1437 }
1438 COMBOEX_DumpItem (item);
1439
1440 xbase = CBE_STARTOFFSET;
1441 if ((item->mask & CBEIF_INDENT) && (dis->itemState & ODS_COMBOEXLBOX))
1442 xbase += (item->iIndent * CBE_INDENT);
1443 if (item->mask & CBEIF_IMAGE) {
1444 ImageList_GetImageInfo(infoPtr->himl, item->iImage, &iinfo);
1445 xioff = (iinfo.rcImage.right - iinfo.rcImage.left + CBE_SEP);
1446 }
1447
1448 switch (dis->itemAction) {
1449 case ODA_FOCUS:
1450 if (dis->itemState & ODS_SELECTED /*1*/) {
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 }
1477 break;
1478 case ODA_SELECT:
1479 case ODA_DRAWENTIRE:
1480 drawimage = -1;
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;
1556 default:
1557 FIXME("unknown action hwnd=%08x, wparam=%08x, lparam=%08lx, action=%d\n",
1558 hwnd, wParam, lParam, dis->itemAction);
1559 }
1560
1561 return 0;
1562}
1563
1564
1565static LRESULT
1566COMBOEX_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
1567{
1568 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
1569
1570 if (infoPtr->hwndCombo)
1571 DestroyWindow (infoPtr->hwndCombo);
1572
1573 if (infoPtr->edit) {
1574 COMCTL32_Free (infoPtr->edit);
1575 infoPtr->edit = 0;
1576 }
1577
1578 if (infoPtr->items) {
1579 CBE_ITEMDATA *this, *next;
1580
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 }
1589 }
1590
1591 DeleteObject (infoPtr->font);
1592
1593 /* free comboex info data */
1594 COMCTL32_Free (infoPtr);
1595 SetWindowLongA (hwnd, 0, 0);
1596 return 0;
1597}
1598
1599
1600static LRESULT
1601COMBOEX_MeasureItem (HWND hwnd, WPARAM wParam, LPARAM lParam)
1602{
1603 /*COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);*/
1604 MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *) lParam;
1605 HDC hdc;
1606 SIZE mysize;
1607
1608 hdc = GetDC (0);
1609 GetTextExtentPointA (hdc, "W", 1, &mysize);
1610 ReleaseDC (0, hdc);
1611 mis->itemHeight = mysize.cy + CBE_EXTRA;
1612
1613 TRACE("adjusted height hwnd=%08x, height=%d\n",
1614 hwnd, mis->itemHeight);
1615
1616 return 0;
1617}
1618
1619
1620static LRESULT
1621COMBOEX_Size (HWND hwnd, WPARAM wParam, LPARAM lParam)
1622{
1623 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
1624 RECT rect;
1625
1626 GetWindowRect (hwnd, &rect);
1627 TRACE("my rect (%d,%d)-(%d,%d)\n",
1628 rect.left, rect.top, rect.right, rect.bottom);
1629
1630 MoveWindow (infoPtr->hwndCombo, 0, 0, rect.right -rect.left,
1631 rect.bottom - rect.top, TRUE);
1632
1633 COMBOEX_AdjustEditPos (infoPtr);
1634
1635 return 0;
1636}
1637
1638
1639static LRESULT
1640COMBOEX_WindowPosChanging (HWND hwnd, WPARAM wParam, LPARAM lParam)
1641{
1642 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
1643 LRESULT ret;
1644 RECT cbx_wrect, cbx_crect, cb_wrect;
1645 UINT width, height;
1646 WINDOWPOS *wp = (WINDOWPOS *)lParam;
1647
1648 ret = DefWindowProcA (hwnd, WM_WINDOWPOSCHANGING, wParam, lParam);
1649 GetWindowRect (hwnd, &cbx_wrect);
1650 GetClientRect (hwnd, &cbx_crect);
1651 GetWindowRect (infoPtr->hwndCombo, &cb_wrect);
1652
1653 /* width is winpos value + border width of comboex */
1654 width = wp->cx
1655 + (cbx_wrect.right-cbx_wrect.left)
1656 - (cbx_crect.right-cbx_crect.left);
1657
1658 TRACE("EX window=(%d,%d)-(%d,%d), client=(%d,%d)-(%d,%d)\n",
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);
1661 TRACE("CB window=(%d,%d)-(%d,%d), EX setting=(0,0)-(%d,%d)\n",
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
1686static LRESULT WINAPI
1687COMBOEX_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
1886static LRESULT WINAPI
1887COMBOEX_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 }
2104 return 0;
2105}
2106
2107
2108static LRESULT WINAPI
2109COMBOEX_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
2110{
2111 TRACE("hwnd=%x msg=%x wparam=%x lParam=%lx\n", hwnd, uMsg, wParam, lParam);
2112 if (!COMBOEX_GetInfoPtr (hwnd) && (uMsg != WM_CREATE))
2113 return DefWindowProcA (hwnd, uMsg, wParam, lParam);
2114
2115 switch (uMsg)
2116 {
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);
2220
2221 case WM_DRAWITEM:
2222 return COMBOEX_DrawItem (hwnd, wParam, lParam);
2223
2224 case WM_DESTROY:
2225 return COMBOEX_Destroy (hwnd, wParam, lParam);
2226
2227 case WM_MEASUREITEM:
2228 return COMBOEX_MeasureItem (hwnd, wParam, lParam);
2229
2230 case WM_SIZE:
2231 return COMBOEX_Size (hwnd, wParam, lParam);
2232
2233 case WM_WINDOWPOSCHANGING:
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);
2240#ifdef __WIN32OS2__
2241 return defComCtl32ProcA (hwnd, uMsg, wParam, lParam);
2242#else
2243 return DefWindowProcA (hwnd, uMsg, wParam, lParam);
2244#endif
2245 }
2246 return 0;
2247}
2248
2249
2250VOID
2251COMBOEX_Register (void)
2252{
2253 WNDCLASSA wndClass;
2254
2255 ZeroMemory (&wndClass, sizeof(WNDCLASSA));
2256 wndClass.style = CS_GLOBALCLASS;
2257 wndClass.lpfnWndProc = (WNDPROC)COMBOEX_WindowProc;
2258 wndClass.cbClsExtra = 0;
2259 wndClass.cbWndExtra = sizeof(COMBOEX_INFO *);
2260 wndClass.hCursor = LoadCursorA (0, IDC_ARROWA);
2261 wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
2262 wndClass.lpszClassName = WC_COMBOBOXEXA;
2263
2264 RegisterClassA (&wndClass);
2265
2266 ComboExInfo = GlobalAddAtomA("CC32SubclassInfo");
2267}
2268
2269
2270VOID
2271COMBOEX_Unregister (void)
2272{
2273 UnregisterClassA (WC_COMBOBOXEXA, (HINSTANCE)NULL);
2274}
2275
Note: See TracBrowser for help on using the repository browser.