[resend] [comctl32] Fix treeview with checkboxes creation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



With the patch it's better :), sorry for the trouble.

Since I've got no comment on this version and it still doesn't appear in
cvs, I send it again.

If there are any problems with it, please tell me

Max

---

This patch fixes the creation of treeviews with checkboxes.
After some notes from Dmitry, I have slightly modified it and I think it
can be included in the cvs tree.

Max


Changelog:
   * Fix the creation of treeview with checkboxes

-- 
Maxime Bellengà <maxime.bellenge@laposte.net>
Index: wine/dlls/comctl32/treeview.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/treeview.c,v
retrieving revision 1.123
diff -u -r1.123 treeview.c
--- wine/dlls/comctl32/treeview.c	19 Aug 2003 00:57:08 -0000	1.123
+++ wine/dlls/comctl32/treeview.c	19 Aug 2003 15:59:55 -0000
@@ -4825,14 +4825,18 @@
     {
 	RECT rc;
 	HBITMAP hbm, hbmOld;
-	HDC hdc;
+	HDC hdc,hdcScreen;
 	int nIndex;
 
 	infoPtr->himlState =
 	    ImageList_Create(16, 16, ILC_COLOR | ILC_MASK, 3, 0);
 
-	hdc = CreateCompatibleDC(0);
-	hbm = CreateCompatibleBitmap(hdc, 48, 16);
+	hdcScreen = CreateDCA("DISPLAY", NULL, NULL, NULL);
+
+	/* Create a coloured bitmap compatible with the screen depth
+	   because checkboxes are not black&white */
+	hdc = CreateCompatibleDC(hdcScreen);
+	hbm = CreateCompatibleBitmap(hdcScreen, 48, 16);
 	hbmOld = SelectObject(hdc, hbm);
 
 	rc.left  = 0;   rc.top    = 0;
@@ -4848,12 +4852,14 @@
 	DrawFrameControl(hdc, &rc, DFC_BUTTON,
 	                  DFCS_BUTTONCHECK|DFCS_FLAT|DFCS_CHECKED);
 
+	SelectObject(hdc, hbmOld);
 	nIndex = ImageList_AddMasked(infoPtr->himlState, hbm,
 	                              GetSysColor(COLOR_WINDOW));
-	TRACE("chckbox index %d\n", nIndex);
-	SelectObject(hdc, hbmOld);
+	TRACE("checkbox index %d\n", nIndex);
+
 	DeleteObject(hbm);
 	DeleteDC(hdc);
+	DeleteDC(hdcScreen);
 
 	infoPtr->stateImageWidth = 16;
 	infoPtr->stateImageHeight = 16;

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux