Ignore:
Timestamp:
Feb 21, 2000, 6:25:33 PM (26 years ago)
Author:
cbratschi
Message:

merged with Corel WINE 20000212, added WS_EX_CONTEXTHELP

File:
1 edited

Legend:

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

    r2804 r2852  
    1 /* $Id: static.cpp,v 1.17 2000-02-16 14:34:34 sandervl Exp $ */
     1/* $Id: static.cpp,v 1.18 2000-02-21 17:25:29 cbratschi Exp $ */
    22/*
    33 * Static control
     
    77 * Copyright  David W. Metcalfe, 1993
    88 *
     9 * Corel version: 20000212
    910 * WINE version: 990923
    1011 *
     
    1920#include "static.h"
    2021
    21 #define DBG_LOCALLOG    DBG_static
     22#define DBG_LOCALLOG    DBG_static
    2223#include "dbglocal.h"
    2324
     
    718719    FillRect( hdc, &rc, hbrush );
    719720
    720     if (infoPtr->hIcon) {
     721    if (infoPtr->hIcon)
     722    {
    721723        BITMAP bm;
    722         SIZE sz;
    723 
    724         if(GetObjectType(infoPtr->hIcon) != OBJ_BITMAP)
    725             return;
     724
     725        if(GetObjectType(infoPtr->hIcon) != OBJ_BITMAP) return;
    726726        if (!(hMemDC = CreateCompatibleDC( hdc ))) return;
    727         GetObjectA(infoPtr->hIcon, sizeof(bm), &bm);
    728         GetBitmapDimensionEx(infoPtr->hIcon, &sz);
    729         oldbitmap = SelectObject(hMemDC, infoPtr->hIcon);
    730         if (dwStyle & SS_CENTERIMAGE)
    731           BitBlt(hdc,sz.cx,sz.cy,bm.bmWidth,bm.bmHeight,hMemDC,(rc.right-bm.bmWidth)/2,(rc.bottom-bm.bmHeight)/2,SRCCOPY);
     727
     728        GetObjectA(infoPtr->hIcon, sizeof(bm), &bm);
     729        oldbitmap = SelectObject(hMemDC, infoPtr->hIcon);
     730
     731        // Paint the image in center area
     732        if(dwStyle & SS_CENTERIMAGE)
     733        {
     734            SIZE szbm;
     735            SIZE szdc;
     736
     737            if(bm.bmWidth > rc.right - rc.left)
     738            {
     739                szdc.cx = 0;
     740                szbm.cx = (bm.bmWidth - (rc.right - rc.left)) / 2;
     741                bm.bmWidth = rc.right - rc.left;
     742            }
     743            else
     744            {
     745                szbm.cx = 0;
     746                szdc.cx = ((rc.right - rc.left) - bm.bmWidth) / 2;
     747            }
     748            if(bm.bmHeight > rc.bottom - rc.top)
     749            {
     750                szdc.cy = 0;
     751                szbm.cy = (bm.bmHeight - (rc.bottom - rc.top)) / 2;
     752                bm.bmWidth = rc.bottom - rc.top;
     753            }
     754            else
     755            {
     756                szbm.cy = 0;
     757                szdc.cy = ((rc.bottom - rc.top) - bm.bmHeight) / 2;
     758            }
     759            BitBlt(hdc, szdc.cx, szdc.cy, bm.bmWidth, bm.bmHeight, hMemDC,
     760                szbm.cx, szbm.cy, SRCCOPY);
     761        }
    732762        else
    733           BitBlt(hdc,sz.cx,sz.cy,bm.bmWidth,bm.bmHeight,hMemDC,0,0,SRCCOPY);
    734         SelectObject(hMemDC, oldbitmap);
    735         DeleteDC(hMemDC);
     763        {
     764            BitBlt(hdc, 0, 0, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
     765        }
     766
     767        SelectObject(hMemDC, oldbitmap);
     768        DeleteDC(hMemDC);
    736769    }
    737770}
     
    764797  di.itemData   = 0;
    765798
    766   SendMessageA(GetParent(hwnd),WM_DRAWITEM,GetWindowLongA(hwnd,GWL_ID),(LPARAM)&di);
     799  SendMessageA(GetParent(hwnd),WM_CTLCOLORSTATIC,hdc,hwnd);
     800  SendMessageA(GetParent(hwnd),WM_DRAWITEM,di.CtlID,(LPARAM)&di);
    767801}
    768802
Note: See TracChangeset for help on using the changeset viewer.