mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 20:05:41 +00:00
Implement undocumented listbox messages LB_INSERTSTRING_UPPER, LB_INSERTSTRING_LOWER, LB_ADDSTRING_UPPER, LB_ADDSTRING_LOWER and use them in combobox CB_ADDSTRING and CB_INSERTSTRING implementation.
svn path=/trunk/; revision=20107
This commit is contained in:
parent
8464f35250
commit
8f10c7915c
3 changed files with 37 additions and 56 deletions
|
@ -1842,19 +1842,6 @@ static LRESULT COMBO_GetComboBoxInfo(LPHEADCOMBO lphc, COMBOBOXINFO *pcbi)
|
||||||
return TRUE;
|
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
|
* ComboWndProc_common
|
||||||
*
|
*
|
||||||
|
@ -2082,33 +2069,14 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
|
||||||
/* fall through */
|
/* fall through */
|
||||||
#endif
|
#endif
|
||||||
case CB_ADDSTRING:
|
case CB_ADDSTRING:
|
||||||
if( unicode )
|
{
|
||||||
{
|
UINT msg = LB_ADDSTRING;
|
||||||
if( lphc->dwStyle & CBS_LOWERCASE )
|
if( lphc->dwStyle & CBS_LOWERCASE )
|
||||||
strlwrW((LPWSTR)lParam);
|
msg = LB_ADDSTRING_LOWER;
|
||||||
else if( lphc->dwStyle & CBS_UPPERCASE )
|
else if( lphc->dwStyle & CBS_UPPERCASE )
|
||||||
struprW((LPWSTR)lParam);
|
msg = LB_ADDSTRING_UPPER;
|
||||||
return SendMessageW(lphc->hWndLBox, LB_ADDSTRING, 0, lParam);
|
return SendMessageW(lphc->hWndLBox, msg, 0, lParam);
|
||||||
}
|
}
|
||||||
else /* unlike the unicode version, the ansi version does not overwrite
|
|
||||||
the string if converting case */
|
|
||||||
{
|
|
||||||
char *string = NULL;
|
|
||||||
LRESULT ret;
|
|
||||||
if( lphc->dwStyle & CBS_LOWERCASE )
|
|
||||||
{
|
|
||||||
string = strdupA((LPSTR)lParam);
|
|
||||||
_strlwr(string);
|
|
||||||
}
|
|
||||||
else if( lphc->dwStyle & CBS_UPPERCASE )
|
|
||||||
{
|
|
||||||
string = strdupA((LPSTR)lParam);
|
|
||||||
_strupr(string);
|
|
||||||
}
|
|
||||||
ret = SendMessageA(lphc->hWndLBox, LB_ADDSTRING, 0, string ? (LPARAM)string : lParam);
|
|
||||||
HeapFree(GetProcessHeap(), 0, string);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
#ifndef __REACTOS__
|
#ifndef __REACTOS__
|
||||||
case CB_INSERTSTRING16:
|
case CB_INSERTSTRING16:
|
||||||
wParam = (INT)(INT16)wParam;
|
wParam = (INT)(INT16)wParam;
|
||||||
|
@ -2116,22 +2084,14 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
|
||||||
/* fall through */
|
/* fall through */
|
||||||
#endif
|
#endif
|
||||||
case CB_INSERTSTRING:
|
case CB_INSERTSTRING:
|
||||||
if( unicode )
|
{
|
||||||
{
|
UINT msg = LB_INSERTSTRING;
|
||||||
if( lphc->dwStyle & CBS_LOWERCASE )
|
if( lphc->dwStyle & CBS_LOWERCASE )
|
||||||
strlwrW((LPWSTR)lParam);
|
msg = LB_INSERTSTRING_LOWER;
|
||||||
else if( lphc->dwStyle & CBS_UPPERCASE )
|
else if( lphc->dwStyle & CBS_UPPERCASE )
|
||||||
struprW((LPWSTR)lParam);
|
msg = LB_INSERTSTRING_UPPER;
|
||||||
return SendMessageW(lphc->hWndLBox, LB_INSERTSTRING, wParam, lParam);
|
return SendMessageW(lphc->hWndLBox, msg, 0, lParam);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if( lphc->dwStyle & CBS_LOWERCASE )
|
|
||||||
_strlwr((LPSTR)lParam);
|
|
||||||
else if( lphc->dwStyle & CBS_UPPERCASE )
|
|
||||||
_strupr((LPSTR)lParam);
|
|
||||||
return SendMessageA(lphc->hWndLBox, LB_INSERTSTRING, wParam, lParam);
|
|
||||||
}
|
|
||||||
#ifndef __REACTOS__
|
#ifndef __REACTOS__
|
||||||
case CB_DELETESTRING16:
|
case CB_DELETESTRING16:
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2650,6 +2650,8 @@ static LRESULT WINAPI ListBoxWndProc_common( HWND hwnd, UINT msg,
|
||||||
/* fall through */
|
/* fall through */
|
||||||
#endif
|
#endif
|
||||||
case LB_ADDSTRING:
|
case LB_ADDSTRING:
|
||||||
|
case LB_ADDSTRING_LOWER:
|
||||||
|
case LB_ADDSTRING_UPPER:
|
||||||
{
|
{
|
||||||
INT ret;
|
INT ret;
|
||||||
LPWSTR textW;
|
LPWSTR textW;
|
||||||
|
@ -2662,6 +2664,12 @@ static LRESULT WINAPI ListBoxWndProc_common( HWND hwnd, UINT msg,
|
||||||
if((textW = HeapAlloc(GetProcessHeap(), 0, countW * sizeof(WCHAR))))
|
if((textW = HeapAlloc(GetProcessHeap(), 0, countW * sizeof(WCHAR))))
|
||||||
MultiByteToWideChar(CP_ACP, 0, textA, -1, textW, countW);
|
MultiByteToWideChar(CP_ACP, 0, textA, -1, textW, countW);
|
||||||
}
|
}
|
||||||
|
/* in the unicode the version, the string is really overwritten
|
||||||
|
during the converting case */
|
||||||
|
if (msg == LB_ADDSTRING_LOWER)
|
||||||
|
strlwrW(textW);
|
||||||
|
else if (msg == LB_ADDSTRING_UPPER)
|
||||||
|
struprW(textW);
|
||||||
wParam = LISTBOX_FindStringPos( descr, textW, FALSE );
|
wParam = LISTBOX_FindStringPos( descr, textW, FALSE );
|
||||||
ret = LISTBOX_InsertString( descr, wParam, textW );
|
ret = LISTBOX_InsertString( descr, wParam, textW );
|
||||||
if (!unicode && HAS_STRINGS(descr))
|
if (!unicode && HAS_STRINGS(descr))
|
||||||
|
@ -2676,6 +2684,8 @@ static LRESULT WINAPI ListBoxWndProc_common( HWND hwnd, UINT msg,
|
||||||
/* fall through */
|
/* fall through */
|
||||||
#endif
|
#endif
|
||||||
case LB_INSERTSTRING:
|
case LB_INSERTSTRING:
|
||||||
|
case LB_INSERTSTRING_UPPER:
|
||||||
|
case LB_INSERTSTRING_LOWER:
|
||||||
{
|
{
|
||||||
INT ret;
|
INT ret;
|
||||||
LPWSTR textW;
|
LPWSTR textW;
|
||||||
|
@ -2688,6 +2698,12 @@ static LRESULT WINAPI ListBoxWndProc_common( HWND hwnd, UINT msg,
|
||||||
if((textW = HeapAlloc(GetProcessHeap(), 0, countW * sizeof(WCHAR))))
|
if((textW = HeapAlloc(GetProcessHeap(), 0, countW * sizeof(WCHAR))))
|
||||||
MultiByteToWideChar(CP_ACP, 0, textA, -1, textW, countW);
|
MultiByteToWideChar(CP_ACP, 0, textA, -1, textW, countW);
|
||||||
}
|
}
|
||||||
|
/* in the unicode the version, the string is really overwritten
|
||||||
|
during the converting case */
|
||||||
|
if (msg == LB_INSERTSTRING_LOWER)
|
||||||
|
strlwrW(textW);
|
||||||
|
else if (msg == LB_INSERTSTRING_UPPER)
|
||||||
|
struprW(textW);
|
||||||
ret = LISTBOX_InsertString( descr, wParam, textW );
|
ret = LISTBOX_InsertString( descr, wParam, textW );
|
||||||
if(!unicode && HAS_STRINGS(descr))
|
if(!unicode && HAS_STRINGS(descr))
|
||||||
HeapFree(GetProcessHeap(), 0, textW);
|
HeapFree(GetProcessHeap(), 0, textW);
|
||||||
|
|
|
@ -110,4 +110,9 @@ typedef struct
|
||||||
|
|
||||||
extern BOOL COMBO_FlipListbox( LPHEADCOMBO, BOOL, BOOL );
|
extern BOOL COMBO_FlipListbox( LPHEADCOMBO, BOOL, BOOL );
|
||||||
|
|
||||||
|
#define LB_INSERTSTRING_UPPER 0x1AA
|
||||||
|
#define LB_INSERTSTRING_LOWER 0x1AB
|
||||||
|
#define LB_ADDSTRING_UPPER 0x1AC
|
||||||
|
#define LB_ADDSTRING_LOWER 0x1AD
|
||||||
|
|
||||||
#endif /* _ROS_CONTROLS_H */
|
#endif /* _ROS_CONTROLS_H */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue