PROPSHEET: Wizard background drawing

Filip Navara xnavara at volny.cz
Fri Sep 10 23:03:06 CDT 2004


Changelog:
Fill the area next to watermark bitmap with window color and subclass
exterior wizard pages to suppress drawing background.

-------------- next part --------------
Changelog:
Fill the area next to watermark bitmap with window color and subclass
exterior wizard pages to suppress drawing background.

--- dlls/comctl32/propsheet.c	Mon Sep  6 21:59:06 2004
+++ dlls/comctl32/propsheet.c	Thu Sep  9 21:20:20 2004
@@ -1250,6 +1250,37 @@
 
   return TRUE;
 }
+
+/******************************************************************************
+ *            PROPSHEET_WizardSubclassProc
+ *
+ * Subclassing window procedure for wizard extrior pages to prevent drawing
+ * background and so drawing above the watermark.
+ */
+LRESULT CALLBACK
+PROPSHEET_WizardSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uID, DWORD_PTR dwRef)
+{
+  LPCPROPSHEETPAGEW ppshpage = (LPCPROPSHEETPAGEW)dwRef;
+
+  switch (uMsg)
+  {
+    case WM_ERASEBKGND:
+      return TRUE;
+
+    case WM_CTLCOLORSTATIC:
+      SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
+      return (INT_PTR)GetSysColorBrush(COLOR_WINDOW);
+
+    case WM_CTLCOLORBTN:
+    case WM_CTLCOLORDLG:
+    case WM_CTLCOLOREDIT:
+    case WM_CTLCOLORLISTBOX:
+      return SendMessage(GetParent(hwnd), uMsg, wParam, lParam);
+  }
+
+  return DefSubclassProc(hwnd, uMsg, wParam, lParam);
+}
+
 /*
  * Get the size of an in-memory Template
  *
@@ -1513,6 +1544,15 @@
 
   psInfo->proppage[index].hwndPage = hwndPage;
 
+  /* Subclass exterior wizard pages */
+  if((psInfo->ppshheader.dwFlags & (PSH_WIZARD97_NEW | PSH_WIZARD97_OLD)) &&
+     (psInfo->ppshheader.dwFlags & PSH_WATERMARK) &&
+     (ppshpage->dwFlags & PSP_HIDEHEADER))
+  {
+      SetWindowSubclass(hwndPage, PROPSHEET_WizardSubclassProc, 1,
+                        (DWORD_PTR)ppshpage);
+  }
+
   return TRUE;
 }
 
@@ -2402,6 +2442,15 @@
   else if (index < psInfo->active_page)
     psInfo->active_page--;
 
+  /* Unsubclass the page dialog window */
+  if((psInfo->ppshheader.dwFlags & (PSH_WIZARD97_NEW | PSH_WIZARD97_OLD) &&
+     (psInfo->ppshheader.dwFlags & PSH_WATERMARK) &&
+     ((PROPSHEETPAGEW*)psInfo->proppage[index].hpage)->dwFlags & PSP_HIDEHEADER))
+  {
+     RemoveWindowSubclass(psInfo->proppage[index].hwndPage,
+                          PROPSHEET_WizardSubclassProc, 1);
+  }
+
   /* Destroy page dialog window */
   DestroyWindow(psInfo->proppage[index].hwndPage);
 
@@ -2662,6 +2711,15 @@
   {
      PROPSHEETPAGEA* psp = (PROPSHEETPAGEA*)psInfo->proppage[i].hpage;
 
+     /* Unsubclass the page dialog window */
+     if((psInfo->ppshheader.dwFlags & (PSH_WIZARD97_NEW | PSH_WIZARD97_OLD)) &&
+        (psInfo->ppshheader.dwFlags & PSH_WATERMARK) &&
+        (psp->dwFlags & PSP_HIDEHEADER))
+     {
+        RemoveWindowSubclass(psInfo->proppage[i].hwndPage,
+                             PROPSHEET_WizardSubclassProc, 1);
+     }
+
      if(psInfo->proppage[i].hwndPage)
         DestroyWindow(psInfo->proppage[i].hwndPage);
 
@@ -3041,7 +3099,7 @@
     HPALETTE hOldPal = 0;
     int offsety = 0;
     HBRUSH hbr;
-    RECT r;
+    RECT r, rzone;
     LPCPROPSHEETPAGEW ppshpage;
     WCHAR szBuffer[256];
     int nLength;
@@ -3059,7 +3117,6 @@
 	 (psInfo->ppshheader.dwFlags & (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW)) &&
 	 (psInfo->ppshheader.dwFlags & PSH_HEADER) ) 
     {
-	RECT rzone;
 	HWND hwndLineHeader = GetDlgItem(hwnd, IDC_SUNKEN_LINEHEADER);
 	HFONT hOldFont;
 	COLORREF clrOld = 0;
@@ -3104,9 +3161,8 @@
  	}
  	else
  	{
- 	    hbr = CreateSolidBrush(GetSysColor(COLOR_WINDOW));
+ 	    hbr = GetSysColorBrush(COLOR_WINDOW);
  	    FillRect(hdc, &rzone, hbr);
- 	    DeleteObject(hbr);
 
  	    /* Draw the header bitmap. It's always centered like a
  	     * common 49 x 49 bitmap. */
@@ -3187,6 +3243,14 @@
 
 	GetClientRect(hwndLine, &r);
 	MapWindowPoints(hwndLine, hwnd, (LPPOINT) &r, 2);
+
+	rzone.left = 0;
+	rzone.top = 0;
+	rzone.right = r.right;
+	rzone.bottom = r.top - 1;
+
+	hbr = GetSysColorBrush(COLOR_WINDOW);
+	FillRect(hdc, &rzone, hbr);
 
 	GetObjectA(psInfo->ppshheader.u4.hbmWatermark, sizeof(BITMAP), (LPVOID)&bm);
 	hbmp = SelectObject(hdcSrc, psInfo->ppshheader.u4.hbmWatermark);



More information about the wine-patches mailing list