4 * Copyright 1997 Alex Korobka
6 * FIXME: roll up in Netscape 3.01.
15 #include "wine/winuser16.h"
21 #include "debugtools.h"
23 DEFAULT_DEBUG_CHANNEL(combo
);
25 /* bits in the dwKeyData */
26 #define KEYDATA_ALT 0x2000
27 #define KEYDATA_PREVSTATE 0x4000
30 * Additional combo box definitions
33 #define CB_GETPTR( wnd ) (*(LPHEADCOMBO*)((wnd)->wExtra))
34 #define CB_NOTIFY( lphc, code ) \
35 (SendMessageW((lphc)->owner, WM_COMMAND, \
36 MAKEWPARAM((lphc)->self->wIDmenu, (code)), (lphc)->self->hwndSelf))
37 #define CB_GETEDITTEXTLENGTH( lphc ) \
38 (SendMessageW((lphc)->hWndEdit, WM_GETTEXTLENGTH, 0, 0 ))
40 #define ISWIN31 (LOWORD(GetVersion()) == 0x0a03)
45 static HBITMAP hComboBmp
= 0;
46 static UINT CBitHeight
, CBitWidth
;
49 * Look and feel dependant "constants"
52 #define COMBO_YBORDERGAP 5
53 #define COMBO_XBORDERSIZE() ( (TWEAK_WineLook == WIN31_LOOK) ? 0 : 2 )
54 #define COMBO_YBORDERSIZE() ( (TWEAK_WineLook == WIN31_LOOK) ? 0 : 2 )
55 #define COMBO_EDITBUTTONSPACE() ( (TWEAK_WineLook == WIN31_LOOK) ? 8 : 0 )
56 #define EDIT_CONTROL_PADDING() ( (TWEAK_WineLook == WIN31_LOOK) ? 0 : 1 )
58 static LRESULT WINAPI
ComboWndProcA( HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
);
59 static LRESULT WINAPI
ComboWndProcW( HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
);
61 /*********************************************************************
62 * combo class descriptor
64 const struct builtin_class_descr COMBO_builtin_class
=
66 "ComboBox", /* name */
67 CS_GLOBALCLASS
| CS_PARENTDC
| CS_DBLCLKS
, /* style */
68 ComboWndProcA
, /* procA */
69 ComboWndProcW
, /* procW */
70 sizeof(HEADCOMBO
*), /* extra */
71 IDC_ARROWA
, /* cursor */
76 /***********************************************************************
79 * Load combo button bitmap.
81 static BOOL
COMBO_Init()
85 if( hComboBmp
) return TRUE
;
86 if( (hDC
= CreateCompatibleDC(0)) )
89 if( (hComboBmp
= LoadBitmapW(0, MAKEINTRESOURCEW(OBM_COMBO
))) )
95 GetObjectW( hComboBmp
, sizeof(bm
), &bm
);
96 CBitHeight
= bm
.bmHeight
;
97 CBitWidth
= bm
.bmWidth
;
99 TRACE("combo bitmap [%i,%i]\n", CBitWidth
, CBitHeight
);
101 hPrevB
= SelectObject( hDC
, hComboBmp
);
102 SetRect( &r
, 0, 0, CBitWidth
, CBitHeight
);
103 InvertRect( hDC
, &r
);
104 SelectObject( hDC
, hPrevB
);
113 /***********************************************************************
116 static LRESULT
COMBO_NCCreate(WND
* wnd
, LONG style
)
120 if ( wnd
&& COMBO_Init() &&
121 (lphc
= HeapAlloc(GetProcessHeap(), 0, sizeof(HEADCOMBO
))) )
123 memset( lphc
, 0, sizeof(HEADCOMBO
) );
124 *(LPHEADCOMBO
*)wnd
->wExtra
= lphc
;
126 /* some braindead apps do try to use scrollbar/border flags */
128 lphc
->dwStyle
= style
& ~(WS_BORDER
| WS_HSCROLL
| WS_VSCROLL
);
129 wnd
->dwStyle
&= ~(WS_BORDER
| WS_HSCROLL
| WS_VSCROLL
);
132 * We also have to remove the client edge style to make sure
133 * we don't end-up with a non client area.
135 wnd
->dwExStyle
&= ~(WS_EX_CLIENTEDGE
);
137 if( !(style
& (CBS_OWNERDRAWFIXED
| CBS_OWNERDRAWVARIABLE
)) )
138 lphc
->dwStyle
|= CBS_HASSTRINGS
;
139 if( !(wnd
->dwExStyle
& WS_EX_NOPARENTNOTIFY
) )
140 lphc
->wState
|= CBF_NOTIFY
;
142 TRACE("[0x%08x], style = %08x\n",
143 (UINT
)lphc
, lphc
->dwStyle
);
145 return (LRESULT
)(UINT
)wnd
->hwndSelf
;
147 return (LRESULT
)FALSE
;
150 /***********************************************************************
153 static LRESULT
COMBO_NCDestroy( LPHEADCOMBO lphc
)
158 WND
* wnd
= lphc
->self
;
160 TRACE("[%04x]: freeing storage\n", CB_HWND(lphc
));
162 if( (CB_GETTYPE(lphc
) != CBS_SIMPLE
) && lphc
->hWndLBox
)
163 DestroyWindow( lphc
->hWndLBox
);
165 HeapFree( GetProcessHeap(), 0, lphc
);
171 /***********************************************************************
172 * CBGetTextAreaHeight
174 * This method will calculate the height of the text area of the
176 * The height of the text area is set in two ways.
177 * It can be set explicitly through a combobox message or through a
178 * WM_MEASUREITEM callback.
179 * If this is not the case, the height is set to 13 dialog units.
180 * This height was determined through experimentation.
182 static INT
CBGetTextAreaHeight(
188 if( lphc
->editHeight
) /* explicitly set height */
190 iTextItemHeight
= lphc
->editHeight
;
195 HDC hDC
= GetDC(hwnd
);
200 hPrevFont
= SelectObject( hDC
, lphc
->hFont
);
202 GetTextMetricsW(hDC
, &tm
);
204 baseUnitY
= tm
.tmHeight
;
207 SelectObject( hDC
, hPrevFont
);
209 ReleaseDC(hwnd
, hDC
);
211 iTextItemHeight
= ((13 * baseUnitY
) / 8);
214 * This "formula" calculates the height of the complete control.
215 * To calculate the height of the text area, we have to remove the
218 iTextItemHeight
-= 2*COMBO_YBORDERSIZE();
222 * Check the ownerdraw case if we haven't asked the parent the size
225 if ( CB_OWNERDRAWN(lphc
) &&
226 (lphc
->wState
& CBF_MEASUREITEM
) )
228 MEASUREITEMSTRUCT measureItem
;
230 INT originalItemHeight
= iTextItemHeight
;
233 * We use the client rect for the width of the item.
235 GetClientRect(hwnd
, &clientRect
);
237 lphc
->wState
&= ~CBF_MEASUREITEM
;
240 * Send a first one to measure the size of the text area
242 measureItem
.CtlType
= ODT_COMBOBOX
;
243 measureItem
.CtlID
= lphc
->self
->wIDmenu
;
244 measureItem
.itemID
= -1;
245 measureItem
.itemWidth
= clientRect
.right
;
246 measureItem
.itemHeight
= iTextItemHeight
- 6; /* ownerdrawn cb is taller */
247 measureItem
.itemData
= 0;
248 SendMessageW(lphc
->owner
, WM_MEASUREITEM
,
249 (WPARAM
)measureItem
.CtlID
, (LPARAM
)&measureItem
);
250 iTextItemHeight
= 6 + measureItem
.itemHeight
;
253 * Send a second one in the case of a fixed ownerdraw list to calculate the
254 * size of the list items. (we basically do this on behalf of the listbox)
256 if (lphc
->dwStyle
& CBS_OWNERDRAWFIXED
)
258 measureItem
.CtlType
= ODT_COMBOBOX
;
259 measureItem
.CtlID
= lphc
->self
->wIDmenu
;
260 measureItem
.itemID
= 0;
261 measureItem
.itemWidth
= clientRect
.right
;
262 measureItem
.itemHeight
= originalItemHeight
;
263 measureItem
.itemData
= 0;
264 SendMessageW(lphc
->owner
, WM_MEASUREITEM
,
265 (WPARAM
)measureItem
.CtlID
, (LPARAM
)&measureItem
);
266 lphc
->fixedOwnerDrawHeight
= measureItem
.itemHeight
;
270 * Keep the size for the next time
272 lphc
->editHeight
= iTextItemHeight
;
275 return iTextItemHeight
;
278 /***********************************************************************
281 * The dummy resize is used for listboxes that have a popup to trigger
282 * a re-arranging of the contents of the combobox and the recalculation
283 * of the size of the "real" control window.
285 static void CBForceDummyResize(
291 newComboHeight
= CBGetTextAreaHeight(CB_HWND(lphc
),lphc
) + 2*COMBO_YBORDERSIZE();
293 GetWindowRect(CB_HWND(lphc
), &windowRect
);
296 * We have to be careful, resizing a combobox also has the meaning that the
297 * dropped rect will be resized. In this case, we want to trigger a resize
298 * to recalculate layout but we don't want to change the dropped rectangle
299 * So, we pass the height of text area of control as the height.
300 * this will cancel-out in the processing of the WM_WINDOWPOSCHANGING
303 SetWindowPos( CB_HWND(lphc
),
306 windowRect
.right
- windowRect
.left
,
308 SWP_NOMOVE
| SWP_NOZORDER
| SWP_NOACTIVATE
);
311 /***********************************************************************
314 * Set up component coordinates given valid lphc->RectCombo.
316 static void CBCalcPlacement(
324 * Again, start with the client rectangle.
326 GetClientRect(hwnd
, lprEdit
);
331 InflateRect(lprEdit
, -COMBO_XBORDERSIZE(), -COMBO_YBORDERSIZE());
334 * Chop off the bottom part to fit with the height of the text area.
336 lprEdit
->bottom
= lprEdit
->top
+ CBGetTextAreaHeight(hwnd
, lphc
);
339 * The button starts the same vertical position as the text area.
341 CopyRect(lprButton
, lprEdit
);
344 * If the combobox is "simple" there is no button.
346 if( CB_GETTYPE(lphc
) == CBS_SIMPLE
)
347 lprButton
->left
= lprButton
->right
= lprButton
->bottom
= 0;
351 * Let's assume the combobox button is the same width as the
353 * size the button horizontally and cut-off the text area.
355 lprButton
->left
= lprButton
->right
- GetSystemMetrics(SM_CXVSCROLL
);
356 lprEdit
->right
= lprButton
->left
;
360 * In the case of a dropdown, there is an additional spacing between the
361 * text area and the button.
363 if( CB_GETTYPE(lphc
) == CBS_DROPDOWN
)
365 lprEdit
->right
-= COMBO_EDITBUTTONSPACE();
369 * If we have an edit control, we space it away from the borders slightly.
371 if (CB_GETTYPE(lphc
) != CBS_DROPDOWNLIST
)
373 InflateRect(lprEdit
, -EDIT_CONTROL_PADDING(), -EDIT_CONTROL_PADDING());
377 * Adjust the size of the listbox popup.
379 if( CB_GETTYPE(lphc
) == CBS_SIMPLE
)
382 * Use the client rectangle to initialize the listbox rectangle
384 GetClientRect(hwnd
, lprLB
);
387 * Then, chop-off the top part.
389 lprLB
->top
= lprEdit
->bottom
+ COMBO_YBORDERSIZE();
394 * Make sure the dropped width is as large as the combobox itself.
396 if (lphc
->droppedWidth
< (lprButton
->right
+ COMBO_XBORDERSIZE()))
398 lprLB
->right
= lprLB
->left
+ (lprButton
->right
+ COMBO_XBORDERSIZE());
401 * In the case of a dropdown, the popup listbox is offset to the right.
402 * so, we want to make sure it's flush with the right side of the
405 if( CB_GETTYPE(lphc
) == CBS_DROPDOWN
)
406 lprLB
->right
-= COMBO_EDITBUTTONSPACE();
409 lprLB
->right
= lprLB
->left
+ lphc
->droppedWidth
;
412 TRACE("\ttext\t= (%i,%i-%i,%i)\n",
413 lprEdit
->left
, lprEdit
->top
, lprEdit
->right
, lprEdit
->bottom
);
415 TRACE("\tbutton\t= (%i,%i-%i,%i)\n",
416 lprButton
->left
, lprButton
->top
, lprButton
->right
, lprButton
->bottom
);
418 TRACE("\tlbox\t= (%i,%i-%i,%i)\n",
419 lprLB
->left
, lprLB
->top
, lprLB
->right
, lprLB
->bottom
);
422 /***********************************************************************
423 * CBGetDroppedControlRect
425 static void CBGetDroppedControlRect( LPHEADCOMBO lphc
, LPRECT lpRect
)
427 /* In windows, CB_GETDROPPEDCONTROLRECT returns the upper left corner
428 of the combo box and the lower right corner of the listbox */
430 GetWindowRect(lphc
->self
->hwndSelf
, lpRect
);
432 lpRect
->right
= lpRect
->left
+ lphc
->droppedRect
.right
- lphc
->droppedRect
.left
;
433 lpRect
->bottom
= lpRect
->top
+ lphc
->droppedRect
.bottom
- lphc
->droppedRect
.top
;
437 /***********************************************************************
438 * COMBO_WindowPosChanging
440 static LRESULT
COMBO_WindowPosChanging(
443 WINDOWPOS
* posChanging
)
446 * We need to override the WM_WINDOWPOSCHANGING method to handle all
447 * the non-simple comboboxes. The problem is that those controls are
448 * always the same height. We have to make sure they are not resized
451 if ( ( CB_GETTYPE(lphc
) != CBS_SIMPLE
) &&
452 ((posChanging
->flags
& SWP_NOSIZE
) == 0) )
456 newComboHeight
= CBGetTextAreaHeight(hwnd
,lphc
) +
457 2*COMBO_YBORDERSIZE();
460 * Resizing a combobox has another side effect, it resizes the dropped
461 * rectangle as well. However, it does it only if the new height for the
462 * combobox is different from the height it should have. In other words,
463 * if the application resizing the combobox only had the intention to resize
464 * the actual control, for example, to do the layout of a dialog that is
465 * resized, the height of the dropdown is not changed.
467 if (posChanging
->cy
!= newComboHeight
)
469 TRACE("posChanging->cy=%d, newComboHeight=%d, oldbot=%d, oldtop=%d\n",
470 posChanging
->cy
, newComboHeight
, lphc
->droppedRect
.bottom
,
471 lphc
->droppedRect
.top
);
472 lphc
->droppedRect
.bottom
= lphc
->droppedRect
.top
+ posChanging
->cy
- newComboHeight
;
474 posChanging
->cy
= newComboHeight
;
481 /***********************************************************************
484 static LRESULT
COMBO_Create( LPHEADCOMBO lphc
, WND
* wnd
, HWND hwndParent
, LONG style
)
486 static const WCHAR clbName
[] = {'C','o','m','b','o','L','B','o','x',0};
487 static const WCHAR editName
[] = {'E','d','i','t',0};
489 if( !CB_GETTYPE(lphc
) ) lphc
->dwStyle
|= CBS_SIMPLE
;
490 if( CB_GETTYPE(lphc
) != CBS_DROPDOWNLIST
) lphc
->wState
|= CBF_EDIT
;
493 lphc
->owner
= hwndParent
;
496 * The item height and dropped width are not set when the control
499 lphc
->droppedWidth
= lphc
->editHeight
= 0;
502 * The first time we go through, we want to measure the ownerdraw item
504 lphc
->wState
|= CBF_MEASUREITEM
;
506 /* M$ IE 3.01 actually creates (and rapidly destroys) an ownerless combobox */
508 if( lphc
->owner
|| !(style
& WS_VISIBLE
) )
514 * Initialize the dropped rect to the size of the client area of the
515 * control and then, force all the areas of the combobox to be
518 GetClientRect( wnd
->hwndSelf
, &lphc
->droppedRect
);
520 CBCalcPlacement(wnd
->hwndSelf
,
524 &lphc
->droppedRect
);
527 * Adjust the position of the popup listbox if it's necessary
529 if ( CB_GETTYPE(lphc
) != CBS_SIMPLE
)
531 lphc
->droppedRect
.top
= lphc
->textRect
.bottom
+ COMBO_YBORDERSIZE();
534 * If it's a dropdown, the listbox is offset
536 if( CB_GETTYPE(lphc
) == CBS_DROPDOWN
)
537 lphc
->droppedRect
.left
+= COMBO_EDITBUTTONSPACE();
539 ClientToScreen(wnd
->hwndSelf
, (LPPOINT
)&lphc
->droppedRect
);
540 ClientToScreen(wnd
->hwndSelf
, (LPPOINT
)&lphc
->droppedRect
.right
);
543 /* create listbox popup */
545 lbeStyle
= (LBS_NOTIFY
| WS_BORDER
| WS_CLIPSIBLINGS
| WS_CHILD
) |
546 (style
& (WS_VSCROLL
| CBS_OWNERDRAWFIXED
| CBS_OWNERDRAWVARIABLE
));
548 if( lphc
->dwStyle
& CBS_SORT
)
549 lbeStyle
|= LBS_SORT
;
550 if( lphc
->dwStyle
& CBS_HASSTRINGS
)
551 lbeStyle
|= LBS_HASSTRINGS
;
552 if( lphc
->dwStyle
& CBS_NOINTEGRALHEIGHT
)
553 lbeStyle
|= LBS_NOINTEGRALHEIGHT
;
554 if( lphc
->dwStyle
& CBS_DISABLENOSCROLL
)
555 lbeStyle
|= LBS_DISABLENOSCROLL
;
557 if( CB_GETTYPE(lphc
) == CBS_SIMPLE
) /* child listbox */
559 lbeStyle
|= WS_VISIBLE
;
562 * In win 95 look n feel, the listbox in the simple combobox has
563 * the WS_EXCLIENTEDGE style instead of the WS_BORDER style.
565 if (TWEAK_WineLook
> WIN31_LOOK
)
567 lbeStyle
&= ~WS_BORDER
;
568 lbeExStyle
|= WS_EX_CLIENTEDGE
;
572 lphc
->hWndLBox
= CreateWindowExW(lbeExStyle
,
576 lphc
->droppedRect
.left
,
577 lphc
->droppedRect
.top
,
578 lphc
->droppedRect
.right
- lphc
->droppedRect
.left
,
579 lphc
->droppedRect
.bottom
- lphc
->droppedRect
.top
,
580 lphc
->self
->hwndSelf
,
581 (HMENU
)ID_CB_LISTBOX
,
582 lphc
->self
->hInstance
,
588 lbeStyle
= WS_CHILD
| WS_VISIBLE
| ES_NOHIDESEL
| ES_LEFT
| ES_COMBO
;
591 * In Win95 look, the border fo the edit control is
592 * provided by the combobox
594 if (TWEAK_WineLook
== WIN31_LOOK
)
595 lbeStyle
|= WS_BORDER
;
597 if( lphc
->wState
& CBF_EDIT
)
599 if( lphc
->dwStyle
& CBS_OEMCONVERT
)
600 lbeStyle
|= ES_OEMCONVERT
;
601 if( lphc
->dwStyle
& CBS_AUTOHSCROLL
)
602 lbeStyle
|= ES_AUTOHSCROLL
;
603 if( lphc
->dwStyle
& CBS_LOWERCASE
)
604 lbeStyle
|= ES_LOWERCASE
;
605 else if( lphc
->dwStyle
& CBS_UPPERCASE
)
606 lbeStyle
|= ES_UPPERCASE
;
608 lphc
->hWndEdit
= CreateWindowExW(0,
612 lphc
->textRect
.left
, lphc
->textRect
.top
,
613 lphc
->textRect
.right
- lphc
->textRect
.left
,
614 lphc
->textRect
.bottom
- lphc
->textRect
.top
,
615 lphc
->self
->hwndSelf
,
617 lphc
->self
->hInstance
,
620 if( !lphc
->hWndEdit
)
626 if( CB_GETTYPE(lphc
) != CBS_SIMPLE
)
628 /* Now do the trick with parent */
629 SetParent(lphc
->hWndLBox
, HWND_DESKTOP
);
631 * If the combo is a dropdown, we must resize the control
632 * to fit only the text area and button. To do this,
633 * we send a dummy resize and the WM_WINDOWPOSCHANGING message
634 * will take care of setting the height for us.
636 CBForceDummyResize(lphc
);
639 TRACE("init done\n");
640 return wnd
->hwndSelf
;
642 ERR("edit control failure.\n");
643 } else ERR("listbox failure.\n");
644 } else ERR("no owner for visible combo.\n");
646 /* CreateWindow() will send WM_NCDESTROY to cleanup */
651 /***********************************************************************
654 * Paint combo button (normal, pressed, and disabled states).
656 static void CBPaintButton(
661 if( lphc
->wState
& CBF_NOREDRAW
)
664 if (TWEAK_WineLook
== WIN31_LOOK
)
670 COLORREF oldTextColor
, oldBkColor
;
673 hPrevBrush
= SelectObject(hdc
, GetSysColorBrush(COLOR_BTNFACE
));
676 * Draw the button background
681 rectButton
.right
-rectButton
.left
,
682 rectButton
.bottom
-rectButton
.top
,
685 if( (bBool
= lphc
->wState
& CBF_BUTTONDOWN
) )
687 DrawEdge( hdc
, &rectButton
, EDGE_SUNKEN
, BF_RECT
);
691 DrawEdge( hdc
, &rectButton
, EDGE_RAISED
, BF_RECT
);
695 * Remove the edge of the button from the rectangle
696 * and calculate the position of the bitmap.
698 InflateRect( &rectButton
, -2, -2);
700 x
= (rectButton
.left
+ rectButton
.right
- CBitWidth
) >> 1;
701 y
= (rectButton
.top
+ rectButton
.bottom
- CBitHeight
) >> 1;
704 hMemDC
= CreateCompatibleDC( hdc
);
705 SelectObject( hMemDC
, hComboBmp
);
706 oldTextColor
= SetTextColor( hdc
, GetSysColor(COLOR_BTNFACE
) );
707 oldBkColor
= SetBkColor( hdc
, CB_DISABLED(lphc
) ? RGB(128,128,128) :
709 BitBlt( hdc
, x
, y
, CBitWidth
, CBitHeight
, hMemDC
, 0, 0, SRCCOPY
);
710 SetBkColor( hdc
, oldBkColor
);
711 SetTextColor( hdc
, oldTextColor
);
713 SelectObject( hdc
, hPrevBrush
);
717 UINT buttonState
= DFCS_SCROLLCOMBOBOX
;
719 if (lphc
->wState
& CBF_BUTTONDOWN
)
721 buttonState
|= DFCS_PUSHED
;
724 if (CB_DISABLED(lphc
))
726 buttonState
|= DFCS_INACTIVE
;
729 DrawFrameControl(hdc
,
736 /***********************************************************************
739 * Paint CBS_DROPDOWNLIST text field / update edit control contents.
741 static void CBPaintText(
749 if( lphc
->wState
& CBF_NOREDRAW
) return;
751 /* follow Windows combobox that sends a bunch of text
752 * inquiries to its listbox while processing WM_PAINT. */
754 if( (id
= SendMessageW(lphc
->hWndLBox
, LB_GETCURSEL
, 0, 0) ) != LB_ERR
)
756 size
= SendMessageW(lphc
->hWndLBox
, LB_GETTEXTLEN
, id
, 0);
757 if( (pText
= HeapAlloc( GetProcessHeap(), 0, (size
+ 1) * sizeof(WCHAR
))) )
759 SendMessageW(lphc
->hWndLBox
, LB_GETTEXT
, (WPARAM
)id
, (LPARAM
)pText
);
760 pText
[size
] = '\0'; /* just in case */
764 if( !CB_OWNERDRAWN(lphc
) )
767 if( lphc
->wState
& CBF_EDIT
)
769 static const WCHAR empty_stringW
[] = { 0 };
770 if( CB_HASSTRINGS(lphc
) ) SetWindowTextW( lphc
->hWndEdit
, pText
? pText
: empty_stringW
);
771 if( lphc
->wState
& CBF_FOCUSED
)
772 SendMessageW(lphc
->hWndEdit
, EM_SETSEL
, 0, (LPARAM
)(-1));
774 else /* paint text field ourselves */
776 UINT itemState
= ODS_COMBOBOXEDIT
;
777 HFONT hPrevFont
= (lphc
->hFont
) ? SelectObject(hdc
, lphc
->hFont
) : 0;
780 * Give ourselves some space.
782 InflateRect( &rectEdit
, -1, -1 );
784 if( CB_OWNERDRAWN(lphc
) )
789 /* setup state for DRAWITEM message. Owner will highlight */
790 if ( (lphc
->wState
& CBF_FOCUSED
) &&
791 !(lphc
->wState
& CBF_DROPPED
) )
792 itemState
|= ODS_SELECTED
| ODS_FOCUS
;
795 * Save the current clip region.
796 * To retrieve the clip region, we need to create one "dummy"
799 clipRegion
= CreateRectRgnIndirect(&rectEdit
);
801 if (GetClipRgn(hdc
, clipRegion
)!=1)
803 DeleteObject(clipRegion
);
804 clipRegion
=(HRGN
)NULL
;
807 if ( lphc
->self
->dwStyle
& WS_DISABLED
)
808 itemState
|= ODS_DISABLED
;
810 dis
.CtlType
= ODT_COMBOBOX
;
811 dis
.CtlID
= lphc
->self
->wIDmenu
;
812 dis
.hwndItem
= lphc
->self
->hwndSelf
;
813 dis
.itemAction
= ODA_DRAWENTIRE
;
815 dis
.itemState
= itemState
;
817 dis
.rcItem
= rectEdit
;
818 dis
.itemData
= SendMessageW(lphc
->hWndLBox
, LB_GETITEMDATA
,
822 * Clip the DC and have the parent draw the item.
824 IntersectClipRect(hdc
,
825 rectEdit
.left
, rectEdit
.top
,
826 rectEdit
.right
, rectEdit
.bottom
);
828 SendMessageW(lphc
->owner
, WM_DRAWITEM
,
829 lphc
->self
->wIDmenu
, (LPARAM
)&dis
);
832 * Reset the clipping region.
834 SelectClipRgn(hdc
, clipRegion
);
838 static const WCHAR empty_stringW
[] = { 0 };
840 if ( (lphc
->wState
& CBF_FOCUSED
) &&
841 !(lphc
->wState
& CBF_DROPPED
) ) {
844 FillRect( hdc
, &rectEdit
, GetSysColorBrush(COLOR_HIGHLIGHT
) );
845 SetBkColor( hdc
, GetSysColor( COLOR_HIGHLIGHT
) );
846 SetTextColor( hdc
, GetSysColor( COLOR_HIGHLIGHTTEXT
) );
852 ETO_OPAQUE
| ETO_CLIPPED
,
854 pText
? pText
: empty_stringW
, size
, NULL
);
856 if(lphc
->wState
& CBF_FOCUSED
&& !(lphc
->wState
& CBF_DROPPED
))
857 DrawFocusRect( hdc
, &rectEdit
);
861 SelectObject(hdc
, hPrevFont
);
864 HeapFree( GetProcessHeap(), 0, pText
);
867 /***********************************************************************
870 static void CBPaintBorder(
877 if (CB_GETTYPE(lphc
) != CBS_SIMPLE
)
879 GetClientRect(hwnd
, &clientRect
);
883 CopyRect(&clientRect
, &lphc
->textRect
);
885 InflateRect(&clientRect
, EDIT_CONTROL_PADDING(), EDIT_CONTROL_PADDING());
886 InflateRect(&clientRect
, COMBO_XBORDERSIZE(), COMBO_YBORDERSIZE());
889 DrawEdge(hdc
, &clientRect
, EDGE_SUNKEN
, BF_RECT
);
892 /***********************************************************************
893 * COMBO_PrepareColors
895 * This method will sent the appropriate WM_CTLCOLOR message to
896 * prepare and setup the colors for the combo's DC.
898 * It also returns the brush to use for the background.
900 static HBRUSH
COMBO_PrepareColors(
907 * Get the background brush for this control.
909 if (CB_DISABLED(lphc
))
911 hBkgBrush
= SendMessageW(lphc
->owner
, WM_CTLCOLORSTATIC
,
912 hDC
, lphc
->self
->hwndSelf
);
915 * We have to change the text color since WM_CTLCOLORSTATIC will
916 * set it to the "enabled" color. This is the same behavior as the
919 SetTextColor(hDC
, GetSysColor(COLOR_GRAYTEXT
));
923 if (lphc
->wState
& CBF_EDIT
)
925 hBkgBrush
= SendMessageW(lphc
->owner
, WM_CTLCOLOREDIT
,
926 hDC
, lphc
->self
->hwndSelf
);
930 hBkgBrush
= SendMessageW(lphc
->owner
, WM_CTLCOLORLISTBOX
,
931 hDC
, lphc
->self
->hwndSelf
);
939 hBkgBrush
= GetSysColorBrush(COLOR_WINDOW
);
944 /***********************************************************************
945 * COMBO_EraseBackground
947 static LRESULT
COMBO_EraseBackground(
955 if(lphc
->wState
& CBF_EDIT
)
958 hDC
= (hParamDC
) ? hParamDC
961 * Retrieve the background brush
963 hBkgBrush
= COMBO_PrepareColors(lphc
, hDC
);
965 FillRect(hDC
, &lphc
->textRect
, hBkgBrush
);
968 ReleaseDC(hwnd
, hDC
);
973 /***********************************************************************
976 static LRESULT
COMBO_Paint(LPHEADCOMBO lphc
, HDC hParamDC
)
981 hDC
= (hParamDC
) ? hParamDC
982 : BeginPaint( lphc
->self
->hwndSelf
, &ps
);
985 if( hDC
&& !(lphc
->wState
& CBF_NOREDRAW
) )
987 HBRUSH hPrevBrush
, hBkgBrush
;
990 * Retrieve the background brush and select it in the
993 hBkgBrush
= COMBO_PrepareColors(lphc
, hDC
);
995 hPrevBrush
= SelectObject( hDC
, hBkgBrush
);
998 * In non 3.1 look, there is a sunken border on the combobox
1000 if (TWEAK_WineLook
!= WIN31_LOOK
)
1002 CBPaintBorder(CB_HWND(lphc
), lphc
, hDC
);
1005 if( !IsRectEmpty(&lphc
->buttonRect
) )
1007 CBPaintButton(lphc
, hDC
, lphc
->buttonRect
);
1010 if( !(lphc
->wState
& CBF_EDIT
) )
1013 * The text area has a border only in Win 3.1 look.
1015 if (TWEAK_WineLook
== WIN31_LOOK
)
1017 HPEN hPrevPen
= SelectObject( hDC
, GetSysColorPen(COLOR_WINDOWFRAME
) );
1020 lphc
->textRect
.left
, lphc
->textRect
.top
,
1021 lphc
->textRect
.right
- 1, lphc
->textRect
.bottom
- 1);
1023 SelectObject( hDC
, hPrevPen
);
1026 CBPaintText( lphc
, hDC
, lphc
->textRect
);
1030 SelectObject( hDC
, hPrevBrush
);
1034 EndPaint(lphc
->self
->hwndSelf
, &ps
);
1039 /***********************************************************************
1042 * Select listbox entry according to the contents of the edit control.
1044 static INT
CBUpdateLBox( LPHEADCOMBO lphc
, BOOL bSelect
)
1047 LPWSTR pText
= NULL
;
1050 length
= CB_GETEDITTEXTLENGTH( lphc
);
1053 pText
= HeapAlloc( GetProcessHeap(), 0, (length
+ 1) * sizeof(WCHAR
));
1055 TRACE("\t edit text length %i\n", length
);
1059 if( length
) GetWindowTextW( lphc
->hWndEdit
, pText
, length
+ 1);
1060 else pText
[0] = '\0';
1061 idx
= SendMessageW(lphc
->hWndLBox
, LB_FINDSTRING
,
1062 (WPARAM
)(-1), (LPARAM
)pText
);
1063 HeapFree( GetProcessHeap(), 0, pText
);
1066 SendMessageW(lphc
->hWndLBox
, LB_SETCURSEL
, (WPARAM
)(bSelect
? idx
: -1), 0);
1068 /* probably superfluous but Windows sends this too */
1069 SendMessageW(lphc
->hWndLBox
, LB_SETCARETINDEX
, (WPARAM
)(idx
< 0 ? 0 : idx
), 0);
1070 SendMessageW(lphc
->hWndLBox
, LB_SETTOPINDEX
, (WPARAM
)(idx
< 0 ? 0 : idx
), 0);
1075 /***********************************************************************
1078 * Copy a listbox entry to the edit control.
1080 static void CBUpdateEdit( LPHEADCOMBO lphc
, INT index
)
1083 LPWSTR pText
= NULL
;
1084 static const WCHAR empty_stringW
[] = { 0 };
1086 TRACE("\t %i\n", index
);
1088 if( index
>= 0 ) /* got an entry */
1090 length
= SendMessageW(lphc
->hWndLBox
, LB_GETTEXTLEN
, (WPARAM
)index
, 0);
1093 if( (pText
= HeapAlloc( GetProcessHeap(), 0, (length
+ 1) * sizeof(WCHAR
))) )
1095 SendMessageW(lphc
->hWndLBox
, LB_GETTEXT
,
1096 (WPARAM
)index
, (LPARAM
)pText
);
1101 lphc
->wState
|= (CBF_NOEDITNOTIFY
| CBF_NOLBSELECT
);
1102 SendMessageW(lphc
->hWndEdit
, WM_SETTEXT
, 0, pText
? (LPARAM
)pText
: (LPARAM
)empty_stringW
);
1103 lphc
->wState
&= ~(CBF_NOEDITNOTIFY
| CBF_NOLBSELECT
);
1105 if( lphc
->wState
& CBF_FOCUSED
)
1106 SendMessageW(lphc
->hWndEdit
, EM_SETSEL
, 0, (LPARAM
)(-1));
1109 HeapFree( GetProcessHeap(), 0, pText
);
1112 /***********************************************************************
1115 * Show listbox popup.
1117 static void CBDropDown( LPHEADCOMBO lphc
)
1123 TRACE("[%04x]: drop down\n", CB_HWND(lphc
));
1125 CB_NOTIFY( lphc
, CBN_DROPDOWN
);
1129 lphc
->wState
|= CBF_DROPPED
;
1130 if( CB_GETTYPE(lphc
) == CBS_DROPDOWN
)
1132 lphc
->droppedIndex
= CBUpdateLBox( lphc
, TRUE
);
1134 /* Update edit only if item is in the list */
1135 if( !(lphc
->wState
& CBF_CAPTURE
) && lphc
->droppedIndex
>= 0)
1136 CBUpdateEdit( lphc
, lphc
->droppedIndex
);
1140 lphc
->droppedIndex
= SendMessageW(lphc
->hWndLBox
, LB_GETCURSEL
, 0, 0);
1142 SendMessageW(lphc
->hWndLBox
, LB_SETTOPINDEX
,
1143 (WPARAM
)(lphc
->droppedIndex
== LB_ERR
? 0 : lphc
->droppedIndex
), 0 );
1144 SendMessageW(lphc
->hWndLBox
, LB_CARETON
, 0, 0);
1147 /* now set popup position */
1148 GetWindowRect( lphc
->self
->hwndSelf
, &rect
);
1151 * If it's a dropdown, the listbox is offset
1153 if( CB_GETTYPE(lphc
) == CBS_DROPDOWN
)
1154 rect
.left
+= COMBO_EDITBUTTONSPACE();
1156 /* if the dropped height is greater than the total height of the dropped
1157 items list, then force the drop down list height to be the total height
1158 of the items in the dropped list */
1160 /* And Remove any extra space (Best Fit) */
1161 nDroppedHeight
= lphc
->droppedRect
.bottom
- lphc
->droppedRect
.top
;
1162 /* if listbox length has been set directly by its handle */
1163 GetWindowRect(lphc
->hWndLBox
, &r
);
1164 if (nDroppedHeight
< r
.bottom
- r
.top
)
1165 nDroppedHeight
= r
.bottom
- r
.top
;
1166 nItems
= (int)SendMessageW(lphc
->hWndLBox
, LB_GETCOUNT
, 0, 0);
1172 nHeight
= (int)SendMessageW(lphc
->hWndLBox
, LB_GETITEMHEIGHT
, 0, 0);
1175 if (nHeight
< nDroppedHeight
- COMBO_YBORDERSIZE())
1176 nDroppedHeight
= nHeight
+ COMBO_YBORDERSIZE();
1179 /*If height of dropped rectangle gets beyond a screen size it should go up, otherwise down.*/
1180 if( (rect
.bottom
+ nDroppedHeight
) >= GetSystemMetrics( SM_CYSCREEN
) )
1181 rect
.bottom
= rect
.top
- nDroppedHeight
;
1183 SetWindowPos( lphc
->hWndLBox
, HWND_TOP
, rect
.left
, rect
.bottom
,
1184 lphc
->droppedRect
.right
- lphc
->droppedRect
.left
,
1186 SWP_NOACTIVATE
| SWP_SHOWWINDOW
);
1189 if( !(lphc
->wState
& CBF_NOREDRAW
) )
1190 RedrawWindow( lphc
->self
->hwndSelf
, NULL
, 0, RDW_INVALIDATE
|
1191 RDW_ERASE
| RDW_UPDATENOW
| RDW_NOCHILDREN
);
1193 EnableWindow( lphc
->hWndLBox
, TRUE
);
1194 if (GetCapture() != lphc
->self
->hwndSelf
)
1195 SetCapture(lphc
->hWndLBox
);
1198 /***********************************************************************
1201 * Hide listbox popup.
1203 static void CBRollUp( LPHEADCOMBO lphc
, BOOL ok
, BOOL bButton
)
1205 HWND hWnd
= lphc
->self
->hwndSelf
;
1207 TRACE("[%04x]: sel ok? [%i] dropped? [%i]\n",
1208 CB_HWND(lphc
), (INT
)ok
, (INT
)(lphc
->wState
& CBF_DROPPED
));
1210 CB_NOTIFY( lphc
, (ok
) ? CBN_SELENDOK
: CBN_SELENDCANCEL
);
1212 if( IsWindow( hWnd
) && CB_GETTYPE(lphc
) != CBS_SIMPLE
)
1215 if( lphc
->wState
& CBF_DROPPED
)
1219 lphc
->wState
&= ~CBF_DROPPED
;
1220 ShowWindow( lphc
->hWndLBox
, SW_HIDE
);
1222 if(GetCapture() == lphc
->hWndLBox
)
1227 if( CB_GETTYPE(lphc
) == CBS_DROPDOWN
)
1229 rect
= lphc
->buttonRect
;
1240 rect
= lphc
->textRect
;
1245 if( bButton
&& !(lphc
->wState
& CBF_NOREDRAW
) )
1246 RedrawWindow( hWnd
, &rect
, 0, RDW_INVALIDATE
|
1247 RDW_ERASE
| RDW_UPDATENOW
| RDW_NOCHILDREN
);
1248 CB_NOTIFY( lphc
, CBN_CLOSEUP
);
1253 /***********************************************************************
1256 * Used by the ComboLBox to show/hide itself in response to VK_F4, etc...
1258 BOOL
COMBO_FlipListbox( LPHEADCOMBO lphc
, BOOL ok
, BOOL bRedrawButton
)
1260 if( lphc
->wState
& CBF_DROPPED
)
1262 CBRollUp( lphc
, ok
, bRedrawButton
);
1270 /***********************************************************************
1273 static void CBRepaintButton( LPHEADCOMBO lphc
)
1275 InvalidateRect(CB_HWND(lphc
), &lphc
->buttonRect
, TRUE
);
1276 UpdateWindow(CB_HWND(lphc
));
1279 /***********************************************************************
1282 static void COMBO_SetFocus( LPHEADCOMBO lphc
)
1284 if( !(lphc
->wState
& CBF_FOCUSED
) )
1286 if( CB_GETTYPE(lphc
) == CBS_DROPDOWNLIST
)
1287 SendMessageW(lphc
->hWndLBox
, LB_CARETON
, 0, 0);
1289 /* This is wrong. Message sequences seem to indicate that this
1290 is set *after* the notify. */
1291 /* lphc->wState |= CBF_FOCUSED; */
1293 if( !(lphc
->wState
& CBF_EDIT
) )
1294 InvalidateRect(CB_HWND(lphc
), &lphc
->textRect
, TRUE
);
1296 CB_NOTIFY( lphc
, CBN_SETFOCUS
);
1297 lphc
->wState
|= CBF_FOCUSED
;
1301 /***********************************************************************
1304 static void COMBO_KillFocus( LPHEADCOMBO lphc
)
1306 HWND hWnd
= lphc
->self
->hwndSelf
;
1308 if( lphc
->wState
& CBF_FOCUSED
)
1310 CBRollUp( lphc
, FALSE
, TRUE
);
1311 if( IsWindow( hWnd
) )
1313 if( CB_GETTYPE(lphc
) == CBS_DROPDOWNLIST
)
1314 SendMessageW(lphc
->hWndLBox
, LB_CARETOFF
, 0, 0);
1316 lphc
->wState
&= ~CBF_FOCUSED
;
1319 if( !(lphc
->wState
& CBF_EDIT
) )
1320 InvalidateRect(CB_HWND(lphc
), &lphc
->textRect
, TRUE
);
1322 CB_NOTIFY( lphc
, CBN_KILLFOCUS
);
1327 /***********************************************************************
1330 static LRESULT
COMBO_Command( LPHEADCOMBO lphc
, WPARAM wParam
, HWND hWnd
)
1332 if ( lphc
->wState
& CBF_EDIT
&& lphc
->hWndEdit
== hWnd
)
1334 /* ">> 8" makes gcc generate jump-table instead of cmp ladder */
1336 switch( HIWORD(wParam
) >> 8 )
1338 case (EN_SETFOCUS
>> 8):
1340 TRACE("[%04x]: edit [%04x] got focus\n",
1341 CB_HWND(lphc
), lphc
->hWndEdit
);
1343 COMBO_SetFocus( lphc
);
1346 case (EN_KILLFOCUS
>> 8):
1348 TRACE("[%04x]: edit [%04x] lost focus\n",
1349 CB_HWND(lphc
), lphc
->hWndEdit
);
1351 /* NOTE: it seems that Windows' edit control sends an
1352 * undocumented message WM_USER + 0x1B instead of this
1353 * notification (only when it happens to be a part of
1354 * the combo). ?? - AK.
1357 COMBO_KillFocus( lphc
);
1361 case (EN_CHANGE
>> 8):
1363 * In some circumstances (when the selection of the combobox
1364 * is changed for example) we don't wans the EN_CHANGE notification
1365 * to be forwarded to the parent of the combobox. This code
1366 * checks a flag that is set in these occasions and ignores the
1369 if (lphc
->wState
& CBF_NOLBSELECT
)
1371 lphc
->wState
&= ~CBF_NOLBSELECT
;
1375 CBUpdateLBox( lphc
, lphc
->wState
& CBF_DROPPED
);
1378 if (!(lphc
->wState
& CBF_NOEDITNOTIFY
))
1379 CB_NOTIFY( lphc
, CBN_EDITCHANGE
);
1382 case (EN_UPDATE
>> 8):
1383 if (!(lphc
->wState
& CBF_NOEDITNOTIFY
))
1384 CB_NOTIFY( lphc
, CBN_EDITUPDATE
);
1387 case (EN_ERRSPACE
>> 8):
1388 CB_NOTIFY( lphc
, CBN_ERRSPACE
);
1391 else if( lphc
->hWndLBox
== hWnd
)
1393 switch( HIWORD(wParam
) )
1396 CB_NOTIFY( lphc
, CBN_ERRSPACE
);
1400 CB_NOTIFY( lphc
, CBN_DBLCLK
);
1406 TRACE("[%04x]: lbox selection change [%04x]\n",
1407 CB_HWND(lphc
), lphc
->wState
);
1409 if( HIWORD(wParam
) == LBN_SELCHANGE
)
1411 if( lphc
->wState
& CBF_EDIT
)
1413 INT index
= SendMessageW(lphc
->hWndLBox
, LB_GETCURSEL
, 0, 0);
1414 lphc
->wState
|= CBF_NOLBSELECT
;
1415 CBUpdateEdit( lphc
, index
);
1416 /* select text in edit, as Windows does */
1417 SendMessageW(lphc
->hWndEdit
, EM_SETSEL
, 0, (LPARAM
)(-1));
1420 InvalidateRect(CB_HWND(lphc
), &lphc
->textRect
, TRUE
);
1423 /* do not roll up if selection is being tracked
1424 * by arrowkeys in the dropdown listbox */
1425 if( ((lphc
->wState
& CBF_DROPPED
) && !(lphc
->wState
& CBF_NOROLLUP
)) )
1427 CBRollUp( lphc
, (HIWORD(wParam
) == LBN_SELCHANGE
), TRUE
);
1429 else lphc
->wState
&= ~CBF_NOROLLUP
;
1431 CB_NOTIFY( lphc
, CBN_SELCHANGE
);
1433 /* added due to traces from native */
1434 if( CB_OWNERDRAWN(lphc
) )
1438 hDC
= GetDC( hWnd
);
1439 CBPaintText( lphc
, hDC
, lphc
->textRect
);
1440 ReleaseDC( hWnd
, hDC
);
1442 /* end of added due to traces from native */
1448 /* nothing to do here since ComboLBox always resets the focus to its
1449 * combo/edit counterpart */
1456 /***********************************************************************
1459 * Fixup an ownerdrawn item operation and pass it up to the combobox owner.
1461 static LRESULT
COMBO_ItemOp( LPHEADCOMBO lphc
, UINT msg
, LPARAM lParam
)
1463 HWND hWnd
= lphc
->self
->hwndSelf
;
1465 TRACE("[%04x]: ownerdraw op %04x\n", CB_HWND(lphc
), msg
);
1467 #define lpIS ((LPDELETEITEMSTRUCT)lParam)
1469 /* two first items are the same in all 4 structs */
1470 lpIS
->CtlType
= ODT_COMBOBOX
;
1471 lpIS
->CtlID
= lphc
->self
->wIDmenu
;
1473 switch( msg
) /* patch window handle */
1476 lpIS
->hwndItem
= hWnd
;
1480 #define lpIS ((LPDRAWITEMSTRUCT)lParam)
1481 lpIS
->hwndItem
= hWnd
;
1484 case WM_COMPAREITEM
:
1485 #define lpIS ((LPCOMPAREITEMSTRUCT)lParam)
1486 lpIS
->hwndItem
= hWnd
;
1491 return SendMessageW(lphc
->owner
, msg
, lphc
->self
->wIDmenu
, lParam
);
1494 /***********************************************************************
1497 static LRESULT
COMBO_GetText( LPHEADCOMBO lphc
, INT N
, LPARAM lParam
, BOOL unicode
)
1499 if( lphc
->wState
& CBF_EDIT
)
1500 return unicode
? SendMessageW(lphc
->hWndEdit
, WM_GETTEXT
, (WPARAM
)N
, lParam
) :
1501 SendMessageA(lphc
->hWndEdit
, WM_GETTEXT
, (WPARAM
)N
, lParam
);
1503 /* get it from the listbox */
1505 if( lphc
->hWndLBox
)
1507 INT idx
= SendMessageW(lphc
->hWndLBox
, LB_GETCURSEL
, 0, 0);
1511 INT length
= SendMessageW(lphc
->hWndLBox
, LB_GETTEXTLEN
,
1516 LPWSTR lpBuffer
, lpText
= (LPWSTR
)lParam
;
1518 /* 'length' is without the terminating character */
1520 lpBuffer
= HeapAlloc(GetProcessHeap(), 0, (length
+ 1) * sizeof(WCHAR
));
1526 n
= SendMessageW(lphc
->hWndLBox
, LB_GETTEXT
, (WPARAM
)idx
, (LPARAM
)lpBuffer
);
1528 /* truncate if buffer is too short */
1534 strncpyW(lpText
, lpBuffer
, (N
> n
) ? n
+1 : N
-1);
1535 lpText
[N
- 1] = '\0';
1538 HeapFree( GetProcessHeap(), 0, lpBuffer
);
1543 LPSTR lpBuffer
, lpText
= (LPSTR
)lParam
;
1545 /* 'length' is without the terminating character */
1547 lpBuffer
= HeapAlloc(GetProcessHeap(), 0, length
+ 1);
1553 n
= SendMessageA(lphc
->hWndLBox
, LB_GETTEXT
, (WPARAM
)idx
, (LPARAM
)lpBuffer
);
1555 /* truncate if buffer is too short */
1561 strncpy(lpText
, lpBuffer
, (N
> n
) ? n
+1 : N
-1);
1562 lpText
[N
- 1] = '\0';
1565 HeapFree( GetProcessHeap(), 0, lpBuffer
);
1575 /***********************************************************************
1578 * This function sets window positions according to the updated
1579 * component placement struct.
1581 static void CBResetPos(
1587 BOOL bDrop
= (CB_GETTYPE(lphc
) != CBS_SIMPLE
);
1589 /* NOTE: logs sometimes have WM_LBUTTONUP before a cascade of
1590 * sizing messages */
1592 if( lphc
->wState
& CBF_EDIT
)
1593 SetWindowPos( lphc
->hWndEdit
, 0,
1594 rectEdit
->left
, rectEdit
->top
,
1595 rectEdit
->right
- rectEdit
->left
,
1596 rectEdit
->bottom
- rectEdit
->top
,
1597 SWP_NOZORDER
| SWP_NOACTIVATE
| ((bDrop
) ? SWP_NOREDRAW
: 0) );
1599 SetWindowPos( lphc
->hWndLBox
, 0,
1600 rectLB
->left
, rectLB
->top
,
1601 rectLB
->right
- rectLB
->left
,
1602 rectLB
->bottom
- rectLB
->top
,
1603 SWP_NOACTIVATE
| SWP_NOZORDER
| ((bDrop
) ? SWP_NOREDRAW
: 0) );
1607 if( lphc
->wState
& CBF_DROPPED
)
1609 lphc
->wState
&= ~CBF_DROPPED
;
1610 ShowWindow( lphc
->hWndLBox
, SW_HIDE
);
1613 if( bRedraw
&& !(lphc
->wState
& CBF_NOREDRAW
) )
1614 RedrawWindow( lphc
->self
->hwndSelf
, NULL
, 0,
1615 RDW_INVALIDATE
| RDW_ERASE
| RDW_UPDATENOW
);
1620 /***********************************************************************
1623 static void COMBO_Size( LPHEADCOMBO lphc
)
1625 CBCalcPlacement(lphc
->self
->hwndSelf
,
1629 &lphc
->droppedRect
);
1631 CBResetPos( lphc
, &lphc
->textRect
, &lphc
->droppedRect
, TRUE
);
1635 /***********************************************************************
1638 static void COMBO_Font( LPHEADCOMBO lphc
, HFONT hFont
, BOOL bRedraw
)
1643 lphc
->hFont
= hFont
;
1646 * Propagate to owned windows.
1648 if( lphc
->wState
& CBF_EDIT
)
1649 SendMessageW(lphc
->hWndEdit
, WM_SETFONT
, (WPARAM
)hFont
, bRedraw
);
1650 SendMessageW(lphc
->hWndLBox
, WM_SETFONT
, (WPARAM
)hFont
, bRedraw
);
1653 * Redo the layout of the control.
1655 if ( CB_GETTYPE(lphc
) == CBS_SIMPLE
)
1657 CBCalcPlacement(lphc
->self
->hwndSelf
,
1661 &lphc
->droppedRect
);
1663 CBResetPos( lphc
, &lphc
->textRect
, &lphc
->droppedRect
, TRUE
);
1667 CBForceDummyResize(lphc
);
1672 /***********************************************************************
1673 * COMBO_SetItemHeight
1675 static LRESULT
COMBO_SetItemHeight( LPHEADCOMBO lphc
, INT index
, INT height
)
1677 LRESULT lRet
= CB_ERR
;
1679 if( index
== -1 ) /* set text field height */
1681 if( height
< 32768 )
1683 lphc
->editHeight
= height
;
1686 * Redo the layout of the control.
1688 if ( CB_GETTYPE(lphc
) == CBS_SIMPLE
)
1690 CBCalcPlacement(lphc
->self
->hwndSelf
,
1694 &lphc
->droppedRect
);
1696 CBResetPos( lphc
, &lphc
->textRect
, &lphc
->droppedRect
, TRUE
);
1700 CBForceDummyResize(lphc
);
1706 else if ( CB_OWNERDRAWN(lphc
) ) /* set listbox item height */
1707 lRet
= SendMessageW(lphc
->hWndLBox
, LB_SETITEMHEIGHT
,
1708 (WPARAM
)index
, (LPARAM
)height
);
1712 /***********************************************************************
1713 * COMBO_SelectString
1715 static LRESULT
COMBO_SelectString( LPHEADCOMBO lphc
, INT start
, LPARAM pText
, BOOL unicode
)
1717 INT index
= unicode
? SendMessageW(lphc
->hWndLBox
, LB_SELECTSTRING
, (WPARAM
)start
, pText
) :
1718 SendMessageA(lphc
->hWndLBox
, LB_SELECTSTRING
, (WPARAM
)start
, pText
);
1721 if( lphc
->wState
& CBF_EDIT
)
1722 CBUpdateEdit( lphc
, index
);
1725 InvalidateRect(CB_HWND(lphc
), &lphc
->textRect
, TRUE
);
1728 return (LRESULT
)index
;
1731 /***********************************************************************
1734 static void COMBO_LButtonDown( LPHEADCOMBO lphc
, LPARAM lParam
)
1738 HWND hWnd
= lphc
->self
->hwndSelf
;
1740 pt
.x
= LOWORD(lParam
);
1741 pt
.y
= HIWORD(lParam
);
1742 bButton
= PtInRect(&lphc
->buttonRect
, pt
);
1744 if( (CB_GETTYPE(lphc
) == CBS_DROPDOWNLIST
) ||
1745 (bButton
&& (CB_GETTYPE(lphc
) == CBS_DROPDOWN
)) )
1747 lphc
->wState
|= CBF_BUTTONDOWN
;
1748 if( lphc
->wState
& CBF_DROPPED
)
1750 /* got a click to cancel selection */
1752 lphc
->wState
&= ~CBF_BUTTONDOWN
;
1753 CBRollUp( lphc
, TRUE
, FALSE
);
1754 if( !IsWindow( hWnd
) ) return;
1756 if( lphc
->wState
& CBF_CAPTURE
)
1758 lphc
->wState
&= ~CBF_CAPTURE
;
1764 /* drop down the listbox and start tracking */
1766 lphc
->wState
|= CBF_CAPTURE
;
1770 if( bButton
) CBRepaintButton( lphc
);
1774 /***********************************************************************
1777 * Release capture and stop tracking if needed.
1779 static void COMBO_LButtonUp( LPHEADCOMBO lphc
)
1781 if( lphc
->wState
& CBF_CAPTURE
)
1783 lphc
->wState
&= ~CBF_CAPTURE
;
1784 if( CB_GETTYPE(lphc
) == CBS_DROPDOWN
)
1786 INT index
= CBUpdateLBox( lphc
, TRUE
);
1787 /* Update edit only if item is in the list */
1790 lphc
->wState
|= CBF_NOLBSELECT
;
1791 CBUpdateEdit( lphc
, index
);
1792 lphc
->wState
&= ~CBF_NOLBSELECT
;
1796 SetCapture(lphc
->hWndLBox
);
1799 if( lphc
->wState
& CBF_BUTTONDOWN
)
1801 lphc
->wState
&= ~CBF_BUTTONDOWN
;
1802 CBRepaintButton( lphc
);
1806 /***********************************************************************
1809 * Two things to do - track combo button and release capture when
1810 * pointer goes into the listbox.
1812 static void COMBO_MouseMove( LPHEADCOMBO lphc
, WPARAM wParam
, LPARAM lParam
)
1817 pt
.x
= LOWORD(lParam
);
1818 pt
.y
= HIWORD(lParam
);
1820 if( lphc
->wState
& CBF_BUTTONDOWN
)
1824 bButton
= PtInRect(&lphc
->buttonRect
, pt
);
1828 lphc
->wState
&= ~CBF_BUTTONDOWN
;
1829 CBRepaintButton( lphc
);
1833 GetClientRect( lphc
->hWndLBox
, &lbRect
);
1834 MapWindowPoints( lphc
->self
->hwndSelf
, lphc
->hWndLBox
, &pt
, 1 );
1835 if( PtInRect(&lbRect
, pt
) )
1837 lphc
->wState
&= ~CBF_CAPTURE
;
1839 if( CB_GETTYPE(lphc
) == CBS_DROPDOWN
) CBUpdateLBox( lphc
, TRUE
);
1841 /* hand over pointer tracking */
1842 SendMessageW(lphc
->hWndLBox
, WM_LBUTTONDOWN
, wParam
, lParam
);
1847 /***********************************************************************
1848 * ComboWndProc_locked
1850 * http://www.microsoft.com/msdn/sdk/platforms/doc/sdk/win32/ctrl/src/combobox_15.htm
1852 static LRESULT
ComboWndProc_locked( WND
* pWnd
, UINT message
,
1853 WPARAM wParam
, LPARAM lParam
, BOOL unicode
)
1856 LPHEADCOMBO lphc
= CB_GETPTR(pWnd
);
1857 HWND hwnd
= pWnd
->hwndSelf
;
1859 TRACE("[%04x]: msg %s wp %08x lp %08lx\n",
1860 pWnd
->hwndSelf
, SPY_GetMsgName(message
), wParam
, lParam
);
1862 if( lphc
|| message
== WM_NCCREATE
)
1866 /* System messages */
1870 LONG style
= unicode
? ((LPCREATESTRUCTW
)lParam
)->style
:
1871 ((LPCREATESTRUCTA
)lParam
)->style
;
1872 return COMBO_NCCreate(pWnd
, style
);
1875 COMBO_NCDestroy(lphc
);
1876 break;/* -> DefWindowProc */
1884 hwndParent
= ((LPCREATESTRUCTW
)lParam
)->hwndParent
;
1885 style
= ((LPCREATESTRUCTW
)lParam
)->style
;
1889 hwndParent
= ((LPCREATESTRUCTA
)lParam
)->hwndParent
;
1890 style
= ((LPCREATESTRUCTA
)lParam
)->style
;
1892 return COMBO_Create(lphc
, pWnd
, hwndParent
, style
);
1895 case WM_PRINTCLIENT
:
1896 if (lParam
& PRF_ERASEBKGND
)
1897 COMBO_EraseBackground(hwnd
, lphc
, wParam
);
1901 /* wParam may contain a valid HDC! */
1902 return COMBO_Paint(lphc
, wParam
);
1904 return COMBO_EraseBackground(hwnd
, lphc
, wParam
);
1907 LRESULT result
= DLGC_WANTARROWS
| DLGC_WANTCHARS
;
1908 if (lParam
&& (((LPMSG
)lParam
)->message
== WM_KEYDOWN
))
1910 int vk
= (int)((LPMSG
)lParam
)->wParam
;
1912 if ((vk
== VK_RETURN
|| vk
== VK_ESCAPE
) && (lphc
->wState
& CBF_DROPPED
))
1913 result
|= DLGC_WANTMESSAGE
;
1917 case WM_WINDOWPOSCHANGING
:
1918 return COMBO_WindowPosChanging(hwnd
, lphc
, (LPWINDOWPOS
)lParam
);
1919 case WM_WINDOWPOSCHANGED
:
1920 /* SetWindowPos can be called on a Combobox to resize its Listbox.
1921 * In that case, the Combobox itself will not be resized, so we won't
1922 * get a WM_SIZE. Since we still want to update the Listbox, we have to
1927 if( lphc
->hWndLBox
&&
1928 !(lphc
->wState
& CBF_NORESIZE
) ) COMBO_Size( lphc
);
1931 COMBO_Font( lphc
, (HFONT16
)wParam
, (BOOL
)lParam
);
1934 return (LRESULT
)lphc
->hFont
;
1936 if( lphc
->wState
& CBF_EDIT
)
1937 SetFocus( lphc
->hWndEdit
);
1939 COMBO_SetFocus( lphc
);
1942 #define hwndFocus ((HWND16)wParam)
1944 (hwndFocus
!= lphc
->hWndEdit
&& hwndFocus
!= lphc
->hWndLBox
))
1945 COMBO_KillFocus( lphc
);
1949 return COMBO_Command( lphc
, wParam
, (HWND
)lParam
);
1951 return COMBO_GetText( lphc
, (INT
)wParam
, lParam
, unicode
);
1953 case WM_GETTEXTLENGTH
:
1955 if ((message
== WM_GETTEXTLENGTH
) && !ISWIN31
&& !(lphc
->wState
& CBF_EDIT
))
1957 int j
= SendMessageW(lphc
->hWndLBox
, LB_GETCURSEL
, 0, 0);
1958 if (j
== -1) return 0;
1959 return SendMessageW(lphc
->hWndLBox
, LB_GETTEXTLEN
, j
, 0);
1961 else if( lphc
->wState
& CBF_EDIT
)
1964 lphc
->wState
|= CBF_NOEDITNOTIFY
;
1965 ret
= unicode
? SendMessageW(lphc
->hWndEdit
, message
, wParam
, lParam
) :
1966 SendMessageA(lphc
->hWndEdit
, message
, wParam
, lParam
);
1967 lphc
->wState
&= ~CBF_NOEDITNOTIFY
;
1974 if( lphc
->wState
& CBF_EDIT
)
1976 return unicode
? SendMessageW(lphc
->hWndEdit
, message
, wParam
, lParam
) :
1977 SendMessageA(lphc
->hWndEdit
, message
, wParam
, lParam
);
1983 case WM_COMPAREITEM
:
1984 case WM_MEASUREITEM
:
1985 return COMBO_ItemOp(lphc
, message
, lParam
);
1987 if( lphc
->wState
& CBF_EDIT
)
1988 EnableWindow( lphc
->hWndEdit
, (BOOL
)wParam
);
1989 EnableWindow( lphc
->hWndLBox
, (BOOL
)wParam
);
1991 /* Force the control to repaint when the enabled state changes. */
1992 InvalidateRect(CB_HWND(lphc
), NULL
, TRUE
);
1996 lphc
->wState
&= ~CBF_NOREDRAW
;
1998 lphc
->wState
|= CBF_NOREDRAW
;
2000 if( lphc
->wState
& CBF_EDIT
)
2001 SendMessageW(lphc
->hWndEdit
, message
, wParam
, lParam
);
2002 SendMessageW(lphc
->hWndLBox
, message
, wParam
, lParam
);
2005 if( KEYDATA_ALT
& HIWORD(lParam
) )
2006 if( wParam
== VK_UP
|| wParam
== VK_DOWN
)
2007 COMBO_FlipListbox( lphc
, FALSE
, FALSE
);
2015 if ((wParam
== VK_RETURN
|| wParam
== VK_ESCAPE
) &&
2016 (lphc
->wState
& CBF_DROPPED
))
2018 CBRollUp( lphc
, wParam
== VK_RETURN
, FALSE
);
2022 if( lphc
->wState
& CBF_EDIT
)
2023 hwndTarget
= lphc
->hWndEdit
;
2025 hwndTarget
= lphc
->hWndLBox
;
2027 return unicode
? SendMessageW(hwndTarget
, message
, wParam
, lParam
) :
2028 SendMessageA(hwndTarget
, message
, wParam
, lParam
);
2030 case WM_LBUTTONDOWN
:
2031 if( !(lphc
->wState
& CBF_FOCUSED
) ) SetFocus( lphc
->self
->hwndSelf
);
2032 if( lphc
->wState
& CBF_FOCUSED
) COMBO_LButtonDown( lphc
, lParam
);
2035 COMBO_LButtonUp( lphc
);
2038 if( lphc
->wState
& CBF_CAPTURE
)
2039 COMBO_MouseMove( lphc
, wParam
, lParam
);
2043 if (wParam
& (MK_SHIFT
| MK_CONTROL
))
2044 return unicode
? DefWindowProcW(hwnd
, message
, wParam
, lParam
) :
2045 DefWindowProcA(hwnd
, message
, wParam
, lParam
);
2046 if (SHIWORD(wParam
) > 0) return SendMessageW(hwnd
, WM_KEYDOWN
, VK_UP
, 0);
2047 if (SHIWORD(wParam
) < 0) return SendMessageW(hwnd
, WM_KEYDOWN
, VK_DOWN
, 0);
2050 /* Combo messages */
2052 case CB_ADDSTRING16
:
2053 if( CB_HASSTRINGS(lphc
) ) lParam
= (LPARAM
)MapSL(lParam
);
2056 return unicode
? SendMessageW(lphc
->hWndLBox
, LB_ADDSTRING
, 0, lParam
) :
2057 SendMessageA(lphc
->hWndLBox
, LB_ADDSTRING
, 0, lParam
);
2058 case CB_INSERTSTRING16
:
2059 wParam
= (INT
)(INT16
)wParam
;
2060 if( CB_HASSTRINGS(lphc
) ) lParam
= (LPARAM
)MapSL(lParam
);
2062 case CB_INSERTSTRING
:
2063 return unicode
? SendMessageW(lphc
->hWndLBox
, LB_INSERTSTRING
, wParam
, lParam
) :
2064 SendMessageA(lphc
->hWndLBox
, LB_INSERTSTRING
, wParam
, lParam
);
2065 case CB_DELETESTRING16
:
2066 case CB_DELETESTRING
:
2067 return unicode
? SendMessageW(lphc
->hWndLBox
, LB_DELETESTRING
, wParam
, 0) :
2068 SendMessageA(lphc
->hWndLBox
, LB_DELETESTRING
, wParam
, 0);
2069 case CB_SELECTSTRING16
:
2070 wParam
= (INT
)(INT16
)wParam
;
2071 if( CB_HASSTRINGS(lphc
) ) lParam
= (LPARAM
)MapSL(lParam
);
2073 case CB_SELECTSTRING
:
2074 return COMBO_SelectString(lphc
, (INT
)wParam
, lParam
, unicode
);
2075 case CB_FINDSTRING16
:
2076 wParam
= (INT
)(INT16
)wParam
;
2077 if( CB_HASSTRINGS(lphc
) ) lParam
= (LPARAM
)MapSL(lParam
);
2080 return unicode
? SendMessageW(lphc
->hWndLBox
, LB_FINDSTRING
, wParam
, lParam
) :
2081 SendMessageA(lphc
->hWndLBox
, LB_FINDSTRING
, wParam
, lParam
);
2082 case CB_FINDSTRINGEXACT16
:
2083 wParam
= (INT
)(INT16
)wParam
;
2084 if( CB_HASSTRINGS(lphc
) ) lParam
= (LPARAM
)MapSL(lParam
);
2086 case CB_FINDSTRINGEXACT
:
2087 return unicode
? SendMessageW(lphc
->hWndLBox
, LB_FINDSTRINGEXACT
, wParam
, lParam
) :
2088 SendMessageA(lphc
->hWndLBox
, LB_FINDSTRINGEXACT
, wParam
, lParam
);
2089 case CB_SETITEMHEIGHT16
:
2090 wParam
= (INT
)(INT16
)wParam
; /* signed integer */
2092 case CB_SETITEMHEIGHT
:
2093 return COMBO_SetItemHeight( lphc
, (INT
)wParam
, (INT
)lParam
);
2094 case CB_GETITEMHEIGHT16
:
2095 wParam
= (INT
)(INT16
)wParam
;
2097 case CB_GETITEMHEIGHT
:
2098 if( (INT
)wParam
>= 0 ) /* listbox item */
2099 return SendMessageW(lphc
->hWndLBox
, LB_GETITEMHEIGHT
, wParam
, 0);
2100 return CBGetTextAreaHeight(hwnd
, lphc
);
2101 case CB_RESETCONTENT16
:
2102 case CB_RESETCONTENT
:
2103 SendMessageW(lphc
->hWndLBox
, LB_RESETCONTENT
, 0, 0);
2104 if( (lphc
->wState
& CBF_EDIT
) && CB_HASSTRINGS(lphc
) )
2106 static const WCHAR empty_stringW
[] = { 0 };
2107 SendMessageW(lphc
->hWndEdit
, WM_SETTEXT
, 0, (LPARAM
)empty_stringW
);
2110 InvalidateRect(CB_HWND(lphc
), NULL
, TRUE
);
2112 case CB_INITSTORAGE
:
2113 return SendMessageW(lphc
->hWndLBox
, LB_INITSTORAGE
, wParam
, lParam
);
2114 case CB_GETHORIZONTALEXTENT
:
2115 return SendMessageW(lphc
->hWndLBox
, LB_GETHORIZONTALEXTENT
, 0, 0);
2116 case CB_SETHORIZONTALEXTENT
:
2117 return SendMessageW(lphc
->hWndLBox
, LB_SETHORIZONTALEXTENT
, wParam
, 0);
2118 case CB_GETTOPINDEX
:
2119 return SendMessageW(lphc
->hWndLBox
, LB_GETTOPINDEX
, 0, 0);
2121 return SendMessageW(lphc
->hWndLBox
, LB_GETLOCALE
, 0, 0);
2123 return SendMessageW(lphc
->hWndLBox
, LB_SETLOCALE
, wParam
, 0);
2124 case CB_GETDROPPEDWIDTH
:
2125 if( lphc
->droppedWidth
)
2126 return lphc
->droppedWidth
;
2127 return lphc
->droppedRect
.right
- lphc
->droppedRect
.left
;
2128 case CB_SETDROPPEDWIDTH
:
2129 if( (CB_GETTYPE(lphc
) != CBS_SIMPLE
) &&
2130 (INT
)wParam
< 32768 ) lphc
->droppedWidth
= (INT
)wParam
;
2132 case CB_GETDROPPEDCONTROLRECT16
:
2133 lParam
= (LPARAM
)MapSL(lParam
);
2137 CBGetDroppedControlRect( lphc
, &r
);
2138 CONV_RECT32TO16( &r
, (LPRECT16
)lParam
);
2141 case CB_GETDROPPEDCONTROLRECT
:
2142 if( lParam
) CBGetDroppedControlRect(lphc
, (LPRECT
)lParam
);
2144 case CB_GETDROPPEDSTATE16
:
2145 case CB_GETDROPPEDSTATE
:
2146 return (lphc
->wState
& CBF_DROPPED
) ? TRUE
: FALSE
;
2148 lParam
= (LPARAM
)MapSL(lParam
);
2152 if(message
== CB_DIR
) message
= LB_DIR
;
2153 return unicode
? SendMessageW(lphc
->hWndLBox
, message
, wParam
, lParam
) :
2154 SendMessageA(lphc
->hWndLBox
, message
, wParam
, lParam
);
2156 case CB_SHOWDROPDOWN16
:
2157 case CB_SHOWDROPDOWN
:
2158 if( CB_GETTYPE(lphc
) != CBS_SIMPLE
)
2162 if( !(lphc
->wState
& CBF_DROPPED
) )
2166 if( lphc
->wState
& CBF_DROPPED
)
2167 CBRollUp( lphc
, FALSE
, TRUE
);
2172 return SendMessageW(lphc
->hWndLBox
, LB_GETCOUNT
, 0, 0);
2173 case CB_GETCURSEL16
:
2175 return SendMessageW(lphc
->hWndLBox
, LB_GETCURSEL
, 0, 0);
2176 case CB_SETCURSEL16
:
2177 wParam
= (INT
)(INT16
)wParam
;
2180 lParam
= SendMessageW(lphc
->hWndLBox
, LB_SETCURSEL
, wParam
, 0);
2182 SendMessageW(lphc
->hWndLBox
, LB_SETTOPINDEX
, wParam
, 0);
2184 /* no LBN_SELCHANGE in this case, update manually */
2185 if( lphc
->wState
& CBF_EDIT
)
2186 CBUpdateEdit( lphc
, (INT
)wParam
);
2188 InvalidateRect(CB_HWND(lphc
), &lphc
->textRect
, TRUE
);
2189 lphc
->wState
&= ~CBF_SELCHANGE
;
2191 case CB_GETLBTEXT16
:
2192 wParam
= (INT
)(INT16
)wParam
;
2193 lParam
= (LPARAM
)MapSL(lParam
);
2196 return unicode
? SendMessageW(lphc
->hWndLBox
, LB_GETTEXT
, wParam
, lParam
) :
2197 SendMessageA(lphc
->hWndLBox
, LB_GETTEXT
, wParam
, lParam
);
2198 case CB_GETLBTEXTLEN16
:
2199 wParam
= (INT
)(INT16
)wParam
;
2201 case CB_GETLBTEXTLEN
:
2202 return SendMessageW(lphc
->hWndLBox
, LB_GETTEXTLEN
, wParam
, 0);
2203 case CB_GETITEMDATA16
:
2204 wParam
= (INT
)(INT16
)wParam
;
2206 case CB_GETITEMDATA
:
2207 return SendMessageW(lphc
->hWndLBox
, LB_GETITEMDATA
, wParam
, 0);
2208 case CB_SETITEMDATA16
:
2209 wParam
= (INT
)(INT16
)wParam
;
2211 case CB_SETITEMDATA
:
2212 return SendMessageW(lphc
->hWndLBox
, LB_SETITEMDATA
, wParam
, lParam
);
2213 case CB_GETEDITSEL16
:
2214 wParam
= lParam
= 0; /* just in case */
2217 /* Edit checks passed parameters itself */
2218 if( lphc
->wState
& CBF_EDIT
)
2219 return SendMessageW(lphc
->hWndEdit
, EM_GETSEL
, wParam
, lParam
);
2221 case CB_SETEDITSEL16
:
2223 if( lphc
->wState
& CBF_EDIT
)
2224 return SendMessageW(lphc
->hWndEdit
, EM_SETSEL
,
2225 (INT
)(INT16
)LOWORD(lParam
), (INT
)(INT16
)HIWORD(lParam
) );
2227 case CB_SETEXTENDEDUI16
:
2228 case CB_SETEXTENDEDUI
:
2229 if( CB_GETTYPE(lphc
) == CBS_SIMPLE
)
2232 lphc
->wState
|= CBF_EUI
;
2233 else lphc
->wState
&= ~CBF_EUI
;
2235 case CB_GETEXTENDEDUI16
:
2236 case CB_GETEXTENDEDUI
:
2237 return (lphc
->wState
& CBF_EUI
) ? TRUE
: FALSE
;
2240 if (message
>= WM_USER
)
2241 WARN("unknown msg WM_USER+%04x wp=%04x lp=%08lx\n",
2242 message
- WM_USER
, wParam
, lParam
);
2245 return unicode
? DefWindowProcW(hwnd
, message
, wParam
, lParam
) :
2246 DefWindowProcA(hwnd
, message
, wParam
, lParam
);
2251 /***********************************************************************
2254 * This is just a wrapper for the real ComboWndProc which locks/unlocks
2257 static LRESULT WINAPI
ComboWndProcA( HWND hwnd
, UINT message
, WPARAM wParam
, LPARAM lParam
)
2259 WND
* pWnd
= WIN_FindWndPtr(hwnd
);
2260 LRESULT retvalue
= ComboWndProc_locked(pWnd
, message
, wParam
, lParam
, FALSE
);
2262 WIN_ReleaseWndPtr(pWnd
);
2266 /***********************************************************************
2269 static LRESULT WINAPI
ComboWndProcW( HWND hwnd
, UINT message
, WPARAM wParam
, LPARAM lParam
)
2271 WND
* pWnd
= WIN_FindWndPtr(hwnd
);
2272 LRESULT retvalue
= ComboWndProc_locked(pWnd
, message
, wParam
, lParam
, TRUE
);
2274 WIN_ReleaseWndPtr(pWnd
);