mirror of
https://github.com/reactos/reactos.git
synced 2025-05-07 02:41:22 +00:00
Vitaly Lipatov : Fix character conversion in combo box. Which needed to be synced to wine.
svn path=/trunk/; revision=22377
This commit is contained in:
parent
35c60c75a7
commit
35135e5ddb
1 changed files with 60 additions and 21 deletions
|
@ -432,6 +432,10 @@ static void CBCalcPlacement(
|
|||
lprLB->right = lprLB->left + lphc->droppedWidth;
|
||||
}
|
||||
|
||||
/* don't allow negative window width */
|
||||
if (lprEdit->right < lprEdit->left)
|
||||
lprEdit->right = lprEdit->left;
|
||||
|
||||
TRACE("\ttext\t= (%ld,%ld-%ld,%ld)\n",
|
||||
lprEdit->left, lprEdit->top, lprEdit->right, lprEdit->bottom);
|
||||
|
||||
|
@ -1841,6 +1845,19 @@ static LRESULT COMBO_GetComboBoxInfo(LPHEADCOMBO lphc, COMBOBOXINFO *pcbi)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static char *strdupA(LPCSTR str)
|
||||
{
|
||||
char *ret;
|
||||
DWORD len;
|
||||
|
||||
if(!str) return NULL;
|
||||
|
||||
len = strlen(str);
|
||||
ret = HeapAlloc(GetProcessHeap(), 0, len + 1);
|
||||
memcpy(ret, str, len + 1);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* ComboWndProc_common
|
||||
*
|
||||
|
@ -2068,17 +2085,33 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
|
|||
/* fall through */
|
||||
#endif
|
||||
case CB_ADDSTRING:
|
||||
{
|
||||
UINT msg = LB_ADDSTRING;
|
||||
if( lphc->dwStyle & CBS_LOWERCASE )
|
||||
msg = LB_ADDSTRING_LOWER;
|
||||
else if( lphc->dwStyle & CBS_UPPERCASE )
|
||||
msg = LB_ADDSTRING_UPPER;
|
||||
if( unicode )
|
||||
return SendMessageW(lphc->hWndLBox, msg, 0, lParam);
|
||||
else
|
||||
return SendMessageA(lphc->hWndLBox, msg, 0, lParam);
|
||||
}
|
||||
if( unicode )
|
||||
{
|
||||
if( lphc->dwStyle & CBS_LOWERCASE )
|
||||
CharLowerW((LPWSTR)lParam);
|
||||
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 */
|
||||
{
|
||||
char *p, *string = NULL;
|
||||
LRESULT ret;
|
||||
if( lphc->dwStyle & CBS_LOWERCASE )
|
||||
{
|
||||
string = strdupA((LPSTR)lParam);
|
||||
CharLowerA(string);
|
||||
}
|
||||
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;
|
||||
}
|
||||
#ifndef __REACTOS__
|
||||
case CB_INSERTSTRING16:
|
||||
wParam = (INT)(INT16)wParam;
|
||||
|
@ -2086,17 +2119,23 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
|
|||
/* fall through */
|
||||
#endif
|
||||
case CB_INSERTSTRING:
|
||||
{
|
||||
UINT msg = LB_INSERTSTRING;
|
||||
if( lphc->dwStyle & CBS_LOWERCASE )
|
||||
msg = LB_INSERTSTRING_LOWER;
|
||||
else if( lphc->dwStyle & CBS_UPPERCASE )
|
||||
msg = LB_INSERTSTRING_UPPER;
|
||||
if( unicode )
|
||||
return SendMessageW(lphc->hWndLBox, msg, 0, lParam);
|
||||
if( unicode )
|
||||
{
|
||||
if( lphc->dwStyle & CBS_LOWERCASE )
|
||||
CharLowerW((LPWSTR)lParam);
|
||||
else if( lphc->dwStyle & CBS_UPPERCASE )
|
||||
CharUpperW((LPWSTR)lParam);
|
||||
return SendMessageW(lphc->hWndLBox, LB_INSERTSTRING, wParam, lParam);
|
||||
}
|
||||
else
|
||||
return SendMessageA(lphc->hWndLBox, msg, 0, lParam);
|
||||
}
|
||||
{
|
||||
char *p;
|
||||
if( lphc->dwStyle & CBS_LOWERCASE )
|
||||
CharLowerA((LPSTR)lParam);
|
||||
else if( lphc->dwStyle & CBS_UPPERCASE )
|
||||
CharUpperA((LPSTR)lParam);
|
||||
return SendMessageA(lphc->hWndLBox, LB_INSERTSTRING, wParam, lParam);
|
||||
}
|
||||
#ifndef __REACTOS__
|
||||
case CB_DELETESTRING16:
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue