Changeset 9386 for trunk/src


Ignore:
Timestamp:
Nov 4, 2002, 2:31:14 PM (23 years ago)
Author:
sandervl
Message:

PF: Update for static control

File:
1 edited

Legend:

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

    r7296 r9386  
    1 /* $Id: static.cpp,v 1.25 2001-11-07 19:19:09 sandervl Exp $ */
     1/* $Id: static.cpp,v 1.26 2002-11-04 13:31:14 sandervl Exp $ */
    22/*
    33 * Static control
     
    341341}
    342342
     343/***********************************************************************
     344 *           STATIC_TryPaintFcn
     345 *
     346 * Try to immediately paint the control.
     347 */
     348static VOID STATIC_TryPaintFcn(HWND hwnd, LONG full_style)
     349{
     350    LONG style = full_style & SS_TYPEMASK;
     351    RECT rc;
     352
     353    GetClientRect( hwnd, &rc );
     354    if (!IsRectEmpty(&rc) && IsWindowVisible(hwnd) && staticPaintFunc[style])
     355    {
     356        HDC hdc;
     357        hdc = GetDC( hwnd );
     358        (staticPaintFunc[style])( hwnd, hdc );
     359        ReleaseDC( hwnd, hdc );
     360    }
     361}
     362
    343363LRESULT STATIC_SetText(HWND hwnd,WPARAM wParam,LPARAM lParam)
    344364{
    345365  DWORD style = GetWindowLongA(hwnd,GWL_STYLE) & SS_TYPEMASK;
    346366
    347   if (style == SS_ICON)
    348     STATIC_SetIcon(hwnd,STATIC_LoadIcon(hwnd,(LPCSTR)lParam));
    349   else if (style == SS_BITMAP)
    350     STATIC_SetBitmap(hwnd,STATIC_LoadBitmap(hwnd,(LPCSTR)lParam));
    351   else if (style == SS_ENHMETAFILE)
    352     STATIC_SetMetafile(hwnd,STATIC_LoadMetafile(hwnd,(LPCSTR)lParam));
    353   else
    354     DefWindowProcA(hwnd,WM_SETTEXT,wParam,lParam);
    355 
    356   InvalidateRect(hwnd,NULL,FALSE);
    357 
    358   return TRUE;
     367  switch (style) {
     368        case SS_ICON:
     369        {
     370            HICON hIcon;
     371            hIcon = STATIC_LoadIcon(hwnd, (LPCSTR)lParam);
     372            /* FIXME : should we also return the previous hIcon here ??? */
     373            STATIC_SetIcon(hwnd, hIcon);
     374            break;
     375        }
     376        case SS_BITMAP:
     377        {
     378            HBITMAP hBitmap;
     379            hBitmap = STATIC_LoadBitmap(hwnd, (LPCSTR)lParam);
     380            STATIC_SetBitmap(hwnd, hBitmap);
     381            break;
     382        }
     383        case SS_LEFT:
     384        case SS_CENTER:
     385        case SS_RIGHT:
     386        case SS_SIMPLE:
     387        case SS_LEFTNOWORDWRAP:
     388        {
     389            if (HIWORD(lParam))
     390            {
     391                 DefWindowProcA( hwnd, WM_SETTEXT, wParam, lParam );
     392            }
     393            STATIC_TryPaintFcn( hwnd, style );
     394            break;
     395        }
     396        default:
     397            if (HIWORD(lParam))
     398            {
     399                DefWindowProcA( hwnd, WM_SETTEXT, wParam, lParam );
     400            }
     401            InvalidateRect(hwnd, NULL, TRUE);
     402        }
     403        return 1; /* success. FIXME: check text length */
    359404}
    360405
Note: See TracChangeset for help on using the changeset viewer.