Paint control immediately on WM_SETTEXT.

This commit is contained in:
Guy Albertelli 2002-01-31 21:02:17 +00:00 committed by Alexandre Julliard
parent 925d602766
commit bde5cf0bc2
1 changed files with 67 additions and 12 deletions

View File

@ -176,6 +176,26 @@ static HBITMAP STATIC_LoadBitmapW( HWND hwnd, LPCWSTR name )
return hbitmap; return hbitmap;
} }
/***********************************************************************
* STATIC_TryPaintFcn
*
* Try to immediately paint the control.
*/
static VOID STATIC_TryPaintFcn(HWND hwnd, LONG full_style)
{
LONG style = full_style & SS_TYPEMASK;
RECT rc;
GetClientRect( hwnd, &rc );
if (!IsRectEmpty(&rc) && IsWindowVisible(hwnd) && staticPaintFunc[style])
{
HDC hdc;
hdc = GetDC( hwnd );
(staticPaintFunc[style])( hwnd, hdc, full_style );
ReleaseDC( hwnd, hdc );
}
}
/*********************************************************************** /***********************************************************************
* StaticWndProc_common * StaticWndProc_common
*/ */
@ -247,7 +267,8 @@ static LRESULT StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam,
lParam = (LPARAM)(((LPCREATESTRUCTA)lParam)->lpszName); lParam = (LPARAM)(((LPCREATESTRUCTA)lParam)->lpszName);
/* fall through */ /* fall through */
case WM_SETTEXT: case WM_SETTEXT:
if (style == SS_ICON) switch (style) {
case SS_ICON:
{ {
HICON hIcon; HICON hIcon;
if(unicode) if(unicode)
@ -256,8 +277,9 @@ static LRESULT StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam,
hIcon = STATIC_LoadIconA(hwnd, (LPCSTR)lParam); hIcon = STATIC_LoadIconA(hwnd, (LPCSTR)lParam);
/* FIXME : should we also return the previous hIcon here ??? */ /* FIXME : should we also return the previous hIcon here ??? */
STATIC_SetIcon(hwnd, hIcon, style); STATIC_SetIcon(hwnd, hIcon, style);
break;
} }
else if (style == SS_BITMAP) case SS_BITMAP:
{ {
HBITMAP hBitmap; HBITMAP hBitmap;
if(unicode) if(unicode)
@ -265,8 +287,27 @@ static LRESULT StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam,
else else
hBitmap = STATIC_LoadBitmapA(hwnd, (LPCSTR)lParam); hBitmap = STATIC_LoadBitmapA(hwnd, (LPCSTR)lParam);
STATIC_SetBitmap(hwnd, hBitmap, style); STATIC_SetBitmap(hwnd, hBitmap, style);
break;
} }
else if (HIWORD(lParam)) case SS_LEFT:
case SS_CENTER:
case SS_RIGHT:
case SS_SIMPLE:
case SS_LEFTNOWORDWRAP:
{
if (HIWORD(lParam))
{
if(unicode)
lResult = DefWindowProcW( hwnd, WM_SETTEXT, wParam, lParam );
else
lResult = DefWindowProcA( hwnd, WM_SETTEXT, wParam, lParam );
}
if (uMsg == WM_SETTEXT)
STATIC_TryPaintFcn( hwnd, full_style );
break;
}
default:
if (HIWORD(lParam))
{ {
if(unicode) if(unicode)
lResult = DefWindowProcW( hwnd, WM_SETTEXT, wParam, lParam ); lResult = DefWindowProcW( hwnd, WM_SETTEXT, wParam, lParam );
@ -275,13 +316,27 @@ static LRESULT StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam,
} }
if(uMsg == WM_SETTEXT) if(uMsg == WM_SETTEXT)
InvalidateRect(hwnd, NULL, FALSE); InvalidateRect(hwnd, NULL, FALSE);
}
return 1; /* success. FIXME: check text length */ return 1; /* success. FIXME: check text length */
case WM_SETFONT: case WM_SETFONT:
if ((style == SS_ICON) || (style == SS_BITMAP)) return 0; if ((style == SS_ICON) || (style == SS_BITMAP)) return 0;
SetWindowLongA( hwnd, HFONT_GWL_OFFSET, wParam ); SetWindowLongA( hwnd, HFONT_GWL_OFFSET, wParam );
switch (style) {
case SS_LEFT:
case SS_CENTER:
case SS_RIGHT:
case SS_SIMPLE:
case SS_LEFTNOWORDWRAP:
{
if (uMsg == WM_SETTEXT)
STATIC_TryPaintFcn( hwnd, full_style );
break;
}
default:
if (LOWORD(lParam)) if (LOWORD(lParam))
InvalidateRect( hwnd, NULL, FALSE ); InvalidateRect( hwnd, NULL, FALSE );
}
break; break;
case WM_GETFONT: case WM_GETFONT: