mirror of
https://github.com/reactos/reactos.git
synced 2024-06-24 06:51:47 +00:00
port back the following commit: 0.4.15-dev-6613-ge13ebd44c6
[USER32] Pure Whitespace sync from comctl32/combo.c, no functional change 0.4.15-dev-6612-gd97313181e
[USER32] Sync comctl32 combo.c code in context of CORE-17883 0.4.15-dev-3453-gff89651ed0
[COMCTL32] Redraw children when the combo box is dropped down (#4138) CORE-17883 and tweak [USER32] combo.c a bit more even than on master, e.g. strip a few TRACEs. Possible because unlike master we don't need to be as much in sync as possible to Wine in the older branches. But we need to have binary size under control for the backports due to base-addresses. Binary size: user32.dll master RosBEWin2.2.2 GCC8.4.0dbg 1.579.008 user32.dll 0.4.14rls RosBEWin2.1.6 GCC4.7.2dbg 1.448.448 -> 1.448.448 user32.dll 0.4.13rls RosBEWin2.1.6 GCC4.7.2dbg 1.445.376 -> 1.444.864 user32.dll 0.4.12rls RosBEWin2.1.6 GCC4.7.2dbg 1.455.616 -> 1.455.104 user32.dll 0.4.11rls RosBEWin2.1.6 GCC4.7.2dbg 1.453.056 -> 1.451.008 user32.dll 0.4.10rls RosBEWin2.1.6 GCC4.7.2dbg 1.434.624 -> 1.434.112 user32.dll 0.4. 9rls RosBEWin2.1.6 GCC4.7.2dbg 1.422.336 -> 1.421.824 user32.dll 0.4. 8rls RosBEWin2.1.6 GCC4.7.2dbg 1.421.824 -> 1.421.824 user32.dll 0.4. 7rls RosBEWin2.1.6 GCC4.7.2dbg 1.418.752 -> 1.417.216
This commit is contained in:
parent
933caa0459
commit
0aca76b392
|
@ -1050,8 +1050,7 @@ static void CBDropDown( LPHEADCOMBO lphc )
|
|||
|
||||
|
||||
if( !(lphc->wState & CBF_NOREDRAW) )
|
||||
RedrawWindow( lphc->self, NULL, 0, RDW_INVALIDATE |
|
||||
RDW_ERASE | RDW_UPDATENOW | RDW_NOCHILDREN );
|
||||
RedrawWindow( lphc->self, NULL, 0, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW );
|
||||
|
||||
EnableWindow( lphc->hWndLBox, TRUE );
|
||||
if (GetCapture() != lphc->self)
|
||||
|
|
|
@ -17,18 +17,7 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*
|
||||
* NOTES
|
||||
*
|
||||
* This code was audited for completeness against the documented features
|
||||
* of Comctl32.dll version 6.0 on Oct. 4, 2004, by Dimitrie O. Paun.
|
||||
*
|
||||
* Unless otherwise noted, we believe this code to be complete, as per
|
||||
* the specification mentioned above.
|
||||
* If you discover missing features, or bugs, please note them below.
|
||||
*
|
||||
* TODO:
|
||||
* - ComboBox_[GS]etMinVisible()
|
||||
* - CB_GETMINVISIBLE, CB_SETMINVISIBLE
|
||||
* - CB_SETTOPINDEX
|
||||
*/
|
||||
|
||||
|
@ -179,21 +168,15 @@ static LRESULT COMBO_NCCreate(HWND hwnd, LONG style)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* COMBO_NCDestroy
|
||||
*/
|
||||
static LRESULT COMBO_NCDestroy( LPHEADCOMBO lphc )
|
||||
{
|
||||
|
||||
if( lphc )
|
||||
if (lphc)
|
||||
{
|
||||
TRACE("[%p]: freeing storage\n", lphc->self);
|
||||
if ((CB_GETTYPE(lphc) != CBS_SIMPLE) && lphc->hWndLBox)
|
||||
DestroyWindow(lphc->hWndLBox);
|
||||
|
||||
if( (CB_GETTYPE(lphc) != CBS_SIMPLE) && lphc->hWndLBox )
|
||||
DestroyWindow( lphc->hWndLBox );
|
||||
|
||||
SetWindowLongPtrW( lphc->self, 0, 0 );
|
||||
HeapFree( GetProcessHeap(), 0, lphc );
|
||||
SetWindowLongPtrW(lphc->self, 0, 0);
|
||||
HeapFree(GetProcessHeap(), 0, lphc);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -651,6 +634,44 @@ static void CBPaintButton( LPHEADCOMBO lphc, HDC hdc, RECT rectButton)
|
|||
DrawFrameControl(hdc, &rectButton, DFC_SCROLL, buttonState);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* COMBO_PrepareColors
|
||||
*
|
||||
* This method will sent the appropriate WM_CTLCOLOR message to
|
||||
* prepare and setup the colors for the combo's DC.
|
||||
*
|
||||
* It also returns the brush to use for the background.
|
||||
*/
|
||||
static HBRUSH COMBO_PrepareColors(
|
||||
LPHEADCOMBO lphc,
|
||||
HDC hDC)
|
||||
{
|
||||
HBRUSH hBkgBrush;
|
||||
|
||||
if (CB_DISABLED(lphc))
|
||||
{
|
||||
#ifdef __REACTOS__
|
||||
hBkgBrush = GetControlColor(lphc->owner, lphc->self, hDC, WM_CTLCOLORSTATIC);
|
||||
#else
|
||||
hBkgBrush = (HBRUSH)SendMessageW(lphc->owner, WM_CTLCOLORSTATIC, (WPARAM)hDC, (LPARAM)lphc->self);
|
||||
#endif
|
||||
SetTextColor(hDC, GetSysColor(COLOR_GRAYTEXT));
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef __REACTOS__
|
||||
hBkgBrush = GetControlColor(lphc->owner, lphc->self, hDC, WM_CTLCOLOREDIT);
|
||||
#else
|
||||
hBkgBrush = (HBRUSH)SendMessageW(lphc->owner, WM_CTLCOLOREDIT, (WPARAM)hDC, (LPARAM)lphc->self);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!hBkgBrush)
|
||||
hBkgBrush = GetSysColorBrush(COLOR_WINDOW);
|
||||
|
||||
return hBkgBrush;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* CBPaintText
|
||||
*
|
||||
|
@ -801,114 +822,43 @@ static void CBPaintBorder(
|
|||
DrawEdge(hdc, &clientRect, EDGE_SUNKEN, BF_RECT);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* COMBO_PrepareColors
|
||||
*
|
||||
* This method will sent the appropriate WM_CTLCOLOR message to
|
||||
* prepare and setup the colors for the combo's DC.
|
||||
*
|
||||
* It also returns the brush to use for the background.
|
||||
*/
|
||||
static HBRUSH COMBO_PrepareColors(
|
||||
LPHEADCOMBO lphc,
|
||||
HDC hDC)
|
||||
{
|
||||
HBRUSH hBkgBrush;
|
||||
|
||||
/*
|
||||
* Get the background brush for this control.
|
||||
*/
|
||||
if (CB_DISABLED(lphc))
|
||||
{
|
||||
#ifdef __REACTOS__
|
||||
hBkgBrush = GetControlColor(lphc->owner, lphc->self, hDC, WM_CTLCOLORSTATIC);
|
||||
#else
|
||||
hBkgBrush = (HBRUSH)SendMessageW(lphc->owner, WM_CTLCOLORSTATIC,
|
||||
(WPARAM)hDC, (LPARAM)lphc->self );
|
||||
#endif
|
||||
/*
|
||||
* We have to change the text color since WM_CTLCOLORSTATIC will
|
||||
* set it to the "enabled" color. This is the same behavior as the
|
||||
* edit control
|
||||
*/
|
||||
SetTextColor(hDC, GetSysColor(COLOR_GRAYTEXT));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* FIXME: In which cases WM_CTLCOLORLISTBOX should be sent? */
|
||||
#ifdef __REACTOS__
|
||||
hBkgBrush = GetControlColor(lphc->owner, lphc->self, hDC, WM_CTLCOLOREDIT);
|
||||
#else
|
||||
hBkgBrush = (HBRUSH)SendMessageW(lphc->owner, WM_CTLCOLOREDIT,
|
||||
(WPARAM)hDC, (LPARAM)lphc->self );
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Catch errors.
|
||||
*/
|
||||
if( !hBkgBrush )
|
||||
hBkgBrush = GetSysColorBrush(COLOR_WINDOW);
|
||||
|
||||
return hBkgBrush;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* COMBO_Paint
|
||||
*/
|
||||
static LRESULT COMBO_Paint(LPHEADCOMBO lphc, HDC hParamDC)
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
HDC hDC;
|
||||
|
||||
hDC = (hParamDC) ? hParamDC
|
||||
: BeginPaint( lphc->self, &ps);
|
||||
hDC = (hParamDC) ? hParamDC : BeginPaint(lphc->self, &ps);
|
||||
|
||||
TRACE("hdc=%p\n", hDC);
|
||||
|
||||
if( hDC && !(lphc->wState & CBF_NOREDRAW) )
|
||||
if (hDC && !(lphc->wState & CBF_NOREDRAW))
|
||||
{
|
||||
HBRUSH hPrevBrush, hBkgBrush;
|
||||
|
||||
/*
|
||||
* Retrieve the background brush and select it in the
|
||||
* DC.
|
||||
*/
|
||||
hBkgBrush = COMBO_PrepareColors(lphc, hDC);
|
||||
|
||||
hPrevBrush = SelectObject( hDC, hBkgBrush );
|
||||
hPrevBrush = SelectObject(hDC, hBkgBrush);
|
||||
if (!(lphc->wState & CBF_EDIT))
|
||||
FillRect(hDC, &lphc->textRect, hBkgBrush);
|
||||
|
||||
/*
|
||||
* In non 3.1 look, there is a sunken border on the combobox
|
||||
*/
|
||||
CBPaintBorder(lphc->self, lphc, hDC);
|
||||
|
||||
if( !IsRectEmpty(&lphc->buttonRect) )
|
||||
{
|
||||
if (!IsRectEmpty(&lphc->buttonRect))
|
||||
CBPaintButton(lphc, hDC, lphc->buttonRect);
|
||||
}
|
||||
|
||||
/* paint the edit control padding area */
|
||||
if (CB_GETTYPE(lphc) != CBS_DROPDOWNLIST)
|
||||
{
|
||||
RECT rPadEdit = lphc->textRect;
|
||||
|
||||
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) )
|
||||
CBPaintText( lphc, hDC, lphc->textRect);
|
||||
if (!(lphc->wState & CBF_EDIT))
|
||||
CBPaintText(lphc, hDC, lphc->textRect);
|
||||
|
||||
if( hPrevBrush )
|
||||
SelectObject( hDC, hPrevBrush );
|
||||
if (hPrevBrush)
|
||||
SelectObject(hDC, hPrevBrush);
|
||||
}
|
||||
|
||||
if( !hParamDC )
|
||||
if (!hParamDC)
|
||||
EndPaint(lphc->self, &ps);
|
||||
|
||||
return 0;
|
||||
|
@ -927,7 +877,7 @@ static INT CBUpdateLBox( LPHEADCOMBO lphc, BOOL bSelect )
|
|||
idx = LB_ERR;
|
||||
length = SendMessageW( lphc->hWndEdit, WM_GETTEXTLENGTH, 0, 0 );
|
||||
|
||||
if( length > 0 )
|
||||
if (length > 0)
|
||||
pText = HeapAlloc( GetProcessHeap(), 0, (length + 1) * sizeof(WCHAR));
|
||||
|
||||
TRACE("\t edit text length %i\n", length );
|
||||
|
@ -966,12 +916,10 @@ static void CBUpdateEdit( LPHEADCOMBO lphc , INT index )
|
|||
length = SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, (WPARAM)index, 0);
|
||||
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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( CB_HASSTRINGS(lphc) )
|
||||
{
|
||||
|
@ -1019,7 +967,7 @@ static void CBDropDown( LPHEADCOMBO lphc )
|
|||
lphc->droppedIndex = SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -1086,8 +1034,7 @@ static void CBDropDown( LPHEADCOMBO lphc )
|
|||
|
||||
|
||||
if( !(lphc->wState & CBF_NOREDRAW) )
|
||||
RedrawWindow( lphc->self, NULL, 0, RDW_INVALIDATE |
|
||||
RDW_ERASE | RDW_UPDATENOW | RDW_NOCHILDREN );
|
||||
RedrawWindow(lphc->self, NULL, 0, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW);
|
||||
|
||||
EnableWindow( lphc->hWndLBox, TRUE );
|
||||
if (GetCapture() != lphc->self)
|
||||
|
@ -1170,7 +1117,7 @@ BOOL COMBO_FlipListbox( LPHEADCOMBO lphc, BOOL ok, BOOL bRedrawButton )
|
|||
* CBRepaintButton
|
||||
*/
|
||||
static void CBRepaintButton( LPHEADCOMBO lphc )
|
||||
{
|
||||
{
|
||||
InvalidateRect(lphc->self, &lphc->buttonRect, TRUE);
|
||||
UpdateWindow(lphc->self);
|
||||
}
|
||||
|
@ -1833,7 +1780,7 @@ static char *strdupA(LPCSTR str)
|
|||
*/
|
||||
LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, BOOL unicode )
|
||||
{
|
||||
LPHEADCOMBO lphc = (LPHEADCOMBO)GetWindowLongPtrW( hwnd, 0 );
|
||||
LPHEADCOMBO lphc = (LPHEADCOMBO)GetWindowLongPtrW(hwnd, 0);
|
||||
#ifdef __REACTOS__
|
||||
PWND pWnd;
|
||||
|
||||
|
@ -1841,9 +1788,7 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPAR
|
|||
if (pWnd)
|
||||
{
|
||||
if (!pWnd->fnid)
|
||||
{
|
||||
NtUserSetWindowFNID(hwnd, FNID_COMBOBOX);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pWnd->fnid != FNID_COMBOBOX)
|
||||
|
@ -1855,23 +1800,16 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPAR
|
|||
}
|
||||
#endif
|
||||
|
||||
TRACE("[%p]: msg %s wp %08lx lp %08lx\n",
|
||||
hwnd, SPY_GetMsgName(message, hwnd), wParam, lParam );
|
||||
|
||||
#ifndef __REACTOS__
|
||||
if (!IsWindow(hwnd)) return 0;
|
||||
#endif
|
||||
|
||||
if( lphc || message == WM_NCCREATE )
|
||||
if (lphc || message == WM_NCCREATE)
|
||||
switch(message)
|
||||
{
|
||||
|
||||
/* System messages */
|
||||
|
||||
case WM_NCCREATE:
|
||||
{
|
||||
LONG style = unicode ? ((LPCREATESTRUCTW)lParam)->style :
|
||||
((LPCREATESTRUCTA)lParam)->style;
|
||||
LONG style = unicode ? ((LPCREATESTRUCTW)lParam)->style : ((LPCREATESTRUCTA)lParam)->style;
|
||||
return COMBO_NCCreate(hwnd, style);
|
||||
}
|
||||
case WM_NCDESTROY:
|
||||
|
@ -1879,8 +1817,7 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPAR
|
|||
#ifdef __REACTOS__
|
||||
NtUserSetWindowFNID(hwnd, FNID_DESTROY);
|
||||
#endif
|
||||
break;/* -> DefWindowProc */
|
||||
|
||||
break;
|
||||
case WM_CREATE:
|
||||
{
|
||||
HWND hwndParent;
|
||||
|
@ -1897,17 +1834,11 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPAR
|
|||
}
|
||||
return COMBO_Create(hwnd, lphc, hwndParent, style, unicode);
|
||||
}
|
||||
|
||||
case WM_PRINTCLIENT:
|
||||
/* Fallthrough */
|
||||
case WM_PAINT:
|
||||
/* wParam may contain a valid HDC! */
|
||||
return COMBO_Paint(lphc, (HDC)wParam);
|
||||
|
||||
case WM_ERASEBKGND:
|
||||
/* do all painting in WM_PAINT like Windows does */
|
||||
return 1;
|
||||
|
||||
case WM_GETDLGCODE:
|
||||
{
|
||||
LRESULT result = DLGC_WANTARROWS | DLGC_WANTCHARS;
|
||||
|
@ -1921,39 +1852,37 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPAR
|
|||
return result;
|
||||
}
|
||||
case WM_SIZE:
|
||||
if( lphc->hWndLBox &&
|
||||
!(lphc->wState & CBF_NORESIZE) ) COMBO_Size( lphc );
|
||||
if (lphc->hWndLBox && !(lphc->wState & CBF_NORESIZE))
|
||||
COMBO_Size(lphc);
|
||||
return TRUE;
|
||||
case WM_SETFONT:
|
||||
COMBO_Font( lphc, (HFONT)wParam, (BOOL)lParam );
|
||||
COMBO_Font(lphc, (HFONT)wParam, (BOOL)lParam);
|
||||
return TRUE;
|
||||
case WM_GETFONT:
|
||||
return (LRESULT)lphc->hFont;
|
||||
case WM_SETFOCUS:
|
||||
if( lphc->wState & CBF_EDIT ) {
|
||||
if (lphc->wState & CBF_EDIT) {
|
||||
SetFocus( lphc->hWndEdit );
|
||||
/* 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);
|
||||
lphc->wState |= CBF_BEENFOCUSED;
|
||||
}
|
||||
}
|
||||
else
|
||||
COMBO_SetFocus( lphc );
|
||||
COMBO_SetFocus(lphc);
|
||||
return TRUE;
|
||||
case WM_KILLFOCUS:
|
||||
{
|
||||
HWND hwndFocus = WIN_GetFullHandle( (HWND)wParam );
|
||||
if( !hwndFocus ||
|
||||
(hwndFocus != lphc->hWndEdit && hwndFocus != lphc->hWndLBox ))
|
||||
COMBO_KillFocus( lphc );
|
||||
HWND hwndFocus = WIN_GetFullHandle((HWND)wParam);
|
||||
if (!hwndFocus || (hwndFocus != lphc->hWndEdit && hwndFocus != lphc->hWndLBox))
|
||||
COMBO_KillFocus(lphc);
|
||||
return TRUE;
|
||||
}
|
||||
case WM_COMMAND:
|
||||
return COMBO_Command( lphc, wParam, WIN_GetFullHandle( (HWND)lParam ) );
|
||||
return COMBO_Command(lphc, wParam, WIN_GetFullHandle((HWND)lParam));
|
||||
case WM_GETTEXT:
|
||||
return unicode ? COMBO_GetTextW( lphc, wParam, (LPWSTR)lParam )
|
||||
: COMBO_GetTextA( lphc, wParam, (LPSTR)lParam );
|
||||
return unicode ? COMBO_GetTextW(lphc, wParam, (LPWSTR)lParam)
|
||||
: COMBO_GetTextA(lphc, wParam, (LPSTR)lParam);
|
||||
case WM_SETTEXT:
|
||||
case WM_GETTEXTLENGTH:
|
||||
case WM_CLEAR:
|
||||
|
@ -1964,7 +1893,7 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPAR
|
|||
return unicode ? SendMessageW(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;
|
||||
lphc->wState |= CBF_NOEDITNOTIFY;
|
||||
|
@ -1977,56 +1906,49 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPAR
|
|||
case WM_CUT:
|
||||
case WM_PASTE:
|
||||
case WM_COPY:
|
||||
if( lphc->wState & CBF_EDIT )
|
||||
{
|
||||
if (lphc->wState & CBF_EDIT)
|
||||
return unicode ? SendMessageW(lphc->hWndEdit, message, wParam, lParam) :
|
||||
SendMessageA(lphc->hWndEdit, message, wParam, lParam);
|
||||
}
|
||||
else return CB_ERR;
|
||||
|
||||
case WM_DRAWITEM:
|
||||
case WM_DELETEITEM:
|
||||
case WM_COMPAREITEM:
|
||||
case WM_MEASUREITEM:
|
||||
return COMBO_ItemOp(lphc, message, lParam);
|
||||
case WM_ENABLE:
|
||||
if( lphc->wState & CBF_EDIT )
|
||||
EnableWindow( lphc->hWndEdit, (BOOL)wParam );
|
||||
EnableWindow( lphc->hWndLBox, (BOOL)wParam );
|
||||
|
||||
/* Force the control to repaint when the enabled state changes. */
|
||||
if (lphc->wState & CBF_EDIT)
|
||||
EnableWindow(lphc->hWndEdit, (BOOL)wParam);
|
||||
EnableWindow(lphc->hWndLBox, (BOOL)wParam);
|
||||
InvalidateRect(lphc->self, NULL, TRUE);
|
||||
return TRUE;
|
||||
case WM_SETREDRAW:
|
||||
if( wParam )
|
||||
if (wParam)
|
||||
lphc->wState &= ~CBF_NOREDRAW;
|
||||
else
|
||||
lphc->wState |= CBF_NOREDRAW;
|
||||
|
||||
if( lphc->wState & CBF_EDIT )
|
||||
if (lphc->wState & CBF_EDIT)
|
||||
SendMessageW(lphc->hWndEdit, message, wParam, lParam);
|
||||
SendMessageW(lphc->hWndLBox, message, wParam, lParam);
|
||||
return 0;
|
||||
case WM_SYSKEYDOWN:
|
||||
#ifdef __REACTOS__
|
||||
if( KF_ALTDOWN & HIWORD(lParam) )
|
||||
if (KF_ALTDOWN & HIWORD(lParam))
|
||||
#else
|
||||
if( KEYDATA_ALT & HIWORD(lParam) )
|
||||
if (KEYDATA_ALT & HIWORD(lParam))
|
||||
#endif
|
||||
if( wParam == VK_UP || wParam == VK_DOWN )
|
||||
COMBO_FlipListbox( lphc, FALSE, FALSE );
|
||||
if(wParam == VK_UP || wParam == VK_DOWN)
|
||||
COMBO_FlipListbox(lphc, FALSE, FALSE);
|
||||
return 0;
|
||||
|
||||
case WM_KEYDOWN:
|
||||
if ((wParam == VK_RETURN || wParam == VK_ESCAPE) &&
|
||||
(lphc->wState & CBF_DROPPED))
|
||||
{
|
||||
CBRollUp( lphc, wParam == VK_RETURN, FALSE );
|
||||
CBRollUp(lphc, wParam == VK_RETURN, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
else if ((wParam == VK_F4) && !(lphc->wState & CBF_EUI))
|
||||
{
|
||||
COMBO_FlipListbox( lphc, FALSE, FALSE );
|
||||
COMBO_FlipListbox(lphc, FALSE, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
/* fall through */
|
||||
|
@ -2035,83 +1957,73 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPAR
|
|||
{
|
||||
HWND hwndTarget;
|
||||
|
||||
if( lphc->wState & CBF_EDIT )
|
||||
if (lphc->wState & CBF_EDIT)
|
||||
hwndTarget = lphc->hWndEdit;
|
||||
else
|
||||
hwndTarget = lphc->hWndLBox;
|
||||
|
||||
return unicode ? SendMessageW(hwndTarget, message, wParam, lParam) :
|
||||
SendMessageA(hwndTarget, message, wParam, lParam);
|
||||
}
|
||||
case WM_LBUTTONDOWN:
|
||||
if( !(lphc->wState & CBF_FOCUSED) ) SetFocus( lphc->self );
|
||||
if( lphc->wState & CBF_FOCUSED ) COMBO_LButtonDown( lphc, lParam );
|
||||
if (!(lphc->wState & CBF_FOCUSED)) SetFocus(lphc->self);
|
||||
if (lphc->wState & CBF_FOCUSED) COMBO_LButtonDown(lphc, lParam);
|
||||
return TRUE;
|
||||
case WM_LBUTTONUP:
|
||||
COMBO_LButtonUp( lphc );
|
||||
COMBO_LButtonUp(lphc);
|
||||
return TRUE;
|
||||
case WM_MOUSEMOVE:
|
||||
if( lphc->wState & CBF_CAPTURE )
|
||||
COMBO_MouseMove( lphc, wParam, lParam );
|
||||
if (lphc->wState & CBF_CAPTURE)
|
||||
COMBO_MouseMove(lphc, wParam, lParam);
|
||||
return TRUE;
|
||||
|
||||
case WM_MOUSEWHEEL:
|
||||
if (wParam & (MK_SHIFT | MK_CONTROL))
|
||||
return unicode ? DefWindowProcW(hwnd, message, wParam, lParam) :
|
||||
DefWindowProcA(hwnd, message, wParam, lParam);
|
||||
|
||||
if (GET_WHEEL_DELTA_WPARAM(wParam) > 0) return SendMessageW(hwnd, WM_KEYDOWN, VK_UP, 0);
|
||||
if (GET_WHEEL_DELTA_WPARAM(wParam) < 0) return SendMessageW(hwnd, WM_KEYDOWN, VK_DOWN, 0);
|
||||
return TRUE;
|
||||
|
||||
/* Combo messages */
|
||||
|
||||
case CB_ADDSTRING:
|
||||
if( unicode )
|
||||
if (unicode)
|
||||
{
|
||||
if( lphc->dwStyle & CBS_LOWERCASE )
|
||||
if (lphc->dwStyle & CBS_LOWERCASE)
|
||||
CharLowerW((LPWSTR)lParam);
|
||||
else if( lphc->dwStyle & CBS_UPPERCASE )
|
||||
else if (lphc->dwStyle & CBS_UPPERCASE)
|
||||
CharUpperW((LPWSTR)lParam);
|
||||
return SendMessageW(lphc->hWndLBox, LB_ADDSTRING, 0, lParam);
|
||||
}
|
||||
else /* unlike the unicode version, the ansi version does not overwrite
|
||||
the string if converting case */
|
||||
else
|
||||
{
|
||||
char *string = NULL;
|
||||
LRESULT ret;
|
||||
if( lphc->dwStyle & CBS_LOWERCASE )
|
||||
if (lphc->dwStyle & CBS_LOWERCASE)
|
||||
{
|
||||
string = strdupA((LPSTR)lParam);
|
||||
CharLowerA(string);
|
||||
}
|
||||
|
||||
else if( lphc->dwStyle & CBS_UPPERCASE )
|
||||
else if (lphc->dwStyle & CBS_UPPERCASE)
|
||||
{
|
||||
string = strdupA((LPSTR)lParam);
|
||||
CharUpperA(string);
|
||||
}
|
||||
|
||||
ret = SendMessageA(lphc->hWndLBox, LB_ADDSTRING, 0, string ? (LPARAM)string : lParam);
|
||||
HeapFree(GetProcessHeap(), 0, string);
|
||||
return ret;
|
||||
}
|
||||
case CB_INSERTSTRING:
|
||||
if( unicode )
|
||||
if (unicode)
|
||||
{
|
||||
if( lphc->dwStyle & CBS_LOWERCASE )
|
||||
if (lphc->dwStyle & CBS_LOWERCASE)
|
||||
CharLowerW((LPWSTR)lParam);
|
||||
else if( lphc->dwStyle & CBS_UPPERCASE )
|
||||
else if (lphc->dwStyle & CBS_UPPERCASE)
|
||||
CharUpperW((LPWSTR)lParam);
|
||||
return SendMessageW(lphc->hWndLBox, LB_INSERTSTRING, wParam, lParam);
|
||||
}
|
||||
else
|
||||
{
|
||||
if( lphc->dwStyle & CBS_LOWERCASE )
|
||||
if (lphc->dwStyle & CBS_LOWERCASE)
|
||||
CharLowerA((LPSTR)lParam);
|
||||
else if( lphc->dwStyle & CBS_UPPERCASE )
|
||||
else if (lphc->dwStyle & CBS_UPPERCASE)
|
||||
CharUpperA((LPSTR)lParam);
|
||||
|
||||
return SendMessageA(lphc->hWndLBox, LB_INSERTSTRING, wParam, lParam);
|
||||
}
|
||||
case CB_DELETESTRING:
|
||||
|
@ -2126,14 +2038,14 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPAR
|
|||
return unicode ? SendMessageW(lphc->hWndLBox, LB_FINDSTRINGEXACT, wParam, lParam) :
|
||||
SendMessageA(lphc->hWndLBox, LB_FINDSTRINGEXACT, wParam, lParam);
|
||||
case CB_SETITEMHEIGHT:
|
||||
return COMBO_SetItemHeight( lphc, (INT)wParam, (INT)lParam);
|
||||
return COMBO_SetItemHeight(lphc, (INT)wParam, (INT)lParam);
|
||||
case CB_GETITEMHEIGHT:
|
||||
if( (INT)wParam >= 0 ) /* listbox item */
|
||||
if ((INT)wParam >= 0)
|
||||
return SendMessageW(lphc->hWndLBox, LB_GETITEMHEIGHT, wParam, 0);
|
||||
return CBGetTextAreaHeight(hwnd, lphc);
|
||||
case CB_RESETCONTENT:
|
||||
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 };
|
||||
SendMessageW(lphc->hWndEdit, WM_SETTEXT, 0, (LPARAM)empty_stringW);
|
||||
|
@ -2154,43 +2066,36 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPAR
|
|||
case CB_SETLOCALE:
|
||||
return SendMessageW(lphc->hWndLBox, LB_SETLOCALE, wParam, 0);
|
||||
case CB_SETDROPPEDWIDTH:
|
||||
if( (CB_GETTYPE(lphc) == CBS_SIMPLE) ||
|
||||
(INT)wParam >= 32768 )
|
||||
if ((CB_GETTYPE(lphc) == CBS_SIMPLE) || (INT)wParam >= 32768)
|
||||
return CB_ERR;
|
||||
/* 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;
|
||||
else if(wParam)
|
||||
else if (wParam)
|
||||
lphc->droppedWidth = 0;
|
||||
|
||||
/* recalculate the combobox area */
|
||||
CBCalcPlacement(hwnd, lphc, &lphc->textRect, &lphc->buttonRect, &lphc->droppedRect );
|
||||
|
||||
/* fall through */
|
||||
case CB_GETDROPPEDWIDTH:
|
||||
if( lphc->droppedWidth )
|
||||
if (lphc->droppedWidth)
|
||||
return lphc->droppedWidth;
|
||||
return lphc->droppedRect.right - lphc->droppedRect.left;
|
||||
case CB_GETDROPPEDCONTROLRECT:
|
||||
if( lParam ) CBGetDroppedControlRect(lphc, (LPRECT)lParam );
|
||||
if (lParam) CBGetDroppedControlRect(lphc, (LPRECT)lParam);
|
||||
return CB_OKAY;
|
||||
case CB_GETDROPPEDSTATE:
|
||||
return (lphc->wState & CBF_DROPPED) != 0;
|
||||
case CB_DIR:
|
||||
return unicode ? SendMessageW(lphc->hWndLBox, LB_DIR, wParam, lParam) :
|
||||
SendMessageA(lphc->hWndLBox, LB_DIR, wParam, lParam);
|
||||
|
||||
case CB_SHOWDROPDOWN:
|
||||
if( CB_GETTYPE(lphc) != CBS_SIMPLE )
|
||||
if (CB_GETTYPE(lphc) != CBS_SIMPLE)
|
||||
{
|
||||
if( wParam )
|
||||
if (wParam)
|
||||
{
|
||||
if( !(lphc->wState & CBF_DROPPED) )
|
||||
CBDropDown( lphc );
|
||||
if (!(lphc->wState & CBF_DROPPED))
|
||||
CBDropDown(lphc);
|
||||
}
|
||||
else
|
||||
if( lphc->wState & CBF_DROPPED )
|
||||
CBRollUp( lphc, FALSE, TRUE );
|
||||
else if (lphc->wState & CBF_DROPPED)
|
||||
CBRollUp(lphc, FALSE, TRUE);
|
||||
}
|
||||
return TRUE;
|
||||
case CB_GETCOUNT:
|
||||
|
@ -2199,12 +2104,10 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPAR
|
|||
return SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
|
||||
case CB_SETCURSEL:
|
||||
lParam = SendMessageW(lphc->hWndLBox, LB_SETCURSEL, wParam, 0);
|
||||
if( lParam >= 0 )
|
||||
if (lParam >= 0)
|
||||
SendMessageW(lphc->hWndLBox, LB_SETTOPINDEX, wParam, 0);
|
||||
|
||||
/* no LBN_SELCHANGE in this case, update manually */
|
||||
if( lphc->wState & CBF_EDIT )
|
||||
CBUpdateEdit( lphc, (INT)wParam );
|
||||
if(lphc->wState & CBF_EDIT)
|
||||
CBUpdateEdit(lphc, (INT)wParam);
|
||||
else
|
||||
InvalidateRect(lphc->self, &lphc->textRect, TRUE);
|
||||
lphc->wState &= ~CBF_SELCHANGE;
|
||||
|
@ -2220,19 +2123,17 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPAR
|
|||
case CB_SETITEMDATA:
|
||||
return SendMessageW(lphc->hWndLBox, LB_SETITEMDATA, wParam, lParam);
|
||||
case CB_GETEDITSEL:
|
||||
/* Edit checks passed parameters itself */
|
||||
if( lphc->wState & CBF_EDIT )
|
||||
if (lphc->wState & CBF_EDIT)
|
||||
return SendMessageW(lphc->hWndEdit, EM_GETSEL, wParam, lParam);
|
||||
return CB_ERR;
|
||||
case CB_SETEDITSEL:
|
||||
if( lphc->wState & CBF_EDIT )
|
||||
return SendMessageW(lphc->hWndEdit, EM_SETSEL,
|
||||
(INT)(INT16)LOWORD(lParam), (INT)(INT16)HIWORD(lParam) );
|
||||
if (lphc->wState & CBF_EDIT)
|
||||
return SendMessageW(lphc->hWndEdit, EM_SETSEL, (INT)(INT16)LOWORD(lParam), (INT)(INT16)HIWORD(lParam));
|
||||
return CB_ERR;
|
||||
case CB_SETEXTENDEDUI:
|
||||
if( CB_GETTYPE(lphc) == CBS_SIMPLE )
|
||||
if (CB_GETTYPE(lphc) == CBS_SIMPLE)
|
||||
return CB_ERR;
|
||||
if( wParam )
|
||||
if (wParam)
|
||||
lphc->wState |= CBF_EUI;
|
||||
else lphc->wState &= ~CBF_EUI;
|
||||
return CB_OKAY;
|
||||
|
@ -2241,27 +2142,22 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPAR
|
|||
case CB_GETCOMBOBOXINFO:
|
||||
return COMBO_GetComboBoxInfo(lphc, (COMBOBOXINFO *)lParam);
|
||||
case CB_LIMITTEXT:
|
||||
if( lphc->wState & CBF_EDIT )
|
||||
if (lphc->wState & CBF_EDIT)
|
||||
return SendMessageW(lphc->hWndEdit, EM_LIMITTEXT, wParam, lParam);
|
||||
return TRUE;
|
||||
|
||||
#ifdef __REACTOS__
|
||||
case WM_UPDATEUISTATE:
|
||||
if (unicode)
|
||||
DefWindowProcW(lphc->self, message, wParam, lParam);
|
||||
else
|
||||
DefWindowProcA(lphc->self, message, wParam, lParam);
|
||||
|
||||
if (COMBO_update_uistate(lphc))
|
||||
{
|
||||
/* redraw text */
|
||||
if( !(lphc->wState & CBF_EDIT) )
|
||||
if (!(lphc->wState & CBF_EDIT))
|
||||
NtUserInvalidateRect(lphc->self, &lphc->textRect, TRUE);
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_CBLOSTTEXTFOCUS: /* undocumented message - deselects the text when focus is lost */
|
||||
{
|
||||
case WM_CBLOSTTEXTFOCUS:
|
||||
if (lphc->hWndEdit != NULL)
|
||||
{
|
||||
SendMessage(lphc->self, WM_LBUTTONUP, 0, 0xFFFFFFFF);
|
||||
|
@ -2269,15 +2165,9 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPAR
|
|||
lphc->wState &= ~CBF_FOCUSED;
|
||||
CB_NOTIFY(lphc, CBN_KILLFOCUS);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
#endif
|
||||
|
||||
default:
|
||||
if (message >= WM_USER)
|
||||
WARN("unknown msg WM_USER+%04x wp=%04lx lp=%08lx\n",
|
||||
message - WM_USER, wParam, lParam );
|
||||
break;
|
||||
}
|
||||
return unicode ? DefWindowProcW(hwnd, message, wParam, lParam) :
|
||||
|
@ -2292,19 +2182,19 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPAR
|
|||
* This is just a wrapper for the real ComboWndProc which locks/unlocks
|
||||
* 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;
|
||||
return ComboWndProc_common( hwnd, message, wParam, lParam, FALSE );
|
||||
return ComboWndProc_common(hwnd, message, wParam, lParam, FALSE);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* 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;
|
||||
return ComboWndProc_common( hwnd, message, wParam, lParam, TRUE );
|
||||
return ComboWndProc_common(hwnd, message, wParam, lParam, TRUE);
|
||||
}
|
||||
|
||||
#endif /* __REACTOS__ */
|
||||
|
@ -2312,10 +2202,8 @@ LRESULT WINAPI ComboWndProcW( HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||
/*************************************************************************
|
||||
* GetComboBoxInfo (USER32.@)
|
||||
*/
|
||||
BOOL WINAPI GetComboBoxInfo(HWND hwndCombo, /* [in] handle to combo box */
|
||||
PCOMBOBOXINFO pcbi /* [in/out] combo box information */)
|
||||
BOOL WINAPI GetComboBoxInfo(HWND hwndCombo, PCOMBOBOXINFO pcbi)
|
||||
{
|
||||
TRACE("(%p, %p)\n", hwndCombo, pcbi);
|
||||
#ifdef __REACTOS__
|
||||
return NtUserGetComboBoxInfo(hwndCombo, pcbi);
|
||||
#else
|
||||
|
|
Loading…
Reference in a new issue