Ignore:
Timestamp:
Sep 15, 2001, 11:26:26 AM (24 years ago)
Author:
sandervl
Message:

restored old version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/comctl32/comboex.c

    r6705 r6709  
    44 *     result in a FIXME:
    55 *           CBES_EX_NOEDITIMAGEINDENT
    6  *       CBES_EX_PATHWORDBREAKPROC
    7  *       CBES_EX_NOSIZELIMIT
    8  *       CBES_EX_CASESENSITIVE
     6 *           CBES_EX_PATHWORDBREAKPROC
     7 *           CBES_EX_NOSIZELIMIT
     8 *           CBES_EX_CASESENSITIVE
    99 *  2. None of the following callback items are implemented. Therefor
    1010 *     no CBEN_GETDISPINFO notifies are issued. Use in either CBEM_INSERTITEM
     
    3737 *      generate message sequence similar to native DLL.
    3838 *   2. Handle case where CBEM_SETITEM is called to display data in EDIT
    39  *      Control.
     39 *      Control. 
    4040 *   3. Add override for WNDPROC for the EDIT control (reqed for VK_RETURN).
    4141 *   4. Dump input data for things using COMBOBOXEXITEM{A|W}.
     
    5555 *   3. Lock image selected status to focus state of edit control if
    5656 *      edit control exists. Mimics native actions.
    57  *   4. Implemented WM_SETFOCUS in EditWndProc to track status of
     57 *   4. Implemented WM_SETFOCUS in EditWndProc to track status of 
    5858 *      focus for 3 above.
    5959 *   5. The LBN_SELCHANGE is just for documentation purposes.
     
    7070 *
    7171 *  mod 6
    72  *   1. Add support for WM_NOTIFYFORMAT (both incoming and outgoing) and do
     72 *   1. Add support for WM_NOTIFYFORMAT (both incoming and outgoing) and do 
    7373 *      WM_NOTIFY correctly based on results.
    7474 *   2. Fix memory leaks of text strings in COMBOEX_WM_DELETEITEM.
    7575 *   3. Add routines to handle special cases of NMCBEENDEDIT and NMCOMBOXEX
    76  *      so translation to ANSI is done correctly.
     76 *      so translation to ANSI is done correctly. 
    7777 *   4. Fix some issues with COMBOEX_DrawItem.
    7878 *
     
    150150/*
    151151 * Special flag set in DRAWITEMSTRUCT itemState field. It is set by
    152  * the ComboEx version of the Combo Window Proc so that when the
    153  * WM_DRAWITEM message is then passed to ComboEx, we know that this
     152 * the ComboEx version of the Combo Window Proc so that when the 
     153 * WM_DRAWITEM message is then passed to ComboEx, we know that this 
    154154 * particular WM_DRAWITEM message is for listbox only items. Any messasges
    155155 * without this flag is then for the Edit control field.
    156156 *
    157  * We really cannot use the ODS_COMBOBOXEDIT flag because MSDN states that
     157 * We really cannot use the ODS_COMBOBOXEDIT flag because MSDN states that 
    158158 * only version 4.0 applications will have ODS_COMBOBOXEDIT set.
    159159 */
     
    189189    if (TRACE_ON(comboex)){
    190190      TRACE("item %p - mask=%08x, pszText=%p, cchTM=%d, iImage=%d\n",
    191         item, item->mask, item->pszText, item->cchTextMax,
    192         item->iImage);
     191            item, item->mask, item->pszText, item->cchTextMax,
     192            item->iImage);
    193193      TRACE("item %p - iSelectedImage=%d, iOverlay=%d, iIndent=%d, lParam=%08lx\n",
    194         item, item->iSelectedImage, item->iOverlay, item->iIndent, item->lParam);
     194            item, item->iSelectedImage, item->iOverlay, item->iIndent, item->lParam);
    195195      if ((item->mask & CBEIF_TEXT) && item->pszText)
    196       TRACE("item %p - pszText=%s\n",
    197         item, debugstr_w((const WCHAR *)item->pszText));
     196          TRACE("item %p - pszText=%s\n",
     197                item, debugstr_w((const WCHAR *)item->pszText));
    198198    }
    199199}
     
    205205    if (TRACE_ON(comboex)){
    206206      TRACE("input - mask=%08x, iItem=%d, pszText=%p, cchTM=%d, iImage=%d\n",
    207         input->mask, input->iItem, input->pszText, input->cchTextMax,
    208         input->iImage);
     207            input->mask, input->iItem, input->pszText, input->cchTextMax,
     208            input->iImage);
    209209      if ((input->mask & CBEIF_TEXT) && input->pszText) {
    210       if (true_for_w)
    211           TRACE("input - pszText=<%s>\n",
    212             debugstr_w((const WCHAR *)input->pszText));
    213       else
    214           TRACE("input - pszText=<%s>\n",
    215             debugstr_a((const char *)input->pszText));
     210          if (true_for_w)
     211              TRACE("input - pszText=<%s>\n",
     212                    debugstr_w((const WCHAR *)input->pszText));
     213          else
     214              TRACE("input - pszText=<%s>\n",
     215                    debugstr_a((const char *)input->pszText));
    216216      }
    217217      TRACE("input - iSelectedImage=%d, iOverlay=%d, iIndent=%d, lParam=%08lx\n",
    218         input->iSelectedImage, input->iOverlay, input->iIndent, input->lParam);
     218            input->iSelectedImage, input->iOverlay, input->iIndent, input->lParam);
    219219    }
    220220}
     
    226226    COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
    227227
    228     if (infoPtr->hwndCombo)
    229     return SendMessageA (infoPtr->hwndCombo, uMsg, wParam, lParam);
     228    if (infoPtr->hwndCombo)   
     229        return SendMessageA (infoPtr->hwndCombo, uMsg, wParam, lParam);
    230230
    231231    return 0;
     
    241241    hdr->code = code;
    242242    if (infoPtr->NtfUnicode)
    243     return SendMessageW (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0,
    244                  (LPARAM)hdr);
     243        return SendMessageW (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0,
     244                             (LPARAM)hdr);
    245245    else
    246     return SendMessageA (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0,
    247                  (LPARAM)hdr);
     246        return SendMessageA (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0,
     247                             (LPARAM)hdr);
    248248}
    249249
     
    259259    hdr->hdr.code = code;
    260260    if (infoPtr->NtfUnicode)
    261     return SendMessageW (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0,
    262                  (LPARAM)hdr);
     261        return SendMessageW (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0,
     262                             (LPARAM)hdr);
    263263    else {
    264     LPWSTR str, ostr = NULL;
    265     INT ret, len = 0;
    266 
    267     if (hdr->ceItem.mask & CBEIF_TEXT) {
    268         ostr = hdr->ceItem.pszText;
    269         str = ostr;
    270         if (!str) str = (LPWSTR)L"";
    271         len = WideCharToMultiByte (CP_ACP, 0, str, -1, 0, 0, NULL, NULL);
    272         if (len > 0) {
    273         hdr->ceItem.pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(CHAR));
    274         WideCharToMultiByte (CP_ACP, 0, str, -1, (LPSTR)hdr->ceItem.pszText,
    275                      len, NULL, NULL);
    276         }
    277     }
    278 
    279     ret = SendMessageA (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0,
    280                 (LPARAM)hdr);
    281     if (hdr->ceItem.mask & CBEIF_TEXT) {
    282         if (len > 0)
    283         COMCTL32_Free (hdr->ceItem.pszText);
    284         hdr->ceItem.pszText = ostr;
    285     }
    286     return ret;
     264        LPWSTR str, ostr = NULL;
     265        INT ret, len = 0;
     266
     267        if (hdr->ceItem.mask & CBEIF_TEXT) {
     268            ostr = hdr->ceItem.pszText;
     269            str = ostr;
     270            if (!str) str = (LPWSTR)L"";
     271            len = WideCharToMultiByte (CP_ACP, 0, str, -1, 0, 0, NULL, NULL);
     272            if (len > 0) {
     273                hdr->ceItem.pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(CHAR));
     274                WideCharToMultiByte (CP_ACP, 0, str, -1, (LPSTR)hdr->ceItem.pszText,
     275                                     len, NULL, NULL);
     276            }
     277        }
     278
     279        ret = SendMessageA (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0,
     280                            (LPARAM)hdr);
     281        if (hdr->ceItem.mask & CBEIF_TEXT) {
     282            if (len > 0)
     283                COMCTL32_Free (hdr->ceItem.pszText);
     284            hdr->ceItem.pszText = ostr;
     285        }
     286        return ret;
    287287    }
    288288}
     
    299299    hdr->hdr.code = (infoPtr->NtfUnicode) ? CBEN_ENDEDITW : CBEN_ENDEDITA;
    300300    if (infoPtr->NtfUnicode)
    301     return SendMessageW (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0,
    302                  (LPARAM)hdr);
     301        return SendMessageW (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0,
     302                             (LPARAM)hdr);
    303303    else {
    304     NMCBEENDEDITA ansi;
    305 
    306     memcpy (&ansi.hdr, &hdr->hdr, sizeof(NMHDR));
    307     ansi.fChanged = hdr->fChanged;
    308     ansi.iNewSelection = hdr->iNewSelection;
    309     WideCharToMultiByte (CP_ACP, 0, itemText, -1,
    310                  (LPSTR)&ansi.szText, CBEMAXSTRLEN, NULL, NULL);
    311     ansi.iWhy = hdr->iWhy;
    312     return SendMessageA (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0,
    313                  (LPARAM)&ansi);
     304        NMCBEENDEDITA ansi;
     305
     306        memcpy (&ansi.hdr, &hdr->hdr, sizeof(NMHDR));
     307        ansi.fChanged = hdr->fChanged;
     308        ansi.iNewSelection = hdr->iNewSelection;
     309        WideCharToMultiByte (CP_ACP, 0, itemText, -1,
     310                             (LPSTR)&ansi.szText, CBEMAXSTRLEN, NULL, NULL);
     311        ansi.iWhy = hdr->iWhy;
     312        return SendMessageA (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0,
     313                             (LPARAM)&ansi);
    314314    }
    315315}
     
    340340    }
    341341    if (cit->mask & CBEIF_IMAGE)
    342     cit->iImage         = item->iImage;
     342        cit->iImage         = item->iImage;
    343343    if (cit->mask & CBEIF_SELECTEDIMAGE)
    344     cit->iSelectedImage = item->iSelectedImage;
     344        cit->iSelectedImage = item->iSelectedImage;
    345345    if (cit->mask & CBEIF_OVERLAY)
    346     cit->iOverlay       = item->iOverlay;
     346        cit->iOverlay       = item->iOverlay;
    347347    if (cit->mask & CBEIF_INDENT)
    348     cit->iIndent        = item->iIndent;
     348        cit->iIndent        = item->iIndent;
    349349    if (cit->mask & CBEIF_LPARAM)
    350     cit->lParam         = item->lParam;
     350        cit->lParam         = item->lParam;
    351351
    352352}
     
    364364    iinfo.rcImage.left = iinfo.rcImage.right = 0;
    365365    if (infoPtr->himl) {
    366     ImageList_GetImageInfo(infoPtr->himl, 0, &iinfo);
    367     xoff = iinfo.rcImage.right - iinfo.rcImage.left + CBE_SEP;
     366        ImageList_GetImageInfo(infoPtr->himl, 0, &iinfo);
     367        xoff = iinfo.rcImage.right - iinfo.rcImage.left + CBE_SEP;
    368368    }
    369369    GetClientRect (infoPtr->hwndCombo, &rect);
     
    380380
    381381    TRACE("Combo client (%d,%d)-(%d,%d), setting Edit to (%d,%d)-(%d,%d)\n",
    382       rect.left, rect.top, rect.right, rect.bottom,
    383       x, y, x + w, y + h);
     382          rect.left, rect.top, rect.right, rect.bottom,
     383          x, y, x + w, y + h);
    384384    SetWindowPos(infoPtr->hwndEdit, HWND_TOP,
    385         x, y,
    386         w, h,
    387         SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOZORDER);
     385                x, y,
     386                w, h,
     387                SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOZORDER);
    388388}
    389389
     
    399399    cy = mysize.cy + CBE_EXTRA;
    400400    if (infoPtr->himl) {
    401     ImageList_GetImageInfo(infoPtr->himl, 0, &iinfo);
    402     cy = max (iinfo.rcImage.bottom - iinfo.rcImage.top, cy);
    403     TRACE("upgraded height due to image:  height=%d\n", cy);
     401        ImageList_GetImageInfo(infoPtr->himl, 0, &iinfo);
     402        cy = max (iinfo.rcImage.bottom - iinfo.rcImage.top, cy);
     403        TRACE("upgraded height due to image:  height=%d\n", cy);
    404404    }
    405405    SendMessageW (hwnd, CB_SETITEMHEIGHT, (WPARAM) -1, (LPARAM) cy);
    406406    if (infoPtr->hwndCombo)
    407407        SendMessageW (infoPtr->hwndCombo, CB_SETITEMHEIGHT,
    408               (WPARAM) 0, (LPARAM) cy);
     408                      (WPARAM) 0, (LPARAM) cy);
    409409}
    410410
     
    419419    /*      EM_SETSEL32 (0,-1)      */
    420420    if (item->mask & CBEIF_TEXT) {
    421     SendMessageW (infoPtr->hwndEdit, WM_SETTEXT, 0, (LPARAM)item->pszText);
    422     SendMessageW (infoPtr->hwndEdit, EM_SETSEL, 0, 0);
    423     SendMessageW (infoPtr->hwndEdit, EM_SETSEL, 0, -1);
    424     }
    425 }
    426 
    427 
     421        SendMessageW (infoPtr->hwndEdit, WM_SETTEXT, 0, (LPARAM)item->pszText);
     422        SendMessageW (infoPtr->hwndEdit, EM_SETSEL, 0, 0);
     423        SendMessageW (infoPtr->hwndEdit, EM_SETSEL, 0, -1);
     424    }
     425}
     426
     427 
    428428static CBE_ITEMDATA *
    429429COMBOEX_FindItem(COMBOEX_INFO *infoPtr, INT index)
     
    433433
    434434    if ((index > infoPtr->nb_items) || (index < -1))
    435     return 0;
     435        return 0;
    436436    if (index == -1)
    437     return infoPtr->edit;
     437        return infoPtr->edit;
    438438    item = infoPtr->items;
    439439    i = infoPtr->nb_items - 1;
     
    441441    /* find the item in the list */
    442442    while (item && (i > index)) {
    443     item = (CBE_ITEMDATA *)item->next;
    444     i--;
     443        item = (CBE_ITEMDATA *)item->next;
     444        i--;
    445445    }
    446446    if (!item || (i != index)) {
    447     FIXME("COMBOBOXEX item structures broken. Please report!\n");
    448     return 0;
     447        FIXME("COMBOBOXEX item structures broken. Please report!\n");
     448        return 0;
    449449    }
    450450    return item;
     
    456456{
    457457    if (item->pszText == LPSTR_TEXTCALLBACKW)
    458     FIXME("Callback not implemented yet for pszText\n");
     458        FIXME("Callback not implemented yet for pszText\n");
    459459    if (item->iImage == I_IMAGECALLBACK)
    460     FIXME("Callback not implemented yet for iImage\n");
     460        FIXME("Callback not implemented yet for iImage\n");
    461461    if (item->iSelectedImage == I_IMAGECALLBACK)
    462     FIXME("Callback not implemented yet for iSelectedImage\n");
     462        FIXME("Callback not implemented yet for iSelectedImage\n");
    463463    if (item->iOverlay == I_IMAGECALLBACK)
    464     FIXME("Callback not implemented yet for iOverlay\n");
     464        FIXME("Callback not implemented yet for iOverlay\n");
    465465    if (item->iIndent == I_INDENTCALLBACK)
    466     FIXME("Callback not implemented yet for iIndent\n");
     466        FIXME("Callback not implemented yet for iIndent\n");
    467467}
    468468
     
    482482    /* if item number requested does not exist then return failure */
    483483    if ((index > infoPtr->nb_items) || (index < 0)) {
    484     ERR("attempt to delete item that does not exist\n");
    485     return CB_ERR;
     484        ERR("attempt to delete item that does not exist\n");
     485        return CB_ERR;
    486486    }
    487487
    488488    if (!(item = COMBOEX_FindItem(infoPtr, index))) {
    489     ERR("attempt to delete item that was not found!\n");
    490     return CB_ERR;
     489        ERR("attempt to delete item that was not found!\n");
     490        return CB_ERR;
    491491    }
    492492
     
    515515
    516516    if ((GetWindowLongA (hwnd, GWL_STYLE) & CBS_DROPDOWNLIST) != CBS_DROPDOWN)
    517     return 0;
     517        return 0;
    518518
    519519    TRACE("-- 0x%x\n", infoPtr->hwndEdit);
     
    560560    /* if item number requested does not exist then return failure */
    561561    if ((index > infoPtr->nb_items) || (index < -1)) {
    562     ERR("attempt to get item that does not exist\n");
    563     return 0;
     562        ERR("attempt to get item that does not exist\n");
     563        return 0;
    564564    }
    565565
    566566    /* if the item is the edit control and there is no edit control, skip */
    567     if ((index == -1) &&
     567    if ((index == -1) && 
    568568        ((GetWindowLongA (hwnd, GWL_STYLE) & CBS_DROPDOWNLIST) != CBS_DROPDOWN))
    569         return 0;
     569            return 0;
    570570
    571571    if (!(item = COMBOEX_FindItem(infoPtr, index))) {
    572     ERR("attempt to get item that was not found!\n");
    573     return 0;
     572        ERR("attempt to get item that was not found!\n");
     573        return 0;
    574574    }
    575575
     
    594594
    595595    len = WideCharToMultiByte (CP_ACP, 0, tmpcit.pszText, -1, 0, 0, NULL, NULL);
    596     if (len > 0)
    597     WideCharToMultiByte (CP_ACP, 0, tmpcit.pszText, -1,
    598                  cit->pszText, cit->cchTextMax, NULL, NULL);
     596    if (len > 0) 
     597        WideCharToMultiByte (CP_ACP, 0, tmpcit.pszText, -1,
     598                             cit->pszText, cit->cchTextMax, NULL, NULL);
    599599
    600600    cit->iImage = tmpcit.iImage;
     
    613613    COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
    614614
    615     TRACE("%s hwnd=0x%x\n",
    616        infoPtr->bUnicode ? "TRUE" : "FALSE", hwnd);
     615    TRACE("%s hwnd=0x%x\n", 
     616           infoPtr->bUnicode ? "TRUE" : "FALSE", hwnd);
    617617
    618618    return infoPtr->bUnicode;
     
    626626
    627627    if ((GetWindowLongA (hwnd, GWL_STYLE) & CBS_DROPDOWNLIST) != CBS_DROPDOWN)
    628     return FALSE;
    629     if ((infoPtr->flags & (WCBE_ACTEDIT | WCBE_EDITCHG)) ==
    630     (WCBE_ACTEDIT | WCBE_EDITCHG))
    631     return TRUE;
     628        return FALSE;
     629    if ((infoPtr->flags & (WCBE_ACTEDIT | WCBE_EDITCHG)) == 
     630        (WCBE_ACTEDIT | WCBE_EDITCHG))
     631        return TRUE;
    632632    return FALSE;
    633633}
     
    661661        /* fast path for iItem = -1 */
    662662        item->next = infoPtr->items;
    663     infoPtr->items = item;
     663        infoPtr->items = item;
    664664    }
    665665    else {
    666666        INT i = infoPtr->nb_items-1;
    667     CBE_ITEMDATA *moving = infoPtr->items;
    668 
    669     while ((i > index) && moving) {
    670         moving = (CBE_ITEMDATA *)moving->next;
    671         i--;
    672     }
    673     if (!moving) {
    674         FIXME("COMBOBOXEX item structures broken. Please report!\n");
    675         COMCTL32_Free(item);
    676         return -1;
    677     }
    678     item->next = moving->next;
    679     moving->next = item;
     667        CBE_ITEMDATA *moving = infoPtr->items;
     668
     669        while ((i > index) && moving) {
     670            moving = (CBE_ITEMDATA *)moving->next;
     671            i--;
     672        }
     673        if (!moving) {
     674            FIXME("COMBOBOXEX item structures broken. Please report!\n");
     675            COMCTL32_Free(item);
     676            return -1;
     677        }
     678        item->next = moving->next;
     679        moving->next = item;
    680680    }
    681681
     
    684684    if (item->mask & CBEIF_TEXT) {
    685685        LPWSTR str;
    686     INT len;
     686        INT len;
    687687
    688688        str = cit->pszText;
    689689        if (!str) str = (LPWSTR) L"";
    690     len = strlenW (str);
    691     if (len > 0) {
    692         item->pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
    693         strcpyW (item->pszText, str);
    694     }
    695     else
    696         item->pszText = NULL;
     690        len = strlenW (str);
     691        if (len > 0) {
     692            item->pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
     693            strcpyW (item->pszText, str);
     694        }
     695        else
     696            item->pszText = NULL;
    697697        item->cchTextMax   = cit->cchTextMax;
    698698    }
     
    713713    COMBOEX_DumpItem (item);
    714714
    715     SendMessageW (infoPtr->hwndCombo, CB_INSERTSTRING,
    716           (WPARAM)cit->iItem, (LPARAM)item);
     715    SendMessageW (infoPtr->hwndCombo, CB_INSERTSTRING, 
     716                  (WPARAM)cit->iItem, (LPARAM)item);
    717717
    718718    COMBOEX_CopyItem (infoPtr, item, &nmcit.ceItem);
     
    727727COMBOEX_InsertItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
    728728{
    729     COMBOBOXEXITEMA *cit = (COMBOBOXEXITEMA *) lParam;
    730     COMBOBOXEXITEMW citW;
    731     LRESULT     ret;
     729    COMBOBOXEXITEMA     *cit = (COMBOBOXEXITEMA *) lParam;
     730    COMBOBOXEXITEMW     citW;
     731    LRESULT             ret;
    732732
    733733    memcpy(&citW,cit,sizeof(COMBOBOXEXITEMA));
    734734    if (cit->mask & CBEIF_TEXT) {
    735735        LPSTR str;
    736     INT len;
     736        INT len;
    737737
    738738        str = cit->pszText;
    739739        if (!str) str="";
    740     len = MultiByteToWideChar (CP_ACP, 0, str, -1, NULL, 0);
    741     if (len > 0) {
    742         citW.pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
    743         MultiByteToWideChar (CP_ACP, 0, str, -1, citW.pszText, len);
    744     }
     740        len = MultiByteToWideChar (CP_ACP, 0, str, -1, NULL, 0);
     741        if (len > 0) {
     742            citW.pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
     743            MultiByteToWideChar (CP_ACP, 0, str, -1, citW.pszText, len);
     744        }
    745745    }
    746746    ret = COMBOEX_InsertItemW(hwnd,wParam,(LPARAM)&citW);;
    747747
    748748    if (cit->mask & CBEIF_TEXT)
    749     COMCTL32_Free(citW.pszText);
     749        COMCTL32_Free(citW.pszText);
    750750    return ret;
    751751}
     
    763763
    764764    if (lParam & (CBES_EX_NOEDITIMAGEINDENT |
    765           CBES_EX_PATHWORDBREAKPROC |
    766           CBES_EX_NOSIZELIMIT |
    767           CBES_EX_CASESENSITIVE))
    768     FIXME("Extended style not implemented %08lx\n", lParam);
     765                  CBES_EX_PATHWORDBREAKPROC |
     766                  CBES_EX_NOSIZELIMIT |
     767                  CBES_EX_CASESENSITIVE))
     768        FIXME("Extended style not implemented %08lx\n", lParam);
    769769
    770770    if ((DWORD)wParam) {
    771     infoPtr->dwExtStyle = (infoPtr->dwExtStyle & ~(DWORD)wParam) | (DWORD)lParam;
     771        infoPtr->dwExtStyle = (infoPtr->dwExtStyle & ~(DWORD)wParam) | (DWORD)lParam;
    772772    }
    773773    else
    774     infoPtr->dwExtStyle = (DWORD)lParam;
     774        infoPtr->dwExtStyle = (DWORD)lParam;
    775775
    776776    /*
     
    778778     */
    779779    if ((infoPtr->dwExtStyle & CBES_EX_NOEDITIMAGE) ^
    780     (dwTemp & CBES_EX_NOEDITIMAGE)) {
    781     /* if state of EX_NOEDITIMAGE changes, invalidate all */
    782     TRACE("EX_NOEDITIMAGE state changed to %ld\n",
    783         infoPtr->dwExtStyle & CBES_EX_NOEDITIMAGE);
    784     InvalidateRect (hwnd, NULL, TRUE);
    785     COMBOEX_AdjustEditPos (infoPtr);
    786     if (infoPtr->hwndEdit)
    787         InvalidateRect (infoPtr->hwndEdit, NULL, TRUE);
     780        (dwTemp & CBES_EX_NOEDITIMAGE)) {
     781        /* if state of EX_NOEDITIMAGE changes, invalidate all */
     782        TRACE("EX_NOEDITIMAGE state changed to %ld\n",
     783            infoPtr->dwExtStyle & CBES_EX_NOEDITIMAGE);
     784        InvalidateRect (hwnd, NULL, TRUE);
     785        COMBOEX_AdjustEditPos (infoPtr);
     786        if (infoPtr->hwndEdit)
     787            InvalidateRect (infoPtr->hwndEdit, NULL, TRUE);
    788788    }
    789789
     
    826826    /* if item number requested does not exist then return failure */
    827827    if ((index > infoPtr->nb_items) || (index < -1)) {
    828     ERR("attempt to set item that does not exist yet!\n");
    829     return 0;
     828        ERR("attempt to set item that does not exist yet!\n");
     829        return 0;
    830830    }
    831831
    832832    /* if the item is the edit control and there is no edit control, skip */
    833     if ((index == -1) &&
     833    if ((index == -1) && 
    834834        ((GetWindowLongA (hwnd, GWL_STYLE) & CBS_DROPDOWNLIST) != CBS_DROPDOWN))
    835         return 0;
     835            return 0;
    836836
    837837    if (!(item = COMBOEX_FindItem(infoPtr, index))) {
    838     ERR("attempt to set item that was not found!\n");
    839     return 0;
    840     }
    841 
    842     /* add/change stuff to the internal item structure */
     838        ERR("attempt to set item that was not found!\n");
     839        return 0;
     840    }
     841
     842    /* add/change stuff to the internal item structure */ 
    843843    item->mask |= cit->mask;
    844844    if (cit->mask & CBEIF_TEXT) {
    845845        LPWSTR str;
    846     INT len;
    847     WCHAR emptystr[1] = {0};
     846        INT len;
     847        WCHAR emptystr[1] = {0};
    848848
    849849        str = cit->pszText;
    850850        if (!str) str=emptystr;
    851     len = strlenW(str);
    852     if (len > 0) {
    853         item->pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
    854         strcpyW(item->pszText,str);
    855     }
     851        len = strlenW(str);
     852        if (len > 0) {
     853            item->pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
     854            strcpyW(item->pszText,str);
     855        }
    856856        item->cchTextMax   = cit->cchTextMax;
    857857    }
     
    873873    /* if original request was to update edit control, do some fast foot work */
    874874    if (cit->iItem == -1) {
    875     COMBOEX_SetEditText (infoPtr, item);
    876     RedrawWindow (infoPtr->hwndCombo, 0, 0, RDW_ERASE | RDW_INVALIDATE);
     875        COMBOEX_SetEditText (infoPtr, item);
     876        RedrawWindow (infoPtr->hwndCombo, 0, 0, RDW_ERASE | RDW_INVALIDATE);
    877877    }
    878878    return TRUE;
     
    882882COMBOEX_SetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
    883883{
    884     COMBOBOXEXITEMA *cit = (COMBOBOXEXITEMA *) lParam;
    885     COMBOBOXEXITEMW citW;
    886     LRESULT     ret;
     884    COMBOBOXEXITEMA     *cit = (COMBOBOXEXITEMA *) lParam;
     885    COMBOBOXEXITEMW     citW;
     886    LRESULT             ret;
    887887
    888888    memcpy(&citW,cit,sizeof(COMBOBOXEXITEMA));
    889889    if (cit->mask & CBEIF_TEXT) {
    890890        LPSTR str;
    891     INT len;
     891        INT len;
    892892
    893893        str = cit->pszText;
    894894        if (!str) str="";
    895     len = MultiByteToWideChar (CP_ACP, 0, str, -1, NULL, 0);
    896     if (len > 0) {
    897         citW.pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
    898         MultiByteToWideChar (CP_ACP, 0, str, -1, citW.pszText, len);
    899     }
     895        len = MultiByteToWideChar (CP_ACP, 0, str, -1, NULL, 0);
     896        if (len > 0) {
     897            citW.pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
     898            MultiByteToWideChar (CP_ACP, 0, str, -1, citW.pszText, len);
     899        }
    900900    }
    901901    ret = COMBOEX_SetItemW(hwnd,wParam,(LPARAM)&citW);;
    902902
    903903    if (cit->mask & CBEIF_TEXT)
    904     COMCTL32_Free(citW.pszText);
     904        COMCTL32_Free(citW.pszText);
    905905    return ret;
    906906}
     
    913913    BOOL bTemp = infoPtr->bUnicode;
    914914
    915     TRACE("to %s hwnd=0x%04x, was %s\n",
    916       ((BOOL)wParam) ? "TRUE" : "FALSE", hwnd,
    917       (bTemp) ? "TRUE" : "FALSE");
     915    TRACE("to %s hwnd=0x%04x, was %s\n", 
     916          ((BOOL)wParam) ? "TRUE" : "FALSE", hwnd,
     917          (bTemp) ? "TRUE" : "FALSE");
    918918
    919919    infoPtr->bUnicode = (BOOL)wParam;
     
    937937    i = MultiByteToWideChar (CP_ACP, 0, (LPSTR)lParam, -1, NULL, 0);
    938938    if (i > 0) {
    939     desired = (LPWSTR)COMCTL32_Alloc ((i + 1)*sizeof(WCHAR));
    940     MultiByteToWideChar (CP_ACP, 0, (LPSTR)lParam, -1, desired, i);
     939        desired = (LPWSTR)COMCTL32_Alloc ((i + 1)*sizeof(WCHAR));
     940        MultiByteToWideChar (CP_ACP, 0, (LPSTR)lParam, -1, desired, i);
    941941    }
    942942
     
    945945    /* now search from after starting loc and wrapping back to start */
    946946    for(i=start+1; i<count; i++) {
    947     item = (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo,
    948               CB_GETITEMDATA, (WPARAM)i, 0);
    949     TRACE("desired=%s, item=%s\n",
    950           debugstr_w(desired), debugstr_w(item->pszText));
    951     if (lstrcmpiW(item->pszText, desired) == 0) {
    952         COMCTL32_Free (desired);
    953         return i;
    954     }
     947        item = (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo,
     948                          CB_GETITEMDATA, (WPARAM)i, 0);
     949        TRACE("desired=%s, item=%s\n",
     950              debugstr_w(desired), debugstr_w(item->pszText));
     951        if (lstrcmpiW(item->pszText, desired) == 0) {
     952            COMCTL32_Free (desired);
     953            return i;
     954        }
    955955    }
    956956    for(i=0; i<=start; i++) {
    957     item = (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo,
    958               CB_GETITEMDATA, (WPARAM)i, 0);
    959     TRACE("desired=%s, item=%s\n",
    960           debugstr_w(desired), debugstr_w(item->pszText));
    961     if (lstrcmpiW(item->pszText, desired) == 0) {
    962         COMCTL32_Free (desired);
    963         return i;
    964     }
     957        item = (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo,
     958                          CB_GETITEMDATA, (WPARAM)i, 0);
     959        TRACE("desired=%s, item=%s\n",
     960              debugstr_w(desired), debugstr_w(item->pszText));
     961        if (lstrcmpiW(item->pszText, desired) == 0) {
     962            COMCTL32_Free (desired);
     963            return i;
     964        }
    965965    }
    966966    COMCTL32_Free(desired);
     
    977977    LRESULT lret = 0;
    978978
    979     item1 = (CBE_ITEMDATA *)COMBOEX_Forward (hwnd, CB_GETITEMDATA,
    980                          wParam, lParam);
     979    item1 = (CBE_ITEMDATA *)COMBOEX_Forward (hwnd, CB_GETITEMDATA, 
     980                                             wParam, lParam);
    981981    if ((item1 != NULL) && ((LRESULT)item1 != CB_ERR)) {
    982     item2 = COMBOEX_FindItem (infoPtr, index);
    983     if (item2 != item1) {
    984         ERR("data structures damaged!\n");
    985         return CB_ERR;
    986     }
    987     if (item1->mask & CBEIF_LPARAM)
    988         lret = (LRESULT) item1->lParam;
    989     TRACE("returning 0x%08lx\n", lret);
    990     return lret;
     982        item2 = COMBOEX_FindItem (infoPtr, index);
     983        if (item2 != item1) {
     984            ERR("data structures damaged!\n");
     985            return CB_ERR;
     986        }
     987        if (item1->mask & CBEIF_LPARAM)
     988            lret = (LRESULT) item1->lParam;
     989        TRACE("returning 0x%08lx\n", lret);
     990        return lret;
    991991    }
    992992    lret = (LRESULT)item1;
     
    10051005
    10061006    if (!(item = COMBOEX_FindItem(infoPtr, index))) {
    1007     /* FIXME: need to clear selection */
    1008     return CB_ERR;
     1007        /* FIXME: need to clear selection */
     1008        return CB_ERR;
    10091009    }
    10101010
    10111011    TRACE("selecting item %d text=%s\n", index, (item->pszText) ?
    1012       debugstr_w(item->pszText) : "<null>");
     1012          debugstr_w(item->pszText) : "<null>");
    10131013    infoPtr->selected = index;
    10141014
     
    10261026    CBE_ITEMDATA *item1, *item2;
    10271027
    1028     item1 = (CBE_ITEMDATA *)COMBOEX_Forward (hwnd, CB_GETITEMDATA,
    1029                          wParam, lParam);
     1028    item1 = (CBE_ITEMDATA *)COMBOEX_Forward (hwnd, CB_GETITEMDATA, 
     1029                                             wParam, lParam);
    10301030    if ((item1 != NULL) && ((LRESULT)item1 != CB_ERR)) {
    1031     item2 = COMBOEX_FindItem (infoPtr, index);
    1032     if (item2 != item1) {
    1033         ERR("data structures damaged!\n");
    1034         return CB_ERR;
    1035     }
    1036     item1->mask |= CBEIF_LPARAM;
    1037     item1->lParam = lParam;
    1038     TRACE("setting lparam to 0x%08lx\n", lParam);
    1039     return 0;
     1031        item2 = COMBOEX_FindItem (infoPtr, index);
     1032        if (item2 != item1) {
     1033            ERR("data structures damaged!\n");
     1034            return CB_ERR;
     1035        }
     1036        item1->mask |= CBEIF_LPARAM;
     1037        item1->lParam = lParam;
     1038        TRACE("setting lparam to 0x%08lx\n", lParam);
     1039        return 0;
    10401040    }
    10411041    TRACE("non-valid result from combo 0x%08lx\n", (DWORD)item1);
     
    10541054    /* First, lets forward the message to the normal combo control
    10551055       just like Windows.     */
    1056     if (infoPtr->hwndCombo)
     1056    if (infoPtr->hwndCombo)   
    10571057       SendMessageW (infoPtr->hwndCombo, CB_SETITEMHEIGHT, wParam, lParam);
    10581058
     
    10601060    GetWindowRect (hwnd, &cbx_wrect);
    10611061    GetClientRect (hwnd, &cbx_crect);
    1062     /* the height of comboex as height of the combo + comboex border */
     1062    /* the height of comboex as height of the combo + comboex border */ 
    10631063    height = cb_wrect.bottom-cb_wrect.top
    10641064             + cbx_wrect.bottom-cbx_wrect.top
    10651065             - (cbx_crect.bottom-cbx_crect.top);
    10661066    TRACE("EX window=(%d,%d)-(%d,%d), client=(%d,%d)-(%d,%d)\n",
    1067       cbx_wrect.left, cbx_wrect.top, cbx_wrect.right, cbx_wrect.bottom,
    1068       cbx_crect.left, cbx_crect.top, cbx_crect.right, cbx_crect.bottom);
     1067          cbx_wrect.left, cbx_wrect.top, cbx_wrect.right, cbx_wrect.bottom,
     1068          cbx_crect.left, cbx_crect.top, cbx_crect.right, cbx_crect.bottom);
    10691069    TRACE("CB window=(%d,%d)-(%d,%d), EX setting=(0,0)-(%d,%d)\n",
    1070       cb_wrect.left, cb_wrect.top, cb_wrect.right, cb_wrect.bottom,
    1071       cbx_wrect.right-cbx_wrect.left, height);
     1070          cb_wrect.left, cb_wrect.top, cb_wrect.right, cb_wrect.bottom,
     1071          cbx_wrect.right-cbx_wrect.left, height);
    10721072    SetWindowPos (hwnd, HWND_TOP, 0, 0,
    1073           cbx_wrect.right-cbx_wrect.left,
    1074           height,
    1075           SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE);
     1073                  cbx_wrect.right-cbx_wrect.left,
     1074                  height,
     1075                  SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE);
    10761076
    10771077    return ret;
     
    11011101#endif
    11021102    if (infoPtr == NULL) {
    1103     ERR("could not allocate info memory!\n");
    1104     return 0;
     1103        ERR("could not allocate info memory!\n");
     1104        return 0;
    11051105    }
    11061106
     
    11151115
    11161116    i = SendMessageA(GetParent (hwnd),
    1117              WM_NOTIFYFORMAT, hwnd, NF_QUERY);
     1117                     WM_NOTIFYFORMAT, hwnd, NF_QUERY);
    11181118    if ((i < NFR_ANSI) || (i > NFR_UNICODE)) {
    1119     ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n",
    1120         i);
    1121     i = NFR_ANSI;
     1119        ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n",
     1120            i);
     1121        i = NFR_ANSI;
    11221122    }
    11231123    infoPtr->NtfUnicode = (i == NFR_UNICODE) ? 1 : 0;
     
    11271127    /* create combo box */
    11281128    dwComboStyle = GetWindowLongA (hwnd, GWL_STYLE) &
    1129             (CBS_SIMPLE|CBS_DROPDOWN|CBS_DROPDOWNLIST|WS_CHILD);
     1129                        (CBS_SIMPLE|CBS_DROPDOWN|CBS_DROPDOWNLIST|WS_CHILD);
    11301130
    11311131    GetWindowRect(hwnd, &wnrc1);
    11321132    GetClientRect(hwnd, &clrc1);
    11331133    TRACE("EX window=(%d,%d)-(%d,%d) client=(%d,%d)-(%d,%d)\n",
    1134       wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom,
    1135       clrc1.left, clrc1.top, clrc1.right, clrc1.bottom);
     1134          wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom,
     1135          clrc1.left, clrc1.top, clrc1.right, clrc1.bottom);
    11361136    TRACE("combo style=%08lx, adding style=%08lx\n", dwComboStyle,
    11371137          WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VSCROLL |
    11381138          CBS_NOINTEGRALHEIGHT | CBS_DROPDOWNLIST |
    1139       WS_CHILD | WS_VISIBLE | CBS_OWNERDRAWFIXED);
     1139          WS_CHILD | WS_VISIBLE | CBS_OWNERDRAWFIXED);
    11401140
    11411141    /* Native version of ComboEx creates the ComboBox with DROPDOWNLIST */
     
    11471147
    11481148    infoPtr->hwndCombo = CreateWindowA ("ComboBox", "",
    1149             /* following line added to match native */
     1149                        /* following line added to match native */
    11501150                         WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VSCROLL |
    1151                          CBS_NOINTEGRALHEIGHT | CBS_DROPDOWNLIST |
    1152             /* was base and is necessary */
    1153             WS_CHILD | WS_VISIBLE | CBS_OWNERDRAWFIXED | dwComboStyle,
    1154             cs->y, cs->x, cs->cx, cs->cy, hwnd,
    1155             (HMENU) GetWindowLongA (hwnd, GWL_ID),
    1156             GetWindowLongA (hwnd, GWL_HINSTANCE), NULL);
    1157 
    1158     /*
     1151                         CBS_NOINTEGRALHEIGHT | CBS_DROPDOWNLIST | 
     1152                        /* was base and is necessary */
     1153                        WS_CHILD | WS_VISIBLE | CBS_OWNERDRAWFIXED | dwComboStyle,
     1154                        cs->y, cs->x, cs->cx, cs->cy, hwnd,
     1155                        (HMENU) GetWindowLongA (hwnd, GWL_ID),
     1156                        GetWindowLongA (hwnd, GWL_HINSTANCE), NULL);
     1157
     1158    /* 
    11591159     * native does the following at this point according to trace:
    11601160     *  GetWindowThreadProcessId(hwndCombo,0)
     
    11651165
    11661166    /*
    1167      * Setup a property to hold the pointer to the COMBOBOXEX
     1167     * Setup a property to hold the pointer to the COMBOBOXEX 
    11681168     * data structure.
    11691169     */
    11701170    test = GetPropA(infoPtr->hwndCombo, (LPCSTR)(LONG)ComboExInfo);
    11711171    if (!test || ((COMBOEX_INFO *)test != infoPtr)) {
    1172     SetPropA(infoPtr->hwndCombo, "CC32SubclassInfo", (LONG)infoPtr);
    1173     }
    1174     infoPtr->prevComboWndProc = (WNDPROC)SetWindowLongA(infoPtr->hwndCombo,
    1175                             GWL_WNDPROC, (LONG)COMBOEX_ComboWndProc);
     1172        SetPropA(infoPtr->hwndCombo, "CC32SubclassInfo", (LONG)infoPtr);
     1173    }
     1174    infoPtr->prevComboWndProc = (WNDPROC)SetWindowLongA(infoPtr->hwndCombo, 
     1175                                GWL_WNDPROC, (LONG)COMBOEX_ComboWndProc);
    11761176    infoPtr->font = SendMessageW (infoPtr->hwndCombo, WM_GETFONT, 0, 0);
    11771177
     
    11821182     */
    11831183    if ((cs->style & CBS_DROPDOWNLIST) == CBS_DROPDOWN) {
    1184     infoPtr->hwndEdit = CreateWindowExA (0, "EDIT", "",
    1185             WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | ES_AUTOHSCROLL,
    1186             0, 0, 0, 0,  /* will set later */
    1187             infoPtr->hwndCombo,
    1188             (HMENU) GetWindowLongA (hwnd, GWL_ID),
    1189             GetWindowLongA (hwnd, GWL_HINSTANCE),
    1190             NULL);
    1191 
    1192     /* native does the following at this point according to trace:
    1193     *  GetWindowThreadProcessId(hwndEdit,0)
    1194     *  GetCurrentThreadId()
    1195     *  GetWindowThreadProcessId(hwndEdit, &???)
    1196     *  GetCurrentProcessId()
    1197     */
    1198 
    1199     /*
    1200      * Setup a property to hold the pointer to the COMBOBOXEX
    1201     * data structure.
    1202     */
    1203     test = GetPropA(infoPtr->hwndEdit, (LPCSTR)(LONG)ComboExInfo);
    1204     if (!test || ((COMBOEX_INFO *)test != infoPtr)) {
    1205         SetPropA(infoPtr->hwndEdit, "CC32SubclassInfo", (LONG)infoPtr);
    1206     }
    1207     infoPtr->prevEditWndProc = (WNDPROC)SetWindowLongA(infoPtr->hwndEdit,
    1208                 GWL_WNDPROC, (LONG)COMBOEX_EditWndProc);
    1209     infoPtr->font = SendMessageW (infoPtr->hwndCombo, WM_GETFONT, 0, 0);
     1184        infoPtr->hwndEdit = CreateWindowExA (0, "EDIT", "",
     1185                    WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | ES_AUTOHSCROLL,
     1186                    0, 0, 0, 0,  /* will set later */
     1187                    infoPtr->hwndCombo,
     1188                    (HMENU) GetWindowLongA (hwnd, GWL_ID),
     1189                    GetWindowLongA (hwnd, GWL_HINSTANCE),
     1190                    NULL);
     1191
     1192        /* native does the following at this point according to trace:
     1193        *  GetWindowThreadProcessId(hwndEdit,0)
     1194        *  GetCurrentThreadId()
     1195        *  GetWindowThreadProcessId(hwndEdit, &???)
     1196        *  GetCurrentProcessId()
     1197        */
     1198
     1199        /*
     1200         * Setup a property to hold the pointer to the COMBOBOXEX
     1201        * data structure.
     1202        */
     1203        test = GetPropA(infoPtr->hwndEdit, (LPCSTR)(LONG)ComboExInfo);
     1204        if (!test || ((COMBOEX_INFO *)test != infoPtr)) {
     1205            SetPropA(infoPtr->hwndEdit, "CC32SubclassInfo", (LONG)infoPtr);
     1206        }
     1207        infoPtr->prevEditWndProc = (WNDPROC)SetWindowLongA(infoPtr->hwndEdit,
     1208                                GWL_WNDPROC, (LONG)COMBOEX_EditWndProc);
     1209        infoPtr->font = SendMessageW (infoPtr->hwndCombo, WM_GETFONT, 0, 0);
    12101210    }
    12111211    else {
    1212     infoPtr->hwndEdit = 0;
    1213     infoPtr->font = 0;
     1212        infoPtr->hwndEdit = 0;
     1213        infoPtr->font = 0;
    12141214    }
    12151215
     
    12191219     */
    12201220    if (!infoPtr->font) {
    1221     SystemParametersInfoA (SPI_GETICONTITLELOGFONT, sizeof(mylogfont),
    1222                    &mylogfont, 0);
    1223     infoPtr->font = CreateFontIndirectA (&mylogfont);
     1221        SystemParametersInfoA (SPI_GETICONTITLELOGFONT, sizeof(mylogfont),
     1222                               &mylogfont, 0);
     1223        infoPtr->font = CreateFontIndirectA (&mylogfont);
    12241224    }
    12251225    SendMessageW (infoPtr->hwndCombo, WM_SETFONT, (WPARAM)infoPtr->font, 0);
    12261226    if (infoPtr->hwndEdit) {
    1227     SendMessageW (infoPtr->hwndEdit, WM_SETFONT, (WPARAM)infoPtr->font, 0);
    1228     SendMessageW (infoPtr->hwndEdit, EM_SETMARGINS, (WPARAM)EC_USEFONTINFO, 0);
     1227        SendMessageW (infoPtr->hwndEdit, WM_SETFONT, (WPARAM)infoPtr->font, 0);
     1228        SendMessageW (infoPtr->hwndEdit, EM_SETMARGINS, (WPARAM)EC_USEFONTINFO, 0);
    12291229    }
    12301230
     
    12371237    GetWindowRect(infoPtr->hwndCombo, &cmbwrc);
    12381238    TRACE("EX window=(%d,%d)-(%d,%d) client=(%d,%d)-(%d,%d) CB wnd=(%d,%d)-(%d,%d)\n",
    1239       wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom,
    1240       clrc1.left, clrc1.top, clrc1.right, clrc1.bottom,
    1241       cmbwrc.left, cmbwrc.top, cmbwrc.right, cmbwrc.bottom);
    1242     SetWindowPos(infoPtr->hwndCombo, HWND_TOP,
    1243         0, 0, wnrc1.right-wnrc1.left, wnrc1.bottom-wnrc1.top,
    1244         SWP_NOACTIVATE | SWP_NOREDRAW);
     1239          wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom,
     1240          clrc1.left, clrc1.top, clrc1.right, clrc1.bottom,
     1241          cmbwrc.left, cmbwrc.top, cmbwrc.right, cmbwrc.bottom);
     1242    SetWindowPos(infoPtr->hwndCombo, HWND_TOP, 
     1243                0, 0, wnrc1.right-wnrc1.left, wnrc1.bottom-wnrc1.top,
     1244                SWP_NOACTIVATE | SWP_NOREDRAW);
    12451245
    12461246    GetWindowRect(infoPtr->hwndCombo, &cmbwrc);
    12471247    TRACE("CB window=(%d,%d)-(%d,%d)\n",
    1248       cmbwrc.left, cmbwrc.top, cmbwrc.right, cmbwrc.bottom);
    1249     SetWindowPos(hwnd, HWND_TOP,
    1250         0, 0, cmbwrc.right-cmbwrc.left, cmbwrc.bottom-cmbwrc.top,
    1251         SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE);
     1248          cmbwrc.left, cmbwrc.top, cmbwrc.right, cmbwrc.bottom);
     1249    SetWindowPos(hwnd, HWND_TOP, 
     1250                0, 0, cmbwrc.right-cmbwrc.left, cmbwrc.bottom-cmbwrc.top,
     1251                SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE);
    12521252
    12531253    COMBOEX_AdjustEditPos (infoPtr);
    12541254
    12551255    /*
    1256      * Create an item structure to represent the data in the
     1256     * Create an item structure to represent the data in the 
    12571257     * EDIT control.
    12581258     */
     
    12841284    {
    12851285    case CBN_DROPDOWN:
    1286     SendMessageW (GetParent (hwnd), WM_COMMAND, wParam,
    1287                  (LPARAM)hwnd);
    1288     /*
    1289      * from native trace of first dropdown after typing in URL in IE4
    1290     *  CB_GETCURSEL(Combo)
    1291     *  GetWindowText(Edit)
    1292     *  CB_GETCURSEL(Combo)
    1293     *  CB_GETCOUNT(Combo)
    1294     *  CB_GETITEMDATA(Combo, n)
    1295     *  WM_NOTIFY(parent, CBEN_ENDEDITA|W)
    1296     *  CB_GETCURSEL(Combo)
    1297     *  CB_SETCURSEL(COMBOEX, n)
    1298     *  SetFocus(Combo)
    1299      * the rest is supposition
    1300     */
    1301     cursel = SendMessageW (infoPtr->hwndCombo, CB_GETCURSEL, 0, 0);
    1302     if (cursel == -1) {
    1303         /* find match from edit against those in Combobox */
    1304         GetWindowTextW (infoPtr->hwndEdit, wintext, 520);
    1305         n = SendMessageW (infoPtr->hwndCombo, CB_GETCOUNT, 0, 0);
    1306         for (cursel = 0; cursel < n; cursel++){
    1307         item = (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo,
    1308                              CB_GETITEMDATA,
    1309                              cursel, 0);
    1310         if ((INT)item == CB_ERR) break;
    1311         if (lstrcmpiW(item->pszText, wintext) == 0) break;
    1312         }
    1313         if ((cursel == n) || ((INT)item == CB_ERR)) {
    1314         TRACE("failed to find match??? item=%p cursel=%d\n",
    1315               item, cursel);
    1316         if (infoPtr->hwndEdit)
    1317             SetFocus(infoPtr->hwndEdit);
    1318         return 0;
    1319         }
    1320     }
    1321     else {
    1322         item = (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo,
    1323                          CB_GETITEMDATA,
    1324                         cursel, 0);
    1325         if ((INT)item == CB_ERR) {
    1326         TRACE("failed to find match??? item=%p cursel=%d\n",
    1327               item, cursel);
    1328         if (infoPtr->hwndEdit)
    1329             SetFocus(infoPtr->hwndEdit);
    1330         return 0;
    1331         }
    1332     }
    1333 
    1334     /* Save flags for testing and reset them */
    1335     oldflags = infoPtr->flags;
    1336     infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG);
    1337 
    1338     if (oldflags & WCBE_ACTEDIT) {
    1339         cbeend.fChanged = (oldflags & WCBE_EDITCHG);
    1340         cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo,
    1341                         CB_GETCURSEL, 0, 0);
    1342         cbeend.iWhy = CBENF_DROPDOWN;
    1343 
    1344         if (COMBOEX_NotifyEndEdit (infoPtr, &cbeend, item->pszText)) {
    1345         /* abort the change */
    1346         TRACE("Notify requested abort of change\n");
    1347         return 0;
    1348         }
    1349     }
    1350 
    1351     /* if selection has changed the set the new current selection */
    1352     cursel = SendMessageW (infoPtr->hwndCombo, CB_GETCURSEL, 0, 0);
    1353     if ((oldflags & WCBE_EDITCHG) || (cursel != infoPtr->selected)) {
    1354         infoPtr->selected = cursel;
    1355         SendMessageW (hwnd, CB_SETCURSEL, cursel, 0);
    1356         SetFocus(infoPtr->hwndCombo);
    1357     }
    1358     return 0;
     1286        SendMessageW (GetParent (hwnd), WM_COMMAND, wParam,
     1287                             (LPARAM)hwnd);
     1288        /*
     1289         * from native trace of first dropdown after typing in URL in IE4
     1290        *  CB_GETCURSEL(Combo)
     1291        *  GetWindowText(Edit)
     1292        *  CB_GETCURSEL(Combo)
     1293        *  CB_GETCOUNT(Combo)
     1294        *  CB_GETITEMDATA(Combo, n)
     1295        *  WM_NOTIFY(parent, CBEN_ENDEDITA|W)
     1296        *  CB_GETCURSEL(Combo)
     1297        *  CB_SETCURSEL(COMBOEX, n)
     1298        *  SetFocus(Combo)
     1299         * the rest is supposition 
     1300        */
     1301        cursel = SendMessageW (infoPtr->hwndCombo, CB_GETCURSEL, 0, 0);
     1302        if (cursel == -1) {
     1303            /* find match from edit against those in Combobox */
     1304            GetWindowTextW (infoPtr->hwndEdit, wintext, 520);
     1305            n = SendMessageW (infoPtr->hwndCombo, CB_GETCOUNT, 0, 0);
     1306            for (cursel = 0; cursel < n; cursel++){
     1307                item = (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo,
     1308                                                     CB_GETITEMDATA,
     1309                                                     cursel, 0);
     1310                if ((INT)item == CB_ERR) break;
     1311                if (lstrcmpiW(item->pszText, wintext) == 0) break;
     1312            }
     1313            if ((cursel == n) || ((INT)item == CB_ERR)) {
     1314                TRACE("failed to find match??? item=%p cursel=%d\n",
     1315                      item, cursel);
     1316                if (infoPtr->hwndEdit)
     1317                    SetFocus(infoPtr->hwndEdit);
     1318                return 0;
     1319            }
     1320        }
     1321        else {
     1322            item = (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo,
     1323                                                 CB_GETITEMDATA,
     1324                                                cursel, 0);
     1325            if ((INT)item == CB_ERR) {
     1326                TRACE("failed to find match??? item=%p cursel=%d\n",
     1327                      item, cursel);
     1328                if (infoPtr->hwndEdit)
     1329                    SetFocus(infoPtr->hwndEdit);
     1330                return 0;
     1331            }
     1332        }
     1333
     1334        /* Save flags for testing and reset them */
     1335        oldflags = infoPtr->flags;
     1336        infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG);
     1337
     1338        if (oldflags & WCBE_ACTEDIT) {
     1339            cbeend.fChanged = (oldflags & WCBE_EDITCHG);
     1340            cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo,
     1341                                                CB_GETCURSEL, 0, 0);
     1342            cbeend.iWhy = CBENF_DROPDOWN;
     1343
     1344            if (COMBOEX_NotifyEndEdit (infoPtr, &cbeend, item->pszText)) {
     1345                /* abort the change */
     1346                TRACE("Notify requested abort of change\n");
     1347                return 0;
     1348            }
     1349        }
     1350
     1351        /* if selection has changed the set the new current selection */
     1352        cursel = SendMessageW (infoPtr->hwndCombo, CB_GETCURSEL, 0, 0);
     1353        if ((oldflags & WCBE_EDITCHG) || (cursel != infoPtr->selected)) {
     1354            infoPtr->selected = cursel;
     1355            SendMessageW (hwnd, CB_SETCURSEL, cursel, 0);
     1356            SetFocus(infoPtr->hwndCombo);
     1357        }
     1358        return 0;
    13591359
    13601360    case CBN_SELCHANGE:
    1361     /*
    1362     * CB_GETCURSEL(Combo)
    1363     * CB_GETITEMDATA(Combo)   < simulated by COMBOEX_FindItem
    1364     * lstrlenA
    1365     * WM_SETTEXT(Edit)
    1366     * WM_GETTEXTLENGTH(Edit)
    1367     * WM_GETTEXT(Edit)
    1368     * EM_SETSEL(Edit, 0,0)
    1369     * WM_GETTEXTLENGTH(Edit)
    1370     * WM_GETTEXT(Edit)
    1371     * EM_SETSEL(Edit, 0,len)
    1372     * return WM_COMMAND to parent
    1373     */
    1374     oldItem = SendMessageW (infoPtr->hwndCombo, CB_GETCURSEL, 0, 0);
    1375     if (!(item = COMBOEX_FindItem(infoPtr, oldItem))) {
    1376         ERR("item %d not found. Problem!\n", oldItem);
    1377         break;
    1378     }
    1379     infoPtr->selected = oldItem;
    1380     COMBOEX_SetEditText (infoPtr, item);
    1381     return SendMessageW (GetParent (hwnd), WM_COMMAND, wParam,
    1382                  (LPARAM)hwnd);
     1361        /*
     1362        * CB_GETCURSEL(Combo)
     1363        * CB_GETITEMDATA(Combo)   < simulated by COMBOEX_FindItem
     1364        * lstrlenA
     1365        * WM_SETTEXT(Edit)
     1366        * WM_GETTEXTLENGTH(Edit)
     1367        * WM_GETTEXT(Edit)
     1368        * EM_SETSEL(Edit, 0,0)
     1369        * WM_GETTEXTLENGTH(Edit)
     1370        * WM_GETTEXT(Edit)
     1371        * EM_SETSEL(Edit, 0,len)
     1372        * return WM_COMMAND to parent
     1373        */
     1374        oldItem = SendMessageW (infoPtr->hwndCombo, CB_GETCURSEL, 0, 0);
     1375        if (!(item = COMBOEX_FindItem(infoPtr, oldItem))) {
     1376            ERR("item %d not found. Problem!\n", oldItem);
     1377            break;
     1378        }
     1379        infoPtr->selected = oldItem;
     1380        COMBOEX_SetEditText (infoPtr, item);
     1381        return SendMessageW (GetParent (hwnd), WM_COMMAND, wParam,
     1382                             (LPARAM)hwnd);
    13831383
    13841384    case CBN_SELENDOK:
    1385     /*
    1386     * We have to change the handle since we are the control
    1387     * issuing the message. IE4 depends on this.
    1388     */
    1389     return SendMessageW (GetParent (hwnd), WM_COMMAND, wParam,
    1390                  (LPARAM)hwnd);
     1385        /*
     1386        * We have to change the handle since we are the control
     1387        * issuing the message. IE4 depends on this.
     1388        */
     1389        return SendMessageW (GetParent (hwnd), WM_COMMAND, wParam,
     1390                             (LPARAM)hwnd);
    13911391
    13921392    case CBN_KILLFOCUS:
    1393     /*
    1394     * from native trace:
    1395     *
    1396     *  pass to parent
    1397     *  WM_GETTEXT(Edit, 104)
    1398     *  CB_GETCURSEL(Combo) rets -1
    1399     *  WM_NOTIFY(CBEN_ENDEDITA) with CBENF_KILLFOCUS
    1400     *  CB_GETCURSEL(Combo)
    1401     *  InvalidateRect(Combo, 0, 0)
    1402     *  return 0
    1403     */
    1404     SendMessageW (GetParent (hwnd), WM_COMMAND, wParam,
    1405                  (LPARAM)hwnd);
    1406     if (infoPtr->flags & WCBE_ACTEDIT) {
    1407         GetWindowTextW (infoPtr->hwndEdit, wintext, 260);
    1408         cbeend.fChanged = (infoPtr->flags & WCBE_EDITCHG);
    1409         cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo,
    1410                         CB_GETCURSEL, 0, 0);
    1411         cbeend.iWhy = CBENF_KILLFOCUS;
    1412 
    1413         infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG);
    1414         if (COMBOEX_NotifyEndEdit (infoPtr, &cbeend, wintext)) {
    1415         /* abort the change */
    1416         TRACE("Notify requested abort of change\n");
    1417         return 0;
    1418         }
    1419     }
    1420     /* possible CB_GETCURSEL */
    1421     InvalidateRect (infoPtr->hwndCombo, 0, 0);
    1422     return 0;
     1393        /*
     1394        * from native trace:
     1395        *
     1396        *  pass to parent
     1397        *  WM_GETTEXT(Edit, 104)
     1398        *  CB_GETCURSEL(Combo) rets -1
     1399        *  WM_NOTIFY(CBEN_ENDEDITA) with CBENF_KILLFOCUS
     1400        *  CB_GETCURSEL(Combo)
     1401        *  InvalidateRect(Combo, 0, 0)
     1402        *  return 0
     1403        */
     1404        SendMessageW (GetParent (hwnd), WM_COMMAND, wParam,
     1405                             (LPARAM)hwnd);
     1406        if (infoPtr->flags & WCBE_ACTEDIT) {
     1407            GetWindowTextW (infoPtr->hwndEdit, wintext, 260);
     1408            cbeend.fChanged = (infoPtr->flags & WCBE_EDITCHG);
     1409            cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo,
     1410                                                CB_GETCURSEL, 0, 0);
     1411            cbeend.iWhy = CBENF_KILLFOCUS;
     1412
     1413            infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG);
     1414            if (COMBOEX_NotifyEndEdit (infoPtr, &cbeend, wintext)) {
     1415                /* abort the change */
     1416                TRACE("Notify requested abort of change\n");
     1417                return 0;
     1418            }
     1419        }
     1420        /* possible CB_GETCURSEL */
     1421        InvalidateRect (infoPtr->hwndCombo, 0, 0);
     1422        return 0;
    14231423
    14241424    case CBN_CLOSEUP:
    14251425    default:
    1426     /*
    1427     * We have to change the handle since we are the control
    1428     * issuing the message. IE4 depends on this.
    1429     * We also need to set the focus back to the Edit control
    1430     * after passing the command to the parent of the ComboEx.
    1431     */
    1432     lret = SendMessageW (GetParent (hwnd), WM_COMMAND, wParam,
    1433                  (LPARAM)hwnd);
    1434     if (infoPtr->hwndEdit)
    1435         SetFocus(infoPtr->hwndEdit);
    1436     return lret;
     1426        /*
     1427        * We have to change the handle since we are the control
     1428        * issuing the message. IE4 depends on this.
     1429        * We also need to set the focus back to the Edit control
     1430        * after passing the command to the parent of the ComboEx.
     1431        */
     1432        lret = SendMessageW (GetParent (hwnd), WM_COMMAND, wParam,
     1433                             (LPARAM)hwnd);
     1434        if (infoPtr->hwndEdit)
     1435            SetFocus(infoPtr->hwndEdit);
     1436        return lret;
    14371437    }
    14381438    return 0;
     
    14501450
    14511451    TRACE("CtlType=%08x, CtlID=%08x, itemID=%08x, hwnd=%x, data=%08lx\n",
    1452       dis->CtlType, dis->CtlID, dis->itemID, dis->hwndItem, dis->itemData);
     1452          dis->CtlType, dis->CtlID, dis->itemID, dis->hwndItem, dis->itemData);
    14531453
    14541454    if ((dis->itemID >= infoPtr->nb_items) || (dis->itemID < 0)) return FALSE;
     
    14581458
    14591459    if (i == dis->itemID) {
    1460     infoPtr->items = infoPtr->items->next;
     1460        infoPtr->items = infoPtr->items->next;
    14611461    }
    14621462    else {
    1463     item = olditem;
    1464     i--;
    1465 
    1466     /* find the prior item in the list */
    1467     while (item->next && (i > dis->itemID)) {
    1468         item = (CBE_ITEMDATA *)item->next;
    1469         i--;
    1470     }
    1471     if (!item->next || (i != dis->itemID)) {
    1472         FIXME("COMBOBOXEX item structures broken. Please report!\n");
    1473         return FALSE;
    1474     }
    1475     olditem = item->next;
    1476     item->next = (CBE_ITEMDATA *)((CBE_ITEMDATA *)item->next)->next;
     1463        item = olditem;
     1464        i--;
     1465
     1466        /* find the prior item in the list */
     1467        while (item->next && (i > dis->itemID)) {
     1468            item = (CBE_ITEMDATA *)item->next;
     1469            i--;
     1470        }
     1471        if (!item->next || (i != dis->itemID)) {
     1472            FIXME("COMBOBOXEX item structures broken. Please report!\n");
     1473            return FALSE;
     1474        }
     1475        olditem = item->next;
     1476        item->next = (CBE_ITEMDATA *)((CBE_ITEMDATA *)item->next)->next;
    14771477    }
    14781478    infoPtr->nb_items--;
     
    14821482
    14831483    if (olditem->pszText)
    1484     COMCTL32_Free(olditem->pszText);
     1484        COMCTL32_Free(olditem->pszText);
    14851485    COMCTL32_Free(olditem);
    14861486
     
    15101510    /* dump the DRAWITEMSTRUCT if tracing "comboex" but not "message" */
    15111511    if (!TRACE_ON(message)) {
    1512     TRACE("DRAWITEMSTRUCT: CtlType=0x%08x CtlID=0x%08x\n",
    1513           dis->CtlType, dis->CtlID);
    1514     TRACE("itemID=0x%08x itemAction=0x%08x itemState=0x%08x\n",
    1515           dis->itemID, dis->itemAction, dis->itemState);
    1516     TRACE("hWnd=0x%04x hDC=0x%04x (%d,%d)-(%d,%d) itemData=0x%08lx\n",
    1517           dis->hwndItem, dis->hDC, dis->rcItem.left,
    1518           dis->rcItem.top, dis->rcItem.right, dis->rcItem.bottom,
    1519           dis->itemData);
     1512        TRACE("DRAWITEMSTRUCT: CtlType=0x%08x CtlID=0x%08x\n",
     1513              dis->CtlType, dis->CtlID);
     1514        TRACE("itemID=0x%08x itemAction=0x%08x itemState=0x%08x\n",
     1515              dis->itemID, dis->itemAction, dis->itemState);
     1516        TRACE("hWnd=0x%04x hDC=0x%04x (%d,%d)-(%d,%d) itemData=0x%08lx\n",
     1517              dis->hwndItem, dis->hDC, dis->rcItem.left,
     1518              dis->rcItem.top, dis->rcItem.right, dis->rcItem.bottom,
     1519              dis->itemData);
    15201520    }
    15211521
     
    15321532    /*      though the list box or combo box has the focus.             */
    15331533    if (dis->itemID == 0xffffffff) {
    1534     if ( ( (dis->itemAction & ODA_FOCUS) && (dis->itemState & ODS_SELECTED)) ||
    1535          ( (dis->itemAction & (ODA_SELECT | ODA_DRAWENTIRE)) && (dis->itemState & ODS_FOCUS) ) ) {
    1536 
    1537         TRACE("drawing item -1 special focus, rect=(%d,%d)-(%d,%d)\n",
    1538           dis->rcItem.left, dis->rcItem.top,
    1539           dis->rcItem.right, dis->rcItem.bottom);
    1540     }
    1541     else if ((dis->CtlType == ODT_COMBOBOX) &&
    1542         (dis->itemAction == ODA_DRAWENTIRE)) {
    1543         /* draw of edit control data */
    1544 
    1545         /* testing */
    1546         {
    1547         RECT exrc, cbrc, edrc;
    1548         GetWindowRect (hwnd, &exrc);
    1549         GetWindowRect (infoPtr->hwndCombo, &cbrc);
    1550         edrc.left=edrc.top=edrc.right=edrc.bottom=-1;
    1551         if (infoPtr->hwndEdit)
    1552             GetWindowRect (infoPtr->hwndEdit, &edrc);
    1553         TRACE("window rects ex=(%d,%d)-(%d,%d), cb=(%d,%d)-(%d,%d), ed=(%d,%d)-(%d,%d)\n",
    1554               exrc.left, exrc.top, exrc.right, exrc.bottom,
    1555               cbrc.left, cbrc.top, cbrc.right, cbrc.bottom,
    1556               edrc.left, edrc.top, edrc.right, edrc.bottom);
    1557         }
    1558     }
    1559     else {
    1560         ERR("NOT drawing item  -1 special focus, rect=(%d,%d)-(%d,%d), action=%08x, state=%08x\n",
    1561         dis->rcItem.left, dis->rcItem.top,
    1562         dis->rcItem.right, dis->rcItem.bottom,
    1563         dis->itemAction, dis->itemState);
    1564         return 0;
    1565     }
     1534        if ( ( (dis->itemAction & ODA_FOCUS) && (dis->itemState & ODS_SELECTED)) ||
     1535             ( (dis->itemAction & (ODA_SELECT | ODA_DRAWENTIRE)) && (dis->itemState & ODS_FOCUS) ) ) {
     1536
     1537            TRACE("drawing item -1 special focus, rect=(%d,%d)-(%d,%d)\n",
     1538                  dis->rcItem.left, dis->rcItem.top,
     1539                  dis->rcItem.right, dis->rcItem.bottom);
     1540        }
     1541        else if ((dis->CtlType == ODT_COMBOBOX) &&
     1542                (dis->itemAction == ODA_DRAWENTIRE)) {
     1543            /* draw of edit control data */
     1544
     1545            /* testing */
     1546            {
     1547                RECT exrc, cbrc, edrc;
     1548                GetWindowRect (hwnd, &exrc);
     1549                GetWindowRect (infoPtr->hwndCombo, &cbrc);
     1550                edrc.left=edrc.top=edrc.right=edrc.bottom=-1;
     1551                if (infoPtr->hwndEdit)
     1552                    GetWindowRect (infoPtr->hwndEdit, &edrc);
     1553                TRACE("window rects ex=(%d,%d)-(%d,%d), cb=(%d,%d)-(%d,%d), ed=(%d,%d)-(%d,%d)\n",
     1554                      exrc.left, exrc.top, exrc.right, exrc.bottom,
     1555                      cbrc.left, cbrc.top, cbrc.right, cbrc.bottom,
     1556                      edrc.left, edrc.top, edrc.right, edrc.bottom);
     1557            }
     1558        }
     1559        else {
     1560            ERR("NOT drawing item  -1 special focus, rect=(%d,%d)-(%d,%d), action=%08x, state=%08x\n",
     1561                dis->rcItem.left, dis->rcItem.top,
     1562                dis->rcItem.right, dis->rcItem.bottom,
     1563                dis->itemAction, dis->itemState);
     1564            return 0;
     1565        }
    15661566    }
    15671567
    15681568    /* If draw item is -1 (edit control) setup the item pointer */
    15691569    if (dis->itemID == 0xffffffff) {
    1570     CHAR str[260];
    1571     INT wlen, alen;
    1572 
    1573     item = infoPtr->edit;
    1574 
    1575     if (infoPtr->hwndEdit) {
    1576 
    1577         /* free previous text of edit item */
    1578         if (item->pszText) {
    1579         COMCTL32_Free(item->pszText);
    1580         item->pszText = 0;
    1581         item->mask &= ~CBEIF_TEXT;
    1582         }
    1583         alen = SendMessageA (infoPtr->hwndEdit, WM_GETTEXT, 260, (LPARAM)&str);
    1584         TRACE("edit control hwndEdit=%0x, text len=%d str=<%s>\n",
    1585           infoPtr->hwndEdit, alen, str);
    1586         if (alen > 0) {
    1587         item->mask |= CBEIF_TEXT;
    1588         wlen = MultiByteToWideChar (CP_ACP, 0, str, -1, NULL, 0);
    1589         if (wlen > 0) {
    1590             item->pszText = (LPWSTR)COMCTL32_Alloc ((wlen + 1)*sizeof(WCHAR));
    1591             MultiByteToWideChar (CP_ACP, 0, str, -1, item->pszText, wlen);
    1592         }
    1593         }
    1594     }
     1570        CHAR str[260];
     1571        INT wlen, alen;
     1572
     1573        item = infoPtr->edit;
     1574
     1575        if (infoPtr->hwndEdit) {
     1576
     1577            /* free previous text of edit item */
     1578            if (item->pszText) {
     1579                COMCTL32_Free(item->pszText);
     1580                item->pszText = 0;
     1581                item->mask &= ~CBEIF_TEXT;
     1582            }
     1583            alen = SendMessageA (infoPtr->hwndEdit, WM_GETTEXT, 260, (LPARAM)&str);
     1584            TRACE("edit control hwndEdit=%0x, text len=%d str=<%s>\n",
     1585                  infoPtr->hwndEdit, alen, str);
     1586            if (alen > 0) {
     1587                item->mask |= CBEIF_TEXT;
     1588                wlen = MultiByteToWideChar (CP_ACP, 0, str, -1, NULL, 0);
     1589                if (wlen > 0) {
     1590                    item->pszText = (LPWSTR)COMCTL32_Alloc ((wlen + 1)*sizeof(WCHAR));
     1591                    MultiByteToWideChar (CP_ACP, 0, str, -1, item->pszText, wlen);
     1592                }
     1593            }
     1594        }
    15951595    }
    15961596
    15971597    /* if the item pointer is not set, then get the data and locate it */
    15981598    if (!item) {
    1599     item = (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo,
    1600                  CB_GETITEMDATA, (WPARAM)dis->itemID, 0);
    1601     if (item == (CBE_ITEMDATA *)CB_ERR)
    1602         {
    1603         FIXME("invalid item for id %d \n",dis->itemID);
    1604         return 0;
    1605         }
     1599        item = (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo,
     1600                             CB_GETITEMDATA, (WPARAM)dis->itemID, 0);
     1601        if (item == (CBE_ITEMDATA *)CB_ERR)
     1602            {
     1603                FIXME("invalid item for id %d \n",dis->itemID);
     1604                return 0;
     1605            }
    16061606    }
    16071607
     
    16121612        xbase += (item->iIndent * CBE_INDENT);
    16131613    if (item->mask & CBEIF_IMAGE) {
    1614     ImageList_GetImageInfo(infoPtr->himl, item->iImage, &iinfo);
    1615     xioff = (iinfo.rcImage.right - iinfo.rcImage.left + CBE_SEP);
     1614        ImageList_GetImageInfo(infoPtr->himl, item->iImage, &iinfo);
     1615        xioff = (iinfo.rcImage.right - iinfo.rcImage.left + CBE_SEP);
    16161616    }
    16171617
     
    16191619    case ODA_FOCUS:
    16201620        if (dis->itemState & ODS_SELECTED /*1*/) {
    1621         if ((item->mask & CBEIF_TEXT) && item->pszText) {
    1622         RECT rect2;
    1623 
    1624             len = strlenW (item->pszText);
    1625         GetTextExtentPointW (dis->hDC, item->pszText, len, &txtsize);
    1626         rect.left = xbase + xioff - 1;
    1627         rect.right = rect.left + txtsize.cx + 2;
    1628         rect.top = dis->rcItem.top;
    1629         rect.bottom = dis->rcItem.bottom;
    1630         GetClipBox (dis->hDC, &rect2);
    1631         TRACE("drawing item %d focus, rect=(%d,%d)-(%d,%d)\n",
    1632               dis->itemID, rect.left, rect.top,
    1633               rect.right, rect.bottom);
    1634         TRACE("                      clip=(%d,%d)-(%d,%d)\n",
    1635               rect2.left, rect2.top,
    1636               rect2.right, rect2.bottom);
    1637 
    1638         DrawFocusRect(dis->hDC, &rect);
    1639         }
    1640         else {
    1641         FIXME("ODA_FOCUS and ODS_SELECTED but no text\n");
    1642         }
    1643     }
    1644     else {
    1645         FIXME("ODA_FOCUS but not ODS_SELECTED\n");
    1646     }
     1621            if ((item->mask & CBEIF_TEXT) && item->pszText) {
     1622                RECT rect2;
     1623
     1624                len = strlenW (item->pszText);
     1625                GetTextExtentPointW (dis->hDC, item->pszText, len, &txtsize);
     1626                rect.left = xbase + xioff - 1;
     1627                rect.right = rect.left + txtsize.cx + 2;
     1628                rect.top = dis->rcItem.top;
     1629                rect.bottom = dis->rcItem.bottom;
     1630                GetClipBox (dis->hDC, &rect2);
     1631                TRACE("drawing item %d focus, rect=(%d,%d)-(%d,%d)\n",
     1632                      dis->itemID, rect.left, rect.top,
     1633                      rect.right, rect.bottom);
     1634                TRACE("                      clip=(%d,%d)-(%d,%d)\n",
     1635                      rect2.left, rect2.top,
     1636                      rect2.right, rect2.bottom);
     1637
     1638                DrawFocusRect(dis->hDC, &rect);
     1639            }
     1640            else {
     1641                FIXME("ODA_FOCUS and ODS_SELECTED but no text\n");
     1642            }
     1643        }
     1644        else {
     1645            FIXME("ODA_FOCUS but not ODS_SELECTED\n");
     1646        }
    16471647        break;
    16481648    case ODA_SELECT:
    16491649    case ODA_DRAWENTIRE:
    16501650        drawimage = -1;
    1651     drawstate = ILD_NORMAL;
    1652     if (!(infoPtr->dwExtStyle & CBES_EX_NOEDITIMAGE)) {
    1653         if (item->mask & CBEIF_IMAGE)
    1654         drawimage = item->iImage;
    1655         if (dis->itemState & ODS_COMBOEXLBOX) {
    1656         /* drawing listbox entry */
    1657         if (dis->itemState & ODS_SELECTED) {
    1658             if (item->mask & CBEIF_SELECTEDIMAGE)
    1659             drawimage = item->iSelectedImage;
    1660             drawstate = ILD_SELECTED;
    1661         }
    1662         }
    1663         else {
    1664         /* drawing combo/edit entry */
    1665         if (infoPtr->hwndEdit) {
    1666             /* if we have an edit control, the slave the
    1667                      * selection state to the Edit focus state
    1668              */
    1669             if (infoPtr->flags & WCBE_EDITFOCUSED) {
    1670             if (item->mask & CBEIF_SELECTEDIMAGE)
    1671                 drawimage = item->iSelectedImage;
    1672             drawstate = ILD_SELECTED;
    1673             }
    1674         }
    1675         else {
    1676             /* if we don't have an edit control, use
    1677              * the requested state.
    1678              */
    1679             if (dis->itemState & ODS_SELECTED) {
    1680             if (item->mask & CBEIF_SELECTEDIMAGE)
    1681                 drawimage = item->iSelectedImage;
    1682             drawstate = ILD_SELECTED;
    1683             }
    1684         }
    1685         }
    1686     }
    1687     if (drawimage != -1) {
    1688         TRACE("drawing image state=%d\n", dis->itemState & ODS_SELECTED);
    1689         ImageList_Draw (infoPtr->himl, drawimage, dis->hDC,
    1690                 xbase, dis->rcItem.top, drawstate);
    1691     }
    1692 
    1693     /* setup pointer to text to be drawn */
    1694     if ((item->mask & CBEIF_TEXT) && item->pszText)
    1695         str = item->pszText;
    1696     else
    1697         str = (LPWSTR) L"";
    1698 
    1699     /* now draw the text */
    1700     len = lstrlenW (str);
    1701     GetTextExtentPointW (dis->hDC, str, len, &txtsize);
    1702     nbkc = GetSysColor ((dis->itemState & ODS_SELECTED) ?
    1703                 COLOR_HIGHLIGHT : COLOR_WINDOW);
    1704     SetBkColor (dis->hDC, nbkc);
    1705     ntxc = GetSysColor ((dis->itemState & ODS_SELECTED) ?
    1706                 COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT);
    1707     SetTextColor (dis->hDC, ntxc);
    1708     x = xbase + xioff;
    1709     y = dis->rcItem.top +
    1710         (dis->rcItem.bottom - dis->rcItem.top - txtsize.cy) / 2;
    1711     rect.left = x;
    1712     rect.right = x + txtsize.cx;
    1713     rect.top = dis->rcItem.top + 1;
    1714     rect.bottom = dis->rcItem.bottom - 1;
    1715     TRACE("drawing item %d text, rect=(%d,%d)-(%d,%d)\n",
    1716           dis->itemID, rect.left, rect.top, rect.right, rect.bottom);
    1717     ExtTextOutW (dis->hDC, x, y, ETO_OPAQUE | ETO_CLIPPED,
    1718              &rect, str, len, 0);
    1719     if (dis->itemState & ODS_FOCUS) {
    1720         rect.top -= 1;
    1721         rect.bottom += 1;
    1722         rect.left -= 1;
    1723         rect.right += 1;
    1724         TRACE("drawing item %d focus after text, rect=(%d,%d)-(%d,%d)\n",
    1725           dis->itemID, rect.left, rect.top, rect.right, rect.bottom);
    1726         DrawFocusRect (dis->hDC, &rect);
    1727     }
    1728     break;
     1651        drawstate = ILD_NORMAL;
     1652        if (!(infoPtr->dwExtStyle & CBES_EX_NOEDITIMAGE)) {
     1653            if (item->mask & CBEIF_IMAGE)
     1654                drawimage = item->iImage;
     1655            if (dis->itemState & ODS_COMBOEXLBOX) {
     1656                /* drawing listbox entry */
     1657                if (dis->itemState & ODS_SELECTED) {
     1658                    if (item->mask & CBEIF_SELECTEDIMAGE)
     1659                        drawimage = item->iSelectedImage;
     1660                    drawstate = ILD_SELECTED;
     1661                }
     1662            }
     1663            else {
     1664                /* drawing combo/edit entry */
     1665                if (infoPtr->hwndEdit) {
     1666                    /* if we have an edit control, the slave the
     1667                     * selection state to the Edit focus state 
     1668                     */
     1669                    if (infoPtr->flags & WCBE_EDITFOCUSED) {
     1670                        if (item->mask & CBEIF_SELECTEDIMAGE)
     1671                            drawimage = item->iSelectedImage;
     1672                        drawstate = ILD_SELECTED;
     1673                    }
     1674                }
     1675                else {
     1676                    /* if we don't have an edit control, use
     1677                     * the requested state.
     1678                     */
     1679                    if (dis->itemState & ODS_SELECTED) {
     1680                        if (item->mask & CBEIF_SELECTEDIMAGE)
     1681                            drawimage = item->iSelectedImage;
     1682                        drawstate = ILD_SELECTED;
     1683                    }
     1684                }
     1685            }
     1686        }
     1687        if (drawimage != -1) {
     1688            TRACE("drawing image state=%d\n", dis->itemState & ODS_SELECTED);
     1689            ImageList_Draw (infoPtr->himl, drawimage, dis->hDC,
     1690                            xbase, dis->rcItem.top, drawstate);
     1691        }
     1692
     1693        /* setup pointer to text to be drawn */
     1694        if ((item->mask & CBEIF_TEXT) && item->pszText)
     1695            str = item->pszText;
     1696        else
     1697            str = (LPWSTR) L"";
     1698
     1699        /* now draw the text */
     1700        len = lstrlenW (str);
     1701        GetTextExtentPointW (dis->hDC, str, len, &txtsize);
     1702        nbkc = GetSysColor ((dis->itemState & ODS_SELECTED) ?
     1703                            COLOR_HIGHLIGHT : COLOR_WINDOW);
     1704        SetBkColor (dis->hDC, nbkc);
     1705        ntxc = GetSysColor ((dis->itemState & ODS_SELECTED) ?
     1706                            COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT);
     1707        SetTextColor (dis->hDC, ntxc);
     1708        x = xbase + xioff;
     1709        y = dis->rcItem.top +
     1710            (dis->rcItem.bottom - dis->rcItem.top - txtsize.cy) / 2;
     1711        rect.left = x;
     1712        rect.right = x + txtsize.cx;
     1713        rect.top = dis->rcItem.top + 1;
     1714        rect.bottom = dis->rcItem.bottom - 1;
     1715        TRACE("drawing item %d text, rect=(%d,%d)-(%d,%d)\n",
     1716              dis->itemID, rect.left, rect.top, rect.right, rect.bottom);
     1717        ExtTextOutW (dis->hDC, x, y, ETO_OPAQUE | ETO_CLIPPED,
     1718                     &rect, str, len, 0);
     1719        if (dis->itemState & ODS_FOCUS) {
     1720            rect.top -= 1;
     1721            rect.bottom += 1;
     1722            rect.left -= 1;
     1723            rect.right += 1;
     1724            TRACE("drawing item %d focus after text, rect=(%d,%d)-(%d,%d)\n",
     1725                  dis->itemID, rect.left, rect.top, rect.right, rect.bottom);
     1726            DrawFocusRect (dis->hDC, &rect);
     1727        }
     1728        break;
    17291729    default:
    1730         FIXME("unknown action hwnd=%08x, wparam=%08x, lparam=%08lx, action=%d\n",
    1731           hwnd, wParam, lParam, dis->itemAction);
     1730        FIXME("unknown action hwnd=%08x, wparam=%08x, lparam=%08lx, action=%d\n", 
     1731              hwnd, wParam, lParam, dis->itemAction);
    17321732    }
    17331733
     
    17421742
    17431743    if (infoPtr->hwndCombo)
    1744     DestroyWindow (infoPtr->hwndCombo);
     1744        DestroyWindow (infoPtr->hwndCombo);
    17451745
    17461746    if (infoPtr->edit) {
    1747     COMCTL32_Free (infoPtr->edit);
    1748     infoPtr->edit = 0;
     1747        COMCTL32_Free (infoPtr->edit);
     1748        infoPtr->edit = 0;
    17491749    }
    17501750
     
    17521752        CBE_ITEMDATA *this, *next;
    17531753
    1754     this = infoPtr->items;
    1755     while (this) {
    1756         next = (CBE_ITEMDATA *)this->next;
    1757         if ((this->mask & CBEIF_TEXT) && this->pszText)
    1758             COMCTL32_Free (this->pszText);
    1759         COMCTL32_Free (this);
    1760         this = next;
    1761     }
     1754        this = infoPtr->items;
     1755        while (this) {
     1756            next = (CBE_ITEMDATA *)this->next;
     1757            if ((this->mask & CBEIF_TEXT) && this->pszText)
     1758                COMCTL32_Free (this->pszText);
     1759            COMCTL32_Free (this);
     1760            this = next;
     1761        }
    17621762    }
    17631763
     
    17851785
    17861786    TRACE("adjusted height hwnd=%08x, height=%d\n",
    1787       hwnd, mis->itemHeight);
     1787          hwnd, mis->itemHeight);
    17881788
    17891789    return 0;
     
    18001800    newstyle = oldstyle & ~(WS_VSCROLL | WS_HSCROLL);
    18011801    if (newstyle != oldstyle) {
    1802     TRACE("req style %08lx, reseting style %08lx\n",
    1803           oldstyle, newstyle);
    1804     SetWindowLongA (hwnd, GWL_STYLE, newstyle);
     1802        TRACE("req style %08lx, reseting style %08lx\n",
     1803              oldstyle, newstyle);
     1804        SetWindowLongA (hwnd, GWL_STYLE, newstyle);
    18051805    }
    18061806    return 1;
     
    18151815
    18161816    if (lParam == NF_REQUERY) {
    1817     i = SendMessageA(GetParent (hwnd),
    1818             WM_NOTIFYFORMAT, infoPtr->hwndSelf, NF_QUERY);
    1819     if ((i < NFR_ANSI) || (i > NFR_UNICODE)) {
    1820         ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n",
    1821         i);
    1822         i = NFR_ANSI;
    1823     }
    1824     infoPtr->NtfUnicode = (i == NFR_UNICODE) ? 1 : 0;
    1825     return (LRESULT)i;
     1817        i = SendMessageA(GetParent (hwnd),
     1818                        WM_NOTIFYFORMAT, infoPtr->hwndSelf, NF_QUERY);
     1819        if ((i < NFR_ANSI) || (i > NFR_UNICODE)) {
     1820            ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n",
     1821                i);
     1822            i = NFR_ANSI;
     1823        }
     1824        infoPtr->NtfUnicode = (i == NFR_UNICODE) ? 1 : 0;
     1825        return (LRESULT)i;
    18261826    }
    18271827    return (LRESULT)((infoPtr->bUnicode) ? NFR_UNICODE : NFR_ANSI);
     
    18371837    GetWindowRect (hwnd, &rect);
    18381838    TRACE("my rect (%d,%d)-(%d,%d)\n",
    1839       rect.left, rect.top, rect.right, rect.bottom);
     1839          rect.left, rect.top, rect.right, rect.bottom);
    18401840
    18411841    MoveWindow (infoPtr->hwndCombo, 0, 0, rect.right -rect.left,
    1842           rect.bottom - rect.top, TRUE);
     1842                  rect.bottom - rect.top, TRUE);
    18431843
    18441844    COMBOEX_AdjustEditPos (infoPtr);
     
    18621862    /* width is winpos value + border width of comboex */
    18631863    width = wp->cx
    1864         + (cbx_wrect.right-cbx_wrect.left)
    1865             - (cbx_crect.right-cbx_crect.left);
     1864            + (cbx_wrect.right-cbx_wrect.left)
     1865            - (cbx_crect.right-cbx_crect.left); 
    18661866
    18671867    TRACE("winpos=(%d,%d %dx%d) flags=0x%08x\n",
    1868       wp->x, wp->y, wp->cx, wp->cy, wp->flags);
     1868          wp->x, wp->y, wp->cx, wp->cy, wp->flags);
    18691869    TRACE("EX window=(%d,%d)-(%d,%d), client=(%d,%d)-(%d,%d)\n",
    1870       cbx_wrect.left, cbx_wrect.top, cbx_wrect.right, cbx_wrect.bottom,
    1871       cbx_crect.left, cbx_crect.top, cbx_crect.right, cbx_crect.bottom);
     1870          cbx_wrect.left, cbx_wrect.top, cbx_wrect.right, cbx_wrect.bottom,
     1871          cbx_crect.left, cbx_crect.top, cbx_crect.right, cbx_crect.bottom);
    18721872    TRACE("CB window=(%d,%d)-(%d,%d), EX setting=(0,0)-(%d,%d)\n",
    1873       cb_wrect.left, cb_wrect.top, cb_wrect.right, cb_wrect.bottom,
    1874       width, cb_wrect.bottom-cb_wrect.top);
     1873          cb_wrect.left, cb_wrect.top, cb_wrect.right, cb_wrect.bottom,
     1874          width, cb_wrect.bottom-cb_wrect.top);
    18751875
    18761876    if (width) SetWindowPos (infoPtr->hwndCombo, HWND_TOP, 0, 0,
    1877                  width,
    1878                  cb_wrect.bottom-cb_wrect.top,
    1879                  SWP_NOACTIVATE);
     1877                             width,
     1878                             cb_wrect.bottom-cb_wrect.top,
     1879                             SWP_NOACTIVATE);
    18801880
    18811881    GetWindowRect (infoPtr->hwndCombo, &cb_wrect);
     
    18831883    /* height is combo window height plus border width of comboex */
    18841884    height =   (cb_wrect.bottom-cb_wrect.top)
    1885          + (cbx_wrect.bottom-cbx_wrect.top)
     1885             + (cbx_wrect.bottom-cbx_wrect.top)
    18861886             - (cbx_crect.bottom-cbx_crect.top);
    18871887    if (wp->cy < height) wp->cy = height;
    18881888    if (infoPtr->hwndEdit) {
    1889     COMBOEX_AdjustEditPos (infoPtr);
    1890     InvalidateRect (infoPtr->hwndCombo, 0, TRUE);
     1889        COMBOEX_AdjustEditPos (infoPtr);
     1890        InvalidateRect (infoPtr->hwndCombo, 0, TRUE);
    18911891    }
    18921892
     
    19061906    LRESULT lret;
    19071907
    1908     TRACE("hwnd=%x msg=%x wparam=%x lParam=%lx, info_ptr=%p\n",
    1909       hwnd, uMsg, wParam, lParam, infoPtr);
     1908    TRACE("hwnd=%x msg=%x wparam=%x lParam=%lx, info_ptr=%p\n", 
     1909          hwnd, uMsg, wParam, lParam, infoPtr);
    19101910
    19111911    if (!infoPtr) return 0;
     
    19151915
    19161916    case WM_CHAR:
    1917         /* handle (ignore) the return character */
    1918         if (wParam == VK_RETURN) return 0;
    1919         /* all other characters pass into the real Edit */
    1920         return CallWindowProcA (infoPtr->prevEditWndProc,
    1921                    hwnd, uMsg, wParam, lParam);
     1917            /* handle (ignore) the return character */
     1918            if (wParam == VK_RETURN) return 0;
     1919            /* all other characters pass into the real Edit */
     1920            return CallWindowProcA (infoPtr->prevEditWndProc,
     1921                                   hwnd, uMsg, wParam, lParam);
    19221922
    19231923    case WM_ERASEBKGND:
    1924         /*
    1925          * The following was determined by traces of the native
    1926          */
     1924            /*
     1925             * The following was determined by traces of the native
     1926             */
    19271927            hDC = (HDC) wParam;
    1928         nbkc = GetSysColor (COLOR_WINDOW);
    1929         obkc = SetBkColor (hDC, nbkc);
     1928            nbkc = GetSysColor (COLOR_WINDOW);
     1929            obkc = SetBkColor (hDC, nbkc);
    19301930            GetClientRect (hwnd, &rect);
    1931         TRACE("erasing (%d,%d)-(%d,%d)\n",
    1932           rect.left, rect.top, rect.right, rect.bottom);
    1933         ExtTextOutW (hDC, 0, 0, ETO_OPAQUE, &rect, 0, 0, 0);
     1931            TRACE("erasing (%d,%d)-(%d,%d)\n",
     1932                  rect.left, rect.top, rect.right, rect.bottom);
     1933            ExtTextOutW (hDC, 0, 0, ETO_OPAQUE, &rect, 0, 0, 0);
    19341934            SetBkColor (hDC, obkc);
    1935         return CallWindowProcA (infoPtr->prevEditWndProc,
    1936                    hwnd, uMsg, wParam, lParam);
     1935            return CallWindowProcA (infoPtr->prevEditWndProc,
     1936                                   hwnd, uMsg, wParam, lParam);
    19371937
    19381938    case WM_KEYDOWN: {
    1939         INT oldItem, selected;
    1940         CBE_ITEMDATA *item;
    1941 
    1942         switch ((INT)wParam)
    1943         {
    1944         case VK_ESCAPE:
    1945         /* native version seems to do following for COMBOEX */
    1946         /*
    1947          *   GetWindowTextA(Edit,&?, 0x104)             x
    1948          *   CB_GETCURSEL to Combo rets -1              x
    1949          *   WM_NOTIFY to COMBOEX parent (rebar)        x
    1950          *     (CBEN_ENDEDIT{A|W}
    1951          *      fChanged = FALSE                        x
    1952          *      inewSelection = -1                      x
    1953          *      txt="www.hoho"                          x
    1954          *      iWhy = 3                                x
    1955          *   CB_GETCURSEL to Combo rets -1              x
    1956          *   InvalidateRect(Combo, 0)                   x
    1957          *   WM_SETTEXT to Edit                         x
    1958          *   EM_SETSEL to Edit (0,0)                    x
    1959          *   EM_SETSEL to Edit (0,-1)                   x
    1960          *   RedrawWindow(Combo, 0, 0, 5)               x
    1961          */
    1962         TRACE("special code for VK_ESCAPE\n");
    1963 
    1964         GetWindowTextW (infoPtr->hwndEdit, edit_text, 260);
    1965 
    1966         infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG);
    1967         cbeend.fChanged = FALSE;
    1968         cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo,
    1969                              CB_GETCURSEL, 0, 0);
    1970         cbeend.iWhy = CBENF_ESCAPE;
    1971 
    1972         if (COMBOEX_NotifyEndEdit (infoPtr, &cbeend, edit_text)) {
    1973             /* abort the change */
    1974             TRACE("Notify requested abort of change\n");
    1975             return 0;
    1976         }
    1977         oldItem = SendMessageW (infoPtr->hwndCombo,CB_GETCURSEL, 0, 0);
    1978         InvalidateRect (infoPtr->hwndCombo, 0, 0);
    1979         if (!(item = COMBOEX_FindItem(infoPtr, oldItem))) {
    1980             ERR("item %d not found. Problem!\n", oldItem);
    1981             break;
    1982         }
    1983         infoPtr->selected = oldItem;
    1984         COMBOEX_SetEditText (infoPtr, item);
    1985         RedrawWindow (infoPtr->hwndCombo, 0, 0, RDW_ERASE |
    1986                   RDW_INVALIDATE);
    1987         break;
    1988 
    1989         case VK_RETURN:
    1990         /* native version seems to do following for COMBOEX */
    1991         /*
    1992          *   GetWindowTextA(Edit,&?, 0x104)             x
    1993          *   CB_GETCURSEL to Combo  rets -1             x
    1994          *   CB_GETCOUNT to Combo  rets 0
    1995          *   if >0 loop
    1996          *       CB_GETITEMDATA to match
    1997          * *** above 3 lines simulated by FindItem      x
    1998          *   WM_NOTIFY to COMBOEX parent (rebar)        x
    1999          *     (CBEN_ENDEDIT{A|W}                       x
    2000          *        fChanged = TRUE (-1)                  x
    2001          *        iNewSelection = -1 or selected        x
    2002          *        txt=                                  x
    2003          *        iWhy = 2 (CBENF_RETURN)               x
    2004          *   CB_GETCURSEL to Combo  rets -1             x
    2005          *   if -1 send CB_SETCURSEL to Combo -1        x
    2006          *   InvalidateRect(Combo, 0, 0)                x
    2007          *   SetFocus(Edit)                             x
    2008          *   CallWindowProc(406615a8, Edit, 0x100, 0xd, 0x1c0001)
    2009          */
    2010 
    2011         TRACE("special code for VK_RETURN\n");
    2012 
    2013         GetWindowTextW (infoPtr->hwndEdit, edit_text, 260);
    2014 
    2015         infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG);
    2016         selected = SendMessageW (infoPtr->hwndCombo,
    2017                      CB_GETCURSEL, 0, 0);
    2018 
    2019         if (selected != -1) {
    2020             item = COMBOEX_FindItem (infoPtr, selected);
    2021             TRACE("handling VK_RETURN, selected = %d, selected_text=%s\n",
    2022               selected, debugstr_w(item->pszText));
    2023             TRACE("handling VK_RETURN, edittext=%s\n",
    2024               debugstr_w(edit_text));
    2025             if (lstrcmpiW (item->pszText, edit_text)) {
    2026             /* strings not equal -- indicate edit has changed */
    2027             selected = -1;
     1939            INT oldItem, selected;
     1940            CBE_ITEMDATA *item;
     1941
     1942            switch ((INT)wParam)
     1943            {
     1944            case VK_ESCAPE:
     1945                /* native version seems to do following for COMBOEX */
     1946                /*
     1947                 *   GetWindowTextA(Edit,&?, 0x104)             x
     1948                 *   CB_GETCURSEL to Combo rets -1              x
     1949                 *   WM_NOTIFY to COMBOEX parent (rebar)        x
     1950                 *     (CBEN_ENDEDIT{A|W}
     1951                 *      fChanged = FALSE                        x
     1952                 *      inewSelection = -1                      x
     1953                 *      txt="www.hoho"                          x
     1954                 *      iWhy = 3                                x
     1955                 *   CB_GETCURSEL to Combo rets -1              x
     1956                 *   InvalidateRect(Combo, 0)                   x
     1957                 *   WM_SETTEXT to Edit                         x
     1958                 *   EM_SETSEL to Edit (0,0)                    x
     1959                 *   EM_SETSEL to Edit (0,-1)                   x
     1960                 *   RedrawWindow(Combo, 0, 0, 5)               x
     1961                 */
     1962                TRACE("special code for VK_ESCAPE\n");
     1963
     1964                GetWindowTextW (infoPtr->hwndEdit, edit_text, 260);
     1965
     1966                infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG);
     1967                cbeend.fChanged = FALSE;
     1968                cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo,
     1969                                                     CB_GETCURSEL, 0, 0);
     1970                cbeend.iWhy = CBENF_ESCAPE;
     1971
     1972                if (COMBOEX_NotifyEndEdit (infoPtr, &cbeend, edit_text)) {
     1973                    /* abort the change */
     1974                    TRACE("Notify requested abort of change\n");
     1975                    return 0;
     1976                }
     1977                oldItem = SendMessageW (infoPtr->hwndCombo,CB_GETCURSEL, 0, 0);
     1978                InvalidateRect (infoPtr->hwndCombo, 0, 0);
     1979                if (!(item = COMBOEX_FindItem(infoPtr, oldItem))) {
     1980                    ERR("item %d not found. Problem!\n", oldItem);
     1981                    break;
     1982                }
     1983                infoPtr->selected = oldItem;             
     1984                COMBOEX_SetEditText (infoPtr, item);
     1985                RedrawWindow (infoPtr->hwndCombo, 0, 0, RDW_ERASE |
     1986                              RDW_INVALIDATE);
     1987                break;
     1988
     1989            case VK_RETURN:
     1990                /* native version seems to do following for COMBOEX */
     1991                /*
     1992                 *   GetWindowTextA(Edit,&?, 0x104)             x
     1993                 *   CB_GETCURSEL to Combo  rets -1             x
     1994                 *   CB_GETCOUNT to Combo  rets 0
     1995                 *   if >0 loop
     1996                 *       CB_GETITEMDATA to match
     1997                 * *** above 3 lines simulated by FindItem      x 
     1998                 *   WM_NOTIFY to COMBOEX parent (rebar)        x
     1999                 *     (CBEN_ENDEDIT{A|W}                       x
     2000                 *        fChanged = TRUE (-1)                  x
     2001                 *        iNewSelection = -1 or selected        x
     2002                 *        txt=                                  x
     2003                 *        iWhy = 2 (CBENF_RETURN)               x
     2004                 *   CB_GETCURSEL to Combo  rets -1             x
     2005                 *   if -1 send CB_SETCURSEL to Combo -1        x
     2006                 *   InvalidateRect(Combo, 0, 0)                x
     2007                 *   SetFocus(Edit)                             x
     2008                 *   CallWindowProc(406615a8, Edit, 0x100, 0xd, 0x1c0001)
     2009                 */
     2010
     2011                TRACE("special code for VK_RETURN\n");
     2012
     2013                GetWindowTextW (infoPtr->hwndEdit, edit_text, 260);
     2014
     2015                infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG);
     2016                selected = SendMessageW (infoPtr->hwndCombo,
     2017                                         CB_GETCURSEL, 0, 0);
     2018
     2019                if (selected != -1) {
     2020                    item = COMBOEX_FindItem (infoPtr, selected);
     2021                    TRACE("handling VK_RETURN, selected = %d, selected_text=%s\n",
     2022                          selected, debugstr_w(item->pszText));
     2023                    TRACE("handling VK_RETURN, edittext=%s\n",
     2024                          debugstr_w(edit_text));
     2025                    if (lstrcmpiW (item->pszText, edit_text)) {
     2026                        /* strings not equal -- indicate edit has changed */
     2027                        selected = -1;
     2028                    }
     2029                }
     2030
     2031                cbeend.iNewSelection = selected;
     2032                cbeend.fChanged = TRUE;
     2033                cbeend.iWhy = CBENF_RETURN;
     2034                if (COMBOEX_NotifyEndEdit (infoPtr, &cbeend, edit_text)) {
     2035                    /* abort the change, restore previous */
     2036                    TRACE("Notify requested abort of change\n");
     2037                    COMBOEX_SetEditText (infoPtr, infoPtr->edit);
     2038                    RedrawWindow (infoPtr->hwndCombo, 0, 0, RDW_ERASE |
     2039                                  RDW_INVALIDATE);
     2040                    return 0;
     2041                }
     2042                oldItem = SendMessageW (infoPtr->hwndCombo,CB_GETCURSEL, 0, 0);
     2043                if (oldItem != -1) {
     2044                    /* if something is selected, then deselect it */
     2045                    SendMessageW (infoPtr->hwndCombo, CB_SETCURSEL,
     2046                                  (WPARAM)-1, 0);
     2047                }
     2048                InvalidateRect (infoPtr->hwndCombo, 0, 0);
     2049                SetFocus(infoPtr->hwndEdit);
     2050                break;
     2051
     2052            default:
     2053                return CallWindowProcA (infoPtr->prevEditWndProc,
     2054                                       hwnd, uMsg, wParam, lParam);
     2055            }
     2056            return 0;
    20282057            }
    2029         }
    2030 
    2031         cbeend.iNewSelection = selected;
    2032         cbeend.fChanged = TRUE;
    2033         cbeend.iWhy = CBENF_RETURN;
    2034         if (COMBOEX_NotifyEndEdit (infoPtr, &cbeend, edit_text)) {
    2035             /* abort the change, restore previous */
    2036             TRACE("Notify requested abort of change\n");
    2037             COMBOEX_SetEditText (infoPtr, infoPtr->edit);
    2038             RedrawWindow (infoPtr->hwndCombo, 0, 0, RDW_ERASE |
    2039                   RDW_INVALIDATE);
    2040             return 0;
    2041         }
    2042         oldItem = SendMessageW (infoPtr->hwndCombo,CB_GETCURSEL, 0, 0);
    2043         if (oldItem != -1) {
    2044             /* if something is selected, then deselect it */
    2045             SendMessageW (infoPtr->hwndCombo, CB_SETCURSEL,
    2046                   (WPARAM)-1, 0);
    2047         }
    2048         InvalidateRect (infoPtr->hwndCombo, 0, 0);
    2049         SetFocus(infoPtr->hwndEdit);
    2050         break;
    2051 
    2052         default:
    2053         return CallWindowProcA (infoPtr->prevEditWndProc,
    2054                        hwnd, uMsg, wParam, lParam);
    2055         }
    2056         return 0;
    2057             }
    20582058
    20592059    case WM_SETFOCUS:
    2060         /* remember the focus to set state of icon */
    2061         lret = CallWindowProcA (infoPtr->prevEditWndProc,
    2062                    hwnd, uMsg, wParam, lParam);
    2063         infoPtr->flags |= WCBE_EDITFOCUSED;
    2064         return lret;
     2060            /* remember the focus to set state of icon */
     2061            lret = CallWindowProcA (infoPtr->prevEditWndProc,
     2062                                   hwnd, uMsg, wParam, lParam);
     2063            infoPtr->flags |= WCBE_EDITFOCUSED;
     2064            return lret;
    20652065
    20662066    case WM_KILLFOCUS:
    2067         /*
    2068          * do NOTIFY CBEN_ENDEDIT with CBENF_KILLFOCUS
    2069          */
    2070         infoPtr->flags &= ~WCBE_EDITFOCUSED;
    2071         if (infoPtr->flags & WCBE_ACTEDIT) {
    2072         infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG);
    2073 
    2074         GetWindowTextW (infoPtr->hwndEdit, edit_text, 260);
    2075         cbeend.fChanged = FALSE;
    2076         cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo,
    2077                              CB_GETCURSEL, 0, 0);
    2078         cbeend.iWhy = CBENF_KILLFOCUS;
    2079 
    2080         COMBOEX_NotifyEndEdit (infoPtr, &cbeend, edit_text);
    2081         }
    2082         /* fall through */
     2067            /*
     2068             * do NOTIFY CBEN_ENDEDIT with CBENF_KILLFOCUS
     2069             */
     2070            infoPtr->flags &= ~WCBE_EDITFOCUSED;
     2071            if (infoPtr->flags & WCBE_ACTEDIT) {
     2072                infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG);
     2073
     2074                GetWindowTextW (infoPtr->hwndEdit, edit_text, 260);
     2075                cbeend.fChanged = FALSE;
     2076                cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo,
     2077                                                     CB_GETCURSEL, 0, 0);
     2078                cbeend.iWhy = CBENF_KILLFOCUS;
     2079
     2080                COMBOEX_NotifyEndEdit (infoPtr, &cbeend, edit_text);
     2081            }
     2082            /* fall through */
    20832083
    20842084    default:
    2085         return CallWindowProcA (infoPtr->prevEditWndProc,
    2086                    hwnd, uMsg, wParam, lParam);
     2085            return CallWindowProcA (infoPtr->prevEditWndProc,
     2086                                   hwnd, uMsg, wParam, lParam);
    20872087    }
    20882088    return 0;
     
    21022102    WCHAR edit_text[260];
    21032103
    2104     TRACE("hwnd=%x msg=%x wparam=%x lParam=%lx, info_ptr=%p\n",
    2105       hwnd, uMsg, wParam, lParam, infoPtr);
     2104    TRACE("hwnd=%x msg=%x wparam=%x lParam=%lx, info_ptr=%p\n", 
     2105          hwnd, uMsg, wParam, lParam, infoPtr);
    21062106
    21072107    if (!infoPtr) return 0;
     
    21112111
    21122112    case CB_FINDSTRINGEXACT:
    2113         return COMBOEX_FindStringExact (infoPtr, wParam, lParam);
     2113            return COMBOEX_FindStringExact (infoPtr, wParam, lParam);
    21142114
    21152115    case WM_DRAWITEM:
    2116         /*
    2117          * The only way this message should come is from the
    2118          * child Listbox issuing the message. Flag this so
    2119          * that ComboEx knows this is listbox.
    2120          */
    2121         ((DRAWITEMSTRUCT *)lParam)->itemState |= ODS_COMBOEXLBOX;
    2122         return CallWindowProcA (infoPtr->prevComboWndProc,
    2123                    hwnd, uMsg, wParam, lParam);
     2116            /*
     2117             * The only way this message should come is from the
     2118             * child Listbox issuing the message. Flag this so
     2119             * that ComboEx knows this is listbox.
     2120             */
     2121            ((DRAWITEMSTRUCT *)lParam)->itemState |= ODS_COMBOEXLBOX;
     2122            return CallWindowProcA (infoPtr->prevComboWndProc,
     2123                                   hwnd, uMsg, wParam, lParam);
    21242124
    21252125    case WM_ERASEBKGND:
    2126         /*
    2127          * The following was determined by traces of the native
    2128          */
     2126            /*
     2127             * The following was determined by traces of the native
     2128             */
    21292129            hDC = (HDC) wParam;
    2130         nbkc = GetSysColor (COLOR_WINDOW);
    2131         obkc = SetBkColor (hDC, nbkc);
     2130            nbkc = GetSysColor (COLOR_WINDOW);
     2131            obkc = SetBkColor (hDC, nbkc);
    21322132            GetClientRect (hwnd, &rect);
    2133         TRACE("erasing (%d,%d)-(%d,%d)\n",
    2134           rect.left, rect.top, rect.right, rect.bottom);
    2135         ExtTextOutW (hDC, 0, 0, ETO_OPAQUE, &rect, 0, 0, 0);
     2133            TRACE("erasing (%d,%d)-(%d,%d)\n",
     2134                  rect.left, rect.top, rect.right, rect.bottom);
     2135            ExtTextOutW (hDC, 0, 0, ETO_OPAQUE, &rect, 0, 0, 0);
    21362136            SetBkColor (hDC, obkc);
    2137         return CallWindowProcA (infoPtr->prevComboWndProc,
    2138                    hwnd, uMsg, wParam, lParam);
     2137            return CallWindowProcA (infoPtr->prevComboWndProc,
     2138                                   hwnd, uMsg, wParam, lParam);
    21392139
    21402140    case WM_SETCURSOR:
    2141         /*
    2142          *  WM_NOTIFY to comboex parent (rebar)
    2143          *   with NM_SETCURSOR with extra words of 0,0,0,0,0x02010001
    2144          *  CallWindowProc (previous)
    2145          */
    2146         nmmse.dwItemSpec = 0;
    2147         nmmse.dwItemData = 0;
    2148         nmmse.pt.x = 0;
    2149         nmmse.pt.y = 0;
    2150         nmmse.dwHitInfo = lParam;
    2151         COMBOEX_Notify (infoPtr, NM_SETCURSOR, (NMHDR *)&nmmse);
    2152         return CallWindowProcA (infoPtr->prevComboWndProc,
    2153                    hwnd, uMsg, wParam, lParam);
     2141            /*
     2142             *  WM_NOTIFY to comboex parent (rebar)
     2143             *   with NM_SETCURSOR with extra words of 0,0,0,0,0x02010001
     2144             *  CallWindowProc (previous)
     2145             */
     2146            nmmse.dwItemSpec = 0;
     2147            nmmse.dwItemData = 0;
     2148            nmmse.pt.x = 0;
     2149            nmmse.pt.y = 0;
     2150            nmmse.dwHitInfo = lParam;
     2151            COMBOEX_Notify (infoPtr, NM_SETCURSOR, (NMHDR *)&nmmse);
     2152            return CallWindowProcA (infoPtr->prevComboWndProc,
     2153                                   hwnd, uMsg, wParam, lParam);
    21542154
    21552155    case WM_COMMAND:
    2156         switch (HIWORD(wParam)) {
    2157 
    2158         case EN_UPDATE:
    2159         /* traces show that COMBOEX does not issue CBN_EDITUPDATE
    2160         * on the EN_UPDATE
    2161         */
    2162         return 0;
    2163 
    2164         case EN_KILLFOCUS:
    2165         /*
    2166         * Native does:
    2167         *
    2168         *  GetFocus() retns AA
    2169         *  GetWindowTextA(Edit)
    2170         *  CB_GETCURSEL(Combo) (got -1)
    2171         *  WM_NOTIFY(CBEN_ENDEDITA) with CBENF_KILLFOCUS
    2172         *  CB_GETCURSEL(Combo) (got -1)
    2173         *  InvalidateRect(Combo, 0, 0)
    2174         *  WM_KILLFOCUS(Combo, AA)
    2175         *  return 0;
    2176         */
    2177         focusedhwnd = GetFocus();
    2178         if (infoPtr->flags & WCBE_ACTEDIT) {
    2179             GetWindowTextW (infoPtr->hwndEdit, edit_text, 260);
    2180             cbeend.fChanged = (infoPtr->flags & WCBE_EDITCHG);
    2181             cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo,
    2182                             CB_GETCURSEL, 0, 0);
    2183             cbeend.iWhy = CBENF_KILLFOCUS;
    2184 
    2185             infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG);
    2186             if (COMBOEX_NotifyEndEdit (infoPtr, &cbeend, edit_text)) {
    2187             /* abort the change */
    2188             TRACE("Notify requested abort of change\n");
    2189             return 0;
    2190             }
    2191         }
    2192         /* possible CB_GETCURSEL */
    2193         InvalidateRect (infoPtr->hwndCombo, 0, 0);
    2194         if (focusedhwnd)
    2195             SendMessageW (infoPtr->hwndCombo, WM_KILLFOCUS,
    2196                   (WPARAM)focusedhwnd, 0);
    2197         return 0;
    2198 
    2199         case EN_SETFOCUS: {
    2200         /*
    2201         * For EN_SETFOCUS this issues the same calls and messages
    2202         *  as the native seems to do.
    2203         *
    2204         * for some cases however native does the following:
    2205         *   (noticed after SetFocus during LBUTTONDOWN on
    2206         *    on dropdown arrow)
    2207         *  WM_GETTEXTLENGTH (Edit);
    2208         *  WM_GETTEXT (Edit, len+1, str);
    2209         *  EM_SETSEL (Edit, 0, 0);
    2210         *  WM_GETTEXTLENGTH (Edit);
    2211         *  WM_GETTEXT (Edit, len+1, str);
    2212         *  EM_SETSEL (Edit, 0, len);
    2213         *  WM_NOTIFY (parent, CBEN_BEGINEDIT)
    2214         */
    2215         NMHDR hdr;
    2216 
    2217         SendMessageW (infoPtr->hwndEdit, EM_SETSEL, 0, 0);
    2218         SendMessageW (infoPtr->hwndEdit, EM_SETSEL, 0, -1);
    2219         COMBOEX_Notify (infoPtr, CBEN_BEGINEDIT, &hdr);
    2220         infoPtr->flags |= WCBE_ACTEDIT;
    2221         infoPtr->flags &= ~WCBE_EDITCHG; /* no change yet */
    2222         return 0;
    2223             }
    2224 
    2225         case EN_CHANGE: {
    2226         /*
    2227         * For EN_CHANGE this issues the same calls and messages
    2228         *  as the native seems to do.
    2229         */
    2230         WCHAR edit_text[260];
    2231         WCHAR *lastwrk;
    2232         INT selected, cnt;
    2233         CBE_ITEMDATA *item;
    2234 
    2235         selected = SendMessageW (infoPtr->hwndCombo,
    2236                     CB_GETCURSEL, 0, 0);
    2237 
    2238         /* lstrlenA( lastworkingURL ) */
    2239 
    2240         GetWindowTextW (infoPtr->hwndEdit, edit_text, 260);
    2241         if (selected == -1) {
    2242             lastwrk = infoPtr->edit->pszText;
    2243             cnt = lstrlenW (lastwrk);
    2244             if (cnt >= 259) cnt = 259;
    2245         }
    2246         else {
    2247             item = COMBOEX_FindItem (infoPtr, selected);
    2248             cnt = lstrlenW (item->pszText);
    2249             lastwrk = item->pszText;
    2250             if (cnt >= 259) cnt = 259;
    2251         }
    2252 
    2253         TRACE("handling EN_CHANGE, selected = %d, selected_text=%s\n",
    2254             selected, debugstr_w(lastwrk));
    2255         TRACE("handling EN_CHANGE, edittext=%s\n",
    2256               debugstr_w(edit_text));
    2257 
    2258         /* lstrcmpiW is between lastworkingURL and GetWindowText */
    2259 
    2260         if (lstrcmpiW (lastwrk, edit_text)) {
    2261             /* strings not equal -- indicate edit has changed */
    2262             infoPtr->flags |= WCBE_EDITCHG;
    2263         }
    2264         SendMessageW ( GetParent(infoPtr->hwndSelf), WM_COMMAND,
    2265                    MAKEWPARAM(GetDlgCtrlID (infoPtr->hwndSelf),
    2266                       CBN_EDITCHANGE),
    2267                    infoPtr->hwndSelf);
    2268         return 0;
    2269             }
    2270 
    2271         case LBN_SELCHANGE:
    2272         /*
    2273         * Therefore from traces there is no additional code here
    2274         */
    2275 
    2276         /*
    2277         * Using native COMCTL32 gets the following:
    2278         *  1 == SHDOCVW.DLL  issues call/message
    2279         *  2 == COMCTL32.DLL  issues call/message
    2280         *  3 == WINE  issues call/message
    2281         *
    2282         *
    2283         * for LBN_SELCHANGE:
    2284         *    1  CB_GETCURSEL(ComboEx)
    2285         *    1  CB_GETDROPPEDSTATE(ComboEx)
    2286         *    1  CallWindowProc( *2* for WM_COMMAND(LBN_SELCHANGE)
    2287         *    2  CallWindowProc( *3* for WM_COMMAND(LBN_SELCHANGE)
    2288         **   call CBRollUp( xxx, TRUE for LBN_SELCHANGE, TRUE)
    2289         *    3  WM_COMMAND(ComboEx, CBN_SELENDOK)
    2290         *      WM_USER+49(ComboLB, 1,0)  <=============!!!!!!!!!!!
    2291         *    3  ShowWindow(ComboLB, SW_HIDE)
    2292         *    3  RedrawWindow(Combo,  RDW_UPDATENOW)
    2293         *    3  WM_COMMAND(ComboEX, CBN_CLOSEUP)
    2294         **   end of CBRollUp
    2295         *    3  WM_COMMAND(ComboEx, CBN_SELCHANGE)  (echo to parent)
    2296         *    ?  LB_GETCURSEL              <==|
    2297         *    ?  LB_GETTEXTLEN                |
    2298         *    ?  LB_GETTEXT                   | Needs to be added to
    2299         *    ?  WM_CTLCOLOREDIT(ComboEx)     | Combo processing
    2300         *    ?  LB_GETITEMDATA               |
    2301         *    ?  WM_DRAWITEM(ComboEx)      <==|
    2302         */
    2303         default:
    2304         break;
    2305         }/* fall through */
     2156            switch (HIWORD(wParam)) {
     2157
     2158            case EN_UPDATE:
     2159                /* traces show that COMBOEX does not issue CBN_EDITUPDATE
     2160                * on the EN_UPDATE
     2161                */
     2162                return 0;
     2163
     2164            case EN_KILLFOCUS:
     2165                /*
     2166                * Native does:
     2167                *
     2168                *  GetFocus() retns AA
     2169                *  GetWindowTextA(Edit)
     2170                *  CB_GETCURSEL(Combo) (got -1)
     2171                *  WM_NOTIFY(CBEN_ENDEDITA) with CBENF_KILLFOCUS
     2172                *  CB_GETCURSEL(Combo) (got -1)
     2173                *  InvalidateRect(Combo, 0, 0)
     2174                *  WM_KILLFOCUS(Combo, AA)
     2175                *  return 0;
     2176                */
     2177                focusedhwnd = GetFocus();
     2178                if (infoPtr->flags & WCBE_ACTEDIT) {
     2179                    GetWindowTextW (infoPtr->hwndEdit, edit_text, 260);
     2180                    cbeend.fChanged = (infoPtr->flags & WCBE_EDITCHG);
     2181                    cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo,
     2182                                                        CB_GETCURSEL, 0, 0);
     2183                    cbeend.iWhy = CBENF_KILLFOCUS;
     2184
     2185                    infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG);
     2186                    if (COMBOEX_NotifyEndEdit (infoPtr, &cbeend, edit_text)) {
     2187                        /* abort the change */
     2188                        TRACE("Notify requested abort of change\n");
     2189                        return 0;
     2190                    }
     2191                }
     2192                /* possible CB_GETCURSEL */
     2193                InvalidateRect (infoPtr->hwndCombo, 0, 0);
     2194                if (focusedhwnd)
     2195                    SendMessageW (infoPtr->hwndCombo, WM_KILLFOCUS,
     2196                                  (WPARAM)focusedhwnd, 0);
     2197                return 0;
     2198
     2199            case EN_SETFOCUS: {
     2200                /*
     2201                * For EN_SETFOCUS this issues the same calls and messages
     2202                *  as the native seems to do.
     2203                *
     2204                * for some cases however native does the following:
     2205                *   (noticed after SetFocus during LBUTTONDOWN on
     2206                *    on dropdown arrow)
     2207                *  WM_GETTEXTLENGTH (Edit);
     2208                *  WM_GETTEXT (Edit, len+1, str);
     2209                *  EM_SETSEL (Edit, 0, 0);
     2210                *  WM_GETTEXTLENGTH (Edit);
     2211                *  WM_GETTEXT (Edit, len+1, str);
     2212                *  EM_SETSEL (Edit, 0, len);
     2213                *  WM_NOTIFY (parent, CBEN_BEGINEDIT)
     2214                */
     2215                NMHDR hdr;
     2216
     2217                SendMessageW (infoPtr->hwndEdit, EM_SETSEL, 0, 0);
     2218                SendMessageW (infoPtr->hwndEdit, EM_SETSEL, 0, -1);
     2219                COMBOEX_Notify (infoPtr, CBEN_BEGINEDIT, &hdr);
     2220                infoPtr->flags |= WCBE_ACTEDIT;
     2221                infoPtr->flags &= ~WCBE_EDITCHG; /* no change yet */
     2222                return 0;
     2223                }
     2224
     2225            case EN_CHANGE: {
     2226                /*
     2227                * For EN_CHANGE this issues the same calls and messages
     2228                *  as the native seems to do.
     2229                */
     2230                WCHAR edit_text[260];
     2231                WCHAR *lastwrk;
     2232                INT selected, cnt;
     2233                CBE_ITEMDATA *item;
     2234
     2235                selected = SendMessageW (infoPtr->hwndCombo,
     2236                                        CB_GETCURSEL, 0, 0);
     2237
     2238                /* lstrlenA( lastworkingURL ) */
     2239
     2240                GetWindowTextW (infoPtr->hwndEdit, edit_text, 260);
     2241                if (selected == -1) {
     2242                    lastwrk = infoPtr->edit->pszText;
     2243                    cnt = lstrlenW (lastwrk);
     2244                    if (cnt >= 259) cnt = 259;
     2245                }
     2246                else {
     2247                    item = COMBOEX_FindItem (infoPtr, selected);
     2248                    cnt = lstrlenW (item->pszText);
     2249                    lastwrk = item->pszText;
     2250                    if (cnt >= 259) cnt = 259;
     2251                }
     2252
     2253                TRACE("handling EN_CHANGE, selected = %d, selected_text=%s\n",
     2254                    selected, debugstr_w(lastwrk));
     2255                TRACE("handling EN_CHANGE, edittext=%s\n",
     2256                      debugstr_w(edit_text));
     2257
     2258                /* lstrcmpiW is between lastworkingURL and GetWindowText */
     2259
     2260                if (lstrcmpiW (lastwrk, edit_text)) {
     2261                    /* strings not equal -- indicate edit has changed */
     2262                    infoPtr->flags |= WCBE_EDITCHG;
     2263                }
     2264                SendMessageW ( GetParent(infoPtr->hwndSelf), WM_COMMAND,
     2265                               MAKEWPARAM(GetDlgCtrlID (infoPtr->hwndSelf),
     2266                                          CBN_EDITCHANGE),
     2267                               infoPtr->hwndSelf);
     2268                return 0;
     2269                }
     2270
     2271            case LBN_SELCHANGE:
     2272                /*
     2273                * Therefore from traces there is no additional code here
     2274                */
     2275
     2276                /*
     2277                * Using native COMCTL32 gets the following:
     2278                *  1 == SHDOCVW.DLL  issues call/message
     2279                *  2 == COMCTL32.DLL  issues call/message
     2280                *  3 == WINE  issues call/message
     2281                *
     2282                *
     2283                * for LBN_SELCHANGE:
     2284                *    1  CB_GETCURSEL(ComboEx)
     2285                *    1  CB_GETDROPPEDSTATE(ComboEx)
     2286                *    1  CallWindowProc( *2* for WM_COMMAND(LBN_SELCHANGE)
     2287                *    2  CallWindowProc( *3* for WM_COMMAND(LBN_SELCHANGE)
     2288                **   call CBRollUp( xxx, TRUE for LBN_SELCHANGE, TRUE)
     2289                *    3  WM_COMMAND(ComboEx, CBN_SELENDOK)
     2290                *      WM_USER+49(ComboLB, 1,0)  <=============!!!!!!!!!!!
     2291                *    3  ShowWindow(ComboLB, SW_HIDE)
     2292                *    3  RedrawWindow(Combo,  RDW_UPDATENOW)
     2293                *    3  WM_COMMAND(ComboEX, CBN_CLOSEUP)
     2294                **   end of CBRollUp
     2295                *    3  WM_COMMAND(ComboEx, CBN_SELCHANGE)  (echo to parent)
     2296                *    ?  LB_GETCURSEL              <==|
     2297                *    ?  LB_GETTEXTLEN                |
     2298                *    ?  LB_GETTEXT                   | Needs to be added to
     2299                *    ?  WM_CTLCOLOREDIT(ComboEx)     | Combo processing
     2300                *    ?  LB_GETITEMDATA               |
     2301                *    ?  WM_DRAWITEM(ComboEx)      <==|
     2302                */
     2303            default:
     2304                break;
     2305            }/* fall through */
    23062306    default:
    2307         return CallWindowProcA (infoPtr->prevComboWndProc,
    2308                    hwnd, uMsg, wParam, lParam);
     2307            return CallWindowProcA (infoPtr->prevComboWndProc,
     2308                                   hwnd, uMsg, wParam, lParam);
    23092309    }
    23102310    return 0;
     
    23202320
    23212321    if (!COMBOEX_GetInfoPtr (hwnd)) {
    2322     if (uMsg == WM_CREATE)
    2323         return COMBOEX_Create (hwnd, wParam, lParam);
    2324     if (uMsg == WM_NCCREATE)
    2325         COMBOEX_NCCreate (hwnd, wParam, lParam);
     2322        if (uMsg == WM_CREATE)
     2323            return COMBOEX_Create (hwnd, wParam, lParam);
     2324        if (uMsg == WM_NCCREATE)
     2325            COMBOEX_NCCreate (hwnd, wParam, lParam);
    23262326        return DefWindowProcA (hwnd, uMsg, wParam, lParam);
    23272327    }
     
    23302330    {
    23312331        case CBEM_DELETEITEM:  /* maps to CB_DELETESTRING */
    2332         return COMBOEX_DeleteItem (hwnd, wParam, lParam);
    2333 
    2334     case CBEM_GETCOMBOCONTROL:
    2335         return COMBOEX_GetComboControl (hwnd, wParam, lParam);
    2336 
    2337     case CBEM_GETEDITCONTROL:
    2338         return COMBOEX_GetEditControl (hwnd, wParam, lParam);
    2339 
    2340     case CBEM_GETEXTENDEDSTYLE:
    2341         return COMBOEX_GetExtendedStyle (hwnd, wParam, lParam);
    2342 
    2343     case CBEM_GETIMAGELIST:
    2344         return COMBOEX_GetImageList (hwnd, wParam, lParam);
    2345 
    2346     case CBEM_GETITEMA:
    2347         return COMBOEX_GetItemA (hwnd, wParam, lParam);
    2348 
    2349     case CBEM_GETITEMW:
    2350         return COMBOEX_GetItemW (hwnd, wParam, lParam);
    2351 
    2352     case CBEM_GETUNICODEFORMAT:
    2353         return COMBOEX_GetUnicodeFormat (hwnd, wParam, lParam);
    2354 
    2355     case CBEM_HASEDITCHANGED:
    2356         return COMBOEX_HasEditChanged (hwnd, wParam, lParam);
    2357 
    2358     case CBEM_INSERTITEMA:
    2359         return COMBOEX_InsertItemA (hwnd, wParam, lParam);
    2360 
    2361     case CBEM_INSERTITEMW:
    2362         return COMBOEX_InsertItemW (hwnd, wParam, lParam);
    2363 
    2364     case CBEM_SETEXSTYLE:   /* FIXME: obsoleted, should be the same as: */
    2365     case CBEM_SETEXTENDEDSTYLE:
    2366         return COMBOEX_SetExtendedStyle (hwnd, wParam, lParam);
    2367 
    2368     case CBEM_SETIMAGELIST:
    2369         return COMBOEX_SetImageList (hwnd, wParam, lParam);
    2370 
    2371     case CBEM_SETITEMA:
    2372         return COMBOEX_SetItemA (hwnd, wParam, lParam);
    2373 
    2374     case CBEM_SETITEMW:
    2375         return COMBOEX_SetItemW (hwnd, wParam, lParam);
    2376 
    2377     case CBEM_SETUNICODEFORMAT:
    2378         return COMBOEX_SetUnicodeFormat (hwnd, wParam, lParam);
     2332            return COMBOEX_DeleteItem (hwnd, wParam, lParam);
     2333
     2334        case CBEM_GETCOMBOCONTROL:
     2335            return COMBOEX_GetComboControl (hwnd, wParam, lParam);
     2336
     2337        case CBEM_GETEDITCONTROL:
     2338            return COMBOEX_GetEditControl (hwnd, wParam, lParam);
     2339
     2340        case CBEM_GETEXTENDEDSTYLE:
     2341            return COMBOEX_GetExtendedStyle (hwnd, wParam, lParam);
     2342
     2343        case CBEM_GETIMAGELIST:
     2344            return COMBOEX_GetImageList (hwnd, wParam, lParam);
     2345
     2346        case CBEM_GETITEMA:
     2347            return COMBOEX_GetItemA (hwnd, wParam, lParam);
     2348
     2349        case CBEM_GETITEMW:
     2350            return COMBOEX_GetItemW (hwnd, wParam, lParam);
     2351
     2352        case CBEM_GETUNICODEFORMAT:
     2353            return COMBOEX_GetUnicodeFormat (hwnd, wParam, lParam);
     2354
     2355        case CBEM_HASEDITCHANGED:
     2356            return COMBOEX_HasEditChanged (hwnd, wParam, lParam);
     2357
     2358        case CBEM_INSERTITEMA:
     2359            return COMBOEX_InsertItemA (hwnd, wParam, lParam);
     2360
     2361        case CBEM_INSERTITEMW:
     2362            return COMBOEX_InsertItemW (hwnd, wParam, lParam);
     2363
     2364        case CBEM_SETEXSTYLE:   /* FIXME: obsoleted, should be the same as: */
     2365        case CBEM_SETEXTENDEDSTYLE:
     2366            return COMBOEX_SetExtendedStyle (hwnd, wParam, lParam);
     2367
     2368        case CBEM_SETIMAGELIST:
     2369            return COMBOEX_SetImageList (hwnd, wParam, lParam);
     2370
     2371        case CBEM_SETITEMA:
     2372            return COMBOEX_SetItemA (hwnd, wParam, lParam);
     2373
     2374        case CBEM_SETITEMW:
     2375            return COMBOEX_SetItemW (hwnd, wParam, lParam);
     2376
     2377        case CBEM_SETUNICODEFORMAT:
     2378            return COMBOEX_SetUnicodeFormat (hwnd, wParam, lParam);
    23792379
    23802380
    23812381/*   Combo messages we are not sure if we need to process or just forward */
    2382     case CB_GETDROPPEDCONTROLRECT:
    2383     case CB_GETITEMHEIGHT:
    2384     case CB_GETLBTEXT:
    2385     case CB_GETLBTEXTLEN:
    2386     case CB_GETEXTENDEDUI:
    2387     case CB_LIMITTEXT:
    2388     case CB_RESETCONTENT:
    2389     case CB_SELECTSTRING:
    2390     case WM_SETTEXT:
    2391     case WM_GETTEXT:
    2392         FIXME("(0x%x 0x%x 0x%lx): possibly missing function\n",
    2393           uMsg, wParam, lParam);
    2394         return COMBOEX_Forward (hwnd, uMsg, wParam, lParam);
     2382        case CB_GETDROPPEDCONTROLRECT:
     2383        case CB_GETITEMHEIGHT:
     2384        case CB_GETLBTEXT:
     2385        case CB_GETLBTEXTLEN:
     2386        case CB_GETEXTENDEDUI:
     2387        case CB_LIMITTEXT:
     2388        case CB_RESETCONTENT:
     2389        case CB_SELECTSTRING:
     2390        case WM_SETTEXT:
     2391        case WM_GETTEXT:
     2392            FIXME("(0x%x 0x%x 0x%lx): possibly missing function\n",
     2393                  uMsg, wParam, lParam);
     2394            return COMBOEX_Forward (hwnd, uMsg, wParam, lParam);
    23952395
    23962396/*   Combo messages OK to just forward to the regular COMBO */
    2397     case CB_GETCOUNT:
    2398     case CB_GETCURSEL:
    2399     case CB_GETDROPPEDSTATE:
     2397        case CB_GETCOUNT:       
     2398        case CB_GETCURSEL:
     2399        case CB_GETDROPPEDSTATE:
    24002400        case CB_SETDROPPEDWIDTH:
    24012401        case CB_SETEXTENDEDUI:
    24022402        case CB_SHOWDROPDOWN:
    2403         return COMBOEX_Forward (hwnd, uMsg, wParam, lParam);
     2403            return COMBOEX_Forward (hwnd, uMsg, wParam, lParam);
    24042404
    24052405/*   Combo messages we need to process specially */
    24062406        case CB_FINDSTRINGEXACT:
    2407         return COMBOEX_FindStringExact (COMBOEX_GetInfoPtr (hwnd),
    2408                         wParam, lParam);
    2409 
    2410     case CB_GETITEMDATA:
    2411         return COMBOEX_GetItemData (hwnd, wParam, lParam);
    2412 
    2413     case CB_SETCURSEL:
    2414         return COMBOEX_SetCursel (hwnd, wParam, lParam);
    2415 
    2416     case CB_SETITEMDATA:
    2417         return COMBOEX_SetItemData (hwnd, wParam, lParam);
    2418 
    2419     case CB_SETITEMHEIGHT:
    2420         return COMBOEX_SetItemHeight (hwnd, wParam, lParam);
     2407            return COMBOEX_FindStringExact (COMBOEX_GetInfoPtr (hwnd),
     2408                                            wParam, lParam);
     2409
     2410        case CB_GETITEMDATA:
     2411            return COMBOEX_GetItemData (hwnd, wParam, lParam);
     2412
     2413        case CB_SETCURSEL:
     2414            return COMBOEX_SetCursel (hwnd, wParam, lParam);
     2415
     2416        case CB_SETITEMDATA:
     2417            return COMBOEX_SetItemData (hwnd, wParam, lParam);
     2418
     2419        case CB_SETITEMHEIGHT:
     2420            return COMBOEX_SetItemHeight (hwnd, wParam, lParam);
    24212421
    24222422
    24232423
    24242424/*   Window messages passed to parent */
    2425     case WM_COMMAND:
    2426         return COMBOEX_Command (hwnd, wParam, lParam);
    2427 
    2428     case WM_NOTIFY:
    2429         if (infoPtr->NtfUnicode)
    2430         return SendMessageW (GetParent (hwnd),
    2431                      uMsg, wParam, lParam);
    2432         else
    2433         return SendMessageA (GetParent (hwnd),
    2434                      uMsg, wParam, lParam);
     2425        case WM_COMMAND:
     2426            return COMBOEX_Command (hwnd, wParam, lParam);
     2427
     2428        case WM_NOTIFY:
     2429            if (infoPtr->NtfUnicode)
     2430                return SendMessageW (GetParent (hwnd),
     2431                                     uMsg, wParam, lParam);
     2432            else
     2433                return SendMessageA (GetParent (hwnd),
     2434                                     uMsg, wParam, lParam);
    24352435
    24362436
    24372437/*   Window messages we need to process */
    24382438        case WM_DELETEITEM:
    2439         return COMBOEX_WM_DeleteItem (hwnd, wParam, lParam);
     2439            return COMBOEX_WM_DeleteItem (hwnd, wParam, lParam);
    24402440
    24412441        case WM_DRAWITEM:
    24422442            return COMBOEX_DrawItem (hwnd, wParam, lParam);
    24432443
    2444     case WM_DESTROY:
    2445         return COMBOEX_Destroy (hwnd, wParam, lParam);
     2444        case WM_DESTROY:
     2445            return COMBOEX_Destroy (hwnd, wParam, lParam);
    24462446
    24472447        case WM_MEASUREITEM:
     
    24492449
    24502450        case WM_NOTIFYFORMAT:
    2451         return COMBOEX_NotifyFormat (hwnd, wParam, lParam);
    2452 
    2453     case WM_SIZE:
    2454         return COMBOEX_Size (hwnd, wParam, lParam);
     2451            return COMBOEX_NotifyFormat (hwnd, wParam, lParam);
     2452
     2453        case WM_SIZE:
     2454            return COMBOEX_Size (hwnd, wParam, lParam);
    24552455
    24562456        case WM_WINDOWPOSCHANGING:
    2457         return COMBOEX_WindowPosChanging (hwnd, wParam, lParam);
    2458 
    2459     default:
    2460         if (uMsg >= WM_USER)
    2461         ERR("unknown msg %04x wp=%08x lp=%08lx\n",
    2462              uMsg, wParam, lParam);
     2457            return COMBOEX_WindowPosChanging (hwnd, wParam, lParam);
     2458
     2459        default:
     2460            if (uMsg >= WM_USER)
     2461                ERR("unknown msg %04x wp=%08x lp=%08lx\n",
     2462                     uMsg, wParam, lParam);
    24632463#ifdef __WIN32OS2__
    24642464            return defComCtl32ProcA (hwnd, uMsg, wParam, lParam);
    24652465#else
    2466         return DefWindowProcA (hwnd, uMsg, wParam, lParam);
     2466            return DefWindowProcA (hwnd, uMsg, wParam, lParam);
    24672467#endif
    24682468    }
     
    24842484    wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
    24852485    wndClass.lpszClassName = WC_COMBOBOXEXA;
    2486 
     2486 
    24872487    RegisterClassA (&wndClass);
    24882488
Note: See TracChangeset for help on using the changeset viewer.