Added support for WS_EX_LEFTSCROLLBAR window style

Alberto Massari alby at exln.com
Thu Jan 2 08:56:51 CST 2003


Changelog:
- Handle the WS_EX_LEFTSCROLLBAR style (that is, draw the vertical scrollbar on the left side of the control)

Alberto

Index: windows/nonclient.c
===================================================================
RCS file: /home/wine/wine/windows/nonclient.c,v
retrieving revision 1.107
diff -u -r1.107 nonclient.c
--- windows/nonclient.c	16 Dec 2002 22:12:11 -0000	1.107
+++ windows/nonclient.c	2 Jan 2003 14:42:37 -0000
@@ -224,7 +224,13 @@
     if (exStyle & WS_EX_CLIENTEDGE)
         InflateRect(rect, GetSystemMetrics(SM_CXEDGE), GetSystemMetrics(SM_CYEDGE));
 
-    if (style & WS_VSCROLL) rect->right  += GetSystemMetrics(SM_CXVSCROLL);
+    if (style & WS_VSCROLL)
+    {
+        if((exStyle & WS_EX_LEFTSCROLLBAR) != 0)
+            rect->left  -= GetSystemMetrics(SM_CXVSCROLL);
+        else
+            rect->right += GetSystemMetrics(SM_CXVSCROLL);
+    }
     if (style & WS_HSCROLL) rect->bottom += GetSystemMetrics(SM_CYHSCROLL);
 }
 
@@ -648,8 +654,11 @@
 
     if (wndPtr->dwStyle & WS_VSCROLL)
     {
-	rect.right += GetSystemMetrics(SM_CXVSCROLL);
-	if (PtInRect( &rect, pt )) return HTVSCROLL;
+        if((wndPtr->dwExStyle & WS_EX_LEFTSCROLLBAR) != 0)
+            rect.left -= GetSystemMetrics(SM_CXVSCROLL);
+        else
+            rect.right += GetSystemMetrics(SM_CXVSCROLL);
+        if (PtInRect( &rect, pt )) return HTVSCROLL;
     }
 
       /* Check horizontal scroll bar */
@@ -661,7 +670,8 @@
 	{
 	      /* Check size box */
 	    if ((wndPtr->dwStyle & WS_VSCROLL) &&
-		(pt.x >= rect.right - GetSystemMetrics(SM_CXVSCROLL)))
+		((((wndPtr->dwExStyle & WS_EX_LEFTSCROLLBAR) != 0) && (pt.x <= rect.left + GetSystemMetrics(SM_CXVSCROLL))) ||
+		(((wndPtr->dwExStyle & WS_EX_LEFTSCROLLBAR) == 0) && (pt.x >= rect.right - GetSystemMetrics(SM_CXVSCROLL)))))
 		return HTSIZE;
 	    return HTHSCROLL;
 	}
@@ -794,8 +804,11 @@
 
     if (wndPtr->dwStyle & WS_VSCROLL)
     {
-	rect.right += GetSystemMetrics(SM_CXVSCROLL);
-	if (PtInRect( &rect, pt )) return HTVSCROLL;
+        if((wndPtr->dwExStyle & WS_EX_LEFTSCROLLBAR) != 0)
+            rect.left -= GetSystemMetrics(SM_CXVSCROLL);
+        else
+            rect.right += GetSystemMetrics(SM_CXVSCROLL);
+        if (PtInRect( &rect, pt )) return HTVSCROLL;
     }
 
       /* Check horizontal scroll bar */
@@ -807,7 +820,8 @@
 	{
 	      /* Check size box */
 	    if ((wndPtr->dwStyle & WS_VSCROLL) &&
-		(pt.x >= rect.right - GetSystemMetrics(SM_CXVSCROLL)))
+		((((wndPtr->dwExStyle & WS_EX_LEFTSCROLLBAR) != 0) && (pt.x <= rect.left + GetSystemMetrics(SM_CXVSCROLL))) ||
+		(((wndPtr->dwExStyle & WS_EX_LEFTSCROLLBAR) == 0) && (pt.x >= rect.right - GetSystemMetrics(SM_CXVSCROLL)))))
 		return HTSIZE;
 	    return HTHSCROLL;
 	}
@@ -1466,7 +1480,10 @@
     if ((dwStyle & WS_VSCROLL) && (dwStyle & WS_HSCROLL))
     {
         RECT r = rect;
-        r.left = r.right - GetSystemMetrics(SM_CXVSCROLL) + 1;
+        if((dwExStyle & WS_EX_LEFTSCROLLBAR) != 0)
+            r.right = r.left + GetSystemMetrics(SM_CXVSCROLL) + 1;
+        else
+            r.left = r.right - GetSystemMetrics(SM_CXVSCROLL) + 1;
         r.top  = r.bottom - GetSystemMetrics(SM_CYHSCROLL) + 1;
 	if(wndPtr->dwStyle & WS_BORDER) {
 	  r.left++;
@@ -1621,7 +1638,10 @@
     if ((dwStyle & WS_VSCROLL) && (dwStyle & WS_HSCROLL))
     {
         RECT r = rect;
-        r.left = r.right - GetSystemMetrics(SM_CXVSCROLL) + 1;
+        if((dwExStyle & WS_EX_LEFTSCROLLBAR) != 0)
+            r.right = r.left + GetSystemMetrics(SM_CXVSCROLL) + 1;
+        else
+            r.left = r.right - GetSystemMetrics(SM_CXVSCROLL) + 1;
         r.top  = r.bottom - GetSystemMetrics(SM_CYHSCROLL) + 1;
         FillRect( hdc, &r,  GetSysColorBrush(COLOR_SCROLLBAR) );
     }
Index: controls/scroll.c
===================================================================
RCS file: /home/wine/wine/controls/scroll.c,v
retrieving revision 1.61
diff -u -r1.61 scroll.c
--- controls/scroll.c	17 Dec 2002 21:00:11 -0000	1.61
+++ controls/scroll.c	2 Jan 2003 14:42:40 -0000
@@ -229,9 +229,12 @@
 	break;
 
       case SB_VERT:
-        lprect->left   = wndPtr->rectClient.right - wndPtr->rectWindow.left;
+        if((wndPtr->dwExStyle & WS_EX_LEFTSCROLLBAR) != 0)
+            lprect->left   = wndPtr->rectClient.left - wndPtr->rectWindow.left - GetSystemMetrics(SM_CXVSCROLL);
+        else
+            lprect->left   = wndPtr->rectClient.right - wndPtr->rectWindow.left;
         lprect->top    = wndPtr->rectClient.top - wndPtr->rectWindow.top;
         lprect->right  = lprect->left + GetSystemMetrics(SM_CXVSCROLL);
         lprect->bottom = wndPtr->rectClient.bottom - wndPtr->rectWindow.top;
 	if(wndPtr->dwStyle & WS_BORDER) {
 	  lprect->top--;





More information about the wine-patches mailing list