Ignore:
Timestamp:
Nov 13, 1999, 5:42:43 PM (26 years ago)
Author:
cbratschi
Message:

merged with wine-991031, fixed edit bugs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/combo.cpp

    r1550 r1724  
    1 /* $Id: combo.cpp,v 1.11 1999-11-02 19:12:59 sandervl Exp $ */
     1/* $Id: combo.cpp,v 1.12 1999-11-13 16:42:41 cbratschi Exp $ */
    22/*
    33 * Combo controls
     
    88 * FIXME: roll up in Netscape 3.01.
    99 *
    10  * WINE version: 990923
     10 * WINE version: 991031
    1111 */
    1212
     
    374374    //SvL: Listbox size might have changed!
    375375    if(lphc->hWndLBox)
    376         GetWindowRect(lphc->hWndLBox, lprLB);
     376        GetWindowRect(lphc->hWndLBox, lprLB);
    377377
    378378    /*
     
    675675    }
    676676
    677     DrawFrameControl(hdc,&rectButton,DFC_SCROLL,buttonState);                   
     677    DrawFrameControl(hdc,&rectButton,DFC_SCROLL,buttonState);
    678678}
    679679
     
    688688  RECT        rectEdit)
    689689{
    690    INT  id, size = 0;
    691    LPSTR        pText = NULL;
     690   INT  id, size = 0;
     691   LPSTR        pText = NULL;
    692692
    693693   if( lphc->wState & CBF_NOREDRAW ) return;
     
    700700        size = SendMessageA( lphc->hWndLBox, LB_GETTEXTLEN, id, 0);
    701701        if( (pText = (char*)HeapAlloc( GetProcessHeap(), 0, size + 1)) != NULL )
    702         {
    703             SendMessageA( lphc->hWndLBox, LB_GETTEXT, (WPARAM)id, (LPARAM)pText );
    704             pText[size] = '\0'; /* just in case */
    705         } else return;
     702        {
     703            SendMessageA( lphc->hWndLBox, LB_GETTEXT, (WPARAM)id, (LPARAM)pText );
     704            pText[size] = '\0'; /* just in case */
     705        } else return;
    706706   }
    707707
    708708   if( lphc->wState & CBF_EDIT )
    709709   {
    710         if( CB_HASSTRINGS(lphc) ) SetWindowTextA( lphc->hWndEdit, pText ? pText : "" );
    711         if( lphc->wState & CBF_FOCUSED )
    712             SendMessageA( lphc->hWndEdit, EM_SETSEL, 0, (LPARAM)(-1));
     710        if( CB_HASSTRINGS(lphc) ) SetWindowTextA( lphc->hWndEdit, pText ? pText : "" );
     711        if( lphc->wState & CBF_FOCUSED )
     712            SendMessageA( lphc->hWndEdit, EM_SETSEL, 0, (LPARAM)(-1));
    713713   }
    714714   else /* paint text field ourselves */
    715715   {
    716      UINT       itemState;
    717      HFONT      hPrevFont = (lphc->hFont) ? SelectObject(hdc, lphc->hFont) : 0;
     716     UINT       itemState;
     717     HFONT      hPrevFont = (lphc->hFont) ? SelectObject(hdc, lphc->hFont) : 0;
    718718
    719719     /*
     
    723723
    724724     if ( (lphc->wState & CBF_FOCUSED) &&
    725           !(lphc->wState & CBF_DROPPED) )
     725          !(lphc->wState & CBF_DROPPED) )
    726726     {
    727727       /* highlight */
     
    742742
    743743       /*
    744         * Save the current clip region.
    745         * To retrieve the clip region, we need to create one "dummy"
    746         * clip region.
    747         */
     744        * Save the current clip region.
     745        * To retrieve the clip region, we need to create one "dummy"
     746        * clip region.
     747        */
    748748       clipRegion = CreateRectRgnIndirect(&rectEdit);
    749749
    750750       if (GetClipRgn(hdc, clipRegion)!=1)
    751751       {
    752         DeleteObject(clipRegion);
    753         clipRegion=(HRGN)NULL;
     752        DeleteObject(clipRegion);
     753        clipRegion=(HRGN)NULL;
    754754       }
    755755
    756756       if ( dwStyle & WS_DISABLED )
    757         itemState |= ODS_DISABLED;
    758 
    759        dis.CtlType      = ODT_COMBOBOX;
    760        dis.CtlID        = GetWindowLongA(lphc->hwndself,GWL_ID);
    761        dis.hwndItem     = lphc->hwndself;
    762        dis.itemAction   = ODA_DRAWENTIRE;
    763        dis.itemID       = id;
    764        dis.itemState    = itemState;
    765        dis.hDC          = hdc;
    766        dis.rcItem       = rectEdit;
    767        dis.itemData     = SendMessageA( lphc->hWndLBox, LB_GETITEMDATA,
    768                                         (WPARAM)id, 0 );
     757        itemState |= ODS_DISABLED;
     758
     759       dis.CtlType      = ODT_COMBOBOX;
     760       dis.CtlID        = GetWindowLongA(lphc->hwndself,GWL_ID);
     761       dis.hwndItem     = lphc->hwndself;
     762       dis.itemAction   = ODA_DRAWENTIRE;
     763       dis.itemID       = id;
     764       dis.itemState    = itemState;
     765       dis.hDC          = hdc;
     766       dis.rcItem       = rectEdit;
     767       dis.itemData     = SendMessageA( lphc->hWndLBox, LB_GETITEMDATA,
     768                                        (WPARAM)id, 0 );
    769769
    770770       /*
    771         * Clip the DC and have the parent draw the item.
    772         */
     771        * Clip the DC and have the parent draw the item.
     772        */
    773773       IntersectClipRect(hdc,
    774                         rectEdit.left,  rectEdit.top,
    775                         rectEdit.right, rectEdit.bottom);
     774                        rectEdit.left,  rectEdit.top,
     775                        rectEdit.right, rectEdit.bottom);
    776776
    777777       SendMessageA(lphc->owner, WM_DRAWITEM,
    778                     GetWindowLongA(lphc->hwndself,GWL_ID), (LPARAM)&dis );
     778                    GetWindowLongA(lphc->hwndself,GWL_ID), (LPARAM)&dis );
    779779
    780780       /*
    781         * Reset the clipping region.
    782         */
    783        SelectClipRgn(hdc, clipRegion);         
     781        * Reset the clipping region.
     782        */
     783       SelectClipRgn(hdc, clipRegion);
    784784     }
    785785     else
    786786     {
    787787       ExtTextOutA( hdc,
    788                     rectEdit.left + 1,
    789                     rectEdit.top + 1,
    790                     ETO_OPAQUE | ETO_CLIPPED,
    791                     &rectEdit,
    792                     pText ? pText : "" , size, NULL );
     788                    rectEdit.left + 1,
     789                    rectEdit.top + 1,
     790                    ETO_OPAQUE | ETO_CLIPPED,
     791                    &rectEdit,
     792                    pText ? pText : "" , size, NULL );
    793793
    794794       if(lphc->wState & CBF_FOCUSED && !(lphc->wState & CBF_DROPPED))
    795         DrawFocusRect( hdc, &rectEdit );
     795        DrawFocusRect( hdc, &rectEdit );
    796796     }
    797797
     
    800800   }
    801801   if (pText)
    802         HeapFree( GetProcessHeap(), 0, pText );
     802        HeapFree( GetProcessHeap(), 0, pText );
    803803}
    804804
     
    849849  {
    850850    hBkgBrush = SendMessageA( lphc->owner, WM_CTLCOLORSTATIC,
    851                               hDC, lphc->hwndself );
     851                              hDC, lphc->hwndself );
    852852
    853853    /*
     
    863863    {
    864864      hBkgBrush = SendMessageA( lphc->owner, WM_CTLCOLOREDIT,
    865                                 hDC, lphc->hwndself );
     865                                hDC, lphc->hwndself );
    866866    }
    867867    else
    868868    {
    869869      hBkgBrush = SendMessageA( lphc->owner, WM_CTLCOLORLISTBOX,
    870                                 hDC, lphc->hwndself );
     870                                hDC, lphc->hwndself );
    871871    }
    872872  }
     
    18451845        case WM_PASTE:
    18461846        case WM_COPY:
    1847                 if( lphc->wState & CBF_EDIT )
     1847                if ((message == WM_GETTEXTLENGTH) && !(lphc->wState & CBF_EDIT))
    18481848                {
    1849                     lphc->wState |= CBF_NOEDITNOTIFY;
    1850 
    1851                     return SendMessageA( lphc->hWndEdit, message, wParam, lParam );
     1849                int j = SendMessageA( lphc->hWndLBox, LB_GETCURSEL, 0, 0 );
     1850                if (j == -1) return 0;
     1851                return SendMessageA( lphc->hWndLBox, LB_GETTEXTLEN, j, 0);
    18521852                }
    1853                 return  CB_ERR;
     1853                else if( lphc->wState & CBF_EDIT )
     1854                {
     1855                    lphc->wState |= CBF_NOEDITNOTIFY;
     1856
     1857                    return SendMessageA( lphc->hWndEdit, message, wParam, lParam );
     1858                }
     1859                else return  CB_ERR;
    18541860        case WM_DRAWITEM:
    18551861        case WM_DELETEITEM:
     
    18621868                EnableWindow( lphc->hWndLBox, (BOOL)wParam );
    18631869
    1864                 /* Force the control to repaint when the enabled state changes. */
    1865                 InvalidateRect(CB_HWND(lphc), NULL, TRUE);
     1870                /* Force the control to repaint when the enabled state changes. */
     1871                InvalidateRect(CB_HWND(lphc), NULL, TRUE);
    18661872                return  TRUE;
    18671873        case WM_SETREDRAW:
Note: See TracChangeset for help on using the changeset viewer.