Changeset 1203 for trunk/src


Ignore:
Timestamp:
Oct 8, 1999, 11:26:08 PM (26 years ago)
Author:
cbratschi
Message:

merged with WINE, other fixes

Location:
trunk/src/user32
Files:
6 edited

Legend:

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

    r1184 r1203  
    1 /* $Id: button.cpp,v 1.4 1999-10-08 12:10:26 cbratschi Exp $ */
     1/* $Id: button.cpp,v 1.5 1999-10-08 21:23:07 cbratschi Exp $ */
    22/* File: button.cpp -- Button type widgets
    33 *
     
    66 * Copyright (C) 1994 Alexandre Julliard
    77 * Copyright (c) 1999 Christoph Bratschi
     8 *
     9 * WINE version: 990923
    810 */
    911
     
    467469        dwStyle &= ~WS_TABSTOP;
    468470
    469       if (oldStyle != dwStyle) SetWindowLongA(hwnd,GWL_STYLE,dwStyle);
     471      //if (oldStyle != dwStyle) SetWindowLongA(hwnd,GWL_STYLE,dwStyle);
    470472    }
    471473    infoPtr->state = (infoPtr->state & ~3) | wParam;
     
    930932    if (action == ODA_DRAWENTIRE || action == ODA_SELECT)
    931933    {
    932         HDC hMemDC = CreateCompatibleDC( hDC );
    933         int x = 0, y = 0;
    934         delta = (rbox.bottom - rbox.top - checkBoxHeight) >> 1;
    935 
    936         if (action == ODA_SELECT) FillRect( hDC, &rbox, hBrush );
    937         else FillRect( hDC, &client, hBrush );
    938 
    939         if (infoPtr->state & BUTTON_HIGHLIGHTED) x += 2 * checkBoxWidth;
    940         if (infoPtr->state & (BUTTON_CHECKED | BUTTON_3STATE)) x += checkBoxWidth;
     934        UINT state;
     935
    941936        if (((dwStyle & 0x0f) == BS_RADIOBUTTON) ||
    942             ((dwStyle & 0x0f) == BS_AUTORADIOBUTTON)) y += checkBoxHeight;
    943         else if (infoPtr->state & BUTTON_3STATE) y += 2 * checkBoxHeight;
    944 
    945         SelectObject( hMemDC, hbitmapCheckBoxes );
    946         BitBlt( hDC, rbox.left, rbox.top + delta, checkBoxWidth,
    947                   checkBoxHeight, hMemDC, x, y, SRCCOPY );
    948         DeleteDC( hMemDC );
     937            ((dwStyle & 0x0f) == BS_AUTORADIOBUTTON)) state = DFCS_BUTTONRADIO;
     938        else if (infoPtr->state & BUTTON_3STATE) state = DFCS_BUTTON3STATE;
     939        else state = DFCS_BUTTONCHECK;
     940
     941        if (infoPtr->state & (BUTTON_CHECKED | BUTTON_3STATE)) state |= DFCS_CHECKED;
     942
     943        if (infoPtr->state & BUTTON_HIGHLIGHTED) state |= DFCS_PUSHED;
     944
     945        if (dwStyle & WS_DISABLED) state |= DFCS_INACTIVE;
     946
     947        DrawFrameControl( hDC, &rbox, DFC_BUTTON, state );
    949948
    950949        if( text && action != ODA_SELECT )
     
    960959            DrawTextA( hDC, text, -1, &rtext,
    961960                         DT_SINGLELINE | DT_VCENTER );
    962             textLen = 0; /* skip DrawText() below */
    963961          }
    964962        }
  • trunk/src/user32/combo.cpp

    r1184 r1203  
    1 /* $Id: combo.cpp,v 1.3 1999-10-08 12:10:26 cbratschi Exp $ */
     1/* $Id: combo.cpp,v 1.4 1999-10-08 21:23:37 cbratschi Exp $ */
    22/*
    33 * Combo controls
     
    77 *
    88 * FIXME: roll up in Netscape 3.01.
     9 *
     10 * WINE version: 990923
    911 */
    1012
     
    655657  RECT        rectButton)
    656658{
    657     UINT        x, y;
    658     BOOL        bBool;
    659     HDC       hMemDC;
    660     HBRUSH    hPrevBrush;
    661     COLORREF    oldTextColor, oldBkColor;
    662 
    663659    if( lphc->wState & CBF_NOREDRAW )
    664660      return;
    665661
    666     hPrevBrush = SelectObject(hdc, GetSysColorBrush(COLOR_BTNFACE));
    667 
    668     /*
    669      * Draw the button background
    670      */
    671     PatBlt( hdc,
    672             rectButton.left,
    673             rectButton.top,
    674             rectButton.right-rectButton.left,
    675             rectButton.bottom-rectButton.top,
    676             PATCOPY );
    677 
    678     bBool = lphc->wState & CBF_BUTTONDOWN;
    679     if (bBool)
     662
     663    UINT buttonState = DFCS_SCROLLCOMBOBOX;
     664
     665    if (lphc->wState & CBF_BUTTONDOWN)
    680666    {
    681         DrawEdge( hdc, &rectButton, EDGE_SUNKEN, BF_RECT );
     667      buttonState |= DFCS_PUSHED;
    682668    }
    683     else
     669
     670    if (CB_DISABLED(lphc))
    684671    {
    685         DrawEdge( hdc, &rectButton, EDGE_RAISED, BF_RECT );
     672      buttonState |= DFCS_INACTIVE;
    686673    }
    687674
    688     /*
    689      * Remove the edge of the button from the rectangle
    690      * and calculate the position of the bitmap.
    691      */
    692     InflateRect( &rectButton, -2, -2);
    693 
    694     x = (rectButton.left + rectButton.right - CBitWidth) >> 1;
    695     y = (rectButton.top + rectButton.bottom - CBitHeight) >> 1;
    696 
    697 
    698     hMemDC = CreateCompatibleDC( hdc );
    699     SelectObject( hMemDC, hComboBmp );
    700     oldTextColor = SetTextColor( hdc, GetSysColor(COLOR_BTNFACE) );
    701     oldBkColor = SetBkColor( hdc, CB_DISABLED(lphc) ? RGB(128,128,128) :
    702                                RGB(0,0,0) );
    703     BitBlt( hdc, x, y, CBitWidth, CBitHeight, hMemDC, 0, 0, SRCCOPY );
    704     SetBkColor( hdc, oldBkColor );
    705     SetTextColor( hdc, oldTextColor );
    706     DeleteDC( hMemDC );
    707     SelectObject( hdc, hPrevBrush );
     675    DrawFrameControl(hdc,&rectButton,DFC_SCROLL,buttonState);                   
    708676}
    709677
     
    718686  RECT        rectEdit)
    719687{
    720    INT  id, size = 0;
    721    LPSTR        pText = NULL;
     688   INT  id, size = 0;
     689   LPSTR        pText = NULL;
    722690
    723691   if( lphc->wState & CBF_NOREDRAW ) return;
     
    729697   {
    730698        size = SendMessageA( lphc->hWndLBox, LB_GETTEXTLEN, id, 0);
    731         pText = (LPSTR)HeapAlloc( GetProcessHeap(), 0, size + 1);
    732         if(pText)
    733         {
    734             SendMessageA( lphc->hWndLBox, LB_GETTEXT, (WPARAM)id, (LPARAM)pText );
    735             pText[size] = '\0'; /* just in case */
    736         } else return;
     699        if( (pText = (char*)HeapAlloc( GetProcessHeap(), 0, size + 1)) != NULL )
     700        {
     701            SendMessageA( lphc->hWndLBox, LB_GETTEXT, (WPARAM)id, (LPARAM)pText );
     702            pText[size] = '\0'; /* just in case */
     703        } else return;
    737704   }
    738705
    739706   if( lphc->wState & CBF_EDIT )
    740707   {
    741         if( CB_HASSTRINGS(lphc) ) SetWindowTextA( lphc->hWndEdit, pText ? pText : "" );
    742         if( lphc->wState & CBF_FOCUSED )
    743             SendMessageA( lphc->hWndEdit, EM_SETSEL, 0, (LPARAM)(-1));
     708        if( CB_HASSTRINGS(lphc) ) SetWindowTextA( lphc->hWndEdit, pText ? pText : "" );
     709        if( lphc->wState & CBF_FOCUSED )
     710            SendMessageA( lphc->hWndEdit, EM_SETSEL, 0, (LPARAM)(-1));
    744711   }
    745712   else /* paint text field ourselves */
    746713   {
    747         HBRUSH hPrevBrush = 0;
    748         HDC      hDC = hdc;
    749 
    750         if( !hDC )
    751         {
    752             hDC = GetDC(lphc->hwndself);
    753             if (hDC)
    754             {
    755                 HBRUSH hBrush = SendMessageA( lphc->owner,
    756                                                   WM_CTLCOLORLISTBOX,
    757                                                   hDC, lphc->hwndself );
    758                 hPrevBrush = SelectObject( hDC,
    759                            (hBrush) ? hBrush : GetStockObject(WHITE_BRUSH) );
    760             }
    761         }
    762         if( hDC )
    763         {
    764             UINT        itemState;
    765             HFONT       hPrevFont = (lphc->hFont) ? SelectObject(hDC, lphc->hFont) : 0;
    766 
    767             /*
    768              * Give ourselves some space.
    769              */
    770             InflateRect( &rectEdit, -1, -1 );
    771 
    772             if ( (lphc->wState & CBF_FOCUSED) &&
    773                 !(lphc->wState & CBF_DROPPED) )
    774             {
    775                 /* highlight */
    776 
    777                 FillRect( hDC, &rectEdit, GetSysColorBrush(COLOR_HIGHLIGHT) );
    778                 SetBkColor( hDC, GetSysColor( COLOR_HIGHLIGHT ) );
    779                 SetTextColor( hDC, GetSysColor( COLOR_HIGHLIGHTTEXT ) );
    780                 itemState = ODS_SELECTED | ODS_FOCUS;
    781             }
    782             else
    783               itemState = 0;
    784 
    785             if( CB_OWNERDRAWN(lphc) )
    786             {
    787                 DRAWITEMSTRUCT dis;
    788                 HRGN           clipRegion;
    789 
    790                 /*
    791                  * Save the current clip region.
    792                  * To retrieve the clip region, we need to create one "dummy"
    793                  * clip region.
    794                  */
    795                 clipRegion = CreateRectRgnIndirect(&rectEdit);
    796 
    797                 if (GetClipRgn(hDC, clipRegion)!=1)
    798                 {
    799                   DeleteObject(clipRegion);
    800                   clipRegion=(HRGN)NULL;
    801                 }
    802 
    803                 if ( GetWindowLongA(lphc->hwndself,GWL_STYLE) & WS_DISABLED )
    804                   itemState |= ODS_DISABLED;
    805 
    806                 dis.CtlType     = ODT_COMBOBOX;
    807                 dis.CtlID       = GetWindowLongA(lphc->hwndself,GWL_ID);
    808                 dis.hwndItem    = lphc->hwndself;
    809                 dis.itemAction  = ODA_DRAWENTIRE;
    810                 dis.itemID      = id;
    811                 dis.itemState   = itemState;
    812                 dis.hDC         = hDC;
    813                 dis.rcItem      = rectEdit;
    814                 dis.itemData    = SendMessageA( lphc->hWndLBox, LB_GETITEMDATA,
    815                                                                   (WPARAM)id, 0 );
    816 
    817                 /*
    818                  * Clip the DC and have the parent draw the item.
    819                  */
    820                 IntersectClipRect(hDC,
    821                                   rectEdit.left,  rectEdit.top,
    822                                   rectEdit.right, rectEdit.bottom);
    823 
    824                 SendMessageA(lphc->owner, WM_DRAWITEM,
    825                              GetWindowLongA(lphc->hwndself,GWL_ID), (LPARAM)&dis );
    826 
    827                 /*
    828                  * Reset the clipping region.
    829                  */
    830                 SelectClipRgn(hDC, clipRegion);
    831             }
    832             else
    833             {
    834                 ExtTextOutA( hDC,
    835                              rectEdit.left + 1,
    836                              rectEdit.top + 1,
    837                              ETO_OPAQUE | ETO_CLIPPED,
    838                              &rectEdit,
    839                                pText ? pText : "" , size, NULL );
    840 
    841                 if(lphc->wState & CBF_FOCUSED && !(lphc->wState & CBF_DROPPED))
    842                     DrawFocusRect( hDC, &rectEdit );
    843             }
    844 
    845             if( hPrevFont )
    846               SelectObject(hDC, hPrevFont );
    847 
    848             if( !hdc )
    849             {
    850                 if( hPrevBrush )
    851                   SelectObject( hDC, hPrevBrush );
    852 
    853                 ReleaseDC( lphc->hwndself, hDC );
    854             }
    855         }
     714     UINT       itemState;
     715     HFONT      hPrevFont = (lphc->hFont) ? SelectObject(hdc, lphc->hFont) : 0;
     716
     717     /*
     718      * Give ourselves some space.
     719      */
     720     InflateRect( &rectEdit, -1, -1 );
     721
     722     if ( (lphc->wState & CBF_FOCUSED) &&
     723          !(lphc->wState & CBF_DROPPED) )
     724     {
     725       /* highlight */
     726
     727       FillRect( hdc, &rectEdit, GetSysColorBrush(COLOR_HIGHLIGHT) );
     728       SetBkColor( hdc, GetSysColor( COLOR_HIGHLIGHT ) );
     729       SetTextColor( hdc, GetSysColor( COLOR_HIGHLIGHTTEXT ) );
     730       itemState = ODS_SELECTED | ODS_FOCUS;
     731     }
     732     else
     733       itemState = 0;
     734
     735     if( CB_OWNERDRAWN(lphc) )
     736     {
     737       DRAWITEMSTRUCT dis;
     738       HRGN           clipRegion;
     739       DWORD dwStyle = GetWindowLongA(lphc->hwndself,GWL_STYLE);
     740
     741       /*
     742        * Save the current clip region.
     743        * To retrieve the clip region, we need to create one "dummy"
     744        * clip region.
     745        */
     746       clipRegion = CreateRectRgnIndirect(&rectEdit);
     747
     748       if (GetClipRgn(hdc, clipRegion)!=1)
     749       {
     750         DeleteObject(clipRegion);
     751         clipRegion=(HRGN)NULL;
     752       }
     753
     754       if ( dwStyle & WS_DISABLED )
     755         itemState |= ODS_DISABLED;
     756
     757       dis.CtlType      = ODT_COMBOBOX;
     758       dis.CtlID        = GetWindowLongA(lphc->hwndself,GWL_ID);
     759       dis.hwndItem     = lphc->hwndself;
     760       dis.itemAction   = ODA_DRAWENTIRE;
     761       dis.itemID       = id;
     762       dis.itemState    = itemState;
     763       dis.hDC          = hdc;
     764       dis.rcItem       = rectEdit;
     765       dis.itemData     = SendMessageA( lphc->hWndLBox, LB_GETITEMDATA,
     766                                        (WPARAM)id, 0 );
     767
     768       /*
     769        * Clip the DC and have the parent draw the item.
     770        */
     771       IntersectClipRect(hdc,
     772                         rectEdit.left,  rectEdit.top,
     773                         rectEdit.right, rectEdit.bottom);
     774
     775       SendMessageA(lphc->owner, WM_DRAWITEM,
     776                    GetWindowLongA(lphc->hwndself,GWL_ID), (LPARAM)&dis );
     777
     778       /*
     779        * Reset the clipping region.
     780        */
     781       SelectClipRgn(hdc, clipRegion);         
     782     }
     783     else
     784     {
     785       ExtTextOutA( hdc,
     786                    rectEdit.left + 1,
     787                    rectEdit.top + 1,
     788                    ETO_OPAQUE | ETO_CLIPPED,
     789                    &rectEdit,
     790                    pText ? pText : "" , size, NULL );
     791
     792       if(lphc->wState & CBF_FOCUSED && !(lphc->wState & CBF_DROPPED))
     793         DrawFocusRect( hdc, &rectEdit );
     794     }
     795
     796     if( hPrevFont )
     797       SelectObject(hdc, hPrevFont );
    856798   }
    857799   if (pText)
    858         HeapFree( GetProcessHeap(), 0, pText );
     800        HeapFree( GetProcessHeap(), 0, pText );
    859801}
    860802
     
    885827
    886828/***********************************************************************
     829 *           COMBO_PrepareColors
     830 *
     831 * This method will sent the appropriate WM_CTLCOLOR message to
     832 * prepare and setup the colors for the combo's DC.
     833 *
     834 * It also returns the brush to use for the background.
     835 */
     836static HBRUSH COMBO_PrepareColors(
     837  HWND        hwnd,
     838  LPHEADCOMBO lphc,
     839  HDC         hDC)
     840{
     841  HBRUSH  hBkgBrush;
     842
     843  /*
     844   * Get the background brush for this control.
     845   */
     846  if (CB_DISABLED(lphc))
     847  {
     848    hBkgBrush = SendMessageA( lphc->owner, WM_CTLCOLORSTATIC,
     849                              hDC, lphc->hwndself );
     850
     851    /*
     852     * We have to change the text color since WM_CTLCOLORSTATIC will
     853     * set it to the "enabled" color. This is the same behavior as the
     854     * edit control
     855     */
     856    SetTextColor(hDC, GetSysColor(COLOR_GRAYTEXT));
     857  }
     858  else
     859  {
     860    if (lphc->wState & CBF_EDIT)
     861    {
     862      hBkgBrush = SendMessageA( lphc->owner, WM_CTLCOLOREDIT,
     863                                hDC, lphc->hwndself );
     864    }
     865    else
     866    {
     867      hBkgBrush = SendMessageA( lphc->owner, WM_CTLCOLORLISTBOX,
     868                                hDC, lphc->hwndself );
     869    }
     870  }
     871
     872  /*
     873   * Catch errors.
     874   */
     875  if( !hBkgBrush )
     876    hBkgBrush = GetSysColorBrush(COLOR_WINDOW);
     877
     878  return hBkgBrush;
     879}
     880
     881/***********************************************************************
    887882 *           COMBO_EraseBackground
    888883 */
     
    913908  }
    914909
    915   hBkgBrush = SendMessageA( lphc->owner, WM_CTLCOLORLISTBOX,
    916                             hDC, hwnd);
    917 
    918   if( !hBkgBrush )
    919     hBkgBrush = GetStockObject(WHITE_BRUSH);
     910  /*
     911   * Retrieve the background brush
     912   */
     913  hBkgBrush = COMBO_PrepareColors(hwnd, lphc, hDC);
    920914
    921915  FillRect(hDC, &clientRect, hBkgBrush);
     
    943937      HBRUSH    hPrevBrush, hBkgBrush;
    944938
    945       hBkgBrush = SendMessageA( lphc->owner, WM_CTLCOLORLISTBOX,
    946                                   hDC, lphc->hwndself );
    947 
    948       if( !hBkgBrush )
    949         hBkgBrush = GetStockObject(WHITE_BRUSH);
     939      /*
     940       * Retrieve the background brush and select it in the
     941       * DC.
     942       */
     943      hBkgBrush = COMBO_PrepareColors(lphc->hwndself, lphc, hDC);
    950944
    951945      hPrevBrush = SelectObject( hDC, hBkgBrush );
     
    10821076   int i;
    10831077   int nHeight;
    1084    int nDroppedHeight;
     1078   int nDroppedHeight,nTempDroppedHeight;
    10851079
    10861080   //TRACE("[%04x]: drop down\n", CB_HWND(lphc));
     
    11221116     of the items in the dropped list */
    11231117
     1118  /* And Remove any extra space (Best Fit) */
    11241119   nDroppedHeight = lphc->droppedRect.bottom - lphc->droppedRect.top;
    11251120   nItems = (int)SendMessageA (lphc->hWndLBox, LB_GETCOUNT, 0, 0);
    1126    nHeight = COMBO_YBORDERGAP;
     1121   nHeight = COMBO_YBORDERSIZE();
     1122   nTempDroppedHeight = 0;
    11271123   for (i = 0; i < nItems; i++)
    11281124   {
    11291125     nHeight += (int)SendMessageA (lphc->hWndLBox, LB_GETITEMHEIGHT, i, 0);
    11301126
    1131      if (nHeight >= nDroppedHeight)
     1127     /* Did we pass the limit of what can be displayed */
     1128     if (nHeight > nDroppedHeight)
     1129     {
    11321130       break;
    11331131   }
    1134 
    1135    if (nHeight < nDroppedHeight)
    1136       nDroppedHeight = nHeight;
     1132     nTempDroppedHeight = nHeight;
     1133   }
     1134
     1135   nDroppedHeight = nTempDroppedHeight;
    11371136
    11381137   SetWindowPos( lphc->hWndLBox, HWND_TOP, rect.left, rect.bottom,
     
    11771176           lphc->wState &= ~CBF_DROPPED;
    11781177           ShowWindow( lphc->hWndLBox, SW_HIDE );
     1178           if(GetCapture() == lphc->hWndLBox)
     1179           {
     1180               ReleaseCapture();
     1181           }
     1182
    11791183
    11801184           if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
     
    17081712       }
    17091713       ReleaseCapture();
     1714       SetCapture(lphc->hWndLBox);
    17101715   }
    17111716
     
    18521857                    EnableWindow( lphc->hWndEdit, (BOOL)wParam );
    18531858                EnableWindow( lphc->hWndLBox, (BOOL)wParam );
     1859
     1860                /* Force the control to repaint when the enabled state changes. */
     1861                InvalidateRect(CB_HWND(lphc), NULL, TRUE);
    18541862                return  TRUE;
    18551863        case WM_SETREDRAW:
  • trunk/src/user32/edit.cpp

    r949 r1203  
    1 /* $Id: edit.cpp,v 1.1 1999-09-15 23:18:50 sandervl Exp $ */
     1/* $Id: edit.cpp,v 1.2 1999-10-08 21:24:07 cbratschi Exp $ */
    22/*
    33 *      Edit control
     
    99 *      Copyright  1999 Christoph Bratschi (ported from WINE)
    1010 *
     11 * WINE version: 990923
    1112 */
    1213
     
    9091        INT y_offset;                   /* scroll offset in number of lines */
    9192        BOOL bCaptureState; /* flag indicating whether mouse was captured */
     93        BOOL bEnableState;             /* flag keeping the enable state */
    9294        /*
    9395         *      only for multi line controls
     
    214216static LRESULT  EDIT_WM_MouseMove(HWND hwnd, EDITSTATE *es, DWORD keys, INT x, INT y);
    215217static LRESULT  EDIT_WM_NCCreate(HWND hwnd, LPCREATESTRUCTA cs);
    216 static void     EDIT_WM_Paint(HWND hwnd, EDITSTATE *es);
     218static void     EDIT_WM_Paint(HWND hwnd, EDITSTATE *es,WPARAM wParam);
    217219static void     EDIT_WM_Paste(HWND hwnd, EDITSTATE *es);
    218220static void     EDIT_WM_SetFocus(HWND hwnd, EDITSTATE *es, HWND window_losing_focus);
     
    320322                //DPRINTF_EDIT_MSG32("EM_SETSEL");
    321323                EDIT_EM_SetSel(hwnd, es, wParam, lParam, FALSE);
     324                EDIT_EM_ScrollCaret(hwnd,es);
    322325                result = 1;
    323326                break;
     
    598601        case WM_ENABLE:
    599602                //DPRINTF_EDIT_MSG32("WM_ENABLE");
     603                es->bEnableState = (BOOL)wParam;
    600604                InvalidateRect(hwnd, NULL, TRUE);
    601605                break;
     
    672676        case WM_PAINT:
    673677                //DPRINTF_EDIT_MSG32("WM_PAINT");
    674                 EDIT_WM_Paint(hwnd, es);
     678                EDIT_WM_Paint(hwnd, es,wParam);
    675679                break;
    676680
     
    12971301        INT e;
    12981302
    1299         if (es->style & ES_MULTILINE)
    1300                 e = EDIT_CharFromPos(hwnd, es, 0x7fffffff,
    1301                         HIWORD(EDIT_EM_PosFromChar(hwnd, es, es->selection_end, es->flags & EF_AFTER_WRAP)), &after_wrap);
     1303        /* Pass a high value in x to make sure of receiving the en of the line */
     1304        if (es->style & ES_MULTILINE)
     1305                e = EDIT_CharFromPos(hwnd, es, 0x3fffffff,
     1306                        HIWORD(EDIT_EM_PosFromChar(hwnd, es, es->selection_end, es->flags & EF_AFTER_WRAP)), &after_wrap);
    13021307        else
    13031308                e = lstrlenA(es->text);
     
    13411346        INT e;
    13421347
    1343         if (es->style & ES_MULTILINE)
    1344                 e = EDIT_CharFromPos(hwnd, es, 0x80000000,
    1345                         HIWORD(EDIT_EM_PosFromChar(hwnd, es, es->selection_end, es->flags & EF_AFTER_WRAP)), NULL);
    1346         else
    1347                 e = 0;
    1348         EDIT_EM_SetSel(hwnd, es, e, extend ? es->selection_start : e, FALSE);
     1348        /* Pass the x_offset in x to make sure of receiving the first position of the line */
     1349        if (es->style & ES_MULTILINE)
     1350                e = EDIT_CharFromPos(hwnd, es, -es->x_offset,
     1351                        HIWORD(EDIT_EM_PosFromChar(hwnd, es, es->selection_end, es->flags & EF_AFTER_WRAP)), NULL);
     1352        else
     1353                e = 0;
     1354        EDIT_EM_SetSel(hwnd, es, extend ? es->selection_start : e, e, FALSE);
    13491355        EDIT_EM_ScrollCaret(hwnd, es);
    13501356}
     
    25632569static void EDIT_WM_Char(HWND hwnd, EDITSTATE *es, CHAR c, DWORD key_data)
    25642570{
     2571        BOOL control = GetKeyState(VK_CONTROL) & 0x8000;
    25652572        switch (c) {
    25662573        case '\r':
     2574            /* If the edit doesn't want the return, do nothing */
     2575            if(!(es->style & ES_WANTRETURN))
     2576                break;
    25672577        case '\n':
    25682578                if (es->style & ES_MULTILINE) {
     
    25782588                        EDIT_EM_ReplaceSel(hwnd, es, TRUE, "\t");
    25792589                break;
     2590        case VK_BACK:
     2591                if (!(es->style & ES_READONLY) && !control) {
     2592                        if (es->selection_start != es->selection_end)
     2593                                EDIT_WM_Clear(hwnd, es);
     2594                        else {
     2595                                /* delete character left of caret */
     2596                                EDIT_EM_SetSel(hwnd, es, -1, 0, FALSE);
     2597                                EDIT_MoveBackward(hwnd, es, TRUE);
     2598                                EDIT_WM_Clear(hwnd, es);
     2599                        }
     2600                }
     2601                break;
    25802602        default:
    25812603                if (!(es->style & ES_READONLY) && ((BYTE)c >= ' ') && (c != 127)) {
     
    26992721/*********************************************************************
    27002722 *
    2701  *      WM_CREATE
     2723 *      WM_CREATE
    27022724 *
    27032725 */
    27042726static LRESULT EDIT_WM_Create(HWND hwnd, EDITSTATE *es, LPCREATESTRUCTA cs)
    27052727{
    2706         /*
    2707          *      To initialize some final structure members, we call some helper
    2708          *      functions.  However, since the EDITSTATE is not consistent (i.e.
    2709          *      not fully initialized), we should be very careful which
    2710          *      functions can be called, and in what order.
    2711          */
     2728       /*
     2729        *       To initialize some final structure members, we call some helper
     2730        *       functions.  However, since the EDITSTATE is not consistent (i.e.
     2731        *       not fully initialized), we should be very careful which
     2732        *       functions can be called, and in what order.
     2733        */
    27122734        EDIT_WM_SetFont(hwnd, es, 0, FALSE);
    2713     EDIT_EM_EmptyUndoBuffer(hwnd, es);
    2714 
    2715         if (cs->lpszName && *(cs->lpszName) != '\0') {
    2716                 EDIT_EM_ReplaceSel(hwnd, es, FALSE, cs->lpszName);
    2717                 /* if we insert text to the editline, the text scrolls out of the window, as the caret is placed after the insert pos normally; thus we reset es->selection... to 0 and update caret */
    2718                 es->selection_start = es->selection_end = 0;
    2719                 EDIT_EM_ScrollCaret(hwnd, es);
    2720         }
    2721         return 0;
     2735        EDIT_EM_EmptyUndoBuffer(hwnd, es);
     2736       if (cs->lpszName && *(cs->lpszName) != '\0') {
     2737           EDIT_EM_ReplaceSel(hwnd, es, FALSE, cs->lpszName);
     2738           /* if we insert text to the editline, the text scrolls out
     2739            * of the window, as the caret is placed after the insert
     2740            * pos normally; thus we reset es->selection... to 0 and
     2741            * update caret
     2742            */
     2743           es->selection_start = es->selection_end = 0;
     2744           EDIT_EM_ScrollCaret(hwnd, es);
     2745       }
     2746       return 0;
    27222747}
    27232748
     
    27512776        RECT rc;
    27522777
    2753         if (!IsWindowEnabled(hwnd) || (es->style & ES_READONLY))
     2778        if (!es->bEnableState || (es->style & ES_READONLY))
    27542779                brush = (HBRUSH)EDIT_SEND_CTLCOLORSTATIC(hwnd, dc);
    27552780        else
     
    30393064                        EDIT_MovePageDown_ML(hwnd, es, shift);
    30403065                break;
    3041         case VK_BACK:
    3042                 if (!(es->style & ES_READONLY) && !control) {
    3043                         if (es->selection_start != es->selection_end)
    3044                                 EDIT_WM_Clear(hwnd, es);
    3045                         else {
    3046                                 /* delete character left of caret */
    3047                                 EDIT_EM_SetSel(hwnd, es, -1, 0, FALSE);
    3048                                 EDIT_MoveBackward(hwnd, es, TRUE);
    3049                                 EDIT_WM_Clear(hwnd, es);
    3050                         }
    3051                 }
    3052                 break;
    30533066        case VK_DELETE:
    30543067                if (!(es->style & ES_READONLY) && !(shift && control)) {
     
    30853098                        EDIT_WM_Copy(hwnd, es);
    30863099                break;
     3100        case VK_RETURN:
     3101            /* If the edit doesn't want the return send a message to the default object */
     3102            if(!(es->style & ES_WANTRETURN))
     3103            {
     3104                HWND hwndParent = GetParent(hwnd);
     3105                DWORD dw = SendMessageA( hwndParent, DM_GETDEFID, 0, 0 );
     3106                if (HIWORD(dw) == DC_HASDEFID)
     3107                {
     3108                    SendMessageA( hwndParent, WM_COMMAND,
     3109                                  MAKEWPARAM( LOWORD(dw), BN_CLICKED ),
     3110                              (LPARAM)GetDlgItem( hwndParent, LOWORD(dw) ) );
     3111                }
     3112            }
     3113            break;
    30873114        }
    30883115        return 0;
     
    31673194static LRESULT EDIT_WM_LButtonUp(HWND hwnd, EDITSTATE *es, DWORD keys, INT x, INT y)
    31683195{
    3169         if (es->bCaptureState && GetCapture() == hwnd) {
    3170                 KillTimer(hwnd, 0);
    3171                 ReleaseCapture();
    3172         }
    3173         es->bCaptureState = FALSE;
    3174 
    3175         return 0;
     3196        if (es->bCaptureState && GetCapture() == hwnd) {
     3197                KillTimer(hwnd, 0);
     3198                ReleaseCapture();
     3199        }
     3200        es->bCaptureState = FALSE;
     3201
     3202        return 0;
    31763203}
    31773204
     
    32283255        es->style = cs->style;
    32293256
    3230 
    3231         /*
    3232          * In Win95 look and feel, the WS_BORDER style is replaced by the
    3233          * WS_EX_CLIENTEDGE style for the edit control. This gives the edit
    3234          * control a non client area.
    3235          */
     3257        es->bEnableState = !(cs->style & WS_DISABLED);
     3258
     3259        /*
     3260         * In Win95 look and feel, the WS_BORDER style is replaced by the
     3261         * WS_EX_CLIENTEDGE style for the edit control. This gives the edit
     3262         * control a non client area.
     3263         */
    32363264        if (es->style & WS_BORDER)
    3237         {
    3238           es->style      &= ~WS_BORDER;
    3239           SetWindowLongA(hwnd,GWL_STYLE,GetWindowLongA(hwnd,GWL_STYLE) & ~WS_BORDER);
    3240           SetWindowLongA(hwnd,GWL_EXSTYLE,GetWindowLongA(hwnd,GWL_EXSTYLE) | WS_EX_CLIENTEDGE);
    3241         }
    3242        
     3265        {
     3266          es->style      &= ~WS_BORDER;
     3267          SetWindowLongA(hwnd,GWL_STYLE,GetWindowLongA(hwnd,GWL_STYLE) & ~WS_BORDER);
     3268          SetWindowLongA(hwnd,GWL_EXSTYLE,GetWindowLongA(hwnd,GWL_EXSTYLE) | WS_EX_CLIENTEDGE);
     3269        }
     3270
    32433271        if (es->style & ES_MULTILINE) {
    32443272                es->buffer_size = BUFSTART_MULTI;
     
    32983326 *
    32993327 */
    3300 static void EDIT_WM_Paint(HWND hwnd, EDITSTATE *es)
     3328static void EDIT_WM_Paint(HWND hwnd, EDITSTATE *es,WPARAM wParam)
    33013329{
    33023330        PAINTSTRUCT ps;
     
    33073335        RECT rcLine;
    33083336        RECT rcRgn;
    3309         BOOL rev = IsWindowEnabled(hwnd) &&
     3337        BOOL rev = es->bEnableState &&
    33103338                                ((es->flags & EF_FOCUSED) ||
    33113339                                        (es->style & ES_NOHIDESEL));
     
    33143342                EDIT_NOTIFY_PARENT(hwnd, EN_UPDATE, "EN_UPDATE");
    33153343
    3316         dc = BeginPaint(hwnd, &ps);
     3344        if (!wParam)
     3345            dc = BeginPaint(hwnd, &ps);
     3346        else
     3347            dc = (HDC) wParam;
     3348
    33173349        if(es->style & WS_BORDER) {
    33183350                GetClientRect(hwnd, &rc);
     
    33333365        if (es->font)
    33343366                old_font = SelectObject(dc, es->font);
    3335         if (!IsWindowEnabled(hwnd) || (es->style & ES_READONLY))
     3367        if (!es->bEnableState || (es->style & ES_READONLY))
    33363368                EDIT_SEND_CTLCOLORSTATIC(hwnd, dc);
    33373369        else
    33383370                EDIT_SEND_CTLCOLOR(hwnd, dc);
    3339         if (!IsWindowEnabled(hwnd))
     3371        if (!es->bEnableState)
    33403372                SetTextColor(dc, GetSysColor(COLOR_GRAYTEXT));
    33413373        GetClipBox(dc, &rcRgn);
     
    33573389                EDIT_SetCaretPos(hwnd, es, es->selection_end,
    33583390                                 es->flags & EF_AFTER_WRAP);
    3359         EndPaint(hwnd, &ps);
     3391        if (!wParam) EndPaint(hwnd, &ps);
    33603392        if ((es->style & WS_VSCROLL) && !(es->flags & EF_VSCROLL_TRACK)) {
    33613393                INT vlc = (es->format_rect.bottom - es->format_rect.top) / es->line_height;
     
    34413473        HDC dc;
    34423474        HFONT old_font = 0;
     3475        RECT r;
    34433476
    34443477        es->font = font;
     
    34553488                EDIT_EM_SetMargins(hwnd, es, EC_LEFTMARGIN | EC_RIGHTMARGIN,
    34563489                                   EC_USEFONTINFO, EC_USEFONTINFO);
     3490        /* Force the recalculation of the format rect for each font change */
     3491        GetClientRect(hwnd, &r);
     3492        EDIT_SetRectNP(hwnd, es, &r);
    34573493        if (es->style & ES_MULTILINE)
    34583494                EDIT_BuildLineDefs_ML(hwnd, es);
    3459         else {
    3460                 RECT r;
    3461                 GetClientRect(hwnd, &r);
    3462                 EDIT_SetRectNP(hwnd, es, &r);
    3463         }
     3495
    34643496        if (redraw)
    34653497                InvalidateRect(hwnd, NULL, TRUE);
  • trunk/src/user32/listbox.cpp

    r949 r1203  
    1 /* $Id: listbox.cpp,v 1.1 1999-09-15 23:18:51 sandervl Exp $ */
     1/* $Id: listbox.cpp,v 1.2 1999-10-08 21:24:40 cbratschi Exp $ */
    22/*
    33 * Listbox controls
     
    55 * Copyright 1996 Alexandre Julliard
    66 * Copyright 1999 Christoph Bratschi (ported from WINE)
     7 *
     8 * WINE version: 990923
    79 */
    810
     
    624626        INT i;
    625627        LPINT16 p = (LPINT16)tabs;
    626         //dbg_decl_str(listbox, 256);
    627628
    628629        for (i = 0; i < descr->nb_tabs; i++) {
     
    764765    if (HAS_STRINGS(descr))
    765766    {
    766         if (!str) return LB_ERR;
     767        if (!str || !str[0]) return LB_ERR;
    767768        if (exact)
    768769        {
     
    17841785
    17851786
     1787/*************************************************************************
     1788 * LISTBOX_HandleLButtonDownCombo [Internal]
     1789 *
     1790 * Process LButtonDown message for the ComboListBox
     1791 *
     1792 * PARAMS
     1793 *     pWnd       [I] The windows internal structure
     1794 *     pDescr     [I] The ListBox internal structure
     1795 *     wParam     [I] Key Flag (WM_LBUTTONDOWN doc for more info)
     1796 *     x          [I] X Mouse Coordinate
     1797 *     y          [I] Y Mouse Coordinate
     1798 *
     1799 * RETURNS
     1800 *     0 since we are processing the WM_LBUTTONDOWN Message
     1801 *
     1802 * NOTES
     1803 *  This function is only to be used when a ListBox is a ComboListBox
     1804 */
     1805
     1806static LRESULT LISTBOX_HandleLButtonDownCombo( HWND hwnd, LB_DESCR *pDescr,
     1807                                               WPARAM wParam, INT x, INT y)
     1808{
     1809    RECT clientRect, screenRect;
     1810    POINT mousePos;
     1811
     1812    mousePos.x = x;
     1813    mousePos.y = y;
     1814
     1815    GetClientRect(hwnd, &clientRect);
     1816
     1817    if(PtInRect(&clientRect, mousePos))
     1818    {
     1819        /* MousePos is in client, resume normal processing */
     1820        return LISTBOX_HandleLButtonDown( hwnd, pDescr, wParam, x, y);
     1821    }
     1822    else
     1823    {
     1824        POINT screenMousePos;
     1825        HWND hWndOldCapture;
     1826
     1827        /* Check the Non-Client Area */
     1828        screenMousePos = mousePos;
     1829        hWndOldCapture = GetCapture();
     1830        ReleaseCapture();
     1831        GetWindowRect(hwnd, &screenRect);
     1832        ClientToScreen(hwnd, &screenMousePos);
     1833
     1834        if(!PtInRect(&screenRect, screenMousePos))
     1835        {
     1836            /* Close The Drop Down */
     1837            SEND_NOTIFICATION( hwnd, pDescr, LBN_SELCANCEL );
     1838            return 0;
     1839        }
     1840        else
     1841        {
     1842            /* Check to see the NC is a scrollbar */
     1843            INT nHitTestType=0;
     1844            DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE);
     1845            /* Check Vertical scroll bar */
     1846            if (dwStyle & WS_VSCROLL)
     1847            {
     1848                clientRect.right += GetSystemMetrics(SM_CXVSCROLL);
     1849                if (PtInRect( &clientRect, mousePos ))
     1850                {
     1851                    nHitTestType = HTVSCROLL;
     1852                }
     1853            }
     1854              /* Check horizontal scroll bar */
     1855            if (dwStyle & WS_HSCROLL)
     1856            {
     1857                clientRect.bottom += GetSystemMetrics(SM_CYHSCROLL);
     1858                if (PtInRect( &clientRect, mousePos ))
     1859                {
     1860                    nHitTestType = HTHSCROLL;
     1861                }
     1862            }
     1863            /* Windows sends this message when a scrollbar is clicked
     1864             */
     1865
     1866            if(nHitTestType != 0)
     1867            {
     1868                SendMessageA(hwnd, WM_NCLBUTTONDOWN, nHitTestType,
     1869                    MAKELONG(screenMousePos.x, screenMousePos.y));
     1870            }
     1871            /* Resume the Capture after scrolling is complete
     1872             */
     1873            if(hWndOldCapture != 0)
     1874            {
     1875                SetCapture(hWndOldCapture);
     1876            }
     1877        }
     1878    }
     1879    return 0;
     1880}
     1881
     1882
    17861883/***********************************************************************
    17871884 *           LISTBOX_HandleLButtonUp
     
    21622259    {
    21632260        switch (msg)
    2164         {
    2165             case WM_CREATE:
    2166             {
     2261        {
     2262            case WM_CREATE:
     2263            {
    21672264                if (!LISTBOX_Create( hwnd, NULL ))
    2168                      return -1;
    2169                 //TRACE("creating wnd=%04x descr=%p\n",
    2170                 //      hwnd, *(LB_DESCR **)wnd->wExtra );
    2171                 return 0;
    2172             }
    2173             case WM_NCCREATE:
    2174             {
    2175                 DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE);
    2176        
    2177                 /*
    2178                 * When a listbox is not in a combobox and the look
    2179                 * is win95,  the WS_BORDER style is replaced with
    2180                 * the WS_EX_CLIENTEDGE style.
    2181                 */
    2182                 if (dwStyle & WS_BORDER)
    2183                 {
    2184                     SetWindowLongA(hwnd,GWL_EXSTYLE,GetWindowLongA(hwnd,GWL_EXSTYLE) | WS_EX_CLIENTEDGE);
    2185                     SetWindowLongA(hwnd,GWL_STYLE,GetWindowLongA(hwnd,GWL_STYLE)  & ~ WS_BORDER);
    2186                 }
    2187             }
    2188         }
     2265                     return -1;
     2266                //TRACE("creating wnd=%04x descr=%p\n",
     2267                //      hwnd, *(LB_DESCR **)wnd->wExtra );
     2268                return 0;
     2269            }
     2270            case WM_NCCREATE:
     2271            {
     2272                DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE);
     2273
     2274                /*
     2275                * When a listbox is not in a combobox and the look
     2276                * is win95,  the WS_BORDER style is replaced with
     2277                * the WS_EX_CLIENTEDGE style.
     2278                */
     2279                if (dwStyle & WS_BORDER)
     2280                {
     2281                    SetWindowLongA(hwnd,GWL_EXSTYLE,GetWindowLongA(hwnd,GWL_EXSTYLE) | WS_EX_CLIENTEDGE);
     2282                    SetWindowLongA(hwnd,GWL_STYLE,GetWindowLongA(hwnd,GWL_STYLE)  & ~ WS_BORDER);
     2283                }
     2284            }
     2285        }
    21892286        /* Ignore all other messages before we get a WM_CREATE */
    21902287        return DefWindowProcA( hwnd, msg, wParam, lParam );
     
    22142311           return descr->nb_items;
    22152312        else
    2216            return LB_ERR;       
     2313           return LB_ERR;
    22172314
    22182315    case LB_GETITEMDATA:
     
    25612658                    * the mouse is captured to show the tracking of the item.
    25622659                    */
    2563                    captured = descr->captured;
    2564                    descr->captured = TRUE;
    2565 
    2566                    LISTBOX_HandleMouseMove( hwnd,
    2567                                             descr,
    2568                                             mousePos.x, mousePos.y);
    2569 
    2570                    descr->captured = captured;
    2571 
    2572                    /*
    2573                     * However, when tracking, it is important that we do not
    2574                     * perform a selection if the cursor is outside the list.
    2575                     */
     2660
    25762661                   GetClientRect(hwnd, &clientRect);
    2577 
    2578                    if (!PtInRect( &clientRect, mousePos ))
     2662                   if (PtInRect( &clientRect, mousePos ))
     2663                   {
     2664                       captured = descr->captured;
     2665                       descr->captured = TRUE;                 
     2666               
     2667                       LISTBOX_HandleMouseMove( hwnd, descr,
     2668                                                    mousePos.x, mousePos.y);
     2669                       descr->captured = captured;
     2670                   }
     2671                   else
    25792672                   {
    2580                      LISTBOX_MoveCaret( hwnd, descr, -1, FALSE );
     2673                       LISTBOX_HandleMouseMove( hwnd, descr,
     2674                                                    mousePos.x, mousePos.y);
    25812675                   }
     2676
    25822677
    25832678                   return 0;
     
    26202715                 return LISTBOX_HandleLButtonUp( hwnd, descr );
    26212716            case WM_LBUTTONDOWN:
    2622                  return LISTBOX_HandleLButtonDown( hwnd, descr, wParam,
     2717                 return LISTBOX_HandleLButtonDownCombo( hwnd, descr, wParam,
    26232718                         (INT16)LOWORD(lParam), (INT16)HIWORD(lParam));
    2624             /* avoid activation at all costs */
    2625              case WM_MOUSEACTIVATE:
     2719            case WM_MOUSEACTIVATE:
    26262720                 return MA_NOACTIVATE;
    26272721            case WM_NCACTIVATE:
  • trunk/src/user32/scroll.cpp

    r1184 r1203  
    1 /* $Id: scroll.cpp,v 1.6 1999-10-08 12:10:27 cbratschi Exp $ */
     1/* $Id: scroll.cpp,v 1.7 1999-10-08 21:25:47 cbratschi Exp $ */
    22/*
    33 * Scrollbar control
     
    77 * Copyright 1993 Martin Ayotte
    88 * Copyright 1994, 1996 Alexandre Julliard
     9 *
     10 * WINE version: 990923
    911 */
    1012
     
    11821184    UINT new_flags;
    11831185
    1184     //dbg_decl_str(scroll, 256);
    1185 
    11861186   *action = 0;
    11871187
     
    11941194    if (info->fMask & SIF_PAGE)
    11951195    {
    1196         //dsprintf(scroll, " page=%d", info->nPage );
    11971196        if( infoPtr->Page != info->nPage )
    11981197        {
     
    12161215    if (info->fMask & SIF_RANGE)
    12171216    {
    1218         //dsprintf(scroll, " min=%d max=%d", info->nMin, info->nMax );
    1219 
    12201217        /* Invalid range -> range is set to (0,0) */
    12211218        if ((info->nMin > info->nMax) ||
     
    12361233        }
    12371234    }
    1238 
    1239     //TRACE("hwnd=%04x bar=%d %s\n",
    1240     //                hwnd, nBar, dbg_str(scroll));
    12411235
    12421236    /* Make sure the page size is valid */
  • trunk/src/user32/static.cpp

    r992 r1203  
    1 /* $Id: static.cpp,v 1.3 1999-09-20 19:17:58 sandervl Exp $ */
     1/* $Id: static.cpp,v 1.4 1999-10-08 21:26:08 cbratschi Exp $ */
    22/*
    33 * Static control
     
    77 * Copyright  David W. Metcalfe, 1993
    88 *
     9 * WINE version: 990923
    910 */
    1011
     
    9293
    9394    if (hBitmap && GetObjectType(hBitmap) != OBJ_BITMAP) {
    94         //ERR("huh? hBitmap!=0, but not bitmap\n");
    95         return 0;
     95        //ERR("huh? hBitmap!=0, but not bitmap\n");
     96        return 0;
    9697    }
    9798    hOldBitmap = infoPtr->hIcon;
     
    102103        GetObjectA(hBitmap, sizeof(bm), &bm);
    103104        SetWindowPos( hwnd, 0, 0, 0, bm.bmWidth, bm.bmHeight,
    104                       SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER );
     105                      SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER );
    105106/* CB: alternative code, if necessary
    106107      HDC hdc = GetDC(hwnd);
     
    113114      }
    114115      ReleaseDC(hwnd,hdc);
    115 */                     
    116                
     116*/
     117
    117118    }
    118119    return hOldBitmap;
     
    463464    FillRect( hdc, &rc, hBrush );
    464465
     466    if (!IsWindowEnabled(hwnd)) SetTextColor(hdc,GetSysColor(COLOR_GRAYTEXT));
     467
    465468    textLen = GetWindowTextLengthA(hwnd);
    466469    if (textLen > 0)
     
    545548    if (infoPtr->hIcon) {
    546549        BITMAP bm;
    547         SIZE sz;
     550        SIZE sz;
    548551
    549552        if(GetObjectType(infoPtr->hIcon) != OBJ_BITMAP)
    550             return;
     553            return;
    551554        if (!(hMemDC = CreateCompatibleDC( hdc ))) return;
    552         GetObjectA(infoPtr->hIcon, sizeof(bm), &bm);
    553         GetBitmapDimensionEx(infoPtr->hIcon, &sz);
    554         oldbitmap = SelectObject(hMemDC, infoPtr->hIcon);
    555         BitBlt(hdc, sz.cx, sz.cy, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0,
    556                SRCCOPY);
    557         SelectObject(hMemDC, oldbitmap);
    558         DeleteDC(hMemDC);
     555        GetObjectA(infoPtr->hIcon, sizeof(bm), &bm);
     556        GetBitmapDimensionEx(infoPtr->hIcon, &sz);
     557        oldbitmap = SelectObject(hMemDC, infoPtr->hIcon);
     558        BitBlt(hdc, sz.cx, sz.cy, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0,
     559               SRCCOPY);
     560        SelectObject(hMemDC, oldbitmap);
     561        DeleteDC(hMemDC);
    559562    }
    560563}
Note: See TracChangeset for help on using the changeset viewer.