[USER32] Pure Whitespace sync from comctl32/combo.c, no functional change

This will make future syncs between those files much easier,
and fixes tons of mixed tab-space-indentation.

Please no whitespace nitpicks when reviewing this commit, it is a SYNC!
This commit is contained in:
Joachim Henze 2023-09-10 23:36:21 +02:00 committed by Joachim Henze
parent d97313181e
commit e13ebd44c6

View File

@ -173,12 +173,11 @@ static LRESULT COMBO_NCCreate(HWND hwnd, LONG style)
*/ */
static LRESULT COMBO_NCDestroy( LPHEADCOMBO lphc ) static LRESULT COMBO_NCDestroy( LPHEADCOMBO lphc )
{ {
if (lphc)
if( lphc )
{ {
TRACE("[%p]: freeing storage\n", lphc->self); TRACE("[%p]: freeing storage\n", lphc->self);
if( (CB_GETTYPE(lphc) != CBS_SIMPLE) && lphc->hWndLBox ) if ( (CB_GETTYPE(lphc) != CBS_SIMPLE) && lphc->hWndLBox )
DestroyWindow( lphc->hWndLBox ); DestroyWindow( lphc->hWndLBox );
SetWindowLongPtrW( lphc->self, 0, 0 ); SetWindowLongPtrW( lphc->self, 0, 0 );
@ -858,8 +857,7 @@ static LRESULT COMBO_Paint(LPHEADCOMBO lphc, HDC hParamDC)
PAINTSTRUCT ps; PAINTSTRUCT ps;
HDC hDC; HDC hDC;
hDC = (hParamDC) ? hParamDC hDC = (hParamDC) ? hParamDC : BeginPaint(lphc->self, &ps);
: BeginPaint( lphc->self, &ps);
TRACE("hdc=%p\n", hDC); TRACE("hdc=%p\n", hDC);
@ -872,8 +870,7 @@ static LRESULT COMBO_Paint(LPHEADCOMBO lphc, HDC hParamDC)
* DC. * DC.
*/ */
hBkgBrush = COMBO_PrepareColors(lphc, hDC); hBkgBrush = COMBO_PrepareColors(lphc, hDC);
hPrevBrush = SelectObject(hDC, hBkgBrush);
hPrevBrush = SelectObject( hDC, hBkgBrush );
if (!(lphc->wState & CBF_EDIT)) if (!(lphc->wState & CBF_EDIT))
FillRect(hDC, &lphc->textRect, hBkgBrush); FillRect(hDC, &lphc->textRect, hBkgBrush);
@ -882,10 +879,8 @@ static LRESULT COMBO_Paint(LPHEADCOMBO lphc, HDC hParamDC)
*/ */
CBPaintBorder(lphc->self, lphc, hDC); CBPaintBorder(lphc->self, lphc, hDC);
if( !IsRectEmpty(&lphc->buttonRect) ) if (!IsRectEmpty(&lphc->buttonRect))
{
CBPaintButton(lphc, hDC, lphc->buttonRect); CBPaintButton(lphc, hDC, lphc->buttonRect);
}
/* paint the edit control padding area */ /* paint the edit control padding area */
if (CB_GETTYPE(lphc) != CBS_DROPDOWNLIST) if (CB_GETTYPE(lphc) != CBS_DROPDOWNLIST)
@ -894,13 +889,13 @@ static LRESULT COMBO_Paint(LPHEADCOMBO lphc, HDC hParamDC)
InflateRect(&rPadEdit, EDIT_CONTROL_PADDING(), EDIT_CONTROL_PADDING()); InflateRect(&rPadEdit, EDIT_CONTROL_PADDING(), EDIT_CONTROL_PADDING());
FrameRect( hDC, &rPadEdit, GetSysColorBrush(COLOR_WINDOW) ); FrameRect(hDC, &rPadEdit, GetSysColorBrush(COLOR_WINDOW));
} }
if( !(lphc->wState & CBF_EDIT) ) if (!(lphc->wState & CBF_EDIT))
CBPaintText( lphc, hDC ); CBPaintText( lphc, hDC );
if( hPrevBrush ) if (hPrevBrush)
SelectObject( hDC, hPrevBrush ); SelectObject( hDC, hPrevBrush );
} }
@ -923,7 +918,7 @@ static INT CBUpdateLBox( LPHEADCOMBO lphc, BOOL bSelect )
idx = LB_ERR; idx = LB_ERR;
length = SendMessageW( lphc->hWndEdit, WM_GETTEXTLENGTH, 0, 0 ); length = SendMessageW( lphc->hWndEdit, WM_GETTEXTLENGTH, 0, 0 );
if( length > 0 ) if (length > 0)
pText = HeapAlloc( GetProcessHeap(), 0, (length + 1) * sizeof(WCHAR)); pText = HeapAlloc( GetProcessHeap(), 0, (length + 1) * sizeof(WCHAR));
TRACE("\t edit text length %i\n", length ); TRACE("\t edit text length %i\n", length );
@ -962,12 +957,10 @@ static void CBUpdateEdit( LPHEADCOMBO lphc , INT index )
length = SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, (WPARAM)index, 0); length = SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, (WPARAM)index, 0);
if( length != LB_ERR) if( length != LB_ERR)
{ {
if( (pText = HeapAlloc( GetProcessHeap(), 0, (length + 1) * sizeof(WCHAR))) ) if ((pText = HeapAlloc(GetProcessHeap(), 0, (length + 1) * sizeof(WCHAR))))
{
SendMessageW(lphc->hWndLBox, LB_GETTEXT, (WPARAM)index, (LPARAM)pText ); SendMessageW(lphc->hWndLBox, LB_GETTEXT, (WPARAM)index, (LPARAM)pText );
} }
} }
}
if( CB_HASSTRINGS(lphc) ) if( CB_HASSTRINGS(lphc) )
{ {
@ -1015,7 +1008,7 @@ static void CBDropDown( LPHEADCOMBO lphc )
lphc->droppedIndex = SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0); lphc->droppedIndex = SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
SendMessageW(lphc->hWndLBox, LB_SETTOPINDEX, SendMessageW(lphc->hWndLBox, LB_SETTOPINDEX,
(WPARAM)(lphc->droppedIndex == LB_ERR ? 0 : lphc->droppedIndex), 0 ); (WPARAM)(lphc->droppedIndex == LB_ERR ? 0 : lphc->droppedIndex), 0);
SendMessageW(lphc->hWndLBox, LB_CARETON, 0, 0); SendMessageW(lphc->hWndLBox, LB_CARETON, 0, 0);
} }
@ -1842,23 +1835,18 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPAR
} }
#endif #endif
TRACE("[%p]: msg %s wp %08lx lp %08lx\n", TRACE("[%p]: msg %s wp %08lx lp %08lx\n", hwnd, SPY_GetMsgName(message, hwnd), wParam, lParam);
hwnd, SPY_GetMsgName(message, hwnd), wParam, lParam );
#ifndef __REACTOS__ #ifndef __REACTOS__
if (!IsWindow(hwnd)) return 0; if (!IsWindow(hwnd)) return 0;
#endif #endif
if( lphc || message == WM_NCCREATE ) if (lphc || message == WM_NCCREATE)
switch(message) switch(message)
{ {
/* System messages */
case WM_NCCREATE: case WM_NCCREATE:
{ {
LONG style = unicode ? ((LPCREATESTRUCTW)lParam)->style : LONG style = unicode ? ((LPCREATESTRUCTW)lParam)->style : ((LPCREATESTRUCTA)lParam)->style;
((LPCREATESTRUCTA)lParam)->style;
return COMBO_NCCreate(hwnd, style); return COMBO_NCCreate(hwnd, style);
} }
case WM_NCDESTROY: case WM_NCDESTROY:
@ -1884,13 +1872,11 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPAR
} }
return COMBO_Create(hwnd, lphc, hwndParent, style, unicode); return COMBO_Create(hwnd, lphc, hwndParent, style, unicode);
} }
case WM_PRINTCLIENT: case WM_PRINTCLIENT:
/* Fallthrough */ /* Fallthrough */
case WM_PAINT: case WM_PAINT:
/* wParam may contain a valid HDC! */ /* wParam may contain a valid HDC! */
return COMBO_Paint(lphc, (HDC)wParam); return COMBO_Paint(lphc, (HDC)wParam);
case WM_ERASEBKGND: case WM_ERASEBKGND:
/* do all painting in WM_PAINT like Windows does */ /* do all painting in WM_PAINT like Windows does */
return 1; return 1;
@ -1908,8 +1894,8 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPAR
return result; return result;
} }
case WM_SIZE: case WM_SIZE:
if( lphc->hWndLBox && if (lphc->hWndLBox && !(lphc->wState & CBF_NORESIZE))
!(lphc->wState & CBF_NORESIZE) ) COMBO_Size( lphc ); COMBO_Size( lphc );
return TRUE; return TRUE;
case WM_SETFONT: case WM_SETFONT:
COMBO_Font( lphc, (HFONT)wParam, (BOOL)lParam ); COMBO_Font( lphc, (HFONT)wParam, (BOOL)lParam );
@ -1917,10 +1903,12 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPAR
case WM_GETFONT: case WM_GETFONT:
return (LRESULT)lphc->hFont; return (LRESULT)lphc->hFont;
case WM_SETFOCUS: case WM_SETFOCUS:
if( lphc->wState & CBF_EDIT ) { if (lphc->wState & CBF_EDIT)
{
SetFocus( lphc->hWndEdit ); SetFocus( lphc->hWndEdit );
/* The first time focus is received, select all the text */ /* The first time focus is received, select all the text */
if( !(lphc->wState & CBF_BEENFOCUSED) ) { if (!(lphc->wState & CBF_BEENFOCUSED))
{
SendMessageW(lphc->hWndEdit, EM_SETSEL, 0, -1); SendMessageW(lphc->hWndEdit, EM_SETSEL, 0, -1);
lphc->wState |= CBF_BEENFOCUSED; lphc->wState |= CBF_BEENFOCUSED;
} }
@ -1930,14 +1918,13 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPAR
return TRUE; return TRUE;
case WM_KILLFOCUS: case WM_KILLFOCUS:
{ {
HWND hwndFocus = WIN_GetFullHandle( (HWND)wParam ); HWND hwndFocus = WIN_GetFullHandle((HWND)wParam);
if( !hwndFocus || if (!hwndFocus || (hwndFocus != lphc->hWndEdit && hwndFocus != lphc->hWndLBox))
(hwndFocus != lphc->hWndEdit && hwndFocus != lphc->hWndLBox ))
COMBO_KillFocus( lphc ); COMBO_KillFocus( lphc );
return TRUE; return TRUE;
} }
case WM_COMMAND: case WM_COMMAND:
return COMBO_Command( lphc, wParam, WIN_GetFullHandle( (HWND)lParam ) ); return COMBO_Command( lphc, wParam, WIN_GetFullHandle((HWND)lParam) );
case WM_GETTEXT: case WM_GETTEXT:
return unicode ? COMBO_GetTextW( lphc, wParam, (LPWSTR)lParam ) return unicode ? COMBO_GetTextW( lphc, wParam, (LPWSTR)lParam )
: COMBO_GetTextA( lphc, wParam, (LPSTR)lParam ); : COMBO_GetTextA( lphc, wParam, (LPSTR)lParam );
@ -1951,7 +1938,7 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPAR
return unicode ? SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, j, 0) : return unicode ? SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, j, 0) :
SendMessageA(lphc->hWndLBox, LB_GETTEXTLEN, j, 0); SendMessageA(lphc->hWndLBox, LB_GETTEXTLEN, j, 0);
} }
else if( lphc->wState & CBF_EDIT ) else if ( lphc->wState & CBF_EDIT )
{ {
LRESULT ret; LRESULT ret;
lphc->wState |= CBF_NOEDITNOTIFY; lphc->wState |= CBF_NOEDITNOTIFY;
@ -1960,11 +1947,12 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPAR
lphc->wState &= ~CBF_NOEDITNOTIFY; lphc->wState &= ~CBF_NOEDITNOTIFY;
return ret; return ret;
} }
else return CB_ERR; else
return CB_ERR;
case WM_CUT: case WM_CUT:
case WM_PASTE: case WM_PASTE:
case WM_COPY: case WM_COPY:
if( lphc->wState & CBF_EDIT ) if (lphc->wState & CBF_EDIT)
{ {
return unicode ? SendMessageW(lphc->hWndEdit, message, wParam, lParam) : return unicode ? SendMessageW(lphc->hWndEdit, message, wParam, lParam) :
SendMessageA(lphc->hWndEdit, message, wParam, lParam); SendMessageA(lphc->hWndEdit, message, wParam, lParam);
@ -1977,7 +1965,7 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPAR
case WM_MEASUREITEM: case WM_MEASUREITEM:
return COMBO_ItemOp(lphc, message, lParam); return COMBO_ItemOp(lphc, message, lParam);
case WM_ENABLE: case WM_ENABLE:
if( lphc->wState & CBF_EDIT ) if (lphc->wState & CBF_EDIT)
EnableWindow( lphc->hWndEdit, (BOOL)wParam ); EnableWindow( lphc->hWndEdit, (BOOL)wParam );
EnableWindow( lphc->hWndLBox, (BOOL)wParam ); EnableWindow( lphc->hWndLBox, (BOOL)wParam );
@ -1985,20 +1973,20 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPAR
InvalidateRect(lphc->self, NULL, TRUE); InvalidateRect(lphc->self, NULL, TRUE);
return TRUE; return TRUE;
case WM_SETREDRAW: case WM_SETREDRAW:
if( wParam ) if (wParam)
lphc->wState &= ~CBF_NOREDRAW; lphc->wState &= ~CBF_NOREDRAW;
else else
lphc->wState |= CBF_NOREDRAW; lphc->wState |= CBF_NOREDRAW;
if( lphc->wState & CBF_EDIT ) if ( lphc->wState & CBF_EDIT )
SendMessageW(lphc->hWndEdit, message, wParam, lParam); SendMessageW(lphc->hWndEdit, message, wParam, lParam);
SendMessageW(lphc->hWndLBox, message, wParam, lParam); SendMessageW(lphc->hWndLBox, message, wParam, lParam);
return 0; return 0;
case WM_SYSKEYDOWN: case WM_SYSKEYDOWN:
#ifdef __REACTOS__ #ifdef __REACTOS__
if( KF_ALTDOWN & HIWORD(lParam) ) if ( KF_ALTDOWN & HIWORD(lParam) )
#else #else
if( KEYDATA_ALT & HIWORD(lParam) ) if ( KEYDATA_ALT & HIWORD(lParam) )
#endif #endif
if( wParam == VK_UP || wParam == VK_DOWN ) if( wParam == VK_UP || wParam == VK_DOWN )
COMBO_FlipListbox( lphc, FALSE, FALSE ); COMBO_FlipListbox( lphc, FALSE, FALSE );
@ -2022,7 +2010,7 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPAR
{ {
HWND hwndTarget; HWND hwndTarget;
if( lphc->wState & CBF_EDIT ) if ( lphc->wState & CBF_EDIT )
hwndTarget = lphc->hWndEdit; hwndTarget = lphc->hWndEdit;
else else
hwndTarget = lphc->hWndLBox; hwndTarget = lphc->hWndLBox;
@ -2031,14 +2019,14 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPAR
SendMessageA(hwndTarget, message, wParam, lParam); SendMessageA(hwndTarget, message, wParam, lParam);
} }
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
if( !(lphc->wState & CBF_FOCUSED) ) SetFocus( lphc->self ); if ( !(lphc->wState & CBF_FOCUSED) ) SetFocus( lphc->self );
if( lphc->wState & CBF_FOCUSED ) COMBO_LButtonDown( lphc, lParam ); if ( lphc->wState & CBF_FOCUSED ) COMBO_LButtonDown( lphc, lParam );
return TRUE; return TRUE;
case WM_LBUTTONUP: case WM_LBUTTONUP:
COMBO_LButtonUp( lphc ); COMBO_LButtonUp( lphc );
return TRUE; return TRUE;
case WM_MOUSEMOVE: case WM_MOUSEMOVE:
if( lphc->wState & CBF_CAPTURE ) if ( lphc->wState & CBF_CAPTURE )
COMBO_MouseMove( lphc, wParam, lParam ); COMBO_MouseMove( lphc, wParam, lParam );
return TRUE; return TRUE;
@ -2060,20 +2048,19 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPAR
case WM_CTLCOLORSCROLLBAR: case WM_CTLCOLORSCROLLBAR:
case WM_CTLCOLORSTATIC: case WM_CTLCOLORSTATIC:
#ifdef __REACTOS__ #ifdef __REACTOS__
if ( pWnd && !(pWnd->state2 & WNDS2_WIN40COMPAT) ) break; // Must be Win 4.0 and above. if (pWnd && !(pWnd->state2 & WNDS2_WIN40COMPAT)) break; // Must be Win 4.0 and above.
#endif #endif
if (lphc->owner) if (lphc->owner)
return SendMessageW(lphc->owner, message, wParam, lParam); return SendMessageW(lphc->owner, message, wParam, lParam);
break; break;
/* Combo messages */ /* Combo messages */
case CB_ADDSTRING: case CB_ADDSTRING:
if( unicode ) if (unicode)
{ {
if( lphc->dwStyle & CBS_LOWERCASE ) if (lphc->dwStyle & CBS_LOWERCASE)
CharLowerW((LPWSTR)lParam); CharLowerW((LPWSTR)lParam);
else if( lphc->dwStyle & CBS_UPPERCASE ) else if (lphc->dwStyle & CBS_UPPERCASE)
CharUpperW((LPWSTR)lParam); CharUpperW((LPWSTR)lParam);
return SendMessageW(lphc->hWndLBox, LB_ADDSTRING, 0, lParam); return SendMessageW(lphc->hWndLBox, LB_ADDSTRING, 0, lParam);
} }
@ -2082,13 +2069,13 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPAR
{ {
char *string = NULL; char *string = NULL;
LRESULT ret; LRESULT ret;
if( lphc->dwStyle & CBS_LOWERCASE ) if (lphc->dwStyle & CBS_LOWERCASE)
{ {
string = strdupA((LPSTR)lParam); string = strdupA((LPSTR)lParam);
CharLowerA(string); CharLowerA(string);
} }
else if( lphc->dwStyle & CBS_UPPERCASE ) else if (lphc->dwStyle & CBS_UPPERCASE)
{ {
string = strdupA((LPSTR)lParam); string = strdupA((LPSTR)lParam);
CharUpperA(string); CharUpperA(string);
@ -2099,21 +2086,20 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPAR
return ret; return ret;
} }
case CB_INSERTSTRING: case CB_INSERTSTRING:
if( unicode ) if (unicode)
{ {
if( lphc->dwStyle & CBS_LOWERCASE ) if (lphc->dwStyle & CBS_LOWERCASE)
CharLowerW((LPWSTR)lParam); CharLowerW((LPWSTR)lParam);
else if( lphc->dwStyle & CBS_UPPERCASE ) else if (lphc->dwStyle & CBS_UPPERCASE)
CharUpperW((LPWSTR)lParam); CharUpperW((LPWSTR)lParam);
return SendMessageW(lphc->hWndLBox, LB_INSERTSTRING, wParam, lParam); return SendMessageW(lphc->hWndLBox, LB_INSERTSTRING, wParam, lParam);
} }
else else
{ {
if( lphc->dwStyle & CBS_LOWERCASE ) if (lphc->dwStyle & CBS_LOWERCASE)
CharLowerA((LPSTR)lParam); CharLowerA((LPSTR)lParam);
else if( lphc->dwStyle & CBS_UPPERCASE ) else if (lphc->dwStyle & CBS_UPPERCASE)
CharUpperA((LPSTR)lParam); CharUpperA((LPSTR)lParam);
return SendMessageA(lphc->hWndLBox, LB_INSERTSTRING, wParam, lParam); return SendMessageA(lphc->hWndLBox, LB_INSERTSTRING, wParam, lParam);
} }
case CB_DELETESTRING: case CB_DELETESTRING:
@ -2130,12 +2116,12 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPAR
case CB_SETITEMHEIGHT: case CB_SETITEMHEIGHT:
return COMBO_SetItemHeight( lphc, (INT)wParam, (INT)lParam); return COMBO_SetItemHeight( lphc, (INT)wParam, (INT)lParam);
case CB_GETITEMHEIGHT: case CB_GETITEMHEIGHT:
if( (INT)wParam >= 0 ) /* listbox item */ if ((INT)wParam >= 0) /* listbox item */
return SendMessageW(lphc->hWndLBox, LB_GETITEMHEIGHT, wParam, 0); return SendMessageW(lphc->hWndLBox, LB_GETITEMHEIGHT, wParam, 0);
return CBGetTextAreaHeight(hwnd, lphc); return CBGetTextAreaHeight(hwnd, lphc);
case CB_RESETCONTENT: case CB_RESETCONTENT:
SendMessageW(lphc->hWndLBox, LB_RESETCONTENT, 0, 0); SendMessageW(lphc->hWndLBox, LB_RESETCONTENT, 0, 0);
if( (lphc->wState & CBF_EDIT) && CB_HASSTRINGS(lphc) ) if ((lphc->wState & CBF_EDIT) && CB_HASSTRINGS(lphc))
{ {
static const WCHAR empty_stringW[] = { 0 }; static const WCHAR empty_stringW[] = { 0 };
SendMessageW(lphc->hWndEdit, WM_SETTEXT, 0, (LPARAM)empty_stringW); SendMessageW(lphc->hWndEdit, WM_SETTEXT, 0, (LPARAM)empty_stringW);
@ -2156,13 +2142,12 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPAR
case CB_SETLOCALE: case CB_SETLOCALE:
return SendMessageW(lphc->hWndLBox, LB_SETLOCALE, wParam, 0); return SendMessageW(lphc->hWndLBox, LB_SETLOCALE, wParam, 0);
case CB_SETDROPPEDWIDTH: case CB_SETDROPPEDWIDTH:
if( (CB_GETTYPE(lphc) == CBS_SIMPLE) || if ((CB_GETTYPE(lphc) == CBS_SIMPLE) || (INT)wParam >= 32768)
(INT)wParam >= 32768 )
return CB_ERR; return CB_ERR;
/* new value must be higher than combobox width */ /* new value must be higher than combobox width */
if((INT)wParam >= lphc->droppedRect.right - lphc->droppedRect.left) if ((INT)wParam >= lphc->droppedRect.right - lphc->droppedRect.left)
lphc->droppedWidth = wParam; lphc->droppedWidth = wParam;
else if(wParam) else if (wParam)
lphc->droppedWidth = 0; lphc->droppedWidth = 0;
/* recalculate the combobox area */ /* recalculate the combobox area */
@ -2170,11 +2155,11 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPAR
/* fall through */ /* fall through */
case CB_GETDROPPEDWIDTH: case CB_GETDROPPEDWIDTH:
if( lphc->droppedWidth ) if (lphc->droppedWidth)
return lphc->droppedWidth; return lphc->droppedWidth;
return lphc->droppedRect.right - lphc->droppedRect.left; return lphc->droppedRect.right - lphc->droppedRect.left;
case CB_GETDROPPEDCONTROLRECT: case CB_GETDROPPEDCONTROLRECT:
if( lParam ) CBGetDroppedControlRect(lphc, (LPRECT)lParam ); if (lParam) CBGetDroppedControlRect(lphc, (LPRECT)lParam );
return CB_OKAY; return CB_OKAY;
case CB_GETDROPPEDSTATE: case CB_GETDROPPEDSTATE:
return (lphc->wState & CBF_DROPPED) != 0; return (lphc->wState & CBF_DROPPED) != 0;
@ -2183,15 +2168,14 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPAR
SendMessageA(lphc->hWndLBox, LB_DIR, wParam, lParam); SendMessageA(lphc->hWndLBox, LB_DIR, wParam, lParam);
case CB_SHOWDROPDOWN: case CB_SHOWDROPDOWN:
if( CB_GETTYPE(lphc) != CBS_SIMPLE ) if (CB_GETTYPE(lphc) != CBS_SIMPLE)
{ {
if( wParam ) if (wParam)
{ {
if( !(lphc->wState & CBF_DROPPED) ) if (!(lphc->wState & CBF_DROPPED))
CBDropDown( lphc ); CBDropDown( lphc );
} }
else else if (lphc->wState & CBF_DROPPED)
if( lphc->wState & CBF_DROPPED )
CBRollUp( lphc, FALSE, TRUE ); CBRollUp( lphc, FALSE, TRUE );
} }
return TRUE; return TRUE;
@ -2201,11 +2185,11 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPAR
return SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0); return SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
case CB_SETCURSEL: case CB_SETCURSEL:
lParam = SendMessageW(lphc->hWndLBox, LB_SETCURSEL, wParam, 0); lParam = SendMessageW(lphc->hWndLBox, LB_SETCURSEL, wParam, 0);
if( lParam >= 0 ) if (lParam >= 0)
SendMessageW(lphc->hWndLBox, LB_SETTOPINDEX, wParam, 0); SendMessageW(lphc->hWndLBox, LB_SETTOPINDEX, wParam, 0);
/* no LBN_SELCHANGE in this case, update manually */ /* no LBN_SELCHANGE in this case, update manually */
CBPaintText( lphc, NULL ); CBPaintText(lphc, NULL);
lphc->wState &= ~CBF_SELCHANGE; lphc->wState &= ~CBF_SELCHANGE;
return lParam; return lParam;
case CB_GETLBTEXT: case CB_GETLBTEXT:
@ -2220,18 +2204,17 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPAR
return SendMessageW(lphc->hWndLBox, LB_SETITEMDATA, wParam, lParam); return SendMessageW(lphc->hWndLBox, LB_SETITEMDATA, wParam, lParam);
case CB_GETEDITSEL: case CB_GETEDITSEL:
/* Edit checks passed parameters itself */ /* Edit checks passed parameters itself */
if( lphc->wState & CBF_EDIT ) if (lphc->wState & CBF_EDIT)
return SendMessageW(lphc->hWndEdit, EM_GETSEL, wParam, lParam); return SendMessageW(lphc->hWndEdit, EM_GETSEL, wParam, lParam);
return CB_ERR; return CB_ERR;
case CB_SETEDITSEL: case CB_SETEDITSEL:
if( lphc->wState & CBF_EDIT ) if (lphc->wState & CBF_EDIT)
return SendMessageW(lphc->hWndEdit, EM_SETSEL, return SendMessageW(lphc->hWndEdit, EM_SETSEL, (INT)(INT16)LOWORD(lParam), (INT)(INT16)HIWORD(lParam) );
(INT)(INT16)LOWORD(lParam), (INT)(INT16)HIWORD(lParam) );
return CB_ERR; return CB_ERR;
case CB_SETEXTENDEDUI: case CB_SETEXTENDEDUI:
if( CB_GETTYPE(lphc) == CBS_SIMPLE ) if (CB_GETTYPE(lphc) == CBS_SIMPLE )
return CB_ERR; return CB_ERR;
if( wParam ) if (wParam)
lphc->wState |= CBF_EUI; lphc->wState |= CBF_EUI;
else lphc->wState &= ~CBF_EUI; else lphc->wState &= ~CBF_EUI;
return CB_OKAY; return CB_OKAY;
@ -2240,7 +2223,7 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPAR
case CB_GETCOMBOBOXINFO: case CB_GETCOMBOBOXINFO:
return COMBO_GetComboBoxInfo(lphc, (COMBOBOXINFO *)lParam); return COMBO_GetComboBoxInfo(lphc, (COMBOBOXINFO *)lParam);
case CB_LIMITTEXT: case CB_LIMITTEXT:
if( lphc->wState & CBF_EDIT ) if (lphc->wState & CBF_EDIT)
return SendMessageW(lphc->hWndEdit, EM_LIMITTEXT, wParam, lParam); return SendMessageW(lphc->hWndEdit, EM_LIMITTEXT, wParam, lParam);
return TRUE; return TRUE;
@ -2254,7 +2237,7 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPAR
if (COMBO_update_uistate(lphc)) if (COMBO_update_uistate(lphc))
{ {
/* redraw text */ /* redraw text */
if( !(lphc->wState & CBF_EDIT) ) if (!(lphc->wState & CBF_EDIT))
NtUserInvalidateRect(lphc->self, &lphc->textRect, TRUE); NtUserInvalidateRect(lphc->self, &lphc->textRect, TRUE);
} }
break; break;
@ -2268,13 +2251,11 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPAR
CB_NOTIFY(lphc, CBN_KILLFOCUS); CB_NOTIFY(lphc, CBN_KILLFOCUS);
} }
return TRUE; return TRUE;
#endif #endif
default: default:
if (message >= WM_USER) if (message >= WM_USER)
WARN("unknown msg WM_USER+%04x wp=%04lx lp=%08lx\n", WARN("unknown msg WM_USER+%04x wp=%04lx lp=%08lx\n", message - WM_USER, wParam, lParam );
message - WM_USER, wParam, lParam );
break; break;
} }
return unicode ? DefWindowProcW(hwnd, message, wParam, lParam) : return unicode ? DefWindowProcW(hwnd, message, wParam, lParam) :
@ -2289,19 +2270,19 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPAR
* This is just a wrapper for the real ComboWndProc which locks/unlocks * This is just a wrapper for the real ComboWndProc which locks/unlocks
* window structs. * window structs.
*/ */
LRESULT WINAPI ComboWndProcA( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam ) LRESULT WINAPI ComboWndProcA(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
if (!IsWindow(hwnd)) return 0; if (!IsWindow(hwnd)) return 0;
return ComboWndProc_common( hwnd, message, wParam, lParam, FALSE ); return ComboWndProc_common(hwnd, message, wParam, lParam, FALSE);
} }
/*********************************************************************** /***********************************************************************
* ComboWndProcW * ComboWndProcW
*/ */
LRESULT WINAPI ComboWndProcW( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam ) LRESULT WINAPI ComboWndProcW(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
if (!IsWindow(hwnd)) return 0; if (!IsWindow(hwnd)) return 0;
return ComboWndProc_common( hwnd, message, wParam, lParam, TRUE ); return ComboWndProc_common(hwnd, message, wParam, lParam, TRUE);
} }
#endif /* __REACTOS__ */ #endif /* __REACTOS__ */
@ -2309,7 +2290,8 @@ LRESULT WINAPI ComboWndProcW( HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
/************************************************************************* /*************************************************************************
* GetComboBoxInfo (USER32.@) * GetComboBoxInfo (USER32.@)
*/ */
BOOL WINAPI GetComboBoxInfo(HWND hwndCombo, /* [in] handle to combo box */ BOOL WINAPI GetComboBoxInfo(
HWND hwndCombo, /* [in] handle to combo box */
PCOMBOBOXINFO pcbi /* [in/out] combo box information */) PCOMBOBOXINFO pcbi /* [in/out] combo box information */)
{ {
TRACE("(%p, %p)\n", hwndCombo, pcbi); TRACE("(%p, %p)\n", hwndCombo, pcbi);