*
* Load the icon for an SS_ICON control.
*/
-static HICON STATIC_LoadIconA( HWND hwnd, LPCSTR name, DWORD style )
+static HICON STATIC_LoadIconA( HINSTANCE hInstance, LPCSTR name, DWORD style )
{
- HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtrW( hwnd, GWLP_HINSTANCE );
- if ((style & SS_REALSIZEIMAGE) != 0)
- {
- return LoadImageA(hInstance, name, IMAGE_ICON, 0, 0, LR_SHARED);
- }
- else
+ HICON hicon = 0;
+
+ if (hInstance && ((ULONG_PTR)hInstance >> 16))
{
- HICON hicon = LoadIconA( hInstance, name );
- if (!hicon) hicon = LoadCursorA( hInstance, name );
- if (!hicon) hicon = LoadIconA( 0, name );
- /* Windows doesn't try to load a standard cursor,
- probably because most IDs for standard cursors conflict
- with the IDs for standard icons anyway */
- return hicon;
+ if ((style & SS_REALSIZEIMAGE) != 0)
+ hicon = LoadImageA(hInstance, name, IMAGE_ICON, 0, 0, LR_SHARED);
+ else
+ {
+ hicon = LoadIconA( hInstance, name );
+ if (!hicon) hicon = LoadCursorA( hInstance, name );
+ }
}
+ if (!hicon) hicon = LoadIconA( 0, name );
+ /* Windows doesn't try to load a standard cursor,
+ probably because most IDs for standard cursors conflict
+ with the IDs for standard icons anyway */
+ return hicon;
}
/***********************************************************************
*
* Load the icon for an SS_ICON control.
*/
-static HICON STATIC_LoadIconW( HWND hwnd, LPCWSTR name, DWORD style )
+static HICON STATIC_LoadIconW( HINSTANCE hInstance, LPCWSTR name, DWORD style )
{
- HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtrW( hwnd, GWLP_HINSTANCE );
- if ((style & SS_REALSIZEIMAGE) != 0)
- {
- return LoadImageW(hInstance, name, IMAGE_ICON, 0, 0, LR_SHARED);
- }
- else
+ HICON hicon = 0;
+
+ if (hInstance && ((ULONG_PTR)hInstance >> 16))
{
- HICON hicon = LoadIconW( hInstance, name );
- if (!hicon) hicon = LoadCursorW( hInstance, name );
- if (!hicon) hicon = LoadIconW( 0, name );
- /* Windows doesn't try to load a standard cursor,
- probably because most IDs for standard cursors conflict
- with the IDs for standard icons anyway */
- return hicon;
+ if ((style & SS_REALSIZEIMAGE) != 0)
+ hicon = LoadImageW(hInstance, name, IMAGE_ICON, 0, 0, LR_SHARED);
+ else
+ {
+ hicon = LoadIconW( hInstance, name );
+ if (!hicon) hicon = LoadCursorW( hInstance, name );
+ }
}
+ if (!hicon) hicon = LoadIconW( 0, name );
+ /* Windows doesn't try to load a standard cursor,
+ probably because most IDs for standard cursors conflict
+ with the IDs for standard icons anyway */
+ return hicon;
}
-/***********************************************************************
- * STATIC_LoadBitmapA
- *
- * Load the bitmap for an SS_BITMAP control.
- */
-static HBITMAP STATIC_LoadBitmapA( HWND hwnd, LPCSTR name )
-{
- HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtrW( hwnd, GWLP_HINSTANCE );
- /* Windows doesn't try to load OEM Bitmaps (hInstance == NULL) */
- return LoadBitmapA( hInstance, name );
-}
-
-/***********************************************************************
- * STATIC_LoadBitmapW
- *
- * Load the bitmap for an SS_BITMAP control.
- */
-static HBITMAP STATIC_LoadBitmapW( HWND hwnd, LPCWSTR name )
-{
- HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtrW( hwnd, GWLP_HINSTANCE );
- /* Windows doesn't try to load OEM Bitmaps (hInstance == NULL) */
- return LoadBitmapW( hInstance, name );
-}
/***********************************************************************
* STATIC_TryPaintFcn
LRESULT lResult = 0;
LONG full_style = GetWindowLongPtrW( hwnd, GWL_STYLE );
LONG style = full_style & SS_TYPEMASK;
+#ifdef __REACTOS__
+ PWND pWnd;
+
+ pWnd = ValidateHwnd(hwnd);
+ if (pWnd)
+ {
+ if (!pWnd->fnid)
+ {
+ NtUserSetWindowFNID(hwnd, FNID_STATIC);
+ }
+ }
+#endif
switch (uMsg)
{
break;
case WM_NCDESTROY:
+#ifdef __REACTOS__
+ NtUserSetWindowFNID(hwnd, FNID_DESTROY);
+#endif
if (style == SS_ICON) {
/*
* FIXME
{
LPCSTR textA;
LPCWSTR textW;
+ HINSTANCE hInstance;
if (full_style & SS_SUNKEN)
SetWindowLongPtrW( hwnd, GWL_EXSTYLE,
{
textA = ((LPCREATESTRUCTA)lParam)->lpszName;
textW = NULL;
+
}
+ hInstance = (HINSTANCE)GetWindowLongPtrW( hwnd, GWLP_HINSTANCE );
+
switch (style) {
case SS_ICON:
{
HICON hIcon;
- if(unicode)
- hIcon = STATIC_LoadIconW(hwnd, textW, full_style);
+ if(unicode )
+ hIcon = STATIC_LoadIconW(hInstance, textW, full_style);
else
- hIcon = STATIC_LoadIconA(hwnd, textA, full_style);
+ hIcon = STATIC_LoadIconA(hInstance, textA, full_style);
STATIC_SetIcon(hwnd, hIcon, full_style);
}
break;
case SS_BITMAP:
+ if ((ULONG_PTR)hInstance >> 16)
{
HBITMAP hBitmap;
if(unicode)
- hBitmap = STATIC_LoadBitmapW(hwnd, textW);
+ hBitmap = LoadBitmapW(hInstance, textW);
else
- hBitmap = STATIC_LoadBitmapA(hwnd, textA);
+ hBitmap = LoadBitmapA(hInstance, textA);
STATIC_SetBitmap(hwnd, hBitmap, full_style);
}
break;
if (hasTextStyle( full_style ))
{
SetWindowLongPtrW( hwnd, HFONT_GWL_OFFSET, wParam );
- if (LOWORD(lParam))
- RedrawWindow( hwnd, NULL, 0, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN );
+ if (LOWORD(lParam))
+ RedrawWindow( hwnd, NULL, 0, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN );
}
break;
case STM_GETIMAGE:
return (LRESULT)STATIC_GetImage( hwnd, wParam, full_style );
-#ifndef __REACTOS__
- case STM_GETICON16:
-#endif
+
case STM_GETICON:
return (LRESULT)STATIC_GetImage( hwnd, IMAGE_ICON, full_style );
STATIC_TryPaintFcn( hwnd, full_style );
break;
-#ifndef __REACTOS__
- case STM_SETICON16:
-#endif
case STM_SETICON:
lResult = (LRESULT)STATIC_SetIcon( hwnd, (HICON)wParam, full_style );
STATIC_TryPaintFcn( hwnd, full_style );
GetClientRect( hwnd, &rc);
/* FIXME: send WM_CTLCOLORSTATIC */
+#ifdef __REACTOS__
+ hBrush = STATIC_SendWmCtlColorStatic(hwnd, hdc); // Always sent....
+#endif
switch (style & SS_TYPEMASK)
{
case SS_BLACKRECT:
DeleteObject( hBrush );
}
-/* Modified for ReactOS */
static void STATIC_PaintIconfn( HWND hwnd, HDC hdc, DWORD style )
{
RECT rc, iconRect;
HBRUSH hbrush;
HICON hIcon;
- ICONINFO info;
+ SIZE size;
GetClientRect( hwnd, &rc );
hbrush = STATIC_SendWmCtlColorStatic(hwnd, hdc);
hIcon = (HICON)GetWindowLongPtrW( hwnd, HICON_GWL_OFFSET );
- if (!hIcon || (!GetIconInfo(hIcon, &info)))
+ if (!hIcon || !get_icon_size( hIcon, &size ))
{
FillRect(hdc, &rc, hbrush);
}
else
{
- BITMAP bm;
- if (!GetObjectW(info.hbmColor, sizeof(BITMAP), &bm)) return;
if (style & SS_CENTERIMAGE)
{
- iconRect.left = (rc.right - rc.left) / 2 - bm.bmWidth / 2;
- iconRect.top = (rc.bottom - rc.top) / 2 - bm.bmHeight / 2;
- iconRect.right = iconRect.left + bm.bmWidth;
- iconRect.bottom = iconRect.top + bm.bmHeight;
+ iconRect.left = (rc.right - rc.left) / 2 - size.cx / 2;
+ iconRect.top = (rc.bottom - rc.top) / 2 - size.cy / 2;
+ iconRect.right = iconRect.left + size.cx;
+ iconRect.bottom = iconRect.top + size.cy;
}
else
iconRect = rc;
break;
}
}
+