ReactOS 0.4.17-dev-1321-g5c122a9
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#ifdef __REACTOS__
64/*********************************************************************
65 * combo class descriptor
66 */
67static const WCHAR comboboxW[] = {'C','o','m','b','o','B','o','x',0};
69{
70 comboboxW, /* name */
72 &pfnClientA.pfnComboBoxWndProc, /* procA */
73 &pfnClientW.pfnComboBoxWndProc, /* procW */
74 sizeof(HEADCOMBO *), /* extra */
75 IDC_ARROW, /* cursor */
76 0 /* brush */
77};
78#endif
79
80static void CBCalcPlacement(HEADCOMBO *combo);
81static void CBResetPos(HEADCOMBO *combo, BOOL redraw);
82
84{
85 return (HEADCOMBO *)NtUserGetPrivateData( hwnd, 0, sizeof(HEADCOMBO *) );
86}
87
89{
90 return (HEADCOMBO *)NtUserSetPrivateData( hwnd, 0, sizeof(HEADCOMBO *), (LONG_PTR)state );
91}
92
93/***********************************************************************
94 * COMBO_Init
95 *
96 * Load combo button bitmap.
97 */
98static BOOL COMBO_Init(void)
99{
100 HDC hDC;
101
102 if( hComboBmp ) return TRUE;
103 if( (hDC = CreateCompatibleDC(0)) )
104 {
105 BOOL bRet = FALSE;
106 if( (hComboBmp = LoadBitmapW(0, MAKEINTRESOURCEW(OBM_COMBO))) )
107 {
108 BITMAP bm;
109 HBITMAP hPrevB;
110 RECT r;
111
112 GetObjectW( hComboBmp, sizeof(bm), &bm );
113 CBitHeight = bm.bmHeight;
114 CBitWidth = bm.bmWidth;
115
116 TRACE("combo bitmap [%i,%i]\n", CBitWidth, CBitHeight );
117
118 hPrevB = SelectObject( hDC, hComboBmp);
119 SetRect( &r, 0, 0, CBitWidth, CBitHeight );
120 InvertRect( hDC, &r );
121 SelectObject( hDC, hPrevB );
122 bRet = TRUE;
123 }
124 DeleteDC( hDC );
125 return bRet;
126 }
127 return FALSE;
128}
129
130#ifdef __REACTOS__
131/* Retrieve the UI state for the control */
132static BOOL COMBO_update_uistate(LPHEADCOMBO lphc)
133{
134 LONG prev_flags;
135
136 prev_flags = lphc->UIState;
137 lphc->UIState = DefWindowProcW(lphc->self, WM_QUERYUISTATE, 0, 0);
138 return prev_flags != lphc->UIState;
139}
140#endif
141
142/***********************************************************************
143 * COMBO_NCCreate
144 */
146{
147 LPHEADCOMBO lphc;
148
149 if( COMBO_Init() && (lphc = calloc( 1, sizeof(HEADCOMBO) )) )
150 {
151 lphc->self = hwnd;
152 set_control_state( hwnd, lphc );
153
154#ifdef __REACTOS__
155 COMBO_update_uistate(lphc);
156#endif
157
158 /* some braindead apps do try to use scrollbar/border flags */
159
162
163 /*
164 * We also have to remove the client edge style to make sure
165 * we don't end-up with a non client area.
166 */
169
171 lphc->dwStyle |= CBS_HASSTRINGS;
173 lphc->wState |= CBF_NOTIFY;
174
175 TRACE("[%p], style = %08x\n", lphc, lphc->dwStyle );
176 return TRUE;
177 }
178 return FALSE;
179}
180
181/***********************************************************************
182 * COMBO_NCDestroy
183 */
185{
186 if (lphc)
187 {
188 TRACE("[%p]: freeing storage\n", lphc->self);
189
190 if( (CB_GETTYPE(lphc) != CBS_SIMPLE) && lphc->hWndLBox )
192
193 set_control_state( lphc->self, NULL );
194 free( lphc );
195 }
196 return 0;
197}
198
200{
201 HDC hdc = NtUserGetDC(combo->self);
202 HFONT prev_font = 0;
204
205 if (combo->hFont)
206 prev_font = SelectObject(hdc, combo->hFont);
207
209
210 if (prev_font)
211 SelectObject(hdc, prev_font);
212
213 NtUserReleaseDC( combo->self, hdc );
214
215 return tm.tmHeight + 4;
216}
217
218/***********************************************************************
219 * CBGetTextAreaHeight
220 *
221 * This method will calculate the height of the text area of the
222 * combobox.
223 * The height of the text area is set in two ways.
224 * It can be set explicitly through a combobox message or through a
225 * WM_MEASUREITEM callback.
226 * If this is not the case, the height is set to font height + 4px
227 * This height was determined through experimentation.
228 * CBCalcPlacement will add 2*COMBO_YBORDERSIZE pixels for the border
229 */
230static INT CBGetTextAreaHeight(HEADCOMBO *lphc, BOOL clip_item_height)
231{
232 INT item_height, text_height;
233
234 if (clip_item_height && !CB_OWNERDRAWN(lphc))
235 {
236 text_height = combo_get_text_height(lphc);
237 if (lphc->item_height < text_height)
238 lphc->item_height = text_height;
239 }
240
241 item_height = lphc->item_height;
242
243 /*
244 * Check the ownerdraw case if we haven't asked the parent the size
245 * of the item yet.
246 */
247 if ( CB_OWNERDRAWN(lphc) &&
248 (lphc->wState & CBF_MEASUREITEM) )
249 {
250 MEASUREITEMSTRUCT measureItem;
251 RECT clientRect;
252 INT originalItemHeight = item_height;
253 UINT id = (UINT)GetWindowLongPtrW( lphc->self, GWLP_ID );
254
255 /*
256 * We use the client rect for the width of the item.
257 */
258 GetClientRect(lphc->self, &clientRect);
259
260 lphc->wState &= ~CBF_MEASUREITEM;
261
262 /*
263 * Send a first one to measure the size of the text area
264 */
265 measureItem.CtlType = ODT_COMBOBOX;
266 measureItem.CtlID = id;
267 measureItem.itemID = -1;
268 measureItem.itemWidth = clientRect.right;
269 measureItem.itemHeight = item_height - 2; /* ownerdrawn cb is taller */
270 measureItem.itemData = 0;
271 SendMessageW(lphc->owner, WM_MEASUREITEM, id, (LPARAM)&measureItem);
272 item_height = 2 + measureItem.itemHeight;
273
274 /*
275 * Send a second one in the case of a fixed ownerdraw list to calculate the
276 * size of the list items. (we basically do this on behalf of the listbox)
277 */
278 if (lphc->dwStyle & CBS_OWNERDRAWFIXED)
279 {
280 measureItem.CtlType = ODT_COMBOBOX;
281 measureItem.CtlID = id;
282 measureItem.itemID = 0;
283 measureItem.itemWidth = clientRect.right;
284 measureItem.itemHeight = originalItemHeight;
285 measureItem.itemData = 0;
286 SendMessageW(lphc->owner, WM_MEASUREITEM, id, (LPARAM)&measureItem);
287 lphc->fixedOwnerDrawHeight = measureItem.itemHeight;
288 }
289
290 /*
291 * Keep the size for the next time
292 */
293 lphc->item_height = item_height;
294 }
295
296 return item_height;
297}
298
299/***********************************************************************
300 * CBForceDummyResize
301 *
302 * The dummy resize is used for listboxes that have a popup to trigger
303 * a re-arranging of the contents of the combobox and the recalculation
304 * of the size of the "real" control window.
305 */
307{
308 RECT windowRect;
309 int newComboHeight;
310
311 newComboHeight = CBGetTextAreaHeight(lphc, FALSE) + 2*COMBO_YBORDERSIZE();
312
313 GetWindowRect(lphc->self, &windowRect);
314
315 /*
316 * We have to be careful, resizing a combobox also has the meaning that the
317 * dropped rect will be resized. In this case, we want to trigger a resize
318 * to recalculate layout but we don't want to change the dropped rectangle
319 * So, we pass the height of text area of control as the height.
320 * this will cancel-out in the processing of the WM_WINDOWPOSCHANGING
321 * message.
322 */
323 lphc->wState |= CBF_NORESIZE;
325 NULL,
326 0, 0,
327 windowRect.right - windowRect.left,
328 newComboHeight,
330 lphc->wState &= ~CBF_NORESIZE;
331
332 CBCalcPlacement(lphc);
333 CBResetPos(lphc, FALSE);
334}
335
336/***********************************************************************
337 * CBCalcPlacement
338 *
339 * Set up component coordinates given valid lphc->RectCombo.
340 */
341static void CBCalcPlacement(HEADCOMBO *combo)
342{
343 /* Start with the client rectangle. */
344 GetClientRect(combo->self, &combo->textRect);
345
346 /* Remove the borders */
348
349 /* Chop off the bottom part to fit with the height of the text area. */
350 combo->textRect.bottom = combo->textRect.top + CBGetTextAreaHeight(combo, FALSE);
351
352 /* The button starts the same vertical position as the text area. */
353 combo->buttonRect = combo->textRect;
354
355 /* If the combobox is "simple" there is no button. */
356 if (CB_GETTYPE(combo) == CBS_SIMPLE)
357 combo->buttonRect.left = combo->buttonRect.right = combo->buttonRect.bottom = 0;
358 else
359 {
360 /*
361 * Let's assume the combobox button is the same width as the
362 * scrollbar button.
363 * size the button horizontally and cut-off the text area.
364 */
366 combo->textRect.right = combo->buttonRect.left;
367 }
368
369 /* In the case of a dropdown, there is an additional spacing between the text area and the button. */
370 if (CB_GETTYPE(combo) == CBS_DROPDOWN)
372
373 /* If we have an edit control, we space it away from the borders slightly. */
374 if (CB_GETTYPE(combo) != CBS_DROPDOWNLIST)
376
377 /* Adjust the size of the listbox popup. */
378 if (CB_GETTYPE(combo) == CBS_SIMPLE)
379 {
380 GetClientRect(combo->self, &combo->droppedRect);
381 combo->droppedRect.top = combo->textRect.bottom + COMBO_YBORDERSIZE();
382 }
383 else
384 {
385 /* Make sure the dropped width is as large as the combobox itself. */
386 if (combo->droppedWidth < (combo->buttonRect.right + COMBO_XBORDERSIZE()))
387 {
388 combo->droppedRect.right = combo->droppedRect.left + (combo->buttonRect.right + COMBO_XBORDERSIZE());
389
390 /* In the case of a dropdown, the popup listbox is offset to the right. We want to make sure it's flush
391 with the right side of the combobox. */
392 if (CB_GETTYPE(combo) == CBS_DROPDOWN)
394 }
395 else
396 combo->droppedRect.right = combo->droppedRect.left + combo->droppedWidth;
397 }
398
399 /* Disallow negative window width */
400 if (combo->textRect.right < combo->textRect.left)
401 combo->textRect.right = combo->textRect.left;
402
403 TRACE("text %s, button %s, lbox %s.\n", wine_dbgstr_rect(&combo->textRect), wine_dbgstr_rect(&combo->buttonRect),
405}
406
407/***********************************************************************
408 * CBGetDroppedControlRect
409 */
411{
412 /* In windows, CB_GETDROPPEDCONTROLRECT returns the upper left corner
413 of the combo box and the lower right corner of the listbox */
414
415 GetWindowRect(lphc->self, lpRect);
416
417 lpRect->right = lpRect->left + lphc->droppedRect.right - lphc->droppedRect.left;
418 lpRect->bottom = lpRect->top + lphc->droppedRect.bottom - lphc->droppedRect.top;
419
420}
421
422/***********************************************************************
423 * COMBO_Create
424 */
426 BOOL unicode )
427{
428 if( !CB_GETTYPE(lphc) ) lphc->dwStyle |= CBS_SIMPLE;
429 if( CB_GETTYPE(lphc) != CBS_DROPDOWNLIST ) lphc->wState |= CBF_EDIT;
430
431 lphc->owner = hwndParent;
432
433 lphc->droppedWidth = 0;
434
436
437 /*
438 * The first time we go through, we want to measure the ownerdraw item
439 */
440 lphc->wState |= CBF_MEASUREITEM;
441
442 /* M$ IE 3.01 actually creates (and rapidly destroys) an ownerless combobox */
443
444#ifdef __REACTOS__
445 if(TRUE)
446#else
447 if( lphc->owner || !(style & WS_VISIBLE) )
448#endif
449 {
450 UINT lbeStyle = 0;
451 UINT lbeExStyle = 0;
452
453 /*
454 * Initialize the dropped rect to the size of the client area of the
455 * control and then, force all the areas of the combobox to be
456 * recalculated.
457 */
458 GetClientRect( hwnd, &lphc->droppedRect );
459 CBCalcPlacement(lphc);
460
461 /*
462 * Adjust the position of the popup listbox if it's necessary
463 */
464 if ( CB_GETTYPE(lphc) != CBS_SIMPLE )
465 {
467
468 /*
469 * If it's a dropdown, the listbox is offset
470 */
471 if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
473
474 if (lphc->droppedRect.bottom < lphc->droppedRect.top)
475 lphc->droppedRect.bottom = lphc->droppedRect.top;
476 if (lphc->droppedRect.right < lphc->droppedRect.left)
477 lphc->droppedRect.right = lphc->droppedRect.left;
478 MapWindowPoints( hwnd, 0, (LPPOINT)&lphc->droppedRect, 2 );
479 }
480
481 /* create listbox popup */
482
485
486 if( lphc->dwStyle & CBS_SORT )
487 lbeStyle |= LBS_SORT;
488 if( lphc->dwStyle & CBS_HASSTRINGS )
489 lbeStyle |= LBS_HASSTRINGS;
490 if( lphc->dwStyle & CBS_NOINTEGRALHEIGHT )
491 lbeStyle |= LBS_NOINTEGRALHEIGHT;
492 if( lphc->dwStyle & CBS_DISABLENOSCROLL )
493 lbeStyle |= LBS_DISABLENOSCROLL;
494
495 if( CB_GETTYPE(lphc) == CBS_SIMPLE ) /* child listbox */
496 {
497 lbeStyle |= WS_VISIBLE;
498
499 /*
500 * In win 95 look n feel, the listbox in the simple combobox has
501 * the WS_EXCLIENTEDGE style instead of the WS_BORDER style.
502 */
503 lbeStyle &= ~WS_BORDER;
504 lbeExStyle |= WS_EX_CLIENTEDGE;
505 }
506 else
507 {
508 lbeExStyle |= (WS_EX_TOPMOST | WS_EX_TOOLWINDOW);
509 }
510
511 if (unicode)
512 lphc->hWndLBox = CreateWindowExW(lbeExStyle, L"ComboLBox", NULL, lbeStyle,
513 lphc->droppedRect.left,
514 lphc->droppedRect.top,
515 lphc->droppedRect.right - lphc->droppedRect.left,
516 lphc->droppedRect.bottom - lphc->droppedRect.top,
519 else
520 lphc->hWndLBox = CreateWindowExA(lbeExStyle, "ComboLBox", NULL, lbeStyle,
521 lphc->droppedRect.left,
522 lphc->droppedRect.top,
523 lphc->droppedRect.right - lphc->droppedRect.left,
524 lphc->droppedRect.bottom - lphc->droppedRect.top,
527
528 if( lphc->hWndLBox )
529 {
530 BOOL bEdit = TRUE;
532
533 if( lphc->wState & CBF_EDIT )
534 {
535 if( lphc->dwStyle & CBS_OEMCONVERT )
536 lbeStyle |= ES_OEMCONVERT;
537 if( lphc->dwStyle & CBS_AUTOHSCROLL )
538 lbeStyle |= ES_AUTOHSCROLL;
539 if( lphc->dwStyle & CBS_LOWERCASE )
540 lbeStyle |= ES_LOWERCASE;
541 else if( lphc->dwStyle & CBS_UPPERCASE )
542 lbeStyle |= ES_UPPERCASE;
543
544 if (!IsWindowEnabled(hwnd)) lbeStyle |= WS_DISABLED;
545
546 if (unicode)
547 lphc->hWndEdit = CreateWindowExW(0, L"Edit", NULL, lbeStyle,
548 lphc->textRect.left, lphc->textRect.top,
549 lphc->textRect.right - lphc->textRect.left,
550 lphc->textRect.bottom - lphc->textRect.top,
553 else
554 lphc->hWndEdit = CreateWindowExA(0, "Edit", NULL, lbeStyle,
555 lphc->textRect.left, lphc->textRect.top,
556 lphc->textRect.right - lphc->textRect.left,
557 lphc->textRect.bottom - lphc->textRect.top,
560
561 if( !lphc->hWndEdit )
562 bEdit = FALSE;
563 }
564
565 if( bEdit )
566 {
567 if( CB_GETTYPE(lphc) != CBS_SIMPLE )
568 {
569 /* Now do the trick with parent */
571 /*
572 * If the combo is a dropdown, we must resize the control
573 * to fit only the text area and button. To do this,
574 * we send a dummy resize and the WM_WINDOWPOSCHANGING message
575 * will take care of setting the height for us.
576 */
577 CBForceDummyResize(lphc);
578 }
579
580 TRACE("init done\n");
581 return 0;
582 }
583 ERR("edit control failure.\n");
584 } else ERR("listbox failure.\n");
585 } else ERR("no owner for visible combo.\n");
586
587 /* CreateWindow() will send WM_NCDESTROY to cleanup */
588
589 return -1;
590}
591
592/***********************************************************************
593 * CBPaintButton
594 *
595 * Paint combo button (normal, pressed, and disabled states).
596 */
597static void CBPaintButton(HEADCOMBO *lphc, HDC hdc)
598{
599 UINT buttonState = DFCS_SCROLLCOMBOBOX;
600
601 if (IsRectEmpty(&lphc->buttonRect))
602 return;
603
604 if( lphc->wState & CBF_NOREDRAW )
605 return;
606
607
608 if (lphc->wState & CBF_BUTTONDOWN)
609 buttonState |= DFCS_PUSHED;
610
611 if (CB_DISABLED(lphc))
612 buttonState |= DFCS_INACTIVE;
613
614 DrawFrameControl(hdc, &lphc->buttonRect, DFC_SCROLL, buttonState);
615}
616
617/***********************************************************************
618 * COMBO_PrepareColors
619 *
620 * This method will sent the appropriate WM_CTLCOLOR message to
621 * prepare and setup the colors for the combo's DC.
622 *
623 * It also returns the brush to use for the background.
624 */
626 LPHEADCOMBO lphc,
627 HDC hDC)
628{
629 HBRUSH hBkgBrush;
630
631 /*
632 * Get the background brush for this control.
633 */
634 if (CB_DISABLED(lphc))
635 {
636#ifdef __REACTOS__
637 hBkgBrush = GetControlColor(lphc->owner, lphc->self, hDC, WM_CTLCOLORSTATIC);
638#else
639 hBkgBrush = (HBRUSH)SendMessageW(lphc->owner, WM_CTLCOLORSTATIC,
640 (WPARAM)hDC, (LPARAM)lphc->self );
641#endif
642
643 /*
644 * We have to change the text color since WM_CTLCOLORSTATIC will
645 * set it to the "enabled" color. This is the same behavior as the
646 * edit control
647 */
649 }
650 else
651 {
652 /* FIXME: In which cases WM_CTLCOLORLISTBOX should be sent? */
653#ifdef __REACTOS__
654 hBkgBrush = GetControlColor(lphc->owner, lphc->self, hDC, WM_CTLCOLOREDIT);
655#else
656 hBkgBrush = (HBRUSH)SendMessageW(lphc->owner, WM_CTLCOLOREDIT,
657 (WPARAM)hDC, (LPARAM)lphc->self );
658#endif
659 }
660
661 /*
662 * Catch errors.
663 */
664 if( !hBkgBrush )
665 hBkgBrush = GetSysColorBrush(COLOR_WINDOW);
666
667 return hBkgBrush;
668}
669
670/***********************************************************************
671 * CBPaintText
672 *
673 * Paint CBS_DROPDOWNLIST text field / update edit control contents.
674 */
675static void CBPaintText(
676 LPHEADCOMBO lphc,
677 HDC hdc_paint)
678{
679 RECT rectEdit = lphc->textRect;
680 INT id, size = 0;
681 LPWSTR pText = NULL;
682
683 TRACE("\n");
684
685 /* follow Windows combobox that sends a bunch of text
686 * inquiries to its listbox while processing WM_PAINT. */
687
688 if( (id = SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0) ) != LB_ERR )
689 {
690 size = SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, id, 0);
691 if (size == LB_ERR)
692 FIXME("LB_ERR probably not handled yet\n");
693 if( (pText = malloc((size + 1) * sizeof(WCHAR))) )
694 {
695 /* size from LB_GETTEXTLEN may be too large, from LB_GETTEXT is accurate */
697 pText[size] = '\0'; /* just in case */
698 } else return;
699 }
700
701 if( lphc->wState & CBF_EDIT )
702 {
703 if( CB_HASSTRINGS(lphc) ) SetWindowTextW( lphc->hWndEdit, pText ? pText : L"" );
704 if( lphc->wState & CBF_FOCUSED )
706 }
707 else if(!(lphc->wState & CBF_NOREDRAW) && IsWindowVisible( lphc->self ))
708 {
709 /* paint text field ourselves */
710 HDC hdc = hdc_paint ? hdc_paint : NtUserGetDC(lphc->self);
711 UINT itemState = ODS_COMBOBOXEDIT;
712 HFONT hPrevFont = (lphc->hFont) ? SelectObject(hdc, lphc->hFont) : 0;
713 HBRUSH hPrevBrush, hBkgBrush;
714
715 /*
716 * Give ourselves some space.
717 */
718 InflateRect( &rectEdit, -1, -1 );
719
720 hBkgBrush = COMBO_PrepareColors( lphc, hdc );
721 hPrevBrush = SelectObject( hdc, hBkgBrush );
722 FillRect( hdc, &rectEdit, hBkgBrush );
723
724 if( CB_OWNERDRAWN(lphc) )
725 {
726 DRAWITEMSTRUCT dis;
727 HRGN clipRegion;
728 UINT ctlid = (UINT)GetWindowLongPtrW( lphc->self, GWLP_ID );
729
730 /* setup state for DRAWITEM message. Owner will highlight */
731 if ( (lphc->wState & CBF_FOCUSED) &&
732 !(lphc->wState & CBF_DROPPED) )
733 itemState |= ODS_SELECTED | ODS_FOCUS;
734
735 if (!IsWindowEnabled(lphc->self)) itemState |= ODS_DISABLED;
736
737 dis.CtlType = ODT_COMBOBOX;
738 dis.CtlID = ctlid;
739 dis.hwndItem = lphc->self;
741 dis.itemID = id;
742 dis.itemState = itemState;
743 dis.hDC = hdc;
744 dis.rcItem = rectEdit;
745 dis.itemData = SendMessageW(lphc->hWndLBox, LB_GETITEMDATA, id, 0);
746
747 /*
748 * Clip the DC and have the parent draw the item.
749 */
750 clipRegion = set_control_clipping( hdc, &rectEdit );
751
752 SendMessageW(lphc->owner, WM_DRAWITEM, ctlid, (LPARAM)&dis );
753
754 SelectClipRgn( hdc, clipRegion );
755 if (clipRegion) DeleteObject( clipRegion );
756 }
757 else
758 {
759 if ( (lphc->wState & CBF_FOCUSED) &&
760 !(lphc->wState & CBF_DROPPED) ) {
761
762 /* highlight */
766 }
767
769 rectEdit.left + 1,
770 rectEdit.top + 1,
772 &rectEdit,
773 pText ? pText : L"" , size, NULL );
774
775#ifdef __REACTOS__
776 if(lphc->wState & CBF_FOCUSED &&
777 !(lphc->wState & CBF_DROPPED) &&
778 !(lphc->UIState & UISF_HIDEFOCUS))
779#else
780 if(lphc->wState & CBF_FOCUSED && !(lphc->wState & CBF_DROPPED))
781#endif
782 DrawFocusRect( hdc, &rectEdit );
783 }
784
785 if( hPrevFont )
786 SelectObject(hdc, hPrevFont );
787
788 if( hPrevBrush )
789 SelectObject( hdc, hPrevBrush );
790
791 if (!hdc_paint)
792 NtUserReleaseDC( lphc->self, hdc );
793 }
794#ifdef __REACTOS__
795 if (pText)
796#endif
797 free(pText);
798}
799
800/***********************************************************************
801 * CBPaintBorder
802 */
803static void CBPaintBorder(const HEADCOMBO *lphc, HDC hdc)
804{
805 RECT clientRect;
806
807 if (CB_GETTYPE(lphc) != CBS_SIMPLE)
808 {
809 GetClientRect(lphc->self, &clientRect);
810 }
811 else
812 {
813 clientRect = lphc->textRect;
814
817 }
818
819 DrawEdge(hdc, &clientRect, EDGE_SUNKEN, BF_RECT);
820}
821
822/***********************************************************************
823 * COMBO_Paint
824 */
825static LRESULT COMBO_Paint(LPHEADCOMBO lphc, HDC hParamDC)
826{
827 PAINTSTRUCT ps;
828 HDC hDC;
829
830 hDC = hParamDC ? hParamDC : NtUserBeginPaint(lphc->self, &ps );
831
832 TRACE("hdc=%p\n", hDC);
833
834 if( hDC && !(lphc->wState & CBF_NOREDRAW) )
835 {
836 HBRUSH hPrevBrush, hBkgBrush;
837
838 /*
839 * Retrieve the background brush and select it in the
840 * DC.
841 */
842 hBkgBrush = COMBO_PrepareColors(lphc, hDC);
843 hPrevBrush = SelectObject(hDC, hBkgBrush);
844 if (!(lphc->wState & CBF_EDIT))
845 FillRect(hDC, &lphc->textRect, hBkgBrush);
846
847 /*
848 * In non 3.1 look, there is a sunken border on the combobox
849 */
850 CBPaintBorder(lphc, hDC);
851 CBPaintButton(lphc, hDC);
852
853 /* paint the edit control padding area */
854 if (CB_GETTYPE(lphc) != CBS_DROPDOWNLIST)
855 {
856 RECT rPadEdit = lphc->textRect;
857
859
861 }
862
863 if (!(lphc->wState & CBF_EDIT))
864 CBPaintText( lphc, hDC );
865
866 if (hPrevBrush)
867 SelectObject( hDC, hPrevBrush );
868 }
869
870 if (!hParamDC)
871 NtUserEndPaint( lphc->self, &ps );
872
873 return 0;
874}
875
876/***********************************************************************
877 * CBUpdateLBox
878 *
879 * Select listbox entry according to the contents of the edit control.
880 */
881static INT CBUpdateLBox( LPHEADCOMBO lphc, BOOL bSelect )
882{
883 INT length, idx;
884 LPWSTR pText = NULL;
885
886 idx = LB_ERR;
888
889 if (length > 0)
890 pText = malloc((length + 1) * sizeof(WCHAR));
891
892 TRACE("\t edit text length %i\n", length );
893
894 if( pText )
895 {
896 GetWindowTextW( lphc->hWndEdit, pText, length + 1);
898 free(pText);
899 }
900
901 SendMessageW(lphc->hWndLBox, LB_SETCURSEL, (WPARAM)(bSelect ? idx : -1), 0);
902
903 /* probably superfluous but Windows sends this too */
904 SendMessageW(lphc->hWndLBox, LB_SETCARETINDEX, (WPARAM)(idx < 0 ? 0 : idx), 0);
905 SendMessageW(lphc->hWndLBox, LB_SETTOPINDEX, (WPARAM)(idx < 0 ? 0 : idx), 0);
906
907 return idx;
908}
909
910/***********************************************************************
911 * CBUpdateEdit
912 *
913 * Copy a listbox entry to the edit control.
914 */
915static void CBUpdateEdit( LPHEADCOMBO lphc , INT index )
916{
917 INT length;
918 LPWSTR pText = NULL;
919
920 TRACE("\t %i\n", index );
921
922 if( index >= 0 ) /* got an entry */
923 {
925 if( length != LB_ERR)
926 {
927 if ((pText = malloc((length + 1) * sizeof(WCHAR))))
929 }
930 }
931
932 if( CB_HASSTRINGS(lphc) )
933 {
937 }
938
939 if( lphc->wState & CBF_FOCUSED )
940 SendMessageW(lphc->hWndEdit, EM_SETSEL, 0, (LPARAM)(-1));
941
942 free(pText);
943}
944
945/***********************************************************************
946 * CBDropDown
947 *
948 * Show listbox popup.
949 */
950static void CBDropDown( LPHEADCOMBO lphc )
951{
952 HMONITOR monitor;
953 MONITORINFO mon_info;
954 RECT rect,r;
955 int nItems;
956 int nDroppedHeight;
957
958 TRACE("[%p]: drop down\n", lphc->self);
959
960 CB_NOTIFY( lphc, CBN_DROPDOWN );
961
962 /* set selection */
963
964 lphc->wState |= CBF_DROPPED;
965 if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
966 {
967 lphc->droppedIndex = CBUpdateLBox( lphc, TRUE );
968
969 /* Update edit only if item is in the list */
970 if( !(lphc->wState & CBF_CAPTURE) && lphc->droppedIndex >= 0)
971 CBUpdateEdit( lphc, lphc->droppedIndex );
972 }
973 else
974 {
975 lphc->droppedIndex = SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
976
978 (WPARAM)(lphc->droppedIndex == LB_ERR ? 0 : lphc->droppedIndex), 0);
979 SendMessageW(lphc->hWndLBox, LB_CARETON, 0, 0);
980 }
981
982 /* now set popup position */
983 GetWindowRect( lphc->self, &rect );
984
985 /*
986 * If it's a dropdown, the listbox is offset
987 */
988 if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
990
991 /* if the dropped height is greater than the total height of the dropped
992 items list, then force the drop down list height to be the total height
993 of the items in the dropped list */
994
995 /* And Remove any extra space (Best Fit) */
996 nDroppedHeight = lphc->droppedRect.bottom - lphc->droppedRect.top;
997 /* if listbox length has been set directly by its handle */
998 GetWindowRect(lphc->hWndLBox, &r);
999 if (nDroppedHeight < r.bottom - r.top)
1000 nDroppedHeight = r.bottom - r.top;
1001 nItems = (int)SendMessageW(lphc->hWndLBox, LB_GETCOUNT, 0, 0);
1002
1003 if (nItems > 0)
1004 {
1005 int nHeight;
1006 int nIHeight;
1007
1008 nIHeight = (int)SendMessageW(lphc->hWndLBox, LB_GETITEMHEIGHT, 0, 0);
1009
1010 nHeight = nIHeight*nItems;
1011
1012 if (nHeight < nDroppedHeight - COMBO_YBORDERSIZE())
1013 nDroppedHeight = nHeight + COMBO_YBORDERSIZE();
1014 }
1015
1016 r.left = rect.left;
1017 r.top = rect.bottom;
1018 r.right = r.left + lphc->droppedRect.right - lphc->droppedRect.left;
1019 r.bottom = r.top + nDroppedHeight;
1020
1021 /*If height of dropped rectangle gets beyond a screen size it should go up, otherwise down.*/
1022 monitor = MonitorFromRect( &rect, MONITOR_DEFAULTTOPRIMARY );
1023 mon_info.cbSize = sizeof(mon_info);
1024 GetMonitorInfoW( monitor, &mon_info );
1025
1026 if (r.bottom > mon_info.rcWork.bottom)
1027 {
1028 r.top = max( rect.top - nDroppedHeight, mon_info.rcWork.top );
1029 r.bottom = min( r.top + nDroppedHeight, mon_info.rcWork.bottom );
1030 }
1031
1032 NtUserSetWindowPos( lphc->hWndLBox, HWND_TOPMOST, r.left, r.top, r.right - r.left, r.bottom - r.top,
1034
1035
1036 if( !(lphc->wState & CBF_NOREDRAW) )
1038
1040 if (GetCapture() != lphc->self)
1042}
1043
1044/***********************************************************************
1045 * CBRollUp
1046 *
1047 * Hide listbox popup.
1048 */
1049static void CBRollUp( LPHEADCOMBO lphc, BOOL ok, BOOL bButton )
1050{
1051 HWND hWnd = lphc->self;
1052
1053 TRACE("[%p]: sel ok? [%i] dropped? [%i]\n",
1054 lphc->self, ok, (INT)(lphc->wState & CBF_DROPPED));
1055
1057
1058 if( IsWindow( hWnd ) && CB_GETTYPE(lphc) != CBS_SIMPLE )
1059 {
1060
1061 if( lphc->wState & CBF_DROPPED )
1062 {
1063 RECT rect;
1064
1065 lphc->wState &= ~CBF_DROPPED;
1067
1068 if(GetCapture() == lphc->hWndLBox)
1069 {
1071 }
1072
1073 if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
1074 {
1075 rect = lphc->buttonRect;
1076 }
1077 else
1078 {
1079 if( bButton )
1080 {
1081 UnionRect( &rect,
1082 &lphc->buttonRect,
1083 &lphc->textRect);
1084 }
1085 else
1086 rect = lphc->textRect;
1087
1088 bButton = TRUE;
1089 }
1090
1091 if( bButton && !(lphc->wState & CBF_NOREDRAW) )
1094 CB_NOTIFY( lphc, CBN_CLOSEUP );
1095 }
1096 }
1097}
1098
1099/***********************************************************************
1100 * COMBO_FlipListbox
1101 *
1102 * Used by the ComboLBox to show/hide itself in response to VK_F4, etc...
1103 */
1105{
1106 if( lphc->wState & CBF_DROPPED )
1107 {
1108 CBRollUp( lphc, ok, bRedrawButton );
1109 return FALSE;
1110 }
1111
1112 CBDropDown( lphc );
1113 return TRUE;
1114}
1115
1116/***********************************************************************
1117 * CBRepaintButton
1118 */
1119static void CBRepaintButton( LPHEADCOMBO lphc )
1120{
1121 NtUserInvalidateRect(lphc->self, &lphc->buttonRect, TRUE);
1122 UpdateWindow(lphc->self);
1123}
1124
1125/***********************************************************************
1126 * COMBO_SetFocus
1127 */
1128static void COMBO_SetFocus( LPHEADCOMBO lphc )
1129{
1130 if( !(lphc->wState & CBF_FOCUSED) )
1131 {
1132 if( CB_GETTYPE(lphc) == CBS_DROPDOWNLIST )
1133 SendMessageW(lphc->hWndLBox, LB_CARETON, 0, 0);
1134
1135 /* This is wrong. Message sequences seem to indicate that this
1136 is set *after* the notify. */
1137 /* lphc->wState |= CBF_FOCUSED; */
1138
1139 if( !(lphc->wState & CBF_EDIT) )
1140 NtUserInvalidateRect(lphc->self, &lphc->textRect, TRUE);
1141
1142 CB_NOTIFY( lphc, CBN_SETFOCUS );
1143 lphc->wState |= CBF_FOCUSED;
1144 }
1145}
1146
1147/***********************************************************************
1148 * COMBO_KillFocus
1149 */
1150static void COMBO_KillFocus( LPHEADCOMBO lphc )
1151{
1152 HWND hWnd = lphc->self;
1153
1154 if( lphc->wState & CBF_FOCUSED )
1155 {
1156 CBRollUp( lphc, FALSE, TRUE );
1157 if( IsWindow( hWnd ) )
1158 {
1159 if( CB_GETTYPE(lphc) == CBS_DROPDOWNLIST )
1160 SendMessageW(lphc->hWndLBox, LB_CARETOFF, 0, 0);
1161
1162 lphc->wState &= ~CBF_FOCUSED;
1163
1164 /* redraw text */
1165 if( !(lphc->wState & CBF_EDIT) )
1166 NtUserInvalidateRect(lphc->self, &lphc->textRect, TRUE);
1167
1168 CB_NOTIFY( lphc, CBN_KILLFOCUS );
1169 }
1170 }
1171}
1172
1173/***********************************************************************
1174 * COMBO_Command
1175 */
1177{
1178 if ( lphc->wState & CBF_EDIT && lphc->hWndEdit == hWnd )
1179 {
1180 /* ">> 8" makes gcc generate jump-table instead of cmp ladder */
1181
1182 switch( HIWORD(wParam) >> 8 )
1183 {
1184 case (EN_SETFOCUS >> 8):
1185
1186 TRACE("[%p]: edit [%p] got focus\n", lphc->self, lphc->hWndEdit );
1187
1188 COMBO_SetFocus( lphc );
1189 break;
1190
1191 case (EN_KILLFOCUS >> 8):
1192
1193 TRACE("[%p]: edit [%p] lost focus\n", lphc->self, lphc->hWndEdit );
1194
1195 /* NOTE: it seems that Windows' edit control sends an
1196 * undocumented message WM_USER + 0x1B instead of this
1197 * notification (only when it happens to be a part of
1198 * the combo). ?? - AK.
1199 */
1200
1201 COMBO_KillFocus( lphc );
1202 break;
1203
1204
1205 case (EN_CHANGE >> 8):
1206 /*
1207 * In some circumstances (when the selection of the combobox
1208 * is changed for example) we don't want the EN_CHANGE notification
1209 * to be forwarded to the parent of the combobox. This code
1210 * checks a flag that is set in these occasions and ignores the
1211 * notification.
1212 */
1213 if (lphc->wState & CBF_NOLBSELECT)
1214 {
1215 lphc->wState &= ~CBF_NOLBSELECT;
1216 }
1217 else
1218 {
1219 CBUpdateLBox( lphc, lphc->wState & CBF_DROPPED );
1220 }
1221
1222 if (!(lphc->wState & CBF_NOEDITNOTIFY))
1223 CB_NOTIFY( lphc, CBN_EDITCHANGE );
1224 break;
1225
1226 case (EN_UPDATE >> 8):
1227 if (!(lphc->wState & CBF_NOEDITNOTIFY))
1228 CB_NOTIFY( lphc, CBN_EDITUPDATE );
1229 break;
1230
1231 case (EN_ERRSPACE >> 8):
1232 CB_NOTIFY( lphc, CBN_ERRSPACE );
1233 }
1234 }
1235 else if( lphc->hWndLBox == hWnd )
1236 {
1237 switch( (short)HIWORD(wParam) )
1238 {
1239 case LBN_ERRSPACE:
1240 CB_NOTIFY( lphc, CBN_ERRSPACE );
1241 break;
1242
1243 case LBN_DBLCLK:
1244 CB_NOTIFY( lphc, CBN_DBLCLK );
1245 break;
1246
1247 case LBN_SELCHANGE:
1248 case LBN_SELCANCEL:
1249
1250 TRACE("[%p]: lbox selection change [%x]\n", lphc->self, lphc->wState );
1251
1252 /* do not roll up if selection is being tracked
1253 * by arrow keys in the dropdown listbox */
1254 if (!(lphc->wState & CBF_NOROLLUP))
1255 {
1256 CBRollUp( lphc, (HIWORD(wParam) == LBN_SELCHANGE), TRUE );
1257 }
1258 else lphc->wState &= ~CBF_NOROLLUP;
1259
1260 CB_NOTIFY( lphc, CBN_SELCHANGE );
1261
1262 if( HIWORD(wParam) == LBN_SELCHANGE)
1263 {
1264 if( lphc->wState & CBF_EDIT )
1265 lphc->wState |= CBF_NOLBSELECT;
1266 CBPaintText( lphc, NULL );
1267 }
1268 break;
1269
1270 case LBN_SETFOCUS:
1271 case LBN_KILLFOCUS:
1272 /* nothing to do here since ComboLBox always resets the focus to its
1273 * combo/edit counterpart */
1274 break;
1275 }
1276 }
1277 return 0;
1278}
1279
1280/***********************************************************************
1281 * COMBO_ItemOp
1282 *
1283 * Fixup an ownerdrawn item operation and pass it up to the combobox owner.
1284 */
1286{
1287 HWND hWnd = lphc->self;
1289
1290 TRACE("[%p]: ownerdraw op %04x\n", lphc->self, msg );
1291
1292 switch( msg )
1293 {
1294 case WM_DELETEITEM:
1295 {
1297 lpIS->CtlType = ODT_COMBOBOX;
1298 lpIS->CtlID = id;
1299 lpIS->hwndItem = hWnd;
1300 break;
1301 }
1302 case WM_DRAWITEM:
1303 {
1305 lpIS->CtlType = ODT_COMBOBOX;
1306 lpIS->CtlID = id;
1307 lpIS->hwndItem = hWnd;
1308 break;
1309 }
1310 case WM_COMPAREITEM:
1311 {
1313 lpIS->CtlType = ODT_COMBOBOX;
1314 lpIS->CtlID = id;
1315 lpIS->hwndItem = hWnd;
1316 break;
1317 }
1318 case WM_MEASUREITEM:
1319 {
1321 lpIS->CtlType = ODT_COMBOBOX;
1322 lpIS->CtlID = id;
1323 break;
1324 }
1325 }
1326 return SendMessageW(lphc->owner, msg, id, lParam);
1327}
1328
1329
1330/***********************************************************************
1331 * COMBO_GetTextW
1332 */
1334{
1335 INT length;
1336
1337 if( lphc->wState & CBF_EDIT )
1338 return SendMessageW( lphc->hWndEdit, WM_GETTEXT, count, (LPARAM)buf );
1339
1340 /* get it from the listbox */
1341
1342 if (!count || !buf) return 0;
1343 if( lphc->hWndLBox )
1344 {
1345 INT idx = SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
1346 if (idx == LB_ERR) goto error;
1348 if (length == LB_ERR) goto error;
1349
1350 /* 'length' is without the terminating character */
1351 if (length >= count)
1352 {
1353 WCHAR *lpBuffer = malloc((length + 1) * sizeof(WCHAR));
1354 if (!lpBuffer) goto error;
1356
1357 /* truncate if buffer is too short */
1358 if (length != LB_ERR)
1359 {
1361 length = count;
1362 }
1363 free(lpBuffer);
1364 }
1366
1367 if (length == LB_ERR) return 0;
1368 return length;
1369 }
1370
1371 error: /* error - truncate string, return zero */
1372 buf[0] = 0;
1373 return 0;
1374}
1375
1376
1377/***********************************************************************
1378 * COMBO_GetTextA
1379 *
1380 * NOTE! LB_GETTEXT does not count terminating \0, WM_GETTEXT does.
1381 * also LB_GETTEXT might return values < 0, WM_GETTEXT doesn't.
1382 */
1384{
1385 INT length;
1386
1387 if( lphc->wState & CBF_EDIT )
1388 return SendMessageA( lphc->hWndEdit, WM_GETTEXT, count, (LPARAM)buf );
1389
1390 /* get it from the listbox */
1391
1392 if (!count || !buf) return 0;
1393 if( lphc->hWndLBox )
1394 {
1395 INT idx = SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
1396 if (idx == LB_ERR) goto error;
1398 if (length == LB_ERR) goto error;
1399
1400 /* 'length' is without the terminating character */
1401 if (length >= count)
1402 {
1403 char *lpBuffer = malloc(length + 1);
1404 if (!lpBuffer) goto error;
1406
1407 /* truncate if buffer is too short */
1408 if (length != LB_ERR)
1409 {
1411 length = count;
1412 }
1413 free(lpBuffer);
1414 }
1416
1417 if (length == LB_ERR) return 0;
1418 return length;
1419 }
1420
1421 error: /* error - truncate string, return zero */
1422 buf[0] = 0;
1423 return 0;
1424}
1425
1426
1427/***********************************************************************
1428 * CBResetPos
1429 *
1430 * This function sets window positions according to the updated
1431 * component placement struct.
1432 */
1433static void CBResetPos(HEADCOMBO *combo, BOOL redraw)
1434{
1435 BOOL drop = CB_GETTYPE(combo) != CBS_SIMPLE;
1436
1437 /* NOTE: logs sometimes have WM_LBUTTONUP before a cascade of
1438 * sizing messages */
1439 if (combo->wState & CBF_EDIT)
1440 NtUserSetWindowPos( combo->hWndEdit, 0, combo->textRect.left, combo->textRect.top,
1441 combo->textRect.right - combo->textRect.left,
1442 combo->textRect.bottom - combo->textRect.top,
1443 SWP_NOZORDER | SWP_NOACTIVATE | (drop ? SWP_NOREDRAW : 0) );
1444
1445 NtUserSetWindowPos( combo->hWndLBox, 0, combo->droppedRect.left, combo->droppedRect.top,
1446 combo->droppedRect.right - combo->droppedRect.left,
1447 combo->droppedRect.bottom - combo->droppedRect.top,
1448 SWP_NOACTIVATE | SWP_NOZORDER | (drop ? SWP_NOREDRAW : 0) );
1449
1450 if (drop)
1451 {
1452 if (combo->wState & CBF_DROPPED)
1453 {
1454 combo->wState &= ~CBF_DROPPED;
1456 }
1457
1458 if (redraw && !(combo->wState & CBF_NOREDRAW))
1460 }
1461}
1462
1463/***********************************************************************
1464 * COMBO_Size
1465 */
1466static void COMBO_Size( HEADCOMBO *lphc )
1467{
1468 if (!lphc->hWndLBox || (lphc->wState & CBF_NORESIZE))
1469 return;
1470
1471 /*
1472 * Those controls are always the same height. So we have to make sure
1473 * they are not resized to another value.
1474 */
1475 if( CB_GETTYPE(lphc) != CBS_SIMPLE )
1476 {
1477 int newComboHeight, curComboHeight, curComboWidth;
1478 RECT rc;
1479
1480 GetWindowRect(lphc->self, &rc);
1481 curComboHeight = rc.bottom - rc.top;
1482 curComboWidth = rc.right - rc.left;
1483 newComboHeight = CBGetTextAreaHeight(lphc, TRUE) + 2*COMBO_YBORDERSIZE();
1484
1485 /*
1486 * Resizing a combobox has another side effect, it resizes the dropped
1487 * rectangle as well. However, it does it only if the new height for the
1488 * combobox is more than the height it should have. In other words,
1489 * if the application resizing the combobox only had the intention to resize
1490 * the actual control, for example, to do the layout of a dialog that is
1491 * resized, the height of the dropdown is not changed.
1492 */
1493 if( curComboHeight > newComboHeight )
1494 {
1495 TRACE("oldComboHeight=%d, newComboHeight=%d, oldDropBottom=%ld, oldDropTop=%ld\n",
1496 curComboHeight, newComboHeight, lphc->droppedRect.bottom,
1497 lphc->droppedRect.top);
1498 lphc->droppedRect.bottom = lphc->droppedRect.top + curComboHeight - newComboHeight;
1499 }
1500 /*
1501 * Restore original height
1502 */
1503 if (curComboHeight != newComboHeight)
1504 {
1505 lphc->wState |= CBF_NORESIZE;
1506 NtUserSetWindowPos( lphc->self, 0, 0, 0, curComboWidth, newComboHeight,
1508 lphc->wState &= ~CBF_NORESIZE;
1509 }
1510 }
1511
1512 CBCalcPlacement(lphc);
1513
1514 CBResetPos(lphc, FALSE);
1515}
1516
1517
1518/***********************************************************************
1519 * COMBO_Font
1520 */
1521static void COMBO_Font( LPHEADCOMBO lphc, HFONT hFont, BOOL bRedraw )
1522{
1523 lphc->hFont = hFont;
1524 if (!CB_OWNERDRAWN(lphc))
1525 lphc->item_height = combo_get_text_height(lphc);
1526
1527 /*
1528 * Propagate to owned windows.
1529 */
1530 if( lphc->wState & CBF_EDIT )
1531 SendMessageW(lphc->hWndEdit, WM_SETFONT, (WPARAM)hFont, bRedraw);
1532 SendMessageW(lphc->hWndLBox, WM_SETFONT, (WPARAM)hFont, bRedraw);
1533
1534 /*
1535 * Redo the layout of the control.
1536 */
1537 if ( CB_GETTYPE(lphc) == CBS_SIMPLE)
1538 {
1539 CBCalcPlacement(lphc);
1540
1541 CBResetPos(lphc, TRUE);
1542 }
1543 else
1544 {
1545 CBForceDummyResize(lphc);
1546 }
1547}
1548
1549
1550/***********************************************************************
1551 * COMBO_SetItemHeight
1552 */
1554{
1555 LRESULT lRet = CB_ERR;
1556
1557 if( index == -1 ) /* set text field height */
1558 {
1559 if( height < 32768 )
1560 {
1561 lphc->item_height = height + 2; /* Is the 2 for 2*EDIT_CONTROL_PADDING? */
1562
1563 /*
1564 * Redo the layout of the control.
1565 */
1566 if ( CB_GETTYPE(lphc) == CBS_SIMPLE)
1567 {
1568 CBCalcPlacement(lphc);
1569
1570 CBResetPos(lphc, TRUE);
1571 }
1572 else
1573 {
1574 CBForceDummyResize(lphc);
1575 }
1576
1577 lRet = height;
1578 }
1579 }
1580 else if ( CB_OWNERDRAWN(lphc) ) /* set listbox item height */
1582 return lRet;
1583}
1584
1585/***********************************************************************
1586 * COMBO_SelectString
1587 */
1589{
1592 if( index >= 0 )
1593 {
1594 if( lphc->wState & CBF_EDIT )
1595 CBUpdateEdit( lphc, index );
1596 else
1597 {
1598 NtUserInvalidateRect(lphc->self, &lphc->textRect, TRUE);
1599 }
1600 }
1601 return (LRESULT)index;
1602}
1603
1604/***********************************************************************
1605 * COMBO_LButtonDown
1606 */
1608{
1609 POINT pt;
1610 BOOL bButton;
1611 HWND hWnd = lphc->self;
1612
1613 pt.x = (short)LOWORD(lParam);
1614 pt.y = (short)HIWORD(lParam);
1615 bButton = PtInRect(&lphc->buttonRect, pt);
1616
1617 if( (CB_GETTYPE(lphc) == CBS_DROPDOWNLIST) ||
1618 (bButton && (CB_GETTYPE(lphc) == CBS_DROPDOWN)) )
1619 {
1620 lphc->wState |= CBF_BUTTONDOWN;
1621 if( lphc->wState & CBF_DROPPED )
1622 {
1623 /* got a click to cancel selection */
1624
1625 lphc->wState &= ~CBF_BUTTONDOWN;
1626 CBRollUp( lphc, TRUE, FALSE );
1627 if( !IsWindow( hWnd ) ) return;
1628
1629 if( lphc->wState & CBF_CAPTURE )
1630 {
1631 lphc->wState &= ~CBF_CAPTURE;
1633 }
1634 }
1635 else
1636 {
1637 /* drop down the listbox and start tracking */
1638
1639 lphc->wState |= CBF_CAPTURE;
1641 CBDropDown( lphc );
1642 }
1643 if( bButton ) CBRepaintButton( lphc );
1644 }
1645}
1646
1647/***********************************************************************
1648 * COMBO_LButtonUp
1649 *
1650 * Release capture and stop tracking if needed.
1651 */
1652static void COMBO_LButtonUp( LPHEADCOMBO lphc )
1653{
1654 if( lphc->wState & CBF_CAPTURE )
1655 {
1656 lphc->wState &= ~CBF_CAPTURE;
1657 if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
1658 {
1659 INT index = CBUpdateLBox( lphc, TRUE );
1660 /* Update edit only if item is in the list */
1661 if(index >= 0)
1662 {
1663 lphc->wState |= CBF_NOLBSELECT;
1664 CBUpdateEdit( lphc, index );
1665 lphc->wState &= ~CBF_NOLBSELECT;
1666 }
1667 }
1670 }
1671
1672 if( lphc->wState & CBF_BUTTONDOWN )
1673 {
1674 lphc->wState &= ~CBF_BUTTONDOWN;
1675 CBRepaintButton( lphc );
1676 }
1677}
1678
1679/***********************************************************************
1680 * COMBO_MouseMove
1681 *
1682 * Two things to do - track combo button and release capture when
1683 * pointer goes into the listbox.
1684 */
1686{
1687 POINT pt;
1688 RECT lbRect;
1689
1690 pt.x = (short)LOWORD(lParam);
1691 pt.y = (short)HIWORD(lParam);
1692
1693 if( lphc->wState & CBF_BUTTONDOWN )
1694 {
1695 BOOL bButton;
1696
1697 bButton = PtInRect(&lphc->buttonRect, pt);
1698
1699 if( !bButton )
1700 {
1701 lphc->wState &= ~CBF_BUTTONDOWN;
1702 CBRepaintButton( lphc );
1703 }
1704 }
1705
1706 GetClientRect( lphc->hWndLBox, &lbRect );
1707 MapWindowPoints( lphc->self, lphc->hWndLBox, &pt, 1 );
1708 if( PtInRect(&lbRect, pt) )
1709 {
1710 lphc->wState &= ~CBF_CAPTURE;
1712 if( CB_GETTYPE(lphc) == CBS_DROPDOWN ) CBUpdateLBox( lphc, TRUE );
1713
1714 /* hand over pointer tracking */
1716 }
1717}
1718
1720{
1721 if (!pcbi || (pcbi->cbSize < sizeof(COMBOBOXINFO)))
1722 return FALSE;
1723
1724 pcbi->rcItem = lphc->textRect;
1725 pcbi->rcButton = lphc->buttonRect;
1726 pcbi->stateButton = 0;
1727 if (lphc->wState & CBF_BUTTONDOWN)
1729 if (IsRectEmpty(&lphc->buttonRect))
1731 pcbi->hwndCombo = lphc->self;
1732 pcbi->hwndItem = lphc->hWndEdit;
1733 pcbi->hwndList = lphc->hWndLBox;
1734 return TRUE;
1735}
1736
1737#ifdef __REACTOS__
1738static char *strdupA(LPCSTR str)
1739{
1740 char *ret;
1741 DWORD len;
1742
1743 if(!str) return NULL;
1744
1745 len = strlen(str);
1746 ret = HeapAlloc(GetProcessHeap(), 0, len + 1);
1747 if (ret != NULL)
1748 memcpy(ret, str, len + 1);
1749 return ret;
1750}
1751
1752#define strdup(String) strdupA(String)
1753#endif
1754
1755/***********************************************************************
1756 * ComboWndProc_common
1757 */
1759{
1761
1762 TRACE("[%p]: msg %s wp %08Ix lp %08Ix\n", hwnd, SPY_GetMsgName(message, hwnd), wParam, lParam);
1763
1764#ifdef __REACTOS__
1765 PWND pWnd;
1766
1767 pWnd = ValidateHwnd(hwnd);
1768 if (pWnd)
1769 {
1770 if (!pWnd->fnid)
1771 {
1773 }
1774 else
1775 {
1776 if (pWnd->fnid != FNID_COMBOBOX)
1777 {
1778 ERR("Wrong window class for ComboBox! fnId 0x%x\n",pWnd->fnid);
1779 return 0;
1780 }
1781 }
1782 }
1783 else
1784 {
1785 return 0;
1786 }
1787#else
1788 if (!IsWindow(hwnd)) return 0;
1789 if (message == WM_NCCREATE || message == WM_CREATE) NtUserSetWindowFNID( hwnd, MAKE_FNID(NTUSER_WNDPROC_COMBO) );
1790#endif
1791
1792 if( lphc || message == WM_NCCREATE )
1793 switch(message)
1794 {
1795 case WM_NCCREATE:
1796 {
1797 LONG style = unicode ? ((LPCREATESTRUCTW)lParam)->style : ((LPCREATESTRUCTA)lParam)->style;
1798 return COMBO_NCCreate(hwnd, style);
1799 }
1800 case WM_NCDESTROY:
1801 COMBO_NCDestroy(lphc);
1802#ifdef __REACTOS__
1804#endif
1805 break;/* -> DefWindowProc */
1806
1807 case WM_CREATE:
1808 {
1810 LONG style;
1811 if(unicode)
1812 {
1813 hwndParent = ((LPCREATESTRUCTW)lParam)->hwndParent;
1815 }
1816 else
1817 {
1818 hwndParent = ((LPCREATESTRUCTA)lParam)->hwndParent;
1820 }
1821 return COMBO_Create(hwnd, lphc, hwndParent, style, unicode);
1822 }
1823 case WM_PRINTCLIENT:
1824 /* Fallthrough */
1825 case WM_PAINT:
1826 /* wParam may contain a valid HDC! */
1827 return COMBO_Paint(lphc, (HDC)wParam);
1828 case WM_ERASEBKGND:
1829 /* do all painting in WM_PAINT like Windows does */
1830 return 1;
1831
1832 case WM_GETDLGCODE:
1833 {
1835 if (lParam && (((LPMSG)lParam)->message == WM_KEYDOWN))
1836 {
1837 int vk = (int)((LPMSG)lParam)->wParam;
1838
1839 if ((vk == VK_RETURN || vk == VK_ESCAPE) && (lphc->wState & CBF_DROPPED))
1841 }
1842 return result;
1843 }
1844 case WM_SIZE:
1845 COMBO_Size( lphc );
1846 return TRUE;
1847 case WM_SETFONT:
1848 COMBO_Font( lphc, (HFONT)wParam, (BOOL)lParam );
1849 return TRUE;
1850 case WM_GETFONT:
1851 return (LRESULT)lphc->hFont;
1852 case WM_SETFOCUS:
1853 if (lphc->wState & CBF_EDIT)
1854 {
1855 NtUserSetFocus( lphc->hWndEdit );
1856 /* The first time focus is received, select all the text */
1857 if (!(lphc->wState & CBF_BEENFOCUSED))
1858 {
1859 SendMessageW(lphc->hWndEdit, EM_SETSEL, 0, -1);
1860 lphc->wState |= CBF_BEENFOCUSED;
1861 }
1862 }
1863 else
1864 COMBO_SetFocus( lphc );
1865 return TRUE;
1866 case WM_KILLFOCUS:
1867 {
1868 HWND hwndFocus = WIN_GetFullHandle((HWND)wParam);
1869 if (!hwndFocus || (hwndFocus != lphc->hWndEdit && hwndFocus != lphc->hWndLBox))
1870 COMBO_KillFocus( lphc );
1871 return TRUE;
1872 }
1873 case WM_COMMAND:
1875 case WM_GETTEXT:
1876 return unicode ? COMBO_GetTextW( lphc, wParam, (LPWSTR)lParam )
1877 : COMBO_GetTextA( lphc, wParam, (LPSTR)lParam );
1878 case WM_SETTEXT:
1879 case WM_GETTEXTLENGTH:
1880 case WM_CLEAR:
1881 if ((message == WM_GETTEXTLENGTH) && !ISWIN31 && !(lphc->wState & CBF_EDIT))
1882 {
1883 int j = SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
1884 if (j == -1) return 0;
1885 return unicode ? SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, j, 0) :
1887 }
1888 else if ( lphc->wState & CBF_EDIT )
1889 {
1890 LRESULT ret;
1891 lphc->wState |= CBF_NOEDITNOTIFY;
1892 ret = unicode ? SendMessageW(lphc->hWndEdit, message, wParam, lParam) :
1894 lphc->wState &= ~CBF_NOEDITNOTIFY;
1895 return ret;
1896 }
1897 else
1898 return CB_ERR;
1899 case WM_CUT:
1900 case WM_PASTE:
1901 case WM_COPY:
1902 if (lphc->wState & CBF_EDIT)
1903 {
1904 return unicode ? SendMessageW(lphc->hWndEdit, message, wParam, lParam) :
1906 }
1907 else return CB_ERR;
1908
1909 case WM_DRAWITEM:
1910 case WM_DELETEITEM:
1911 case WM_COMPAREITEM:
1912 case WM_MEASUREITEM:
1913 return COMBO_ItemOp(lphc, message, lParam);
1914 case WM_ENABLE:
1915 if (lphc->wState & CBF_EDIT)
1918
1919 /* Force the control to repaint when the enabled state changes. */
1921 return TRUE;
1922 case WM_SETREDRAW:
1923 if (wParam)
1924 lphc->wState &= ~CBF_NOREDRAW;
1925 else
1926 lphc->wState |= CBF_NOREDRAW;
1927
1928 if ( lphc->wState & CBF_EDIT )
1931 return 0;
1932 case WM_SYSKEYDOWN:
1933#ifdef __REACTOS__
1934 if ( KF_ALTDOWN & HIWORD(lParam) )
1935#else
1936 if ( KEYDATA_ALT & HIWORD(lParam) )
1937#endif
1938 if( wParam == VK_UP || wParam == VK_DOWN )
1939#ifdef __REACTOS__
1940 {
1941#endif
1942 COMBO_FlipListbox( lphc, FALSE, FALSE );
1943 return 0;
1944#ifdef __REACTOS__
1945 }
1946 break;
1947#endif
1948
1949 case WM_KEYDOWN:
1950 if ((wParam == VK_RETURN || wParam == VK_ESCAPE) &&
1951 (lphc->wState & CBF_DROPPED))
1952 {
1953 CBRollUp( lphc, wParam == VK_RETURN, FALSE );
1954 return TRUE;
1955 }
1956 else if ((wParam == VK_F4) && !(lphc->wState & CBF_EUI))
1957 {
1958 COMBO_FlipListbox( lphc, FALSE, FALSE );
1959 return TRUE;
1960 }
1961 /* fall through */
1962 case WM_CHAR:
1963 case WM_IME_CHAR:
1964 {
1965 HWND hwndTarget;
1966
1967#ifdef __REACTOS__
1968 if (lphc->wState & CBF_DROPPED)
1969 lphc->wState |= CBF_NOROLLUP;
1970#endif
1971 if ( lphc->wState & CBF_EDIT )
1972 hwndTarget = lphc->hWndEdit;
1973 else
1974 hwndTarget = lphc->hWndLBox;
1975
1976 return unicode ? SendMessageW(hwndTarget, message, wParam, lParam) :
1977 SendMessageA(hwndTarget, message, wParam, lParam);
1978 }
1979 case WM_LBUTTONDOWN:
1980 if (!(lphc->wState & CBF_FOCUSED)) NtUserSetFocus( lphc->self );
1981 if (lphc->wState & CBF_FOCUSED) COMBO_LButtonDown( lphc, lParam );
1982 return TRUE;
1983 case WM_LBUTTONUP:
1984 COMBO_LButtonUp( lphc );
1985 return TRUE;
1986 case WM_MOUSEMOVE:
1987 if ( lphc->wState & CBF_CAPTURE )
1988 COMBO_MouseMove( lphc, wParam, lParam );
1989 return TRUE;
1990
1991 case WM_MOUSEWHEEL:
1992 if (wParam & (MK_SHIFT | MK_CONTROL))
1993 return unicode ? DefWindowProcW(hwnd, message, wParam, lParam) :
1995
1996 if (GET_WHEEL_DELTA_WPARAM(wParam) > 0) return SendMessageW(hwnd, WM_KEYDOWN, VK_UP, 0);
1997 if (GET_WHEEL_DELTA_WPARAM(wParam) < 0) return SendMessageW(hwnd, WM_KEYDOWN, VK_DOWN, 0);
1998 return TRUE;
1999
2000 case WM_CTLCOLOR:
2001 case WM_CTLCOLORMSGBOX:
2002 case WM_CTLCOLOREDIT:
2003 case WM_CTLCOLORLISTBOX:
2004 case WM_CTLCOLORBTN:
2005 case WM_CTLCOLORDLG:
2007 case WM_CTLCOLORSTATIC:
2008#ifdef __REACTOS__
2009 if (pWnd && !(pWnd->state2 & WNDS2_WIN40COMPAT)) break; // Must be Win 4.0 and above.
2010#endif
2011 if (lphc->owner)
2012 return SendMessageW(lphc->owner, message, wParam, lParam);
2013 break;
2014
2015 /* Combo messages */
2016
2017 case CB_ADDSTRING:
2018 if( unicode )
2019 {
2020 if (lphc->dwStyle & CBS_LOWERCASE)
2022 else if (lphc->dwStyle & CBS_UPPERCASE)
2024 return SendMessageW(lphc->hWndLBox, LB_ADDSTRING, 0, lParam);
2025 }
2026 else /* unlike the unicode version, the ansi version does not overwrite
2027 the string if converting case */
2028 {
2029 char *string = NULL;
2030 LRESULT ret;
2031 if (lphc->dwStyle & CBS_LOWERCASE)
2032 {
2033 string = strdup((char *)lParam);
2034 CharLowerA(string);
2035 }
2036
2037 else if (lphc->dwStyle & CBS_UPPERCASE)
2038 {
2039 string = strdup((char *)lParam);
2040 CharUpperA(string);
2041 }
2042
2043 ret = SendMessageA(lphc->hWndLBox, LB_ADDSTRING, 0, string ? (LPARAM)string : lParam);
2044 free(string);
2045 return ret;
2046 }
2047 case CB_INSERTSTRING:
2048 if (unicode)
2049 {
2050 if (lphc->dwStyle & CBS_LOWERCASE)
2052 else if (lphc->dwStyle & CBS_UPPERCASE)
2055 }
2056 else
2057 {
2058 if (lphc->dwStyle & CBS_LOWERCASE)
2060 else if (lphc->dwStyle & CBS_UPPERCASE)
2063 }
2064 case CB_DELETESTRING:
2065 return unicode ? SendMessageW(lphc->hWndLBox, LB_DELETESTRING, wParam, 0) :
2067 case CB_SELECTSTRING:
2068 return COMBO_SelectString(lphc, (INT)wParam, lParam, unicode);
2069 case CB_FINDSTRING:
2070 return unicode ? SendMessageW(lphc->hWndLBox, LB_FINDSTRING, wParam, lParam) :
2072 case CB_FINDSTRINGEXACT:
2073 return unicode ? SendMessageW(lphc->hWndLBox, LB_FINDSTRINGEXACT, wParam, lParam) :
2075 case CB_SETITEMHEIGHT:
2076 return COMBO_SetItemHeight( lphc, (INT)wParam, (INT)lParam);
2077 case CB_GETITEMHEIGHT:
2078 if ((INT)wParam >= 0) /* listbox item */
2079 return SendMessageW(lphc->hWndLBox, LB_GETITEMHEIGHT, wParam, 0);
2080 return CBGetTextAreaHeight(lphc, FALSE);
2081 case CB_RESETCONTENT:
2083 if( (lphc->wState & CBF_EDIT) && CB_HASSTRINGS(lphc) )
2084 SendMessageW(lphc->hWndEdit, WM_SETTEXT, 0, (LPARAM)L"");
2085 else
2087 return TRUE;
2088 case CB_INITSTORAGE:
2091 return SendMessageW(lphc->hWndLBox, LB_GETHORIZONTALEXTENT, 0, 0);
2094 case CB_GETTOPINDEX:
2095 return SendMessageW(lphc->hWndLBox, LB_GETTOPINDEX, 0, 0);
2096 case CB_GETLOCALE:
2097 return SendMessageW(lphc->hWndLBox, LB_GETLOCALE, 0, 0);
2098 case CB_SETLOCALE:
2099 return SendMessageW(lphc->hWndLBox, LB_SETLOCALE, wParam, 0);
2100 case CB_SETDROPPEDWIDTH:
2101 if ((CB_GETTYPE(lphc) == CBS_SIMPLE) || (INT)wParam >= 32768)
2102 return CB_ERR;
2103 /* new value must be higher than combobox width */
2104 if ((INT)wParam >= lphc->droppedRect.right - lphc->droppedRect.left)
2105 lphc->droppedWidth = wParam;
2106 else if (wParam)
2107 lphc->droppedWidth = 0;
2108
2109 /* recalculate the combobox area */
2110 CBCalcPlacement(lphc);
2111
2112 /* fall through */
2113 case CB_GETDROPPEDWIDTH:
2114 if (lphc->droppedWidth)
2115 return lphc->droppedWidth;
2116 return lphc->droppedRect.right - lphc->droppedRect.left;
2119 return CB_OKAY;
2120 case CB_GETDROPPEDSTATE:
2121 return (lphc->wState & CBF_DROPPED) != 0;
2122 case CB_DIR:
2123 return unicode ? SendMessageW(lphc->hWndLBox, LB_DIR, wParam, lParam) :
2125
2126 case CB_SHOWDROPDOWN:
2127 if (CB_GETTYPE(lphc) != CBS_SIMPLE)
2128 {
2129 if (wParam)
2130 {
2131 if (!(lphc->wState & CBF_DROPPED))
2132 CBDropDown( lphc );
2133 }
2134 else if (lphc->wState & CBF_DROPPED)
2135 CBRollUp( lphc, FALSE, TRUE );
2136 }
2137 return TRUE;
2138 case CB_GETCOUNT:
2139 return SendMessageW(lphc->hWndLBox, LB_GETCOUNT, 0, 0);
2140 case CB_GETCURSEL:
2141 return SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
2142 case CB_SETCURSEL:
2144 if (lParam >= 0)
2146
2147 /* no LBN_SELCHANGE in this case, update manually */
2148 CBPaintText( lphc, NULL );
2149 lphc->wState &= ~CBF_SELCHANGE;
2150 return lParam;
2151 case CB_GETLBTEXT:
2152 return unicode ? SendMessageW(lphc->hWndLBox, LB_GETTEXT, wParam, lParam) :
2154 case CB_GETLBTEXTLEN:
2155 return unicode ? SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, wParam, 0) :
2157 case CB_GETITEMDATA:
2158 return SendMessageW(lphc->hWndLBox, LB_GETITEMDATA, wParam, 0);
2159 case CB_SETITEMDATA:
2161 case CB_GETEDITSEL:
2162 /* Edit checks passed parameters itself */
2163 if (lphc->wState & CBF_EDIT)
2164 return SendMessageW(lphc->hWndEdit, EM_GETSEL, wParam, lParam);
2165 return CB_ERR;
2166 case CB_SETEDITSEL:
2167 if (lphc->wState & CBF_EDIT)
2169 return CB_ERR;
2170 case CB_SETEXTENDEDUI:
2171 if (CB_GETTYPE(lphc) == CBS_SIMPLE )
2172 return CB_ERR;
2173 if (wParam)
2174 lphc->wState |= CBF_EUI;
2175 else lphc->wState &= ~CBF_EUI;
2176 return CB_OKAY;
2177 case CB_GETEXTENDEDUI:
2178 return (lphc->wState & CBF_EUI) != 0;
2179 case CB_GETCOMBOBOXINFO:
2180 return COMBO_GetComboBoxInfo(lphc, (COMBOBOXINFO *)lParam);
2181 case CB_LIMITTEXT:
2182 if (lphc->wState & CBF_EDIT)
2184 return TRUE;
2185
2186#ifdef __REACTOS__
2187 case WM_UPDATEUISTATE:
2188 if (unicode)
2190 else
2192
2193 if (COMBO_update_uistate(lphc))
2194 {
2195 /* redraw text */
2196 if (!(lphc->wState & CBF_EDIT))
2197 NtUserInvalidateRect(lphc->self, &lphc->textRect, TRUE);
2198 }
2199 break;
2200
2201 case WM_CBLOSTTEXTFOCUS: /* undocumented message - deselects the text when focus is lost */
2202 if (lphc->hWndEdit != NULL)
2203 {
2204 SendMessage(lphc->self, WM_LBUTTONUP, 0, 0xFFFFFFFF);
2205 SendMessage(lphc->hWndEdit, EM_SETSEL, 0, 0);
2206 lphc->wState &= ~(CBF_FOCUSED | CBF_BEENFOCUSED);
2207 CB_NOTIFY(lphc, CBN_KILLFOCUS);
2208 }
2209 return TRUE;
2210#endif
2211
2212 default:
2213 if (message >= WM_USER)
2214 WARN("unknown msg WM_USER+%04x wp=%04Ix lp=%08Ix\n", message - WM_USER, wParam, lParam );
2215 break;
2216 }
2217 return unicode ? DefWindowProcW(hwnd, message, wParam, lParam) :
2219}
2220
2221#ifdef __REACTOS__
2222
2223/***********************************************************************
2224 * ComboWndProcA
2225 *
2226 * This is just a wrapper for the real ComboWndProc which locks/unlocks
2227 * window structs.
2228 */
2230{
2231 if (!IsWindow(hwnd)) return 0;
2233}
2234
2235/***********************************************************************
2236 * ComboWndProcW
2237 */
2239{
2240 if (!IsWindow(hwnd)) return 0;
2242}
2243
2244#endif /* __REACTOS__ */
2245
2246/*************************************************************************
2247 * GetComboBoxInfo (USER32.@)
2248 */
2250 HWND hwndCombo, /* [in] handle to combo box */
2251 PCOMBOBOXINFO pcbi /* [in/out] combo box information */)
2252{
2253 TRACE("(%p, %p)\n", hwndCombo, pcbi);
2254#ifdef __REACTOS__
2255 return NtUserGetComboBoxInfo(hwndCombo, pcbi);
2256#else
2257 return SendMessageW(hwndCombo, CB_GETCOMBOBOXINFO, 0, (LPARAM)pcbi);
2258#endif
2259}
static HDC hDC
Definition: 3dtext.c:33
short INT16
Definition: actypes.h:130
static int state
Definition: maze.c:121
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
RECT rect
Definition: combotst.c:67
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#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:299
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int idx
Definition: utils.c:40
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 INT combo_get_text_height(const HEADCOMBO *combo)
Definition: combo.c:175
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 lstrcpynW
Definition: compat.h:738
LPSTR WINAPI CharLowerA(char *str)
Definition: string.c:1087
LPWSTR WINAPI CharLowerW(WCHAR *str)
Definition: string.c:1136
LPWSTR WINAPI CharUpperW(WCHAR *str)
Definition: string.c:1249
LPSTR WINAPI CharUpperA(LPSTR str)
Definition: string.c:1200
unsigned short vk
Definition: console.c:118
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1597
static char * strdup(const char *buf)
Definition: string.h:83
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:147
#define L(x)
Definition: resources.c:13
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
unsigned int UINT
Definition: sysinfo.c:13
#define WNDS2_WIN40COMPAT
Definition: ntuser.h:654
BOOL NTAPI NtUserSetWindowPos(HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags)
Definition: winpos.c:3573
#define FNID_DESTROY
Definition: ntuser.h:905
BOOL NTAPI NtUserGetComboBoxInfo(HWND hWnd, PCOMBOBOXINFO pcbi)
Definition: window.c:3471
HWND NTAPI NtUserSetFocus(HWND hWnd)
Definition: focus.c:1717
#define FNID_COMBOBOX
Definition: ntuser.h:874
BOOL NTAPI NtUserInvalidateRect(HWND hWnd, CONST RECT *lpRect, BOOL bErase)
Definition: painting.c:2541
BOOLEAN NTAPI NtUserDestroyWindow(HWND Wnd)
Definition: window.c:3041
HWND NTAPI NtUserSetParent(HWND hWndChild, HWND hWndNewParent)
Definition: window.c:3650
BOOL NTAPI NtUserEndPaint(HWND hWnd, CONST PAINTSTRUCT *lPs)
Definition: painting.c:1660
HDC NTAPI NtUserBeginPaint(HWND hWnd, PAINTSTRUCT *lPs)
Definition: painting.c:1614
HWND NTAPI NtUserSetCapture(HWND Wnd)
Definition: focus.c:1699
BOOL NTAPI NtUserRedrawWindow(HWND hWnd, CONST RECT *lprcUpdate, HRGN hrgnUpdate, UINT flags)
Definition: painting.c:2002
BOOL NTAPI NtUserShowWindow(HWND hWnd, LONG nCmdShow)
Definition: winpos.c:3861
BOOL NTAPI NtUserSetWindowFNID(HWND hWnd, WORD fnID)
Definition: window.c:4335
HDC NTAPI NtUserGetDC(HWND hWnd)
Definition: windc.c:1014
static char * strdupA(const char *src)
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 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)
_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
short WCHAR
Definition: pedump.c:58
#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_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
#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:2972
#define LBN_ERRSPACE
Definition: winuser.h:2108
#define CBN_ERRSPACE
Definition: winuser.h:2006
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
#define EM_LIMITTEXT
Definition: winuser.h:2029
#define GetWindowLongPtrW
Definition: winuser.h:4983
#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
#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
#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
#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)
#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)
#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:2984
BOOL WINAPI UpdateWindow(_In_ HWND)
#define CB_GETITEMDATA
Definition: winuser.h:1979
#define SWP_SHOWWINDOW
Definition: winuser.h:1259
#define SendMessage
Definition: winuser.h:6009
#define CBN_KILLFOCUS
Definition: winuser.h:2007
#define COLOR_HIGHLIGHTTEXT
Definition: winuser.h:938
#define CBS_LOWERCASE
Definition: winuser.h:286
#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
#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
#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:5512
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)
#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
void redraw(int x, int y, int cx, int cy)
Definition: qtewin.cpp:1248
PFNCLIENT pfnClientA
Definition: regcontrol.c:15
PFNCLIENT pfnClientW
Definition: regcontrol.c:16
const struct builtin_class_descr COMBO_builtin_class
#define WM_PRINTCLIENT
Definition: richedit.h:70
#define calloc
Definition: rosglue.h:14
const WCHAR * str
#define UINT
Definition: utils.c:29
#define TRACE(s)
Definition: solgame.cpp:4
RECT buttonRect
Definition: comctl32.h:158
INT fixedOwnerDrawHeight
Definition: comctl32.h:161
RECT textRect
Definition: comctl32.h:157
LONG UIState
Definition: window.c:3455
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
UINT dwStyle
Definition: comctl32.h:152
INT item_height
Definition: comctl32.h:163
Definition: dcommon.idl:28
long bottom
Definition: dcommon.idl:29
long right
Definition: dcommon.idl:29
long left
Definition: dcommon.idl:29
long top
Definition: dcommon.idl:29
WNDPROC pfnComboBoxWndProc
Definition: ntuser.h:808
Definition: ntuser.h:698
DWORD state2
Definition: ntuser.h:706
DWORD fnid
Definition: ntuser.h:713
Definition: tftpd.h:60
Definition: style.c:91
DMUS_IO_STYLE style
Definition: style.c:95
LONG bmHeight
Definition: wingdi.h:1869
LONG bmWidth
Definition: wingdi.h:1868
DWORD stateButton
Definition: winuser.h:3820
ULONG_PTR itemData
Definition: winuser.h:3201
ULONG_PTR itemData
Definition: winuser.h:3754
DWORD cbSize
Definition: winuser.h:3892
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
const char * LPCSTR
Definition: typedefs.h:52
uint16_t * LPWSTR
Definition: typedefs.h:56
char * LPSTR
Definition: typedefs.h:51
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:2232
#define NtUserEnableWindow(HWND, ENABLE)
Definition: user_x.h:124
#define NtUserSetPrivateData(HWND, OFFSET, SIZE, VALUE)
Definition: user_x.h:132
#define NtUserReleaseDC(HWND, HDC)
Definition: user_x.h:120
#define WIN_GetFullHandle(h)
Definition: user_x.h:108
#define MAKE_FNID(index)
Definition: user_x.h:143
#define NtUserGetPrivateData(HWND, OFFSET, SIZE)
Definition: user_x.h:131
#define NtUserReleaseCapture()
Definition: user_x.h:121
#define ValidateHwnd(hwnd)
Definition: precomp.h:98
HBRUSH FASTCALL GetControlColor(PWND pwndParent, PWND pwnd, HDC hdc, UINT CtlMsg)
Definition: misc.c:153
#define CBF_BUTTONDOWN
Definition: window.c:3465
static LRESULT COMBO_GetTextW(LPHEADCOMBO lphc, INT count, LPWSTR buf)
Definition: combo.c:1333
static HEADCOMBO * get_control_state(HWND hwnd)
Definition: combo.c:83
static HEADCOMBO * set_control_state(HWND hwnd, HEADCOMBO *state)
Definition: combo.c:88
LRESULT WINAPI ComboWndProc_common(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: combo.c:1758
static LRESULT COMBO_GetTextA(LPHEADCOMBO lphc, INT count, LPSTR buf)
Definition: combo.c:1383
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)