changeset 1542:edbc7405ed4d

Added code to auto-size container on Windows.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 13 Jan 2012 02:35:59 +0000
parents 1c6593b0ce45
children b86a04751ea0
files win/dw.c
diffstat 1 files changed, 19 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/win/dw.c	Fri Jan 13 02:02:28 2012 +0000
+++ b/win/dw.c	Fri Jan 13 02:35:59 2012 +0000
@@ -4538,9 +4538,25 @@
          extraheight = 6;
       }
    }
-   /* Container and Tree */
-   else if(strnicmp(tmpbuf, WC_LISTVIEW, strlen(WC_LISTVIEW)+1)== 0 ||
-           strnicmp(tmpbuf, WC_TREEVIEW, strlen(WC_TREEVIEW)+1)== 0)
+   /* Container */
+   else if(strnicmp(tmpbuf, WC_LISTVIEW, strlen(WC_LISTVIEW)+1)== 0)
+   {
+      DWORD result = ListView_ApproximateViewRect(handle, _DW_SCROLLED_MAX_WIDTH, _DW_SCROLLED_MAX_HEIGHT, -1);
+      
+      thiswidth = LOWORD(result);
+      thisheight = HIWORD(result);
+      
+      if(thiswidth > _DW_SCROLLED_MAX_WIDTH)
+         thiswidth = _DW_SCROLLED_MAX_WIDTH;
+      if(thiswidth < _DW_SCROLLED_MIN_WIDTH)
+         thiswidth = _DW_SCROLLED_MIN_WIDTH;
+      if(thisheight < _DW_SCROLLED_MIN_HEIGHT)
+         thisheight = _DW_SCROLLED_MIN_HEIGHT;
+      if(thisheight > _DW_SCROLLED_MAX_HEIGHT)
+         thisheight = _DW_SCROLLED_MAX_HEIGHT;
+   }
+   /* Tree */
+   else if(strnicmp(tmpbuf, WC_TREEVIEW, strlen(WC_TREEVIEW)+1)== 0)
    {
       thiswidth = _DW_SCROLLED_MAX_WIDTH;
       thisheight = _DW_SCROLLED_MAX_HEIGHT;