Resend: Smarten Up Toolbar

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

 



I assume this slipped through the cracks first time round...

This fixes two little things that were 'bugging' me.
1. The text wasn't centred correctly when a dropdown arrow was present, due
to copying a rectangle before it had been adjusted for the dropdown button
2. The dropdown arrow icon was previously drawn near the top of the button,
now it is centred horizontally.

ChangeLog:
- Make button text centre correctly when dropdown arrow is present
- Centre dropdown arrow

Rob
Index: wine/dlls/comctl32/toolbar.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/toolbar.c,v
retrieving revision 1.132
diff -u -r1.132 toolbar.c
--- wine/dlls/comctl32/toolbar.c	13 May 2003 23:38:01 -0000	1.132
+++ wine/dlls/comctl32/toolbar.c	18 May 2003 16:34:22 -0000
@@ -179,6 +179,7 @@
 #define TOP_BORDER         2
 #define BOTTOM_BORDER      2
 #define DDARROW_WIDTH      11
+#define ARROW_HEIGHT       3
 
 #define TOOLBAR_GetInfoPtr(hwnd) ((TOOLBAR_INFO *)GetWindowLongA(hwnd,0))
 #define TOOLBAR_HasText(x, y) (TOOLBAR_GetText(x, y) ? TRUE : FALSE)
@@ -502,7 +503,7 @@
     if (!(hPen = CreatePen( PS_SOLID, 1, GetSysColor( colorRef )))) return;
     hOldPen = SelectObject ( hdc, hPen );
     x = left + 2;
-    y = top + 8;
+    y = top;
     MoveToEx (hdc, x, y, NULL);
     LineTo (hdc, x+5, y++); x++;
     MoveToEx (hdc, x, y, NULL);
@@ -642,7 +643,6 @@
     CopyRect (&rcFill, &rc);
     CopyRect (&rcArrow, &rc);
     CopyRect(&rcBitmap, &rc);
-    CopyRect(&rcText, &rc);
 
     /* get a pointer to the text */
     lpText = TOOLBAR_GetText(infoPtr, btnPtr);
@@ -656,6 +656,11 @@
 	rcArrow.left = rc.right;
     }
 
+    /* copy text rect after adjusting for drop-down arrow
+     * so that text is centred in the rectangle not containing
+     * the arrow */
+    CopyRect(&rcText, &rc);
+
     /* Center the bitmap horizontally and vertically */
     if (dwStyle & TBSTYLE_LIST)
 	rcBitmap.left += 3;
@@ -794,8 +799,8 @@
 
         if (hasDropDownArrow)
 	{
-	    TOOLBAR_DrawArrow(hdc, rcArrow.left+1, rcArrow.top+1, COLOR_3DHIGHLIGHT);
-	    TOOLBAR_DrawArrow(hdc, rcArrow.left, rcArrow.top, COLOR_3DSHADOW);
+	    TOOLBAR_DrawArrow(hdc, rcArrow.left+1, rcArrow.top+1 + (rcArrow.bottom - rcArrow.top - ARROW_HEIGHT) / 2, COLOR_3DHIGHLIGHT);
+	    TOOLBAR_DrawArrow(hdc, rcArrow.left, rcArrow.top + (rcArrow.bottom - rcArrow.top - ARROW_HEIGHT) / 2, COLOR_3DSHADOW);
 	}
 
 	if (!TOOLBAR_DrawImageList (infoPtr, btnPtr, himlDis,
@@ -827,7 +832,7 @@
 	}
 
         if (hasDropDownArrow)
-	    TOOLBAR_DrawArrow(hdc, rcArrow.left, rcArrow.top, COLOR_WINDOWFRAME);
+	    TOOLBAR_DrawArrow(hdc, rcArrow.left, rcArrow.top + (rcArrow.bottom - rcArrow.top - ARROW_HEIGHT) / 2, COLOR_WINDOWFRAME);
 
 	TOOLBAR_DrawImageList (infoPtr, btnPtr, himlDef,
 			       hdc, rcBitmap.left+offset, rcBitmap.top+offset,
@@ -940,7 +945,7 @@
 	    if (!(infoPtr->dwItemCDFlag & TBCDRF_NOEDGES))
 		DrawEdge (hdc, &rcArrow, EDGE_RAISED,
 			  BF_SOFT | BF_RECT | BF_MIDDLE | BF_ADJUST);
-	    TOOLBAR_DrawArrow(hdc, rcArrow.left, rcArrow.top, COLOR_WINDOWFRAME);
+	    TOOLBAR_DrawArrow(hdc, rcArrow.left, rcArrow.top + (rcArrow.bottom - rcArrow.top - ARROW_HEIGHT) / 2, COLOR_WINDOWFRAME);
 	}
 
 	TOOLBAR_DrawImageList (infoPtr, btnPtr, himlDef,

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

  Powered by Linux