changeset 842:89dd3e442e7e

Implemented dw_scrollbox_get_pos() and dw_scrollbox_get_range() on Windows.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 29 Mar 2011 22:57:49 +0000
parents 9be19dbd2ff4
children d51e958aad95
files win/dw.c
diffstat 1 files changed, 34 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/win/dw.c	Tue Mar 29 22:20:45 2011 +0000
+++ b/win/dw.c	Tue Mar 29 22:57:49 2011 +0000
@@ -4580,12 +4580,44 @@
 
 int API dw_scrollbox_get_pos( HWND handle, int orient )
 {
-   return 0;
+    SCROLLINFO si;
+    int bar = SB_HORZ;
+
+    if(orient == DW_VERT)
+    {
+        bar = SB_VERT;
+    }
+
+    si.cbSize = sizeof(SCROLLINFO);
+    si.fMask = SIF_POS;
+
+    /* Save the current scroll positions */
+    if(!GetScrollInfo(handle, bar, &si))
+    {
+        return -1;
+    }
+    return si.nPos;
 }
 
 int API dw_scrollbox_get_range( HWND handle, int orient )
 {
-   return 0;
+    SCROLLINFO si;
+    int bar = SB_HORZ;
+
+    if(orient == DW_VERT)
+    {
+        bar = SB_VERT;
+    }
+
+    si.cbSize = sizeof(SCROLLINFO);
+    si.fMask = SIF_RANGE;
+
+    /* Save the current scroll positions */
+    if(!GetScrollInfo(handle, bar, &si))
+    {
+        return -1;
+    }
+    return si.nMax;
 }
 /*
  * Create a new Group Box to be packed.