ReactOS 0.4.16-dev-2284-g3529151
combo.c
Go to the documentation of this file.
1/*
2 * Combo controls
3 *
4 * Copyright 1997 Alex Korobka
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 *
20 * TODO:
21 * - CB_SETTOPINDEX
22 */
23
24#include <user32.h>
25
27
28/*
29 * Additional combo box definitions
30 */
31
32#define CB_NOTIFY( lphc, code ) \
33 (SendMessageW((lphc)->owner, WM_COMMAND, \
34 MAKEWPARAM(GetWindowLongPtrW((lphc)->self,GWLP_ID), (code)), (LPARAM)(lphc)->self))
35
36#define CB_DISABLED( lphc ) (!IsWindowEnabled((lphc)->self))
37#define CB_OWNERDRAWN( lphc ) ((lphc)->dwStyle & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE))
38#define CB_HASSTRINGS( lphc ) ((lphc)->dwStyle & CBS_HASSTRINGS)
39#define CB_HWND( lphc ) ((lphc)->self)
40#ifndef __REACTOS__
41/* ReactOS already define in include/controls.h We have it here as a sync note. */
42#define CB_GETTYPE( lphc ) ((lphc)->dwStyle & (CBS_DROPDOWNLIST))
43#endif
44
45#define ISWIN31 (LOWORD(GetVersion()) == 0x0a03)
46
47/*
48 * Drawing globals
49 */
50static HBITMAP hComboBmp = 0;
52
53/*
54 * Look and feel dependent "constants"
55 */
56
57#define COMBO_YBORDERGAP 5
58#define COMBO_XBORDERSIZE() 2
59#define COMBO_YBORDERSIZE() 2
60#define COMBO_EDITBUTTONSPACE() 0
61#define EDIT_CONTROL_PADDING() 1
62
63/*********************************************************************
64 * combo class descriptor
65 */
66static const WCHAR comboboxW[] = {'C','o','m','b','o','B','o','x',0};
68{
69 comboboxW, /* name */
71#ifdef __REACTOS__
72 ComboWndProcA, /* procA */
73 ComboWndProcW, /* procW */
74#else
75 WINPROC_COMBO, /* proc */
76#endif
77 sizeof(HEADCOMBO *), /* extra */
78 IDC_ARROW, /* cursor */
79 0 /* brush */
80};
81
82
83/***********************************************************************
84 * COMBO_Init
85 *
86 * Load combo button bitmap.
87 */
88static BOOL COMBO_Init(void)
89{
90 HDC hDC;
91
92 if( hComboBmp ) return TRUE;
93 if( (hDC = CreateCompatibleDC(0)) )
94 {
95 BOOL bRet = FALSE;
96 if( (hComboBmp = LoadBitmapW(0, MAKEINTRESOURCEW(OBM_COMBO))) )
97 {
98 BITMAP bm;
99 HBITMAP hPrevB;
100 RECT r;
101
102 GetObjectW( hComboBmp, sizeof(bm), &bm );
103 CBitHeight = bm.bmHeight;
104 CBitWidth = bm.bmWidth;
105
106 TRACE("combo bitmap [%i,%i]\n", CBitWidth, CBitHeight );
107
108 hPrevB = SelectObject( hDC, hComboBmp);
109 SetRect( &r, 0, 0, CBitWidth, CBitHeight );
110 InvertRect( hDC, &r );
111 SelectObject( hDC, hPrevB );
112 bRet = TRUE;
113 }
114 DeleteDC( hDC );
115 return bRet;
116 }
117 return FALSE;
118}
119
120#ifdef __REACTOS__
121/* Retrieve the UI state for the control */
122static BOOL COMBO_update_uistate(LPHEADCOMBO lphc)
123{
124 LONG prev_flags;
125
126 prev_flags = lphc->UIState;
127 lphc->UIState = DefWindowProcW(lphc->self, WM_QUERYUISTATE, 0, 0);
128 return prev_flags != lphc->UIState;
129}
130#endif
131
132/***********************************************************************
133 * COMBO_NCCreate
134 */
136{
137 LPHEADCOMBO lphc;
138
139 if (COMBO_Init() && (lphc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(HEADCOMBO))) )
140 {
141 lphc->self = hwnd;
142 SetWindowLongPtrW( hwnd, 0, (LONG_PTR)lphc );
143
144#ifdef __REACTOS__
145 COMBO_update_uistate(lphc);
146#endif
147
148 /* some braindead apps do try to use scrollbar/border flags */
149
150 lphc->dwStyle = style & ~(WS_BORDER | WS_HSCROLL | WS_VSCROLL);
152
153 /*
154 * We also have to remove the client edge style to make sure
155 * we don't end-up with a non client area.
156 */
159
161 lphc->dwStyle |= CBS_HASSTRINGS;
163 lphc->wState |= CBF_NOTIFY;
164
165 TRACE("[%p], style = %08x\n", lphc, lphc->dwStyle );
166 return TRUE;
167 }
168 return FALSE;
169}
170
171/***********************************************************************
172 * COMBO_NCDestroy
173 */
175{
176 if (lphc)
177 {
178 TRACE("[%p]: freeing storage\n", lphc->self);
179
180 if ( (CB_GETTYPE(lphc) != CBS_SIMPLE) && lphc->hWndLBox )
181 DestroyWindow( lphc->hWndLBox );
182
183 SetWindowLongPtrW( lphc->self, 0, 0 );
184 HeapFree( GetProcessHeap(), 0, lphc );
185 }
186 return 0;
187}
188
189/***********************************************************************
190 * CBGetTextAreaHeight
191 *
192 * This method will calculate the height of the text area of the
193 * combobox.
194 * The height of the text area is set in two ways.
195 * It can be set explicitly through a combobox message or through a
196 * WM_MEASUREITEM callback.
197 * If this is not the case, the height is set to font height + 4px
198 * This height was determined through experimentation.
199 * CBCalcPlacement will add 2*COMBO_YBORDERSIZE pixels for the border
200 */
202 HWND hwnd,
203 LPHEADCOMBO lphc)
204{
205 INT iTextItemHeight;
206
207 if( lphc->editHeight ) /* explicitly set height */
208 {
209 iTextItemHeight = lphc->editHeight;
210 }
211 else
212 {
214 HDC hDC = GetDC(hwnd);
215 HFONT hPrevFont = 0;
216 INT baseUnitY;
217
218 if (lphc->hFont)
219 hPrevFont = SelectObject( hDC, lphc->hFont );
220
222
223 baseUnitY = tm.tmHeight;
224
225 if( hPrevFont )
226 SelectObject( hDC, hPrevFont );
227
229
230 iTextItemHeight = baseUnitY + 4;
231 }
232
233 /*
234 * Check the ownerdraw case if we haven't asked the parent the size
235 * of the item yet.
236 */
237 if ( CB_OWNERDRAWN(lphc) &&
238 (lphc->wState & CBF_MEASUREITEM) )
239 {
240 MEASUREITEMSTRUCT measureItem;
241 RECT clientRect;
242 INT originalItemHeight = iTextItemHeight;
243 UINT id = (UINT)GetWindowLongPtrW( lphc->self, GWLP_ID );
244
245 /*
246 * We use the client rect for the width of the item.
247 */
248 GetClientRect(hwnd, &clientRect);
249
250 lphc->wState &= ~CBF_MEASUREITEM;
251
252 /*
253 * Send a first one to measure the size of the text area
254 */
255 measureItem.CtlType = ODT_COMBOBOX;
256 measureItem.CtlID = id;
257 measureItem.itemID = -1;
258 measureItem.itemWidth = clientRect.right;
259 measureItem.itemHeight = iTextItemHeight - 6; /* ownerdrawn cb is taller */
260 measureItem.itemData = 0;
261 SendMessageW(lphc->owner, WM_MEASUREITEM, id, (LPARAM)&measureItem);
262 iTextItemHeight = 6 + measureItem.itemHeight;
263
264 /*
265 * Send a second one in the case of a fixed ownerdraw list to calculate the
266 * size of the list items. (we basically do this on behalf of the listbox)
267 */
268 if (lphc->dwStyle & CBS_OWNERDRAWFIXED)
269 {
270 measureItem.CtlType = ODT_COMBOBOX;
271 measureItem.CtlID = id;
272 measureItem.itemID = 0;
273 measureItem.itemWidth = clientRect.right;
274 measureItem.itemHeight = originalItemHeight;
275 measureItem.itemData = 0;
276 SendMessageW(lphc->owner, WM_MEASUREITEM, id, (LPARAM)&measureItem);
277 lphc->fixedOwnerDrawHeight = measureItem.itemHeight;
278 }
279
280 /*
281 * Keep the size for the next time
282 */
283 lphc->editHeight = iTextItemHeight;
284 }
285
286 return iTextItemHeight;
287}
288
289/***********************************************************************
290 * CBForceDummyResize
291 *
292 * The dummy resize is used for listboxes that have a popup to trigger
293 * a re-arranging of the contents of the combobox and the recalculation
294 * of the size of the "real" control window.
295 */
297 LPHEADCOMBO lphc)
298{
299 RECT windowRect;
300 int newComboHeight;
301
302 newComboHeight = CBGetTextAreaHeight(lphc->self,lphc) + 2*COMBO_YBORDERSIZE();
303
304 GetWindowRect(lphc->self, &windowRect);
305
306 /*
307 * We have to be careful, resizing a combobox also has the meaning that the
308 * dropped rect will be resized. In this case, we want to trigger a resize
309 * to recalculate layout but we don't want to change the dropped rectangle
310 * So, we pass the height of text area of control as the height.
311 * this will cancel-out in the processing of the WM_WINDOWPOSCHANGING
312 * message.
313 */
314 SetWindowPos( lphc->self,
315 NULL,
316 0, 0,
317 windowRect.right - windowRect.left,
318 newComboHeight,
320}
321
322/***********************************************************************
323 * CBCalcPlacement
324 *
325 * Set up component coordinates given valid lphc->RectCombo.
326 */
327static void CBCalcPlacement(
328 HWND hwnd,
329 LPHEADCOMBO lphc,
330 LPRECT lprEdit,
331 LPRECT lprButton,
332 LPRECT lprLB)
333{
334 /*
335 * Again, start with the client rectangle.
336 */
337 GetClientRect(hwnd, lprEdit);
338
339 /*
340 * Remove the borders
341 */
343
344 /*
345 * Chop off the bottom part to fit with the height of the text area.
346 */
347 lprEdit->bottom = lprEdit->top + CBGetTextAreaHeight(hwnd, lphc);
348
349 /*
350 * The button starts the same vertical position as the text area.
351 */
352 CopyRect(lprButton, lprEdit);
353
354 /*
355 * If the combobox is "simple" there is no button.
356 */
357 if( CB_GETTYPE(lphc) == CBS_SIMPLE )
358 lprButton->left = lprButton->right = lprButton->bottom = 0;
359 else
360 {
361 /*
362 * Let's assume the combobox button is the same width as the
363 * scrollbar button.
364 * size the button horizontally and cut-off the text area.
365 */
366 lprButton->left = lprButton->right - GetSystemMetrics(SM_CXVSCROLL);
367 lprEdit->right = lprButton->left;
368 }
369
370 /*
371 * In the case of a dropdown, there is an additional spacing between the
372 * text area and the button.
373 */
374 if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
375 {
376 lprEdit->right -= COMBO_EDITBUTTONSPACE();
377 }
378
379 /*
380 * If we have an edit control, we space it away from the borders slightly.
381 */
382 if (CB_GETTYPE(lphc) != CBS_DROPDOWNLIST)
383 {
385 }
386
387 /*
388 * Adjust the size of the listbox popup.
389 */
390 if( CB_GETTYPE(lphc) == CBS_SIMPLE )
391 {
392 /*
393 * Use the client rectangle to initialize the listbox rectangle
394 */
395 GetClientRect(hwnd, lprLB);
396
397 /*
398 * Then, chop-off the top part.
399 */
400 lprLB->top = lprEdit->bottom + COMBO_YBORDERSIZE();
401 }
402 else
403 {
404 /*
405 * Make sure the dropped width is as large as the combobox itself.
406 */
407 if (lphc->droppedWidth < (lprButton->right + COMBO_XBORDERSIZE()))
408 {
409 lprLB->right = lprLB->left + (lprButton->right + COMBO_XBORDERSIZE());
410
411 /*
412 * In the case of a dropdown, the popup listbox is offset to the right.
413 * so, we want to make sure it's flush with the right side of the
414 * combobox
415 */
416 if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
417 lprLB->right -= COMBO_EDITBUTTONSPACE();
418 }
419 else
420 lprLB->right = lprLB->left + lphc->droppedWidth;
421 }
422
423 /* don't allow negative window width */
424 if (lprEdit->right < lprEdit->left)
425 lprEdit->right = lprEdit->left;
426
427 TRACE("\ttext\t= (%s)\n", wine_dbgstr_rect(lprEdit));
428
429 TRACE("\tbutton\t= (%s)\n", wine_dbgstr_rect(lprButton));
430
431 TRACE("\tlbox\t= (%s)\n", wine_dbgstr_rect(lprLB));
432}
433
434/***********************************************************************
435 * CBGetDroppedControlRect
436 */
438{
439 /* In windows, CB_GETDROPPEDCONTROLRECT returns the upper left corner
440 of the combo box and the lower right corner of the listbox */
441
442 GetWindowRect(lphc->self, lpRect);
443
444 lpRect->right = lpRect->left + lphc->droppedRect.right - lphc->droppedRect.left;
445 lpRect->bottom = lpRect->top + lphc->droppedRect.bottom - lphc->droppedRect.top;
446
447}
448
449/***********************************************************************
450 * COMBO_Create
451 */
453 BOOL unicode )
454{
455 static const WCHAR clbName[] = {'C','o','m','b','o','L','B','o','x',0};
456 static const WCHAR editName[] = {'E','d','i','t',0};
457
458 if( !CB_GETTYPE(lphc) ) lphc->dwStyle |= CBS_SIMPLE;
459 if( CB_GETTYPE(lphc) != CBS_DROPDOWNLIST ) lphc->wState |= CBF_EDIT;
460
461 lphc->owner = hwndParent;
462
463 /*
464 * The item height and dropped width are not set when the control
465 * is created.
466 */
467 lphc->droppedWidth = lphc->editHeight = 0;
468
469 /*
470 * The first time we go through, we want to measure the ownerdraw item
471 */
472 lphc->wState |= CBF_MEASUREITEM;
473
474 /* M$ IE 3.01 actually creates (and rapidly destroys) an ownerless combobox */
475
476#ifdef __REACTOS__
477 if(TRUE)
478#else
479 if( lphc->owner || !(style & WS_VISIBLE) )
480#endif
481 {
482 UINT lbeStyle = 0;
483 UINT lbeExStyle = 0;
484
485 /*
486 * Initialize the dropped rect to the size of the client area of the
487 * control and then, force all the areas of the combobox to be
488 * recalculated.
489 */
490 GetClientRect( hwnd, &lphc->droppedRect );
491 CBCalcPlacement(hwnd, lphc, &lphc->textRect, &lphc->buttonRect, &lphc->droppedRect );
492
493 /*
494 * Adjust the position of the popup listbox if it's necessary
495 */
496 if ( CB_GETTYPE(lphc) != CBS_SIMPLE )
497 {
499
500 /*
501 * If it's a dropdown, the listbox is offset
502 */
503 if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
505
506 if (lphc->droppedRect.bottom < lphc->droppedRect.top)
507 lphc->droppedRect.bottom = lphc->droppedRect.top;
508 if (lphc->droppedRect.right < lphc->droppedRect.left)
509 lphc->droppedRect.right = lphc->droppedRect.left;
510 MapWindowPoints( hwnd, 0, (LPPOINT)&lphc->droppedRect, 2 );
511 }
512
513 /* create listbox popup */
514
517
518 if( lphc->dwStyle & CBS_SORT )
519 lbeStyle |= LBS_SORT;
520 if( lphc->dwStyle & CBS_HASSTRINGS )
521 lbeStyle |= LBS_HASSTRINGS;
522 if( lphc->dwStyle & CBS_NOINTEGRALHEIGHT )
523 lbeStyle |= LBS_NOINTEGRALHEIGHT;
524 if( lphc->dwStyle & CBS_DISABLENOSCROLL )
525 lbeStyle |= LBS_DISABLENOSCROLL;
526
527 if( CB_GETTYPE(lphc) == CBS_SIMPLE ) /* child listbox */
528 {
529 lbeStyle |= WS_VISIBLE;
530
531 /*
532 * In win 95 look n feel, the listbox in the simple combobox has
533 * the WS_EXCLIENTEDGE style instead of the WS_BORDER style.
534 */
535 lbeStyle &= ~WS_BORDER;
536 lbeExStyle |= WS_EX_CLIENTEDGE;
537 }
538 else
539 {
540 lbeExStyle |= (WS_EX_TOPMOST | WS_EX_TOOLWINDOW);
541 }
542
543 if (unicode)
544 lphc->hWndLBox = CreateWindowExW(lbeExStyle, clbName, NULL, lbeStyle,
545 lphc->droppedRect.left,
546 lphc->droppedRect.top,
547 lphc->droppedRect.right - lphc->droppedRect.left,
548 lphc->droppedRect.bottom - lphc->droppedRect.top,
551 else
552 lphc->hWndLBox = CreateWindowExA(lbeExStyle, "ComboLBox", NULL, lbeStyle,
553 lphc->droppedRect.left,
554 lphc->droppedRect.top,
555 lphc->droppedRect.right - lphc->droppedRect.left,
556 lphc->droppedRect.bottom - lphc->droppedRect.top,
559
560 if( lphc->hWndLBox )
561 {
562 BOOL bEdit = TRUE;
564
565 if( lphc->wState & CBF_EDIT )
566 {
567 if( lphc->dwStyle & CBS_OEMCONVERT )
568 lbeStyle |= ES_OEMCONVERT;
569 if( lphc->dwStyle & CBS_AUTOHSCROLL )
570 lbeStyle |= ES_AUTOHSCROLL;
571 if( lphc->dwStyle & CBS_LOWERCASE )
572 lbeStyle |= ES_LOWERCASE;
573 else if( lphc->dwStyle & CBS_UPPERCASE )
574 lbeStyle |= ES_UPPERCASE;
575
576 if (!IsWindowEnabled(hwnd)) lbeStyle |= WS_DISABLED;
577
578 if (unicode)
579 lphc->hWndEdit = CreateWindowExW(0, editName, NULL, lbeStyle,
580 lphc->textRect.left, lphc->textRect.top,
581 lphc->textRect.right - lphc->textRect.left,
582 lphc->textRect.bottom - lphc->textRect.top,
585 else
586 lphc->hWndEdit = CreateWindowExA(0, "Edit", NULL, lbeStyle,
587 lphc->textRect.left, lphc->textRect.top,
588 lphc->textRect.right - lphc->textRect.left,
589 lphc->textRect.bottom - lphc->textRect.top,
592
593 if( !lphc->hWndEdit )
594 bEdit = FALSE;
595 }
596
597 if( bEdit )
598 {
599 if( CB_GETTYPE(lphc) != CBS_SIMPLE )
600 {
601 /* Now do the trick with parent */
603 /*
604 * If the combo is a dropdown, we must resize the control
605 * to fit only the text area and button. To do this,
606 * we send a dummy resize and the WM_WINDOWPOSCHANGING message
607 * will take care of setting the height for us.
608 */
609 CBForceDummyResize(lphc);
610 }
611
612 TRACE("init done\n");
613 return 0;
614 }
615 ERR("edit control failure.\n");
616 } else ERR("listbox failure.\n");
617 } else ERR("no owner for visible combo.\n");
618
619 /* CreateWindow() will send WM_NCDESTROY to cleanup */
620
621 return -1;
622}
623
624/***********************************************************************
625 * CBPaintButton
626 *
627 * Paint combo button (normal, pressed, and disabled states).
628 */
629static void CBPaintButton( LPHEADCOMBO lphc, HDC hdc, RECT rectButton)
630{
631 UINT buttonState = DFCS_SCROLLCOMBOBOX;
632
633 if( lphc->wState & CBF_NOREDRAW )
634 return;
635
636
637 if (lphc->wState & CBF_BUTTONDOWN)
638 buttonState |= DFCS_PUSHED;
639
640 if (CB_DISABLED(lphc))
641 buttonState |= DFCS_INACTIVE;
642
643 DrawFrameControl(hdc, &rectButton, DFC_SCROLL, buttonState);
644}
645
646/***********************************************************************
647 * COMBO_PrepareColors
648 *
649 * This method will sent the appropriate WM_CTLCOLOR message to
650 * prepare and setup the colors for the combo's DC.
651 *
652 * It also returns the brush to use for the background.
653 */
655 LPHEADCOMBO lphc,
656 HDC hDC)
657{
658 HBRUSH hBkgBrush;
659
660 /*
661 * Get the background brush for this control.
662 */
663 if (CB_DISABLED(lphc))
664 {
665#ifdef __REACTOS__
666 hBkgBrush = GetControlColor(lphc->owner, lphc->self, hDC, WM_CTLCOLORSTATIC);
667#else
668 hBkgBrush = (HBRUSH)SendMessageW(lphc->owner, WM_CTLCOLORSTATIC,
669 (WPARAM)hDC, (LPARAM)lphc->self );
670#endif
671 /*
672 * We have to change the text color since WM_CTLCOLORSTATIC will
673 * set it to the "enabled" color. This is the same behavior as the
674 * edit control
675 */
677 }
678 else
679 {
680 /* FIXME: In which cases WM_CTLCOLORLISTBOX should be sent? */
681#ifdef __REACTOS__
682 hBkgBrush = GetControlColor(lphc->owner, lphc->self, hDC, WM_CTLCOLOREDIT);
683#else
684 hBkgBrush = (HBRUSH)SendMessageW(lphc->owner, WM_CTLCOLOREDIT,
685 (WPARAM)hDC, (LPARAM)lphc->self );
686#endif
687 }
688
689 /*
690 * Catch errors.
691 */
692 if( !hBkgBrush )
693 hBkgBrush = GetSysColorBrush(COLOR_WINDOW);
694
695 return hBkgBrush;
696}
697
698/***********************************************************************
699 * CBPaintText
700 *
701 * Paint CBS_DROPDOWNLIST text field / update edit control contents.
702 */
703static void CBPaintText(
704 LPHEADCOMBO lphc,
705 HDC hdc_paint)
706{
707 RECT rectEdit = lphc->textRect;
708 INT id, size = 0;
709 LPWSTR pText = NULL;
710
711 TRACE("\n");
712
713 /* follow Windows combobox that sends a bunch of text
714 * inquiries to its listbox while processing WM_PAINT. */
715
716 if( (id = SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0) ) != LB_ERR )
717 {
718 size = SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, id, 0);
719 if (size == LB_ERR)
720 FIXME("LB_ERR probably not handled yet\n");
721 if( (pText = HeapAlloc( GetProcessHeap(), 0, (size + 1) * sizeof(WCHAR))) )
722 {
723 /* size from LB_GETTEXTLEN may be too large, from LB_GETTEXT is accurate */
725 pText[size] = '\0'; /* just in case */
726 } else return;
727 }
728
729 if( lphc->wState & CBF_EDIT )
730 {
731 static const WCHAR empty_stringW[] = { 0 };
733 if( lphc->wState & CBF_FOCUSED )
735 }
736 else if(!(lphc->wState & CBF_NOREDRAW) && IsWindowVisible( lphc->self ))
737 {
738 /* paint text field ourselves */
739 HDC hdc = hdc_paint ? hdc_paint : GetDC(lphc->self);
740 UINT itemState = ODS_COMBOBOXEDIT;
741 HFONT hPrevFont = (lphc->hFont) ? SelectObject(hdc, lphc->hFont) : 0;
742 HBRUSH hPrevBrush, hBkgBrush;
743
744 /*
745 * Give ourselves some space.
746 */
747 InflateRect( &rectEdit, -1, -1 );
748
749 hBkgBrush = COMBO_PrepareColors( lphc, hdc );
750 hPrevBrush = SelectObject( hdc, hBkgBrush );
751 FillRect( hdc, &rectEdit, hBkgBrush );
752
753 if( CB_OWNERDRAWN(lphc) )
754 {
755 DRAWITEMSTRUCT dis;
756 HRGN clipRegion;
757 UINT ctlid = (UINT)GetWindowLongPtrW( lphc->self, GWLP_ID );
758
759 /* setup state for DRAWITEM message. Owner will highlight */
760 if ( (lphc->wState & CBF_FOCUSED) &&
761 !(lphc->wState & CBF_DROPPED) )
762 itemState |= ODS_SELECTED | ODS_FOCUS;
763
764 if (!IsWindowEnabled(lphc->self)) itemState |= ODS_DISABLED;
765
766 dis.CtlType = ODT_COMBOBOX;
767 dis.CtlID = ctlid;
768 dis.hwndItem = lphc->self;
770 dis.itemID = id;
771 dis.itemState = itemState;
772 dis.hDC = hdc;
773 dis.rcItem = rectEdit;
774 dis.itemData = SendMessageW(lphc->hWndLBox, LB_GETITEMDATA, id, 0);
775
776 /*
777 * Clip the DC and have the parent draw the item.
778 */
779 clipRegion = set_control_clipping( hdc, &rectEdit );
780
781 SendMessageW(lphc->owner, WM_DRAWITEM, ctlid, (LPARAM)&dis );
782
783 SelectClipRgn( hdc, clipRegion );
784 if (clipRegion) DeleteObject( clipRegion );
785 }
786 else
787 {
788 static const WCHAR empty_stringW[] = { 0 };
789
790 if ( (lphc->wState & CBF_FOCUSED) &&
791 !(lphc->wState & CBF_DROPPED) ) {
792
793 /* highlight */
797 }
798
800 rectEdit.left + 1,
801 rectEdit.top + 1,
803 &rectEdit,
805
806#ifdef __REACTOS__
807 if(lphc->wState & CBF_FOCUSED &&
808 !(lphc->wState & CBF_DROPPED) &&
809 !(lphc->UIState & UISF_HIDEFOCUS))
810#else
811 if(lphc->wState & CBF_FOCUSED && !(lphc->wState & CBF_DROPPED))
812#endif
813 DrawFocusRect( hdc, &rectEdit );
814 }
815
816 if( hPrevFont )
817 SelectObject(hdc, hPrevFont );
818
819 if( hPrevBrush )
820 SelectObject( hdc, hPrevBrush );
821
822 if( !hdc_paint )
823 ReleaseDC( lphc->self, hdc );
824 }
825#ifdef __REACTOS__
826 if (pText)
827#endif
829}
830
831/***********************************************************************
832 * CBPaintBorder
833 */
834static void CBPaintBorder(
835 HWND hwnd,
836 const HEADCOMBO *lphc,
837 HDC hdc)
838{
839 RECT clientRect;
840
841 if (CB_GETTYPE(lphc) != CBS_SIMPLE)
842 {
843 GetClientRect(hwnd, &clientRect);
844 }
845 else
846 {
847 CopyRect(&clientRect, &lphc->textRect);
848
851 }
852
853 DrawEdge(hdc, &clientRect, EDGE_SUNKEN, BF_RECT);
854}
855
856/***********************************************************************
857 * COMBO_Paint
858 */
859static LRESULT COMBO_Paint(LPHEADCOMBO lphc, HDC hParamDC)
860{
861 PAINTSTRUCT ps;
862 HDC hDC;
863
864 hDC = (hParamDC) ? hParamDC : BeginPaint(lphc->self, &ps);
865
866 TRACE("hdc=%p\n", hDC);
867
868 if( hDC && !(lphc->wState & CBF_NOREDRAW) )
869 {
870 HBRUSH hPrevBrush, hBkgBrush;
871
872 /*
873 * Retrieve the background brush and select it in the
874 * DC.
875 */
876 hBkgBrush = COMBO_PrepareColors(lphc, hDC);
877 hPrevBrush = SelectObject(hDC, hBkgBrush);
878 if (!(lphc->wState & CBF_EDIT))
879 FillRect(hDC, &lphc->textRect, hBkgBrush);
880
881 /*
882 * In non 3.1 look, there is a sunken border on the combobox
883 */
884 CBPaintBorder(lphc->self, lphc, hDC);
885
886 if (!IsRectEmpty(&lphc->buttonRect))
887 CBPaintButton(lphc, hDC, lphc->buttonRect);
888
889 /* paint the edit control padding area */
890 if (CB_GETTYPE(lphc) != CBS_DROPDOWNLIST)
891 {
892 RECT rPadEdit = lphc->textRect;
893
895
897 }
898
899 if (!(lphc->wState & CBF_EDIT))
900 CBPaintText( lphc, hDC );
901
902 if (hPrevBrush)
903 SelectObject( hDC, hPrevBrush );
904 }
905
906 if( !hParamDC )
907 EndPaint(lphc->self, &ps);
908
909 return 0;
910}
911
912/***********************************************************************
913 * CBUpdateLBox
914 *
915 * Select listbox entry according to the contents of the edit control.
916 */
917static INT CBUpdateLBox( LPHEADCOMBO lphc, BOOL bSelect )
918{
919 INT length, idx;
920 LPWSTR pText = NULL;
921
922 idx = LB_ERR;
924
925 if (length > 0)
926 pText = HeapAlloc( GetProcessHeap(), 0, (length + 1) * sizeof(WCHAR));
927
928 TRACE("\t edit text length %i\n", length );
929
930 if( pText )
931 {
932 GetWindowTextW( lphc->hWndEdit, pText, length + 1);
935 }
936
937 SendMessageW(lphc->hWndLBox, LB_SETCURSEL, (WPARAM)(bSelect ? idx : -1), 0);
938
939 /* probably superfluous but Windows sends this too */
940 SendMessageW(lphc->hWndLBox, LB_SETCARETINDEX, (WPARAM)(idx < 0 ? 0 : idx), 0);
941 SendMessageW(lphc->hWndLBox, LB_SETTOPINDEX, (WPARAM)(idx < 0 ? 0 : idx), 0);
942
943 return idx;
944}
945
946/***********************************************************************
947 * CBUpdateEdit
948 *
949 * Copy a listbox entry to the edit control.
950 */
951static void CBUpdateEdit( LPHEADCOMBO lphc , INT index )
952{
953 INT length;
954 LPWSTR pText = NULL;
955 static const WCHAR empty_stringW[] = { 0 };
956
957 TRACE("\t %i\n", index );
958
959 if( index >= 0 ) /* got an entry */
960 {
962 if( length != LB_ERR)
963 {
964 if ((pText = HeapAlloc(GetProcessHeap(), 0, (length + 1) * sizeof(WCHAR))))
966 }
967 }
968
969 if( CB_HASSTRINGS(lphc) )
970 {
974 }
975
976 if( lphc->wState & CBF_FOCUSED )
977 SendMessageW(lphc->hWndEdit, EM_SETSEL, 0, (LPARAM)(-1));
978
980}
981
982/***********************************************************************
983 * CBDropDown
984 *
985 * Show listbox popup.
986 */
987static void CBDropDown( LPHEADCOMBO lphc )
988{
989 HMONITOR monitor;
990 MONITORINFO mon_info;
991 RECT rect,r;
992 int nItems = 0;
993 int nDroppedHeight;
994
995 TRACE("[%p]: drop down\n", lphc->self);
996
997 CB_NOTIFY( lphc, CBN_DROPDOWN );
998
999 /* set selection */
1000
1001 lphc->wState |= CBF_DROPPED;
1002 if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
1003 {
1004 lphc->droppedIndex = CBUpdateLBox( lphc, TRUE );
1005
1006 /* Update edit only if item is in the list */
1007 if( !(lphc->wState & CBF_CAPTURE) && lphc->droppedIndex >= 0)
1008 CBUpdateEdit( lphc, lphc->droppedIndex );
1009 }
1010 else
1011 {
1012 lphc->droppedIndex = SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
1013
1015 (WPARAM)(lphc->droppedIndex == LB_ERR ? 0 : lphc->droppedIndex), 0);
1016 SendMessageW(lphc->hWndLBox, LB_CARETON, 0, 0);
1017 }
1018
1019 /* now set popup position */
1020 GetWindowRect( lphc->self, &rect );
1021
1022 /*
1023 * If it's a dropdown, the listbox is offset
1024 */
1025 if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
1026 rect.left += COMBO_EDITBUTTONSPACE();
1027
1028 /* if the dropped height is greater than the total height of the dropped
1029 items list, then force the drop down list height to be the total height
1030 of the items in the dropped list */
1031
1032 /* And Remove any extra space (Best Fit) */
1033 nDroppedHeight = lphc->droppedRect.bottom - lphc->droppedRect.top;
1034 /* if listbox length has been set directly by its handle */
1035 GetWindowRect(lphc->hWndLBox, &r);
1036 if (nDroppedHeight < r.bottom - r.top)
1037 nDroppedHeight = r.bottom - r.top;
1038 nItems = (int)SendMessageW(lphc->hWndLBox, LB_GETCOUNT, 0, 0);
1039
1040 if (nItems > 0)
1041 {
1042 int nHeight;
1043 int nIHeight;
1044
1045 nIHeight = (int)SendMessageW(lphc->hWndLBox, LB_GETITEMHEIGHT, 0, 0);
1046
1047 nHeight = nIHeight*nItems;
1048
1049 if (nHeight < nDroppedHeight - COMBO_YBORDERSIZE())
1050 nDroppedHeight = nHeight + COMBO_YBORDERSIZE();
1051 }
1052
1053 r.left = rect.left;
1054 r.top = rect.bottom;
1055 r.right = r.left + lphc->droppedRect.right - lphc->droppedRect.left;
1056 r.bottom = r.top + nDroppedHeight;
1057
1058 /*If height of dropped rectangle gets beyond a screen size it should go up, otherwise down.*/
1059 monitor = MonitorFromRect( &rect, MONITOR_DEFAULTTOPRIMARY );
1060 mon_info.cbSize = sizeof(mon_info);
1061 GetMonitorInfoW( monitor, &mon_info );
1062
1063 if (r.bottom > mon_info.rcWork.bottom)
1064 {
1065 r.top = max( rect.top - nDroppedHeight, mon_info.rcWork.top );
1066 r.bottom = min( r.top + nDroppedHeight, mon_info.rcWork.bottom );
1067 }
1068
1069 SetWindowPos( lphc->hWndLBox, HWND_TOPMOST, r.left, r.top, r.right - r.left, r.bottom - r.top,
1071
1072
1073 if( !(lphc->wState & CBF_NOREDRAW) )
1075
1076 EnableWindow( lphc->hWndLBox, TRUE );
1077 if (GetCapture() != lphc->self)
1078 SetCapture(lphc->hWndLBox);
1079}
1080
1081/***********************************************************************
1082 * CBRollUp
1083 *
1084 * Hide listbox popup.
1085 */
1086static void CBRollUp( LPHEADCOMBO lphc, BOOL ok, BOOL bButton )
1087{
1088 HWND hWnd = lphc->self;
1089
1090 TRACE("[%p]: sel ok? [%i] dropped? [%i]\n",
1091 lphc->self, ok, (INT)(lphc->wState & CBF_DROPPED));
1092
1094
1095 if( IsWindow( hWnd ) && CB_GETTYPE(lphc) != CBS_SIMPLE )
1096 {
1097
1098 if( lphc->wState & CBF_DROPPED )
1099 {
1100 RECT rect;
1101
1102 lphc->wState &= ~CBF_DROPPED;
1103 ShowWindow( lphc->hWndLBox, SW_HIDE );
1104
1105 if(GetCapture() == lphc->hWndLBox)
1106 {
1108 }
1109
1110 if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
1111 {
1112 rect = lphc->buttonRect;
1113 }
1114 else
1115 {
1116 if( bButton )
1117 {
1118 UnionRect( &rect,
1119 &lphc->buttonRect,
1120 &lphc->textRect);
1121 }
1122 else
1123 rect = lphc->textRect;
1124
1125 bButton = TRUE;
1126 }
1127
1128 if( bButton && !(lphc->wState & CBF_NOREDRAW) )
1131 CB_NOTIFY( lphc, CBN_CLOSEUP );
1132 }
1133 }
1134}
1135
1136/***********************************************************************
1137 * COMBO_FlipListbox
1138 *
1139 * Used by the ComboLBox to show/hide itself in response to VK_F4, etc...
1140 */
1142{
1143 if( lphc->wState & CBF_DROPPED )
1144 {
1145 CBRollUp( lphc, ok, bRedrawButton );
1146 return FALSE;
1147 }
1148
1149 CBDropDown( lphc );
1150 return TRUE;
1151}
1152
1153/***********************************************************************
1154 * CBRepaintButton
1155 */
1156static void CBRepaintButton( LPHEADCOMBO lphc )
1157 {
1158 InvalidateRect(lphc->self, &lphc->buttonRect, TRUE);
1159 UpdateWindow(lphc->self);
1160}
1161
1162/***********************************************************************
1163 * COMBO_SetFocus
1164 */
1165static void COMBO_SetFocus( LPHEADCOMBO lphc )
1166{
1167 if( !(lphc->wState & CBF_FOCUSED) )
1168 {
1169 if( CB_GETTYPE(lphc) == CBS_DROPDOWNLIST )
1170 SendMessageW(lphc->hWndLBox, LB_CARETON, 0, 0);
1171
1172 /* This is wrong. Message sequences seem to indicate that this
1173 is set *after* the notify. */
1174 /* lphc->wState |= CBF_FOCUSED; */
1175
1176 if( !(lphc->wState & CBF_EDIT) )
1177 InvalidateRect(lphc->self, &lphc->textRect, TRUE);
1178
1179 CB_NOTIFY( lphc, CBN_SETFOCUS );
1180 lphc->wState |= CBF_FOCUSED;
1181 }
1182}
1183
1184/***********************************************************************
1185 * COMBO_KillFocus
1186 */
1187static void COMBO_KillFocus( LPHEADCOMBO lphc )
1188{
1189 HWND hWnd = lphc->self;
1190
1191 if( lphc->wState & CBF_FOCUSED )
1192 {
1193 CBRollUp( lphc, FALSE, TRUE );
1194 if( IsWindow( hWnd ) )
1195 {
1196 if( CB_GETTYPE(lphc) == CBS_DROPDOWNLIST )
1197 SendMessageW(lphc->hWndLBox, LB_CARETOFF, 0, 0);
1198
1199 lphc->wState &= ~CBF_FOCUSED;
1200
1201 /* redraw text */
1202 if( !(lphc->wState & CBF_EDIT) )
1203 InvalidateRect(lphc->self, &lphc->textRect, TRUE);
1204
1205 CB_NOTIFY( lphc, CBN_KILLFOCUS );
1206 }
1207 }
1208}
1209
1210/***********************************************************************
1211 * COMBO_Command
1212 */
1214{
1215 if ( lphc->wState & CBF_EDIT && lphc->hWndEdit == hWnd )
1216 {
1217 /* ">> 8" makes gcc generate jump-table instead of cmp ladder */
1218
1219 switch( HIWORD(wParam) >> 8 )
1220 {
1221 case (EN_SETFOCUS >> 8):
1222
1223 TRACE("[%p]: edit [%p] got focus\n", lphc->self, lphc->hWndEdit );
1224
1225 COMBO_SetFocus( lphc );
1226 break;
1227
1228 case (EN_KILLFOCUS >> 8):
1229
1230 TRACE("[%p]: edit [%p] lost focus\n", lphc->self, lphc->hWndEdit );
1231
1232 /* NOTE: it seems that Windows' edit control sends an
1233 * undocumented message WM_USER + 0x1B instead of this
1234 * notification (only when it happens to be a part of
1235 * the combo). ?? - AK.
1236 */
1237
1238 COMBO_KillFocus( lphc );
1239 break;
1240
1241
1242 case (EN_CHANGE >> 8):
1243 /*
1244 * In some circumstances (when the selection of the combobox
1245 * is changed for example) we don't want the EN_CHANGE notification
1246 * to be forwarded to the parent of the combobox. This code
1247 * checks a flag that is set in these occasions and ignores the
1248 * notification.
1249 */
1250 if (lphc->wState & CBF_NOLBSELECT)
1251 {
1252 lphc->wState &= ~CBF_NOLBSELECT;
1253 }
1254 else
1255 {
1256 CBUpdateLBox( lphc, lphc->wState & CBF_DROPPED );
1257 }
1258
1259 if (!(lphc->wState & CBF_NOEDITNOTIFY))
1260 CB_NOTIFY( lphc, CBN_EDITCHANGE );
1261 break;
1262
1263 case (EN_UPDATE >> 8):
1264 if (!(lphc->wState & CBF_NOEDITNOTIFY))
1265 CB_NOTIFY( lphc, CBN_EDITUPDATE );
1266 break;
1267
1268 case (EN_ERRSPACE >> 8):
1269 CB_NOTIFY( lphc, CBN_ERRSPACE );
1270 }
1271 }
1272 else if( lphc->hWndLBox == hWnd )
1273 {
1274 switch( (short)HIWORD(wParam) )
1275 {
1276 case LBN_ERRSPACE:
1277 CB_NOTIFY( lphc, CBN_ERRSPACE );
1278 break;
1279
1280 case LBN_DBLCLK:
1281 CB_NOTIFY( lphc, CBN_DBLCLK );
1282 break;
1283
1284 case LBN_SELCHANGE:
1285 case LBN_SELCANCEL:
1286
1287 TRACE("[%p]: lbox selection change [%x]\n", lphc->self, lphc->wState );
1288
1289 /* do not roll up if selection is being tracked
1290 * by arrow keys in the dropdown listbox */
1291 if (!(lphc->wState & CBF_NOROLLUP))
1292 {
1293 CBRollUp( lphc, (HIWORD(wParam) == LBN_SELCHANGE), TRUE );
1294 }
1295 else lphc->wState &= ~CBF_NOROLLUP;
1296
1297 CB_NOTIFY( lphc, CBN_SELCHANGE );
1298
1299 if( HIWORD(wParam) == LBN_SELCHANGE)
1300 {
1301 if( lphc->wState & CBF_EDIT )
1302 {
1303 INT index = SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
1304 lphc->wState |= CBF_NOLBSELECT;
1305 CBUpdateEdit( lphc, index );
1306 /* select text in edit, as Windows does */
1307 SendMessageW(lphc->hWndEdit, EM_SETSEL, 0, (LPARAM)(-1));
1308 }
1309 else
1310 {
1311 InvalidateRect(lphc->self, &lphc->textRect, TRUE);
1312 UpdateWindow(lphc->self);
1313 }
1314 }
1315 break;
1316
1317 case LBN_SETFOCUS:
1318 case LBN_KILLFOCUS:
1319 /* nothing to do here since ComboLBox always resets the focus to its
1320 * combo/edit counterpart */
1321 break;
1322 }
1323 }
1324 return 0;
1325}
1326
1327/***********************************************************************
1328 * COMBO_ItemOp
1329 *
1330 * Fixup an ownerdrawn item operation and pass it up to the combobox owner.
1331 */
1333{
1334 HWND hWnd = lphc->self;
1336
1337 TRACE("[%p]: ownerdraw op %04x\n", lphc->self, msg );
1338
1339 switch( msg )
1340 {
1341 case WM_DELETEITEM:
1342 {
1344 lpIS->CtlType = ODT_COMBOBOX;
1345 lpIS->CtlID = id;
1346 lpIS->hwndItem = hWnd;
1347 break;
1348 }
1349 case WM_DRAWITEM:
1350 {
1352 lpIS->CtlType = ODT_COMBOBOX;
1353 lpIS->CtlID = id;
1354 lpIS->hwndItem = hWnd;
1355 break;
1356 }
1357 case WM_COMPAREITEM:
1358 {
1360 lpIS->CtlType = ODT_COMBOBOX;
1361 lpIS->CtlID = id;
1362 lpIS->hwndItem = hWnd;
1363 break;
1364 }
1365 case WM_MEASUREITEM:
1366 {
1368 lpIS->CtlType = ODT_COMBOBOX;
1369 lpIS->CtlID = id;
1370 break;
1371 }
1372 }
1373 return SendMessageW(lphc->owner, msg, id, lParam);
1374}
1375
1376
1377/***********************************************************************
1378 * COMBO_GetTextW
1379 */
1381{
1382 INT length;
1383
1384 if( lphc->wState & CBF_EDIT )
1385 return SendMessageW( lphc->hWndEdit, WM_GETTEXT, count, (LPARAM)buf );
1386
1387 /* get it from the listbox */
1388
1389 if (!count || !buf) return 0;
1390 if( lphc->hWndLBox )
1391 {
1392 INT idx = SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
1393 if (idx == LB_ERR) goto error;
1395 if (length == LB_ERR) goto error;
1396
1397 /* 'length' is without the terminating character */
1398 if (length >= count)
1399 {
1400 LPWSTR lpBuffer = HeapAlloc(GetProcessHeap(), 0, (length + 1) * sizeof(WCHAR));
1401 if (!lpBuffer) goto error;
1403
1404 /* truncate if buffer is too short */
1405 if (length != LB_ERR)
1406 {
1408 length = count;
1409 }
1411 }
1413
1414 if (length == LB_ERR) return 0;
1415 return length;
1416 }
1417
1418 error: /* error - truncate string, return zero */
1419 buf[0] = 0;
1420 return 0;
1421}
1422
1423
1424/***********************************************************************
1425 * COMBO_GetTextA
1426 *
1427 * NOTE! LB_GETTEXT does not count terminating \0, WM_GETTEXT does.
1428 * also LB_GETTEXT might return values < 0, WM_GETTEXT doesn't.
1429 */
1431{
1432 INT length;
1433
1434 if( lphc->wState & CBF_EDIT )
1435 return SendMessageA( lphc->hWndEdit, WM_GETTEXT, count, (LPARAM)buf );
1436
1437 /* get it from the listbox */
1438
1439 if (!count || !buf) return 0;
1440 if( lphc->hWndLBox )
1441 {
1442 INT idx = SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
1443 if (idx == LB_ERR) goto error;
1445 if (length == LB_ERR) goto error;
1446
1447 /* 'length' is without the terminating character */
1448 if (length >= count)
1449 {
1451 if (!lpBuffer) goto error;
1453
1454 /* truncate if buffer is too short */
1455 if (length != LB_ERR)
1456 {
1458 length = count;
1459 }
1461 }
1463
1464 if (length == LB_ERR) return 0;
1465 return length;
1466 }
1467
1468 error: /* error - truncate string, return zero */
1469 buf[0] = 0;
1470 return 0;
1471}
1472
1473
1474/***********************************************************************
1475 * CBResetPos
1476 *
1477 * This function sets window positions according to the updated
1478 * component placement struct.
1479 */
1480static void CBResetPos(
1481 LPHEADCOMBO lphc,
1482 const RECT *rectEdit,
1483 const RECT *rectLB,
1484 BOOL bRedraw)
1485{
1486 BOOL bDrop = (CB_GETTYPE(lphc) != CBS_SIMPLE);
1487
1488 /* NOTE: logs sometimes have WM_LBUTTONUP before a cascade of
1489 * sizing messages */
1490
1491 if( lphc->wState & CBF_EDIT )
1492 SetWindowPos( lphc->hWndEdit, 0,
1493 rectEdit->left, rectEdit->top,
1494 rectEdit->right - rectEdit->left,
1495 rectEdit->bottom - rectEdit->top,
1496 SWP_NOZORDER | SWP_NOACTIVATE | ((bDrop) ? SWP_NOREDRAW : 0) );
1497
1498 SetWindowPos( lphc->hWndLBox, 0,
1499 rectLB->left, rectLB->top,
1500 rectLB->right - rectLB->left,
1501 rectLB->bottom - rectLB->top,
1502 SWP_NOACTIVATE | SWP_NOZORDER | ((bDrop) ? SWP_NOREDRAW : 0) );
1503
1504 if( bDrop )
1505 {
1506 if( lphc->wState & CBF_DROPPED )
1507 {
1508 lphc->wState &= ~CBF_DROPPED;
1509 ShowWindow( lphc->hWndLBox, SW_HIDE );
1510 }
1511
1512 if( bRedraw && !(lphc->wState & CBF_NOREDRAW) )
1513 RedrawWindow( lphc->self, NULL, 0,
1515 }
1516}
1517
1518
1519/***********************************************************************
1520 * COMBO_Size
1521 */
1522static void COMBO_Size( LPHEADCOMBO lphc )
1523{
1524 /*
1525 * Those controls are always the same height. So we have to make sure
1526 * they are not resized to another value.
1527 */
1528 if( CB_GETTYPE(lphc) != CBS_SIMPLE )
1529 {
1530 int newComboHeight, curComboHeight, curComboWidth;
1531 RECT rc;
1532
1533 GetWindowRect(lphc->self, &rc);
1534 curComboHeight = rc.bottom - rc.top;
1535 curComboWidth = rc.right - rc.left;
1536 newComboHeight = CBGetTextAreaHeight(lphc->self, lphc) + 2*COMBO_YBORDERSIZE();
1537
1538 /*
1539 * Resizing a combobox has another side effect, it resizes the dropped
1540 * rectangle as well. However, it does it only if the new height for the
1541 * combobox is more than the height it should have. In other words,
1542 * if the application resizing the combobox only had the intention to resize
1543 * the actual control, for example, to do the layout of a dialog that is
1544 * resized, the height of the dropdown is not changed.
1545 */
1546 if( curComboHeight > newComboHeight )
1547 {
1548 TRACE("oldComboHeight=%d, newComboHeight=%d, oldDropBottom=%d, oldDropTop=%d\n",
1549 curComboHeight, newComboHeight, lphc->droppedRect.bottom,
1550 lphc->droppedRect.top);
1551 lphc->droppedRect.bottom = lphc->droppedRect.top + curComboHeight - newComboHeight;
1552 }
1553 /*
1554 * Restore original height
1555 */
1556 if( curComboHeight != newComboHeight )
1557 SetWindowPos(lphc->self, 0, 0, 0, curComboWidth, newComboHeight,
1559 }
1560
1561 CBCalcPlacement(lphc->self,
1562 lphc,
1563 &lphc->textRect,
1564 &lphc->buttonRect,
1565 &lphc->droppedRect);
1566
1567 CBResetPos( lphc, &lphc->textRect, &lphc->droppedRect, FALSE );
1568}
1569
1570
1571/***********************************************************************
1572 * COMBO_Font
1573 */
1574static void COMBO_Font( LPHEADCOMBO lphc, HFONT hFont, BOOL bRedraw )
1575{
1576 /*
1577 * Set the font
1578 */
1579 lphc->hFont = hFont;
1580
1581 /*
1582 * Propagate to owned windows.
1583 */
1584 if( lphc->wState & CBF_EDIT )
1585 SendMessageW(lphc->hWndEdit, WM_SETFONT, (WPARAM)hFont, bRedraw);
1586 SendMessageW(lphc->hWndLBox, WM_SETFONT, (WPARAM)hFont, bRedraw);
1587
1588 /*
1589 * Redo the layout of the control.
1590 */
1591 if ( CB_GETTYPE(lphc) == CBS_SIMPLE)
1592 {
1593 CBCalcPlacement(lphc->self,
1594 lphc,
1595 &lphc->textRect,
1596 &lphc->buttonRect,
1597 &lphc->droppedRect);
1598
1599 CBResetPos( lphc, &lphc->textRect, &lphc->droppedRect, TRUE );
1600 }
1601 else
1602 {
1603 CBForceDummyResize(lphc);
1604 }
1605}
1606
1607
1608/***********************************************************************
1609 * COMBO_SetItemHeight
1610 */
1612{
1613 LRESULT lRet = CB_ERR;
1614
1615 if( index == -1 ) /* set text field height */
1616 {
1617 if( height < 32768 )
1618 {
1619 lphc->editHeight = height + 2; /* Is the 2 for 2*EDIT_CONTROL_PADDING? */
1620
1621 /*
1622 * Redo the layout of the control.
1623 */
1624 if ( CB_GETTYPE(lphc) == CBS_SIMPLE)
1625 {
1626 CBCalcPlacement(lphc->self,
1627 lphc,
1628 &lphc->textRect,
1629 &lphc->buttonRect,
1630 &lphc->droppedRect);
1631
1632 CBResetPos( lphc, &lphc->textRect, &lphc->droppedRect, TRUE );
1633 }
1634 else
1635 {
1636 CBForceDummyResize(lphc);
1637 }
1638
1639 lRet = height;
1640 }
1641 }
1642 else if ( CB_OWNERDRAWN(lphc) ) /* set listbox item height */
1644 return lRet;
1645}
1646
1647/***********************************************************************
1648 * COMBO_SelectString
1649 */
1651{
1654 if( index >= 0 )
1655 {
1656 if( lphc->wState & CBF_EDIT )
1657 CBUpdateEdit( lphc, index );
1658 else
1659 {
1660 InvalidateRect(lphc->self, &lphc->textRect, TRUE);
1661 }
1662 }
1663 return (LRESULT)index;
1664}
1665
1666/***********************************************************************
1667 * COMBO_LButtonDown
1668 */
1670{
1671 POINT pt;
1672 BOOL bButton;
1673 HWND hWnd = lphc->self;
1674
1675 pt.x = (short)LOWORD(lParam);
1676 pt.y = (short)HIWORD(lParam);
1677 bButton = PtInRect(&lphc->buttonRect, pt);
1678
1679 if( (CB_GETTYPE(lphc) == CBS_DROPDOWNLIST) ||
1680 (bButton && (CB_GETTYPE(lphc) == CBS_DROPDOWN)) )
1681 {
1682 lphc->wState |= CBF_BUTTONDOWN;
1683 if( lphc->wState & CBF_DROPPED )
1684 {
1685 /* got a click to cancel selection */
1686
1687 lphc->wState &= ~CBF_BUTTONDOWN;
1688 CBRollUp( lphc, TRUE, FALSE );
1689 if( !IsWindow( hWnd ) ) return;
1690
1691 if( lphc->wState & CBF_CAPTURE )
1692 {
1693 lphc->wState &= ~CBF_CAPTURE;
1695 }
1696 }
1697 else
1698 {
1699 /* drop down the listbox and start tracking */
1700
1701 lphc->wState |= CBF_CAPTURE;
1702 SetCapture( hWnd );
1703 CBDropDown( lphc );
1704 }
1705 if( bButton ) CBRepaintButton( lphc );
1706 }
1707}
1708
1709/***********************************************************************
1710 * COMBO_LButtonUp
1711 *
1712 * Release capture and stop tracking if needed.
1713 */
1714static void COMBO_LButtonUp( LPHEADCOMBO lphc )
1715{
1716 if( lphc->wState & CBF_CAPTURE )
1717 {
1718 lphc->wState &= ~CBF_CAPTURE;
1719 if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
1720 {
1721 INT index = CBUpdateLBox( lphc, TRUE );
1722 /* Update edit only if item is in the list */
1723 if(index >= 0)
1724 {
1725 lphc->wState |= CBF_NOLBSELECT;
1726 CBUpdateEdit( lphc, index );
1727 lphc->wState &= ~CBF_NOLBSELECT;
1728 }
1729 }
1731 SetCapture(lphc->hWndLBox);
1732 }
1733
1734 if( lphc->wState & CBF_BUTTONDOWN )
1735 {
1736 lphc->wState &= ~CBF_BUTTONDOWN;
1737 CBRepaintButton( lphc );
1738 }
1739}
1740
1741/***********************************************************************
1742 * COMBO_MouseMove
1743 *
1744 * Two things to do - track combo button and release capture when
1745 * pointer goes into the listbox.
1746 */
1748{
1749 POINT pt;
1750 RECT lbRect;
1751
1752 pt.x = (short)LOWORD(lParam);
1753 pt.y = (short)HIWORD(lParam);
1754
1755 if( lphc->wState & CBF_BUTTONDOWN )
1756 {
1757 BOOL bButton;
1758
1759 bButton = PtInRect(&lphc->buttonRect, pt);
1760
1761 if( !bButton )
1762 {
1763 lphc->wState &= ~CBF_BUTTONDOWN;
1764 CBRepaintButton( lphc );
1765 }
1766 }
1767
1768 GetClientRect( lphc->hWndLBox, &lbRect );
1769 MapWindowPoints( lphc->self, lphc->hWndLBox, &pt, 1 );
1770 if( PtInRect(&lbRect, pt) )
1771 {
1772 lphc->wState &= ~CBF_CAPTURE;
1774 if( CB_GETTYPE(lphc) == CBS_DROPDOWN ) CBUpdateLBox( lphc, TRUE );
1775
1776 /* hand over pointer tracking */
1778 }
1779}
1780
1782{
1783 if (!pcbi || (pcbi->cbSize < sizeof(COMBOBOXINFO)))
1784 return FALSE;
1785
1786 pcbi->rcItem = lphc->textRect;
1787 pcbi->rcButton = lphc->buttonRect;
1788 pcbi->stateButton = 0;
1789 if (lphc->wState & CBF_BUTTONDOWN)
1791 if (IsRectEmpty(&lphc->buttonRect))
1793 pcbi->hwndCombo = lphc->self;
1794 pcbi->hwndItem = lphc->hWndEdit;
1795 pcbi->hwndList = lphc->hWndLBox;
1796 return TRUE;
1797}
1798
1799static char *strdupA(LPCSTR str)
1800{
1801 char *ret;
1802 DWORD len;
1803
1804 if(!str) return NULL;
1805
1806 len = strlen(str);
1807 ret = HeapAlloc(GetProcessHeap(), 0, len + 1);
1808#ifdef __REACTOS__
1809 if (ret != NULL)
1810#endif
1811 memcpy(ret, str, len + 1);
1812 return ret;
1813}
1814
1815/***********************************************************************
1816 * ComboWndProc_common
1817 */
1819{
1821#ifdef __REACTOS__
1822 PWND pWnd;
1823
1824 pWnd = ValidateHwnd(hwnd);
1825 if (pWnd)
1826 {
1827 if (!pWnd->fnid)
1828 {
1830 }
1831 else
1832 {
1833 if (pWnd->fnid != FNID_COMBOBOX)
1834 {
1835 ERR("Wrong window class for ComboBox! fnId 0x%x\n",pWnd->fnid);
1836 return 0;
1837 }
1838 }
1839 }
1840#endif
1841
1842 TRACE("[%p]: msg %s wp %08lx lp %08lx\n", hwnd, SPY_GetMsgName(message, hwnd), wParam, lParam);
1843
1844#ifndef __REACTOS__
1845 if (!IsWindow(hwnd)) return 0;
1846#endif
1847
1848 if (lphc || message == WM_NCCREATE)
1849 switch(message)
1850 {
1851 case WM_NCCREATE:
1852 {
1853 LONG style = unicode ? ((LPCREATESTRUCTW)lParam)->style : ((LPCREATESTRUCTA)lParam)->style;
1854 return COMBO_NCCreate(hwnd, style);
1855 }
1856 case WM_NCDESTROY:
1857 COMBO_NCDestroy(lphc);
1858#ifdef __REACTOS__
1860#endif
1861 break;/* -> DefWindowProc */
1862
1863 case WM_CREATE:
1864 {
1866 LONG style;
1867 if(unicode)
1868 {
1869 hwndParent = ((LPCREATESTRUCTW)lParam)->hwndParent;
1870 style = ((LPCREATESTRUCTW)lParam)->style;
1871 }
1872 else
1873 {
1874 hwndParent = ((LPCREATESTRUCTA)lParam)->hwndParent;
1875 style = ((LPCREATESTRUCTA)lParam)->style;
1876 }
1877 return COMBO_Create(hwnd, lphc, hwndParent, style, unicode);
1878 }
1879 case WM_PRINTCLIENT:
1880 /* Fallthrough */
1881 case WM_PAINT:
1882 /* wParam may contain a valid HDC! */
1883 return COMBO_Paint(lphc, (HDC)wParam);
1884 case WM_ERASEBKGND:
1885 /* do all painting in WM_PAINT like Windows does */
1886 return 1;
1887
1888 case WM_GETDLGCODE:
1889 {
1891 if (lParam && (((LPMSG)lParam)->message == WM_KEYDOWN))
1892 {
1893 int vk = (int)((LPMSG)lParam)->wParam;
1894
1895 if ((vk == VK_RETURN || vk == VK_ESCAPE) && (lphc->wState & CBF_DROPPED))
1897 }
1898 return result;
1899 }
1900 case WM_SIZE:
1901 if (lphc->hWndLBox && !(lphc->wState & CBF_NORESIZE))
1902 COMBO_Size( lphc );
1903 return TRUE;
1904 case WM_SETFONT:
1905 COMBO_Font( lphc, (HFONT)wParam, (BOOL)lParam );
1906 return TRUE;
1907 case WM_GETFONT:
1908 return (LRESULT)lphc->hFont;
1909 case WM_SETFOCUS:
1910 if (lphc->wState & CBF_EDIT)
1911 {
1912 SetFocus( lphc->hWndEdit );
1913 /* The first time focus is received, select all the text */
1914 if (!(lphc->wState & CBF_BEENFOCUSED))
1915 {
1916 SendMessageW(lphc->hWndEdit, EM_SETSEL, 0, -1);
1917 lphc->wState |= CBF_BEENFOCUSED;
1918 }
1919 }
1920 else
1921 COMBO_SetFocus( lphc );
1922 return TRUE;
1923 case WM_KILLFOCUS:
1924 {
1925 HWND hwndFocus = WIN_GetFullHandle((HWND)wParam);
1926 if (!hwndFocus || (hwndFocus != lphc->hWndEdit && hwndFocus != lphc->hWndLBox))
1927 COMBO_KillFocus( lphc );
1928 return TRUE;
1929 }
1930 case WM_COMMAND:
1932 case WM_GETTEXT:
1933 return unicode ? COMBO_GetTextW( lphc, wParam, (LPWSTR)lParam )
1934 : COMBO_GetTextA( lphc, wParam, (LPSTR)lParam );
1935 case WM_SETTEXT:
1936 case WM_GETTEXTLENGTH:
1937 case WM_CLEAR:
1938 if ((message == WM_GETTEXTLENGTH) && !ISWIN31 && !(lphc->wState & CBF_EDIT))
1939 {
1940 int j = SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
1941 if (j == -1) return 0;
1942 return unicode ? SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, j, 0) :
1944 }
1945 else if ( lphc->wState & CBF_EDIT )
1946 {
1947 LRESULT ret;
1948 lphc->wState |= CBF_NOEDITNOTIFY;
1949 ret = unicode ? SendMessageW(lphc->hWndEdit, message, wParam, lParam) :
1951 lphc->wState &= ~CBF_NOEDITNOTIFY;
1952 return ret;
1953 }
1954 else
1955 return CB_ERR;
1956 case WM_CUT:
1957 case WM_PASTE:
1958 case WM_COPY:
1959 if (lphc->wState & CBF_EDIT)
1960 {
1961 return unicode ? SendMessageW(lphc->hWndEdit, message, wParam, lParam) :
1963 }
1964 else return CB_ERR;
1965
1966 case WM_DRAWITEM:
1967 case WM_DELETEITEM:
1968 case WM_COMPAREITEM:
1969 case WM_MEASUREITEM:
1970 return COMBO_ItemOp(lphc, message, lParam);
1971 case WM_ENABLE:
1972 if (lphc->wState & CBF_EDIT)
1973 EnableWindow( lphc->hWndEdit, (BOOL)wParam );
1974 EnableWindow( lphc->hWndLBox, (BOOL)wParam );
1975
1976 /* Force the control to repaint when the enabled state changes. */
1977 InvalidateRect(lphc->self, NULL, TRUE);
1978 return TRUE;
1979 case WM_SETREDRAW:
1980 if (wParam)
1981 lphc->wState &= ~CBF_NOREDRAW;
1982 else
1983 lphc->wState |= CBF_NOREDRAW;
1984
1985 if ( lphc->wState & CBF_EDIT )
1988 return 0;
1989 case WM_SYSKEYDOWN:
1990#ifdef __REACTOS__
1991 if ( KF_ALTDOWN & HIWORD(lParam) )
1992#else
1993 if ( KEYDATA_ALT & HIWORD(lParam) )
1994#endif
1995 if( wParam == VK_UP || wParam == VK_DOWN )
1996#ifdef __REACTOS__
1997 {
1998#endif
1999 COMBO_FlipListbox( lphc, FALSE, FALSE );
2000 return 0;
2001#ifdef __REACTOS__
2002 }
2003 break;
2004#endif
2005
2006 case WM_KEYDOWN:
2007 if ((wParam == VK_RETURN || wParam == VK_ESCAPE) &&
2008 (lphc->wState & CBF_DROPPED))
2009 {
2010 CBRollUp( lphc, wParam == VK_RETURN, FALSE );
2011 return TRUE;
2012 }
2013 else if ((wParam == VK_F4) && !(lphc->wState & CBF_EUI))
2014 {
2015 COMBO_FlipListbox( lphc, FALSE, FALSE );
2016 return TRUE;
2017 }
2018 /* fall through */
2019 case WM_CHAR:
2020 case WM_IME_CHAR:
2021 {
2022 HWND hwndTarget;
2023
2024#ifdef __REACTOS__
2025 if (lphc->wState & CBF_DROPPED)
2026 lphc->wState |= CBF_NOROLLUP;
2027#endif
2028 if ( lphc->wState & CBF_EDIT )
2029 hwndTarget = lphc->hWndEdit;
2030 else
2031 hwndTarget = lphc->hWndLBox;
2032
2033 return unicode ? SendMessageW(hwndTarget, message, wParam, lParam) :
2034 SendMessageA(hwndTarget, message, wParam, lParam);
2035 }
2036 case WM_LBUTTONDOWN:
2037 if ( !(lphc->wState & CBF_FOCUSED) ) SetFocus( lphc->self );
2038 if ( lphc->wState & CBF_FOCUSED ) COMBO_LButtonDown( lphc, lParam );
2039 return TRUE;
2040 case WM_LBUTTONUP:
2041 COMBO_LButtonUp( lphc );
2042 return TRUE;
2043 case WM_MOUSEMOVE:
2044 if ( lphc->wState & CBF_CAPTURE )
2045 COMBO_MouseMove( lphc, wParam, lParam );
2046 return TRUE;
2047
2048 case WM_MOUSEWHEEL:
2049 if (wParam & (MK_SHIFT | MK_CONTROL))
2050 return unicode ? DefWindowProcW(hwnd, message, wParam, lParam) :
2052
2053 if (GET_WHEEL_DELTA_WPARAM(wParam) > 0) return SendMessageW(hwnd, WM_KEYDOWN, VK_UP, 0);
2054 if (GET_WHEEL_DELTA_WPARAM(wParam) < 0) return SendMessageW(hwnd, WM_KEYDOWN, VK_DOWN, 0);
2055 return TRUE;
2056
2057 case WM_CTLCOLOR:
2058 case WM_CTLCOLORMSGBOX:
2059 case WM_CTLCOLOREDIT:
2060 case WM_CTLCOLORLISTBOX:
2061 case WM_CTLCOLORBTN:
2062 case WM_CTLCOLORDLG:
2064 case WM_CTLCOLORSTATIC:
2065#ifdef __REACTOS__
2066 if (pWnd && !(pWnd->state2 & WNDS2_WIN40COMPAT)) break; // Must be Win 4.0 and above.
2067#endif
2068 if (lphc->owner)
2069 return SendMessageW(lphc->owner, message, wParam, lParam);
2070 break;
2071
2072 /* Combo messages */
2073 case CB_ADDSTRING:
2074 if (unicode)
2075 {
2076 if (lphc->dwStyle & CBS_LOWERCASE)
2078 else if (lphc->dwStyle & CBS_UPPERCASE)
2080 return SendMessageW(lphc->hWndLBox, LB_ADDSTRING, 0, lParam);
2081 }
2082 else /* unlike the unicode version, the ansi version does not overwrite
2083 the string if converting case */
2084 {
2085 char *string = NULL;
2086 LRESULT ret;
2087 if (lphc->dwStyle & CBS_LOWERCASE)
2088 {
2089 string = strdupA((LPSTR)lParam);
2090 CharLowerA(string);
2091 }
2092
2093 else if (lphc->dwStyle & CBS_UPPERCASE)
2094 {
2095 string = strdupA((LPSTR)lParam);
2096 CharUpperA(string);
2097 }
2098
2099 ret = SendMessageA(lphc->hWndLBox, LB_ADDSTRING, 0, string ? (LPARAM)string : lParam);
2100 HeapFree(GetProcessHeap(), 0, string);
2101 return ret;
2102 }
2103 case CB_INSERTSTRING:
2104 if (unicode)
2105 {
2106 if (lphc->dwStyle & CBS_LOWERCASE)
2108 else if (lphc->dwStyle & CBS_UPPERCASE)
2111 }
2112 else
2113 {
2114 if (lphc->dwStyle & CBS_LOWERCASE)
2116 else if (lphc->dwStyle & CBS_UPPERCASE)
2119 }
2120 case CB_DELETESTRING:
2121 return unicode ? SendMessageW(lphc->hWndLBox, LB_DELETESTRING, wParam, 0) :
2123 case CB_SELECTSTRING:
2124 return COMBO_SelectString(lphc, (INT)wParam, lParam, unicode);
2125 case CB_FINDSTRING:
2126 return unicode ? SendMessageW(lphc->hWndLBox, LB_FINDSTRING, wParam, lParam) :
2128 case CB_FINDSTRINGEXACT:
2129 return unicode ? SendMessageW(lphc->hWndLBox, LB_FINDSTRINGEXACT, wParam, lParam) :
2131 case CB_SETITEMHEIGHT:
2132 return COMBO_SetItemHeight( lphc, (INT)wParam, (INT)lParam);
2133 case CB_GETITEMHEIGHT:
2134 if ((INT)wParam >= 0) /* listbox item */
2135 return SendMessageW(lphc->hWndLBox, LB_GETITEMHEIGHT, wParam, 0);
2136 return CBGetTextAreaHeight(hwnd, lphc);
2137 case CB_RESETCONTENT:
2139 if ((lphc->wState & CBF_EDIT) && CB_HASSTRINGS(lphc))
2140 {
2141 static const WCHAR empty_stringW[] = { 0 };
2143 }
2144 else
2145 InvalidateRect(lphc->self, NULL, TRUE);
2146 return TRUE;
2147 case CB_INITSTORAGE:
2150 return SendMessageW(lphc->hWndLBox, LB_GETHORIZONTALEXTENT, 0, 0);
2153 case CB_GETTOPINDEX:
2154 return SendMessageW(lphc->hWndLBox, LB_GETTOPINDEX, 0, 0);
2155 case CB_GETLOCALE:
2156 return SendMessageW(lphc->hWndLBox, LB_GETLOCALE, 0, 0);
2157 case CB_SETLOCALE:
2158 return SendMessageW(lphc->hWndLBox, LB_SETLOCALE, wParam, 0);
2159 case CB_SETDROPPEDWIDTH:
2160 if ((CB_GETTYPE(lphc) == CBS_SIMPLE) || (INT)wParam >= 32768)
2161 return CB_ERR;
2162 /* new value must be higher than combobox width */
2163 if ((INT)wParam >= lphc->droppedRect.right - lphc->droppedRect.left)
2164 lphc->droppedWidth = wParam;
2165 else if (wParam)
2166 lphc->droppedWidth = 0;
2167
2168 /* recalculate the combobox area */
2169 CBCalcPlacement(hwnd, lphc, &lphc->textRect, &lphc->buttonRect, &lphc->droppedRect );
2170
2171 /* fall through */
2172 case CB_GETDROPPEDWIDTH:
2173 if (lphc->droppedWidth)
2174 return lphc->droppedWidth;
2175 return lphc->droppedRect.right - lphc->droppedRect.left;
2178 return CB_OKAY;
2179 case CB_GETDROPPEDSTATE:
2180 return (lphc->wState & CBF_DROPPED) != 0;
2181 case CB_DIR:
2182 return unicode ? SendMessageW(lphc->hWndLBox, LB_DIR, wParam, lParam) :
2184
2185 case CB_SHOWDROPDOWN:
2186 if (CB_GETTYPE(lphc) != CBS_SIMPLE)
2187 {
2188 if (wParam)
2189 {
2190 if (!(lphc->wState & CBF_DROPPED))
2191 CBDropDown( lphc );
2192 }
2193 else if (lphc->wState & CBF_DROPPED)
2194 CBRollUp( lphc, FALSE, TRUE );
2195 }
2196 return TRUE;
2197 case CB_GETCOUNT:
2198 return SendMessageW(lphc->hWndLBox, LB_GETCOUNT, 0, 0);
2199 case CB_GETCURSEL:
2200 return SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
2201 case CB_SETCURSEL:
2203 if (lParam >= 0)
2205
2206 /* no LBN_SELCHANGE in this case, update manually */
2207 CBPaintText(lphc, NULL);
2208 lphc->wState &= ~CBF_SELCHANGE;
2209 return lParam;
2210 case CB_GETLBTEXT:
2211 return unicode ? SendMessageW(lphc->hWndLBox, LB_GETTEXT, wParam, lParam) :
2213 case CB_GETLBTEXTLEN:
2214 return unicode ? SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, wParam, 0) :
2216 case CB_GETITEMDATA:
2217 return SendMessageW(lphc->hWndLBox, LB_GETITEMDATA, wParam, 0);
2218 case CB_SETITEMDATA:
2220 case CB_GETEDITSEL:
2221 /* Edit checks passed parameters itself */
2222 if (lphc->wState & CBF_EDIT)
2223 return SendMessageW(lphc->hWndEdit, EM_GETSEL, wParam, lParam);
2224 return CB_ERR;
2225 case CB_SETEDITSEL:
2226 if (lphc->wState & CBF_EDIT)
2228 return CB_ERR;
2229 case CB_SETEXTENDEDUI:
2230 if (CB_GETTYPE(lphc) == CBS_SIMPLE )
2231 return CB_ERR;
2232 if (wParam)
2233 lphc->wState |= CBF_EUI;
2234 else lphc->wState &= ~CBF_EUI;
2235 return CB_OKAY;
2236 case CB_GETEXTENDEDUI:
2237 return (lphc->wState & CBF_EUI) != 0;
2238 case CB_GETCOMBOBOXINFO:
2239 return COMBO_GetComboBoxInfo(lphc, (COMBOBOXINFO *)lParam);
2240 case CB_LIMITTEXT:
2241 if (lphc->wState & CBF_EDIT)
2243 return TRUE;
2244
2245#ifdef __REACTOS__
2246 case WM_UPDATEUISTATE:
2247 if (unicode)
2249 else
2251
2252 if (COMBO_update_uistate(lphc))
2253 {
2254 /* redraw text */
2255 if (!(lphc->wState & CBF_EDIT))
2256 NtUserInvalidateRect(lphc->self, &lphc->textRect, TRUE);
2257 }
2258 break;
2259
2260 case WM_CBLOSTTEXTFOCUS: /* undocumented message - deselects the text when focus is lost */
2261 if (lphc->hWndEdit != NULL)
2262 {
2263 SendMessage(lphc->self, WM_LBUTTONUP, 0, 0xFFFFFFFF);
2264 SendMessage(lphc->hWndEdit, EM_SETSEL, 0, 0);
2265 lphc->wState &= ~(CBF_FOCUSED | CBF_BEENFOCUSED);
2266 CB_NOTIFY(lphc, CBN_KILLFOCUS);
2267 }
2268 return TRUE;
2269#endif
2270
2271 default:
2272 if (message >= WM_USER)
2273 WARN("unknown msg WM_USER+%04x wp=%04lx lp=%08lx\n", message - WM_USER, wParam, lParam );
2274 break;
2275 }
2276 return unicode ? DefWindowProcW(hwnd, message, wParam, lParam) :
2278}
2279
2280#ifdef __REACTOS__
2281
2282/***********************************************************************
2283 * ComboWndProcA
2284 *
2285 * This is just a wrapper for the real ComboWndProc which locks/unlocks
2286 * window structs.
2287 */
2289{
2290 if (!IsWindow(hwnd)) return 0;
2292}
2293
2294/***********************************************************************
2295 * ComboWndProcW
2296 */
2298{
2299 if (!IsWindow(hwnd)) return 0;
2301}
2302
2303#endif /* __REACTOS__ */
2304
2305/*************************************************************************
2306 * GetComboBoxInfo (USER32.@)
2307 */
2309 HWND hwndCombo, /* [in] handle to combo box */
2310 PCOMBOBOXINFO pcbi /* [in/out] combo box information */)
2311{
2312 TRACE("(%p, %p)\n", hwndCombo, pcbi);
2313#ifdef __REACTOS__
2314 return NtUserGetComboBoxInfo(hwndCombo, pcbi);
2315#else
2316 return SendMessageW(hwndCombo, CB_GETCOMBOBOXINFO, 0, (LPARAM)pcbi);
2317#endif
2318}
static HDC hDC
Definition: 3dtext.c:33
short INT16
Definition: actypes.h:130
Arabic default style
Definition: afstyles.h:94
int nItems
Definition: appswitch.c:55
#define ok(value,...)
Definition: atltest.h:57
static const char * wine_dbgstr_rect(const RECT *prc)
Definition: atltest.h:160
#define msg(x)
Definition: auth_time.c:54
HWND hWnd
Definition: settings.c:17
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define index(s, c)
Definition: various.h:29
HFONT hFont
Definition: main.c:53
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
struct HEADCOMBO * LPHEADCOMBO
#define CBF_MEASUREITEM
Definition: controls.h:48
#define CBF_EDIT
Definition: controls.h:51
#define CBF_DROPPED
Definition: controls.h:45
#define CBF_NOREDRAW
Definition: controls.h:54
#define CBF_FOCUSED
Definition: controls.h:49
LRESULT WINAPI ComboWndProcA(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
#define CBF_NOTIFY
Definition: controls.h:53
#define CBF_CAPTURE
Definition: controls.h:50
#define CBF_EUI
Definition: controls.h:59
#define CBF_BEENFOCUSED
Definition: controls.h:58
#define CBF_NOLBSELECT
Definition: controls.h:57
#define CBF_NOEDITNOTIFY
Definition: controls.h:56
#define CBF_NOROLLUP
Definition: controls.h:47
LRESULT WINAPI ComboWndProcW(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
#define CBF_NORESIZE
Definition: controls.h:52
static HWND hwndParent
Definition: cryptui.c:300
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int idx
Definition: utils.c:41
HRGN set_control_clipping(HDC hdc, const RECT *rect)
Definition: button.c:242
static LRESULT COMBO_Paint(HEADCOMBO *lphc, HDC hdc)
Definition: combo.c:809
static LRESULT COMBO_NCDestroy(HEADCOMBO *lphc)
Definition: combo.c:159
static void CBRepaintButton(LPHEADCOMBO lphc)
Definition: combo.c:1101
static void CBPaintBorder(const HEADCOMBO *lphc, HDC hdc)
Definition: combo.c:750
#define COMBO_EDITBUTTONSPACE()
Definition: combo.c:75
static INT CBGetTextAreaHeight(HEADCOMBO *lphc, BOOL clip_item_height)
Definition: combo.c:206
static LRESULT COMBO_NCCreate(HWND hwnd, LONG style)
Definition: combo.c:124
static HBITMAP hComboBmp
Definition: combo.c:65
#define ID_CB_LISTBOX
Definition: combo.c:78
static BOOL COMBO_Init(void)
Definition: combo.c:89
#define ISWIN31
Definition: combo.c:60
#define EDIT_CONTROL_PADDING()
Definition: combo.c:76
#define ID_CB_EDIT
Definition: combo.c:79
static UINT CBitWidth
Definition: combo.c:66
static void COMBO_Size(HEADCOMBO *lphc)
Definition: combo.c:1398
static UINT CBitHeight
Definition: combo.c:66
static void COMBO_LButtonDown(LPHEADCOMBO lphc, LPARAM lParam)
Definition: combo.c:1537
#define CB_GETTYPE(lphc)
Definition: combo.c:58
static void COMBO_KillFocus(LPHEADCOMBO lphc)
Definition: combo.c:1132
static HBRUSH COMBO_PrepareColors(LPHEADCOMBO lphc, HDC hDC)
Definition: combo.c:587
static INT CBUpdateLBox(LPHEADCOMBO lphc, BOOL bSelect)
Definition: combo.c:855
static void COMBO_MouseMove(LPHEADCOMBO lphc, WPARAM wParam, LPARAM lParam)
Definition: combo.c:1615
static LRESULT COMBO_GetComboBoxInfo(const HEADCOMBO *lphc, COMBOBOXINFO *pcbi)
Definition: combo.c:1649
static void COMBO_SetFocus(LPHEADCOMBO lphc)
Definition: combo.c:1110
#define CB_OWNERDRAWN(lphc)
Definition: combo.c:55
static void CBForceDummyResize(LPHEADCOMBO lphc)
Definition: combo.c:282
static void CBPaintText(HEADCOMBO *lphc, HDC hdc_paint)
Definition: combo.c:629
#define COMBO_YBORDERSIZE()
Definition: combo.c:74
static LRESULT COMBO_Command(LPHEADCOMBO lphc, WPARAM wParam, HWND hWnd)
Definition: combo.c:1158
static void CBResetPos(HEADCOMBO *combo)
Definition: combo.c:1364
static void COMBO_LButtonUp(LPHEADCOMBO lphc)
Definition: combo.c:1582
static void CBCalcPlacement(HEADCOMBO *combo)
Definition: combo.c:317
#define CB_HASSTRINGS(lphc)
Definition: combo.c:56
#define KEYDATA_ALT
Definition: combo.c:43
static LRESULT COMBO_ItemOp(LPHEADCOMBO lphc, UINT msg, LPARAM lParam)
Definition: combo.c:1267
#define COMBO_XBORDERSIZE()
Definition: combo.c:73
static LRESULT COMBO_SelectString(LPHEADCOMBO lphc, INT start, LPARAM pText)
Definition: combo.c:1519
static void CBRollUp(LPHEADCOMBO lphc, BOOL ok, BOOL bButton)
Definition: combo.c:1031
BOOL COMBO_FlipListbox(LPHEADCOMBO lphc, BOOL ok, BOOL bRedrawButton)
Definition: combo.c:1086
static LRESULT COMBO_SetItemHeight(LPHEADCOMBO lphc, INT index, INT height)
Definition: combo.c:1484
static void CBPaintButton(HEADCOMBO *lphc, HDC hdc)
Definition: combo.c:559
static void CBDropDown(LPHEADCOMBO lphc)
Definition: combo.c:925
static void COMBO_Font(LPHEADCOMBO lphc, HFONT hFont, BOOL bRedraw)
Definition: combo.c:1453
#define CB_DISABLED(lphc)
Definition: combo.c:54
#define CB_NOTIFY(lphc, code)
Definition: combo.c:50
static void CBGetDroppedControlRect(LPHEADCOMBO lphc, LPRECT lpRect)
Definition: combo.c:386
static LRESULT COMBO_Create(HWND hwnd, LPHEADCOMBO lphc, HWND hwndParent, LONG style)
Definition: combo.c:401
static void CBUpdateEdit(LPHEADCOMBO lphc, INT index)
Definition: combo.c:889
#define GetProcessHeap()
Definition: compat.h:736
#define lstrcpynA
Definition: compat.h:751
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define lstrcpynW
Definition: compat.h:738
LPSTR WINAPI CharLowerA(char *str)
Definition: string.c:1043
LPWSTR WINAPI CharLowerW(WCHAR *str)
Definition: string.c:1092
LPWSTR WINAPI CharUpperW(WCHAR *str)
Definition: string.c:1205
LPSTR WINAPI CharUpperA(LPSTR str)
Definition: string.c:1156
unsigned short vk
Definition: console.c:118
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1592
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
#define pt(x, y)
Definition: drawing.c:79
return ret
Definition: mutex.c:146
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
pKey DeleteObject()
GLuint start
Definition: gl.h:1545
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLsizeiptr size
Definition: glext.h:5919
GLuint index
Definition: glext.h:6031
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
GLuint64EXT * result
Definition: glext.h:11304
GLenum GLsizei len
Definition: glext.h:6722
GLuint id
Definition: glext.h:5910
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define WNDS2_WIN40COMPAT
Definition: ntuser.h:650
#define FNID_DESTROY
Definition: ntuser.h:898
BOOL NTAPI NtUserGetComboBoxInfo(HWND hWnd, PCOMBOBOXINFO pcbi)
Definition: window.c:3487
#define FNID_COMBOBOX
Definition: ntuser.h:867
BOOL NTAPI NtUserInvalidateRect(HWND hWnd, CONST RECT *lpRect, BOOL bErase)
Definition: painting.c:2542
BOOL NTAPI NtUserSetWindowFNID(HWND hWnd, WORD fnID)
Definition: window.c:4351
LONG_PTR LPARAM
Definition: minwindef.h:175
LONG_PTR LRESULT
Definition: minwindef.h:176
UINT_PTR WPARAM
Definition: minwindef.h:174
#define error(str)
Definition: mkdosfs.c:1605
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
HDC hdc
Definition: main.c:9
static HBITMAP
Definition: button.c:44
#define ES_COMBO
Definition: edit.c:29
static HDC
Definition: imagelist.c:88
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define min(a, b)
Definition: monoChain.cc:55
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
HMONITOR WINAPI MonitorFromRect(LPCRECT, DWORD)
unsigned int UINT
Definition: ndis.h:50
_Out_ LPWSTR lpBuffer
Definition: netsh.h:68
#define LOWORD(l)
Definition: pedump.c:82
#define WS_CHILD
Definition: pedump.c:617
#define ES_LOWERCASE
Definition: pedump.c:669
#define LBS_DISABLENOSCROLL
Definition: pedump.c:690
#define LBS_SORT
Definition: pedump.c:679
#define WS_EX_NOPARENTNOTIFY
Definition: pedump.c:646
#define ES_UPPERCASE
Definition: pedump.c:668
#define WS_BORDER
Definition: pedump.c:625
#define ES_NOHIDESEL
Definition: pedump.c:673
#define LBS_HASSTRINGS
Definition: pedump.c:684
#define WS_VSCROLL
Definition: pedump.c:627
#define ES_AUTOHSCROLL
Definition: pedump.c:672
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_EX_TOPMOST
Definition: pedump.c:647
long LONG
Definition: pedump.c:60
#define WS_DISABLED
Definition: pedump.c:621
#define ES_LEFT
Definition: pedump.c:664
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define WS_HSCROLL
Definition: pedump.c:628
#define LBS_NOINTEGRALHEIGHT
Definition: pedump.c:686
#define LBS_NOTIFY
Definition: pedump.c:678
#define ES_OEMCONVERT
Definition: pedump.c:674
#define WM_PRINTCLIENT
Definition: richedit.h:70
const WCHAR * str
#define TRACE(s)
Definition: solgame.cpp:4
& rect
Definition: startmenu.cpp:1413
RECT buttonRect
Definition: comctl32.h:158
INT fixedOwnerDrawHeight
Definition: comctl32.h:161
RECT textRect
Definition: comctl32.h:157
LONG UIState
Definition: window.c:3471
RECT droppedRect
Definition: comctl32.h:159
UINT wState
Definition: comctl32.h:155
HWND hWndLBox
Definition: comctl32.h:154
INT droppedIndex
Definition: comctl32.h:160
HWND owner
Definition: comctl32.h:151
HWND hWndEdit
Definition: comctl32.h:153
HWND self
Definition: comctl32.h:150
HFONT hFont
Definition: comctl32.h:156
INT droppedWidth
Definition: comctl32.h:162
INT editHeight
Definition: window.c:3470
UINT dwStyle
Definition: comctl32.h:152
Definition: ntuser.h:694
DWORD state2
Definition: ntuser.h:702
DWORD fnid
Definition: ntuser.h:709
Definition: tftpd.h:60
LONG bmHeight
Definition: wingdi.h:1869
LONG bmWidth
Definition: wingdi.h:1868
DWORD stateButton
Definition: winuser.h:3814
ULONG_PTR itemData
Definition: winuser.h:3195
ULONG_PTR itemData
Definition: winuser.h:3748
DWORD cbSize
Definition: winuser.h:3886
LONG right
Definition: windef.h:108
LONG bottom
Definition: windef.h:109
LONG top
Definition: windef.h:107
LONG left
Definition: windef.h:106
#define max(a, b)
Definition: svc.c:63
#define WM_MOUSEWHEEL
Definition: treelist.c:96
LPCSTR pText
Definition: txtscale.cpp:79
int32_t INT
Definition: typedefs.h:58
#define HIWORD(l)
Definition: typedefs.h:247
#define MAXLONG
Definition: umtypes.h:116
#define WM_CBLOSTTEXTFOCUS
Definition: undocuser.h:52
#define LB_CARETON
Definition: undocuser.h:53
#define LB_CARETOFF
Definition: undocuser.h:54
const char * SPY_GetMsgName(UINT msg, HWND hWnd)
Definition: spy.c:2218
#define WIN_GetFullHandle(h)
Definition: user_x.h:108
#define ValidateHwnd(hwnd)
Definition: precomp.h:101
HBRUSH FASTCALL GetControlColor(PWND pwndParent, PWND pwnd, HDC hdc, UINT CtlMsg)
Definition: misc.c:154
#define CBF_BUTTONDOWN
Definition: window.c:3481
static LRESULT COMBO_GetTextW(LPHEADCOMBO lphc, INT count, LPWSTR buf)
Definition: combo.c:1380
LRESULT WINAPI ComboWndProc_common(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: combo.c:1818
static const WCHAR comboboxW[]
Definition: combo.c:66
const struct builtin_class_descr COMBO_builtin_class
Definition: combo.c:67
static char * strdupA(LPCSTR str)
Definition: combo.c:1799
static LRESULT COMBO_GetTextA(LPHEADCOMBO lphc, INT count, LPSTR buf)
Definition: combo.c:1430
static const WCHAR empty_stringW[]
Definition: edit.c:173
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1382
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define WINAPI
Definition: msvc.h:6
#define WM_CTLCOLOR
Definition: windowsx.h:29
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:999
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define ETO_CLIPPED
Definition: wingdi.h:648
BOOL WINAPI ExtTextOutW(_In_ HDC hdc, _In_ int x, _In_ int y, _In_ UINT options, _In_opt_ const RECT *lprect, _In_reads_opt_(c) LPCWSTR lpString, _In_ UINT c, _In_reads_opt_(c) const INT *lpDx)
#define ETO_OPAQUE
Definition: wingdi.h:647
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:917
BOOL WINAPI DeleteDC(_In_ HDC)
int WINAPI SelectClipRgn(_In_ HDC, _In_opt_ HRGN)
#define WM_PAINT
Definition: winuser.h:1648
#define ODS_DISABLED
Definition: winuser.h:2583
#define LB_ERR
Definition: winuser.h:2468
#define CBS_OWNERDRAWFIXED
Definition: winuser.h:289
HWND WINAPI SetCapture(_In_ HWND hWnd)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define WM_ERASEBKGND
Definition: winuser.h:1653
#define CS_VREDRAW
Definition: winuser.h:666
#define ODT_COMBOBOX
Definition: winuser.h:2575
#define CB_SELECTSTRING
Definition: winuser.h:1989
DWORD WINAPI GetSysColor(_In_ int)
#define CB_SETITEMDATA
Definition: winuser.h:1995
#define STATE_SYSTEM_PRESSED
Definition: winuser.h:2967
#define LBN_ERRSPACE
Definition: winuser.h:2108
#define CBN_ERRSPACE
Definition: winuser.h:2006
BOOL WINAPI CopyRect(_Out_ LPRECT, _In_ LPCRECT)
BOOL WINAPI IsWindow(_In_opt_ HWND)
int WINAPI FrameRect(_In_ HDC, _In_ LPCRECT, _In_ HBRUSH)
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1800
#define CB_GETHORIZONTALEXTENT
Definition: winuser.h:1978
#define MK_SHIFT
Definition: winuser.h:2405
#define LB_GETCOUNT
Definition: winuser.h:2067
#define ODS_SELECTED
Definition: winuser.h:2581
#define WM_GETTEXTLENGTH
Definition: winuser.h:1647
#define SW_HIDE
Definition: winuser.h:779
#define CB_SETDROPPEDWIDTH
Definition: winuser.h:1991
#define LB_FINDSTRINGEXACT
Definition: winuser.h:2064
#define SWP_NOACTIVATE
Definition: winuser.h:1253
#define CB_GETLBTEXTLEN
Definition: winuser.h:1982
#define LB_GETITEMDATA
Definition: winuser.h:2070
#define DFC_SCROLL
Definition: winuser.h:475
#define SWP_NOREDRAW
Definition: winuser.h:1257
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
#define EM_LIMITTEXT
Definition: winuser.h:2029
#define GetWindowLongPtrW
Definition: winuser.h:4931
#define CB_GETLBTEXT
Definition: winuser.h:1981
#define WM_ENABLE
Definition: winuser.h:1643
#define EDGE_SUNKEN
Definition: winuser.h:451
#define WM_PASTE
Definition: winuser.h:1891
#define LB_SETHORIZONTALEXTENT
Definition: winuser.h:2100
#define EN_KILLFOCUS
Definition: winuser.h:2054
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define COLOR_GRAYTEXT
Definition: winuser.h:943
#define COLOR_WINDOW
Definition: winuser.h:929
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2890
#define ODA_DRAWENTIRE
Definition: winuser.h:2578
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CBS_NOINTEGRALHEIGHT
Definition: winuser.h:287
#define CB_OKAY
Definition: winuser.h:2470
#define LBN_SELCANCEL
Definition: winuser.h:2110
#define HWND_TOPMOST
Definition: winuser.h:1219
#define CBS_AUTOHSCROLL
Definition: winuser.h:281
#define CBS_DROPDOWNLIST
Definition: winuser.h:284
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LB_GETTEXT
Definition: winuser.h:2085
#define LB_SETTOPINDEX
Definition: winuser.h:2106
#define LBN_DBLCLK
Definition: winuser.h:2107
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define WM_CREATE
Definition: winuser.h:1636
#define DLGC_WANTCHARS
Definition: winuser.h:2660
BOOL WINAPI InvertRect(_In_ HDC, _In_ LPCRECT)
#define CB_SHOWDROPDOWN
Definition: winuser.h:1999
BOOL WINAPI DrawFrameControl(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define CB_GETITEMHEIGHT
Definition: winuser.h:1980
#define EM_GETSEL
Definition: winuser.h:2026
#define EN_SETFOCUS
Definition: winuser.h:2056
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define EN_UPDATE
Definition: winuser.h:2057
#define CB_SETHORIZONTALEXTENT
Definition: winuser.h:1994
#define SM_CXVSCROLL
Definition: winuser.h:972
#define CBS_OWNERDRAWVARIABLE
Definition: winuser.h:290
#define LB_DIR
Definition: winuser.h:2062
HWND WINAPI SetParent(_In_ HWND, _In_opt_ HWND)
#define WM_SIZE
Definition: winuser.h:1639
#define COLOR_HIGHLIGHT
Definition: winuser.h:937
HBRUSH WINAPI GetSysColorBrush(_In_ int)
#define CBN_SETFOCUS
Definition: winuser.h:2011
#define SWP_NOMOVE
Definition: winuser.h:1255
#define WM_COMMAND
Definition: winuser.h:1768
#define CS_HREDRAW
Definition: winuser.h:661
#define DFCS_INACTIVE
Definition: winuser.h:502
#define KF_ALTDOWN
Definition: winuser.h:2485
#define CBS_DISABLENOSCROLL
Definition: winuser.h:282
struct tagCREATESTRUCTA * LPCREATESTRUCTA
#define CB_INITSTORAGE
Definition: winuser.h:1985
#define CB_ERR
Definition: winuser.h:2471
#define IDC_ARROW
Definition: winuser.h:695
#define CB_SETCURSEL
Definition: winuser.h:1990
#define LBN_SETFOCUS
Definition: winuser.h:2112
#define LB_GETTOPINDEX
Definition: winuser.h:2087
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define VK_UP
Definition: winuser.h:2261
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI IsRectEmpty(_In_ LPCRECT)
#define WM_SETFOCUS
Definition: winuser.h:1641
#define WM_MOUSEMOVE
Definition: winuser.h:1803
#define LB_GETLOCALE
Definition: winuser.h:2081
#define WM_GETTEXT
Definition: winuser.h:1646
#define RDW_UPDATENOW
Definition: winuser.h:1231
HWND WINAPI GetCapture(void)
Definition: message.c:2881
#define RDW_ERASE
Definition: winuser.h:1222
#define WM_CTLCOLORSCROLLBAR
Definition: winuser.h:1799
#define RDW_NOCHILDREN
Definition: winuser.h:1233
#define WM_CUT
Definition: winuser.h:1889
#define LB_SETLOCALE
Definition: winuser.h:2103
#define CB_RESETCONTENT
Definition: winuser.h:1988
#define CB_FINDSTRINGEXACT
Definition: winuser.h:1969
#define CS_DBLCLKS
Definition: winuser.h:659
#define WM_LBUTTONDOWN
Definition: winuser.h:1804
#define LB_ADDSTRING
Definition: winuser.h:2060
#define CB_DIR
Definition: winuser.h:1967
#define CB_GETCOUNT
Definition: winuser.h:1971
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
#define WM_GETFONT
Definition: winuser.h:1679
#define GWLP_HINSTANCE
Definition: winuser.h:867
#define CB_GETDROPPEDWIDTH
Definition: winuser.h:1975
#define WM_DELETEITEM
Definition: winuser.h:1675
#define CBN_EDITUPDATE
Definition: winuser.h:2005
#define CB_GETCOMBOBOXINFO
Definition: winuser.h:1970
#define WM_CTLCOLORMSGBOX
Definition: winuser.h:1794
#define WM_DRAWITEM
Definition: winuser.h:1673
#define CBN_SELCHANGE
Definition: winuser.h:2008
#define CB_SETLOCALE
Definition: winuser.h:1997
#define WM_NCCREATE
Definition: winuser.h:1711
#define HWND_DESKTOP
Definition: winuser.h:1220
#define LB_SETITEMHEIGHT
Definition: winuser.h:2102
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define WM_CTLCOLORBTN
Definition: winuser.h:1797
BOOL WINAPI PtInRect(_In_ LPCRECT, _In_ POINT)
#define WM_SETTEXT
Definition: winuser.h:1645
#define CBN_CLOSEUP
Definition: winuser.h:2001
#define CBS_SIMPLE
Definition: winuser.h:291
#define LB_SELECTSTRING
Definition: winuser.h:2092
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define WM_IME_CHAR
Definition: winuser.h:1862
#define LBS_COMBOBOX
Definition: winuser.h:324
#define LB_RESETCONTENT
Definition: winuser.h:2091
#define LB_DELETESTRING
Definition: winuser.h:2061
#define VK_RETURN
Definition: winuser.h:2237
#define CB_GETDROPPEDCONTROLRECT
Definition: winuser.h:1973
#define CBN_DROPDOWN
Definition: winuser.h:2003
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
HWND WINAPI SetFocus(_In_opt_ HWND)
#define LB_FINDSTRING
Definition: winuser.h:2063
#define MK_CONTROL
Definition: winuser.h:2406
#define LB_GETITEMHEIGHT
Definition: winuser.h:2071
BOOL WINAPI GetComboBoxInfo(_In_ HWND, _Inout_ PCOMBOBOXINFO)
#define WM_SETFONT
Definition: winuser.h:1678
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
#define LB_GETHORIZONTALEXTENT
Definition: winuser.h:2069
#define DLGC_WANTARROWS
Definition: winuser.h:2652
#define LB_INSERTSTRING
Definition: winuser.h:2089
#define CB_ADDSTRING
Definition: winuser.h:1965
#define STATE_SYSTEM_INVISIBLE
Definition: winuser.h:2979
BOOL WINAPI UpdateWindow(_In_ HWND)
#define CB_GETITEMDATA
Definition: winuser.h:1979
#define SWP_SHOWWINDOW
Definition: winuser.h:1259
#define SendMessage
Definition: winuser.h:5954
#define CBN_KILLFOCUS
Definition: winuser.h:2007
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define COLOR_HIGHLIGHTTEXT
Definition: winuser.h:938
#define CBS_LOWERCASE
Definition: winuser.h:286
HDC WINAPI GetDC(_In_opt_ HWND)
#define EM_SETSEL
Definition: winuser.h:2047
#define CBS_DROPDOWN
Definition: winuser.h:283
#define CBS_HASSTRINGS
Definition: winuser.h:285
#define WM_MEASUREITEM
Definition: winuser.h:1674
#define DFCS_SCROLLCOMBOBOX
Definition: winuser.h:493
#define CBS_SORT
Definition: winuser.h:292
#define CB_SETEDITSEL
Definition: winuser.h:1992
#define CBS_OEMCONVERT
Definition: winuser.h:288
#define VK_F4
Definition: winuser.h:2294
#define CB_GETDROPPEDSTATE
Definition: winuser.h:1974
#define WM_LBUTTONUP
Definition: winuser.h:1805
#define WM_CHAR
Definition: winuser.h:1745
BOOL WINAPI IsWindowEnabled(_In_ HWND)
#define LB_GETTEXTLEN
Definition: winuser.h:2086
#define LB_SETITEMDATA
Definition: winuser.h:2101
#define LBN_SELCHANGE
Definition: winuser.h:2111
#define WM_NCDESTROY
Definition: winuser.h:1712
#define CB_GETEXTENDEDUI
Definition: winuser.h:1977
#define CBN_DBLCLK
Definition: winuser.h:2002
#define VK_DOWN
Definition: winuser.h:2263
#define GWLP_ID
Definition: winuser.h:871
#define WM_COPY
Definition: winuser.h:1890
#define CB_GETTOPINDEX
Definition: winuser.h:1984
#define CB_LIMITTEXT
Definition: winuser.h:1987
#define WM_USER
Definition: winuser.h:1923
#define LBN_KILLFOCUS
Definition: winuser.h:2109
#define CB_GETEDITSEL
Definition: winuser.h:1976
#define WM_CTLCOLORLISTBOX
Definition: winuser.h:1796
#define CBN_SELENDOK
Definition: winuser.h:2010
#define DLGC_WANTMESSAGE
Definition: winuser.h:2655
#define CB_FINDSTRING
Definition: winuser.h:1968
#define CBN_SELENDCANCEL
Definition: winuser.h:2009
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define LB_SETCURSEL
Definition: winuser.h:2099
#define WM_CLEAR
Definition: winuser.h:1892
#define WM_KEYDOWN
Definition: winuser.h:1743
#define CBS_UPPERCASE
Definition: winuser.h:293
#define CB_SETEXTENDEDUI
Definition: winuser.h:1993
BOOL WINAPI GetMonitorInfoW(_In_ HMONITOR, _Inout_ LPMONITORINFO)
BOOL WINAPI DrawFocusRect(_In_ HDC, _In_ LPCRECT)
#define WM_COMPAREITEM
Definition: winuser.h:1683
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define CB_INSERTSTRING
Definition: winuser.h:1986
HBITMAP WINAPI LoadBitmapW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2532
#define SWP_NOZORDER
Definition: winuser.h:1258
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define LB_GETCURSEL
Definition: winuser.h:2068
#define CB_GETCURSEL
Definition: winuser.h:1972
BOOL WINAPI UnionRect(_Out_ LPRECT, _In_ LPCRECT, _In_ LPCRECT)
#define SetWindowLongPtrW
Definition: winuser.h:5457
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define CB_DELETESTRING
Definition: winuser.h:1966
#define EN_ERRSPACE
Definition: winuser.h:2052
#define BF_RECT
Definition: winuser.h:462
#define CB_GETLOCALE
Definition: winuser.h:1983
#define GWL_STYLE
Definition: winuser.h:863
#define CB_SETITEMHEIGHT
Definition: winuser.h:1996
#define CS_PARENTDC
Definition: winuser.h:664
#define LB_INITSTORAGE
Definition: winuser.h:2088
#define WM_CTLCOLOREDIT
Definition: winuser.h:1795
#define VK_ESCAPE
Definition: winuser.h:2250
BOOL WINAPI IsWindowVisible(_In_ HWND)
BOOL WINAPI DestroyWindow(_In_ HWND)
#define WM_CTLCOLORDLG
Definition: winuser.h:1798
#define DFCS_PUSHED
Definition: winuser.h:503
#define WM_KILLFOCUS
Definition: winuser.h:1642
struct tagCREATESTRUCTW * LPCREATESTRUCTW
#define ODS_FOCUS
Definition: winuser.h:2585
int WINAPI GetSystemMetrics(_In_ int)
#define WM_SYSKEYDOWN
Definition: winuser.h:1747
#define LB_SETCARETINDEX
Definition: winuser.h:2096
#define RDW_INVALIDATE
Definition: winuser.h:1225
#define WM_GETDLGCODE
Definition: winuser.h:1717
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CBN_EDITCHANGE
Definition: winuser.h:2004
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
#define GWL_EXSTYLE
Definition: winuser.h:862
#define EN_CHANGE
Definition: winuser.h:2051
#define WM_SETREDRAW
Definition: winuser.h:1644
const char * LPCSTR
Definition: xmlstorage.h:183
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
char * LPSTR
Definition: xmlstorage.h:182