Ignore:
Timestamp:
Aug 15, 1999, 9:11:02 PM (26 years ago)
Author:
cbratschi
Message:

wine-990731 update

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/new/static.cpp

    r387 r500  
    1 /* $Id: static.cpp,v 1.4 1999-07-24 17:10:26 cbratschi Exp $ */
     1/* $Id: static.cpp,v 1.5 1999-08-15 19:11:01 cbratschi Exp $ */
    22/*
    33 * Static control
     
    8383 * Set the bitmap for an SS_BITMAP control.
    8484 */
    85 static HBITMAP STATIC_SetBitmap( HWND hwnd, HBITMAP hbitmap )
    86 {
    87     HBITMAP prevIcon;
     85static HBITMAP STATIC_SetBitmap( HWND hwnd, HBITMAP hBitmap )
     86{
     87    HBITMAP hOldBitmap;
    8888    STATICINFO *infoPtr = (STATICINFO *)GetInfoPtr(hwnd);
    8989    DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE);
     
    9191    if ((dwStyle & SS_TYPEMASK) != SS_BITMAP) return 0;
    9292
    93     if (infoPtr->hIcon) DeleteObject(infoPtr->hIcon);
    94     prevIcon = infoPtr->hIcon;
    95     infoPtr->hIcon = hbitmap;
    96 
    97     if (hbitmap)
     93    if (hBitmap && GetObjectType(hBitmap) != OBJ_BITMAP) {
     94        //ERR("huh? hBitmap!=0, but not bitmap\n");
     95        return 0;
     96    }
     97    hOldBitmap = infoPtr->hIcon;
     98    infoPtr->hIcon = hBitmap;
     99    if (hBitmap)
    98100    {
     101        BITMAP bm;
     102        GetObjectA(hBitmap, sizeof(bm), &bm);
     103        SetWindowPos( hwnd, 0, 0, 0, bm.bmWidth, bm.bmHeight,
     104                      SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER );
     105/* CB: alternative code, if necessary
    99106      HDC hdc = GetDC(hwnd);
    100107      BITMAPINFO info;
     
    106113      }
    107114      ReleaseDC(hwnd,hdc);
    108     }
    109 
    110     return prevIcon;
    111 }
    112 
     115*/                     
     116               
     117    }
     118    return hOldBitmap;
     119}
    113120
    114121/***********************************************************************
     
    535542                             hdc, hwnd );
    536543    FillRect( hdc, &rc, hbrush );
    537     if (infoPtr->hIcon)
    538       DrawIcon(hdc,0,0,infoPtr->hIcon);
     544
     545    if (infoPtr->hIcon) {
     546        BITMAP bm;
     547        SIZE sz;
     548
     549        if(GetObjectType(infoPtr->hIcon) != OBJ_BITMAP)
     550            return;
     551        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);
     559    }
    539560}
    540561
Note: See TracChangeset for help on using the changeset viewer.