changeset 1445:8f7692fcad37

Use system metrics/values to get the scrollbar sizes on Windows and OS/2.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 08 Dec 2011 23:49:55 +0000
parents 914ac25f7d37
children 0d4fdf646caf
files os2/dw.c win/dw.c
diffstat 2 files changed, 10 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/os2/dw.c	Thu Dec 08 23:32:40 2011 +0000
+++ b/os2/dw.c	Thu Dec 08 23:49:55 2011 +0000
@@ -1054,8 +1054,6 @@
    return WinSetWindowPos(hwnd, behind, x, height - y - cy, cx, cy, fl);
 }
 
-#define _DW_DEFAULT_SCROLLBAR_WIDTH 14
-
 /* This function calculates how much space the widgets and boxes require
  * and does expansion as necessary.
  */
@@ -1283,12 +1281,12 @@
 
                 /* Position the scrollbox parts */
                 _MySetWindowPos(handle, thisbox->hwnd, HWND_TOP, currentx + pad, currenty + pad, width, height, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
-                WinSetWindowPos(client, HWND_TOP, 0, _DW_DEFAULT_SCROLLBAR_WIDTH, width - _DW_DEFAULT_SCROLLBAR_WIDTH, height - _DW_DEFAULT_SCROLLBAR_WIDTH, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
-                WinSetWindowPos(hscroll, HWND_TOP, 0, 0, width - _DW_DEFAULT_SCROLLBAR_WIDTH, _DW_DEFAULT_SCROLLBAR_WIDTH, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
-                WinSetWindowPos(vscroll, HWND_TOP, width - _DW_DEFAULT_SCROLLBAR_WIDTH, _DW_DEFAULT_SCROLLBAR_WIDTH, _DW_DEFAULT_SCROLLBAR_WIDTH, height - _DW_DEFAULT_SCROLLBAR_WIDTH, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
-
-                origx = cx = width - _DW_DEFAULT_SCROLLBAR_WIDTH;
-                origy = cy = height - _DW_DEFAULT_SCROLLBAR_WIDTH;
+                WinSetWindowPos(client, HWND_TOP, 0, WinQuerySysValue(HWND_DESKTOP, SV_CYHSCROLL), width - WinQuerySysValue(HWND_DESKTOP, SV_CXVSCROLL), height - WinQuerySysValue(HWND_DESKTOP, SV_CYHSCROLL), SWP_MOVE | SWP_SIZE | SWP_ZORDER);
+                WinSetWindowPos(hscroll, HWND_TOP, 0, 0, width - WinQuerySysValue(HWND_DESKTOP, SV_CXVSCROLL), WinQuerySysValue(HWND_DESKTOP, SV_CYHSCROLL), SWP_MOVE | SWP_SIZE | SWP_ZORDER);
+                WinSetWindowPos(vscroll, HWND_TOP, width - WinQuerySysValue(HWND_DESKTOP, SV_CXVSCROLL), WinQuerySysValue(HWND_DESKTOP, SV_CYHSCROLL), WinQuerySysValue(HWND_DESKTOP, SV_CXVSCROLL), height - WinQuerySysValue(HWND_DESKTOP, SV_CYHSCROLL), SWP_MOVE | SWP_SIZE | SWP_ZORDER);
+
+                origx = cx = width - WinQuerySysValue(HWND_DESKTOP, SV_CXVSCROLL);
+                origy = cy = height - WinQuerySysValue(HWND_DESKTOP, SV_CYHSCROLL);
 
                 /* Get the required space for the box */
                 _resize_box(contentbox, &depth, cx, cy, 1);
@@ -4602,13 +4600,13 @@
       if(strncmp(tmpbuf, "#8", 3)== 0 &&
          WinQueryWindowULong(handle, QWL_STYLE) & SBS_VERT)
       {
-         thiswidth = _DW_DEFAULT_SCROLLBAR_WIDTH;
+         thiswidth = WinQuerySysValue(HWND_DESKTOP, SV_CXVSCROLL);
          thisheight = 100;
       }
       else
       {
          thiswidth = 100;
-         thisheight = _DW_DEFAULT_SCROLLBAR_WIDTH;
+         thisheight = WinQuerySysValue(HWND_DESKTOP, SV_CYHSCROLL);
       }
    }
    /* Spinbutton */
--- a/win/dw.c	Thu Dec 08 23:32:40 2011 +0000
+++ b/win/dw.c	Thu Dec 08 23:49:55 2011 +0000
@@ -4247,14 +4247,14 @@
         GetWindowLong(handle, GWL_STYLE) & SBS_VERT)
       {
          /* Vertical */
-         thiswidth = 14;
+         thiswidth = GetSystemMetrics(SM_CXVSCROLL);
          thisheight = 100;
       }
       else
       {
          /* Horizontal */
          thiswidth = 100;
-         thisheight = 14;
+         thisheight = GetSystemMetrics(SM_CYHSCROLL);
       }
    }
    /* Spinbuttons */