[User32]
[reactos.git] / reactos / dll / win32 / user32 / controls / static.c
index db0f440..d421eae 100644 (file)
@@ -423,6 +423,18 @@ LRESULT WINAPI StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam,
     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)
     {
@@ -437,6 +449,9 @@ LRESULT WINAPI StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam,
         break;
 
     case WM_NCDESTROY:
+#ifdef __REACTOS__
+        NtUserSetWindowFNID(hwnd, FNID_DESTROY);
+#endif
         if (style == SS_ICON) {
 /*
  * FIXME
@@ -798,6 +813,9 @@ static void STATIC_PaintRectfn( HWND hwnd, HDC hdc, DWORD 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:
@@ -830,31 +848,28 @@ static void STATIC_PaintRectfn( HWND hwnd, HDC hdc, DWORD style )
     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;
@@ -951,3 +966,4 @@ static void STATIC_PaintEtchedfn( HWND hwnd, HDC hdc, DWORD style )
            break;
     }
 }
+