Handle the WS_EX_LEFTSCROLLBAR style (that is, draw the vertical
scrollbar on the left side of the control).
diff --git a/controls/scroll.c b/controls/scroll.c
index 8a6c3cc..c6e191d 100644
--- a/controls/scroll.c
+++ b/controls/scroll.c
@@ -229,7 +229,10 @@
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;
diff --git a/windows/nonclient.c b/windows/nonclient.c
index 88a1131..c7e78cc 100644
--- a/windows/nonclient.c
+++ b/windows/nonclient.c
@@ -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) );
}