static void COMBOEX_DumpInput (COMBOBOXEXITEMW const *input)
{
- TRACE("input - mask=%08x, iItem=%d, pszText=%p, cchTM=%d, iImage=%d\n",
+ TRACE("input - mask=%08x, iItem=%ld, pszText=%p, cchTM=%d, iImage=%d\n",
input->mask, input->iItem, input->pszText, input->cchTextMax,
input->iImage);
if (input->mask & CBEIF_TEXT)
static INT
-COMBOEX_NotifyItem (COMBOEX_INFO *infoPtr, INT code, NMCOMBOBOXEXW *hdr)
+COMBOEX_NotifyItem (COMBOEX_INFO *infoPtr, UINT code, NMCOMBOBOXEXW *hdr)
{
/* Change the Text item from Unicode to ANSI if necessary for NOTIFY */
if (infoPtr->NtfUnicode)
if ((hdr->ceItem.mask & CBEIF_TEXT) && is_textW(wstr)) {
len = WideCharToMultiByte (CP_ACP, 0, wstr, -1, 0, 0, NULL, NULL);
if (len > 0) {
- astr = (LPSTR)Alloc ((len + 1)*sizeof(CHAR));
+ astr = Alloc ((len + 1)*sizeof(CHAR));
if (!astr) return 0;
WideCharToMultiByte (CP_ACP, 0, wstr, -1, astr, len, 0, 0);
hdr->ceItem.pszText = (LPWSTR)astr;
if (is_textW(nmce.ceItem.pszText)) {
len = MultiByteToWideChar (CP_ACP, 0, (LPSTR)nmce.ceItem.pszText, -1, NULL, 0);
- buf = (LPWSTR)Alloc ((len + 1)*sizeof(WCHAR));
+ buf = Alloc ((len + 1)*sizeof(WCHAR));
if (buf)
MultiByteToWideChar (CP_ACP, 0, (LPSTR)nmce.ceItem.pszText, -1, buf, len);
if (nmce.ceItem.mask & CBEIF_DI_SETITEM) {
mydc = GetDC (0); /* why the entire screen???? */
nfont = (HFONT)SendMessageW (infoPtr->hwndCombo, WM_GETFONT, 0, 0);
- ofont = (HFONT) SelectObject (mydc, nfont);
+ ofont = SelectObject (mydc, nfont);
GetTextExtentPointW (mydc, strA, 1, size);
SelectObject (mydc, ofont);
ReleaseDC (0, mydc);
}
-static void COMBOEX_CopyItem (CBE_ITEMDATA *item, COMBOBOXEXITEMW *cit)
+static void COMBOEX_CopyItem (const CBE_ITEMDATA *item, COMBOBOXEXITEMW *cit)
{
if (cit->mask & CBEIF_TEXT) {
/*
cy = max (iinfo.rcImage.bottom - iinfo.rcImage.top, cy);
TRACE("upgraded height due to image: height=%d\n", cy);
}
- SendMessageW (infoPtr->hwndSelf, CB_SETITEMHEIGHT, (WPARAM)-1, (LPARAM)cy);
+ SendMessageW (infoPtr->hwndSelf, CB_SETITEMHEIGHT, -1, cy);
if (infoPtr->hwndCombo) {
- SendMessageW (infoPtr->hwndCombo, CB_SETITEMHEIGHT,
- (WPARAM) 0, (LPARAM) cy);
+ SendMessageW (infoPtr->hwndCombo, CB_SETITEMHEIGHT, 0, cy);
if ( !(infoPtr->flags & CBES_EX_NOSIZELIMIT)) {
RECT comboRect;
if (GetWindowRect(infoPtr->hwndCombo, &comboRect)) {
}
-static CBE_ITEMDATA * COMBOEX_FindItem(COMBOEX_INFO *infoPtr, INT index)
+static CBE_ITEMDATA * COMBOEX_FindItem(const COMBOEX_INFO *infoPtr, INT_PTR index)
{
CBE_ITEMDATA *item;
INT i;
/* *** CBEM_xxx message support *** */
-static UINT COMBOEX_GetListboxText(COMBOEX_INFO *infoPtr, int n, LPWSTR buf)
+static UINT COMBOEX_GetListboxText(COMBOEX_INFO *infoPtr, INT_PTR n, LPWSTR buf)
{
CBE_ITEMDATA *item;
LPCWSTR str;
}
-static INT COMBOEX_DeleteItem (COMBOEX_INFO *infoPtr, INT index)
+static INT COMBOEX_DeleteItem (COMBOEX_INFO *infoPtr, INT_PTR index)
{
- TRACE("(index=%d)\n", index);
+ TRACE("(index=%ld)\n", index);
/* if item number requested does not exist then return failure */
if ((index >= infoPtr->nb_items) || (index < 0)) return CB_ERR;
}
-static BOOL COMBOEX_GetItemW (COMBOEX_INFO *infoPtr, COMBOBOXEXITEMW *cit)
+static BOOL COMBOEX_GetItemW (const COMBOEX_INFO *infoPtr, COMBOBOXEXITEMW *cit)
{
- INT index = cit->iItem;
+ INT_PTR index = cit->iItem;
CBE_ITEMDATA *item;
TRACE("(...)\n");
}
-static BOOL COMBOEX_GetItemA (COMBOEX_INFO *infoPtr, COMBOBOXEXITEMA *cit)
+static BOOL COMBOEX_GetItemA (const COMBOEX_INFO *infoPtr, COMBOBOXEXITEMA *cit)
{
COMBOBOXEXITEMW tmpcit;
static INT COMBOEX_InsertItemW (COMBOEX_INFO *infoPtr, COMBOBOXEXITEMW const *cit)
{
- INT index;
+ INT_PTR index;
CBE_ITEMDATA *item;
NMCOMBOBOXEXW nmcit;
if (index > infoPtr->nb_items) return -1;
/* get zero-filled space and chain it in */
- if(!(item = (CBE_ITEMDATA *)Alloc (sizeof(*item)))) return -1;
+ if(!(item = Alloc (sizeof(*item)))) return -1;
/* locate position to insert new item in */
if (index == infoPtr->nb_items) {
if (is_textW(cit->pszText)) len = strlenW (cit->pszText);
if (len > 0) {
- item->pszText = (LPWSTR)Alloc ((len + 1)*sizeof(WCHAR));
+ item->pszText = Alloc ((len + 1)*sizeof(WCHAR));
if (!item->pszText) {
Free(item);
return -1;
memcpy(&citW,cit,sizeof(COMBOBOXEXITEMA));
if (cit->mask & CBEIF_TEXT && is_textA(cit->pszText)) {
INT len = MultiByteToWideChar (CP_ACP, 0, cit->pszText, -1, NULL, 0);
- wstr = (LPWSTR)Alloc ((len + 1)*sizeof(WCHAR));
+ wstr = Alloc ((len + 1)*sizeof(WCHAR));
if (!wstr) return -1;
MultiByteToWideChar (CP_ACP, 0, cit->pszText, -1, wstr, len);
citW.pszText = wstr;
static BOOL COMBOEX_SetItemW (COMBOEX_INFO *infoPtr, COMBOBOXEXITEMW *cit)
{
- INT index = cit->iItem;
+ INT_PTR index = cit->iItem;
CBE_ITEMDATA *item;
if (TRACE_ON(comboex)) COMBOEX_DumpInput (cit);
COMBOEX_FreeText(item);
if (is_textW(cit->pszText)) len = strlenW(cit->pszText);
if (len > 0) {
- item->pszText = (LPWSTR)Alloc ((len + 1)*sizeof(WCHAR));
+ item->pszText = Alloc ((len + 1)*sizeof(WCHAR));
if (!item->pszText) return FALSE;
strcpyW(item->pszText, cit->pszText);
} else if (cit->pszText == LPSTR_TEXTCALLBACKW)
if (TRACE_ON(comboex)) COMBOEX_DumpItem (item);
/* if original request was to update edit control, do some fast foot work */
- if (cit->iItem == -1) {
+ if (cit->iItem == -1 && cit->mask & CBEIF_TEXT) {
COMBOEX_SetEditText (infoPtr, item);
RedrawWindow (infoPtr->hwndCombo, 0, 0, RDW_ERASE | RDW_INVALIDATE);
}
memcpy(&citW, cit, sizeof(COMBOBOXEXITEMA));
if ((cit->mask & CBEIF_TEXT) && is_textA(cit->pszText)) {
INT len = MultiByteToWideChar (CP_ACP, 0, cit->pszText, -1, NULL, 0);
- wstr = (LPWSTR)Alloc ((len + 1)*sizeof(WCHAR));
+ wstr = Alloc ((len + 1)*sizeof(WCHAR));
if (!wstr) return FALSE;
MultiByteToWideChar (CP_ACP, 0, cit->pszText, -1, wstr, len);
citW.pszText = wstr;
/* now search from after starting loc and wrapping back to start */
for(i=start+1; i<count; i++) {
CBE_ITEMDATA *item = get_item_data(infoPtr, i);
+ if ((LRESULT)item == CB_ERR) continue;
if (cmptext(COMBOEX_GetText(infoPtr, item), str) == 0) return i;
}
for(i=0; i<=start; i++) {
CBE_ITEMDATA *item = get_item_data(infoPtr, i);
+ if ((LRESULT)item == CB_ERR) continue;
if (cmptext(COMBOEX_GetText(infoPtr, item), str) == 0) return i;
}
return CB_ERR;
}
-static DWORD_PTR COMBOEX_GetItemData (COMBOEX_INFO *infoPtr, INT index)
+static DWORD_PTR COMBOEX_GetItemData (COMBOEX_INFO *infoPtr, INT_PTR index)
{
CBE_ITEMDATA const *item1;
CBE_ITEMDATA const *item2;
}
-static INT COMBOEX_SetCursel (COMBOEX_INFO *infoPtr, INT index)
+static INT COMBOEX_SetCursel (COMBOEX_INFO *infoPtr, INT_PTR index)
{
CBE_ITEMDATA *item;
INT sel;
if (!(item = COMBOEX_FindItem(infoPtr, index)))
return SendMessageW (infoPtr->hwndCombo, CB_SETCURSEL, index, 0);
- TRACE("selecting item %d text=%s\n", index, debugstr_txt(item->pszText));
+ TRACE("selecting item %ld text=%s\n", index, debugstr_txt(item->pszText));
infoPtr->selected = index;
sel = (INT)SendMessageW (infoPtr->hwndCombo, CB_SETCURSEL, index, 0);
}
-static DWORD_PTR COMBOEX_SetItemData (COMBOEX_INFO *infoPtr, INT index, DWORD_PTR data)
+static DWORD_PTR COMBOEX_SetItemData (COMBOEX_INFO *infoPtr, INT_PTR index, DWORD_PTR data)
{
CBE_ITEMDATA *item1;
CBE_ITEMDATA const *item2;
INT i;
/* allocate memory for info structure */
- infoPtr = (COMBOEX_INFO *)Alloc (sizeof(COMBOEX_INFO));
+ infoPtr = Alloc (sizeof(COMBOEX_INFO));
if (!infoPtr) return -1;
/* initialize info structure */
* Create an item structure to represent the data in the
* EDIT control. It is allocated zero-filled.
*/
- infoPtr->edit = (CBE_ITEMDATA *)Alloc (sizeof (CBE_ITEMDATA));
+ infoPtr->edit = Alloc (sizeof (CBE_ITEMDATA));
if (!infoPtr->edit) {
COMBOEX_Destroy(infoPtr);
return -1;
}
-static LRESULT COMBOEX_Command (COMBOEX_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT COMBOEX_Command (COMBOEX_INFO *infoPtr, WPARAM wParam)
{
LRESULT lret;
INT command = HIWORD(wParam);
CBE_ITEMDATA *item = 0;
WCHAR wintext[520];
- INT cursel, n, oldItem;
+ INT cursel, n;
+ INT_PTR oldItem;
NMCBEENDEDITW cbeend;
DWORD oldflags;
HWND parent = infoPtr->hwndNotify;
*/
oldItem = SendMessageW (infoPtr->hwndCombo, CB_GETCURSEL, 0, 0);
if (!(item = COMBOEX_FindItem(infoPtr, oldItem))) {
- ERR("item %d not found. Problem!\n", oldItem);
+ ERR("item %ld not found. Problem!\n", oldItem);
break;
}
infoPtr->selected = oldItem;
item->mask &= ~CBEIF_TEXT;
if( (len = GetWindowTextLengthW(infoPtr->hwndEdit)) ) {
item->mask |= CBEIF_TEXT;
- item->pszText = (LPWSTR)Alloc ((len + 1)*sizeof(WCHAR));
+ item->pszText = Alloc ((len + 1)*sizeof(WCHAR));
if (item->pszText)
GetWindowTextW(infoPtr->hwndEdit, item->pszText, len+1);
/* now draw the text */
if (!IsWindowVisible (infoPtr->hwndEdit)) {
- nbkc = GetSysColor ((dis->itemState & ODS_SELECTED) ?
- COLOR_HIGHLIGHT : COLOR_WINDOW);
+ nbkc = (dis->itemState & ODS_SELECTED) ?
+ comctl32_color.clrHighlight : comctl32_color.clrWindow;
bkc = SetBkColor (dis->hDC, nbkc);
- ntxc = GetSysColor ((dis->itemState & ODS_SELECTED) ?
- COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT);
+ ntxc = (dis->itemState & ODS_SELECTED) ?
+ comctl32_color.clrHighlightText : comctl32_color.clrWindowText;
txc = SetTextColor (dis->hDC, ntxc);
x = xbase + xioff;
y = dis->rcItem.top +
}
+static LRESULT COMBOEX_SetRedraw(COMBOEX_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
+{
+ LRESULT ret = DefWindowProcW( infoPtr->hwndSelf, WM_SETREDRAW, wParam, lParam );
+ if (wParam) RedrawWindow( infoPtr->hwndSelf, NULL, 0, RDW_INVALIDATE|RDW_ERASE|RDW_ALLCHILDREN );
+ return ret;
+}
+
+
static LRESULT COMBOEX_WindowPosChanging (COMBOEX_INFO *infoPtr, WINDOWPOS *wp)
{
RECT cbx_wrect, cbx_crect, cb_wrect;
static LRESULT WINAPI
COMBOEX_EditWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- HWND hwndComboex = (HWND)GetPropW(hwnd, COMBOEX_SUBCLASS_PROP);
+ HWND hwndComboex = GetPropW(hwnd, COMBOEX_SUBCLASS_PROP);
COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwndComboex);
NMCBEENDEDITW cbeend;
WCHAR edit_text[260];
* The following was determined by traces of the native
*/
hDC = (HDC) wParam;
- obkc = SetBkColor (hDC, GetSysColor (COLOR_WINDOW));
+ obkc = SetBkColor (hDC, comctl32_color.clrWindow);
GetClientRect (hwnd, &rect);
TRACE("erasing (%s)\n", wine_dbgstr_rect(&rect));
ExtTextOutW (hDC, 0, 0, ETO_OPAQUE, &rect, 0, 0, 0);
hwnd, uMsg, wParam, lParam);
case WM_KEYDOWN: {
- INT oldItem, selected, step = 1;
+ INT_PTR oldItem, selected, step = 1;
CBE_ITEMDATA *item;
switch ((INT)wParam)
oldItem = SendMessageW (infoPtr->hwndCombo, CB_GETCURSEL, 0, 0);
InvalidateRect (infoPtr->hwndCombo, 0, 0);
if (!(item = COMBOEX_FindItem(infoPtr, oldItem))) {
- ERR("item %d not found. Problem!\n", oldItem);
+ ERR("item %ld not found. Problem!\n", oldItem);
break;
}
infoPtr->selected = oldItem;
if (selected != -1) {
cmp_func_t cmptext = get_cmp_func(infoPtr);
item = COMBOEX_FindItem (infoPtr, selected);
- TRACE("handling VK_RETURN, selected = %d, selected_text=%s\n",
+ TRACE("handling VK_RETURN, selected = %ld, selected_text=%s\n",
selected, debugstr_txt(item->pszText));
TRACE("handling VK_RETURN, edittext=%s\n",
debugstr_w(edit_text));
static LRESULT WINAPI
COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- HWND hwndComboex = (HWND)GetPropW(hwnd, COMBOEX_SUBCLASS_PROP);
+ HWND hwndComboex = GetPropW(hwnd, COMBOEX_SUBCLASS_PROP);
COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwndComboex);
NMCBEENDEDITW cbeend;
NMMOUSE nmmse;
* The following was determined by traces of the native
*/
hDC = (HDC) wParam;
- obkc = SetBkColor (hDC, GetSysColor (COLOR_WINDOW));
+ obkc = SetBkColor (hDC, comctl32_color.clrWindow);
GetClientRect (hwnd, &rect);
TRACE("erasing (%s)\n", wine_dbgstr_rect(&rect));
ExtTextOutW (hDC, 0, 0, ETO_OPAQUE, &rect, 0, 0, 0);
LPCWSTR lastwrk;
cmp_func_t cmptext = get_cmp_func(infoPtr);
- INT selected = SendMessageW (infoPtr->hwndCombo,
- CB_GETCURSEL, 0, 0);
+ INT_PTR selected = SendMessageW (infoPtr->hwndCombo,
+ CB_GETCURSEL, 0, 0);
/* lstrlenW( lastworkingURL ) */
lastwrk = COMBOEX_GetText(infoPtr, item);
}
- TRACE("handling EN_CHANGE, selected = %d, selected_text=%s\n",
+ TRACE("handling EN_CHANGE, selected = %ld, selected_text=%s\n",
selected, debugstr_w(lastwrk));
TRACE("handling EN_CHANGE, edittext=%s\n",
debugstr_w(edit_text));
/* Window messages passed to parent */
case WM_COMMAND:
- return COMBOEX_Command (infoPtr, wParam, lParam);
+ return COMBOEX_Command (infoPtr, wParam);
case WM_NOTIFY:
if (infoPtr->NtfUnicode)
case WM_SIZE:
return COMBOEX_Size (infoPtr, LOWORD(lParam), HIWORD(lParam));
+ case WM_SETREDRAW:
+ return COMBOEX_SetRedraw(infoPtr, wParam, lParam);
+
case WM_WINDOWPOSCHANGING:
return COMBOEX_WindowPosChanging (infoPtr, (WINDOWPOS *)lParam);
SetFocus(infoPtr->hwndCombo);
return 0;
+ case WM_SYSCOLORCHANGE:
+ COMCTL32_RefreshSysColors();
+ return 0;
+
default:
- if ((uMsg >= WM_USER) && (uMsg < WM_APP))
+ if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg))
ERR("unknown msg %04x wp=%08lx lp=%08lx\n",uMsg,wParam,lParam);
return DefWindowProcW (hwnd, uMsg, wParam, lParam);
}