changeset 1537:a4ecef1980db

Added code for returning a size for scrolled widgets on OS/2, Windows and Mac... They get 500x200 because this is what GTK seems to recommend. It occurs to me that listboxes may not currently be handled... will have to look into that.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 12 Jan 2012 18:21:54 +0000
parents a71ec02f3b70
children 333f07bdbf7c
files mac/dw.m os2/dw.c win/dw.c
diffstat 3 files changed, 47 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/mac/dw.m	Thu Jan 12 17:21:31 2012 +0000
+++ b/mac/dw.m	Thu Jan 12 18:21:54 2012 +0000
@@ -3403,7 +3403,8 @@
 /* Internal function to calculate the widget's required size..
  * These are the general rules for widget sizes:
  * 
- * Scrolled(Container,Tree,MLE)/Render/Unspecified: 1x1
+ * Render/Unspecified: 1x1
+ * Scrolled(Container,Tree,MLE): 500x200
  * Entryfield/Combobox/Spinbutton: 150x(maxfontheight)
  * Spinbutton: 50x(maxfontheight)
  * Text/Status: (textwidth)x(textheight)
@@ -3526,6 +3527,14 @@
             thisheight = size.height;
         }
     }
+    /* MLE, Container and Tree */
+    else if([ object isMemberOfClass:[DWMLE class] ] ||
+            [ object isMemberOfClass:[DWContainer class] ] ||
+            [ object isMemberOfClass:[DWTree class] ])
+    {
+        thiswidth = 500;
+        thisheight = 200;
+    }
     /* Any other control type */
     else if([ object isKindOfClass:[ NSControl class ] ])
         nsstr = [object stringValue];
--- a/os2/dw.c	Thu Jan 12 17:21:31 2012 +0000
+++ b/os2/dw.c	Thu Jan 12 18:21:54 2012 +0000
@@ -4634,10 +4634,13 @@
 /* Internal function to calculate the widget's required size..
  * These are the general rules for widget sizes:
  * 
- * Scrolled(Container,Tree,MLE)/Render/Unspecified: 1x1
+ * Render/Unspecified: 1x1
+ * Scrolled(Container,Tree,MLE): 500x200
  * Entryfield/Combobox/Spinbutton: 150x(maxfontheight)
  * Spinbutton: 50x(maxfontheight)
  * Text/Status: (textwidth)x(textheight)
+ * Ranged: 100x14 or 14x100 for vertical.
+ * Buttons/Bitmaps: Size of text or image and border.
  */
 void _control_size(HWND handle, int *width, int *height)
 {
@@ -4729,6 +4732,12 @@
       thiswidth = 150;
       extraheight = 6;
    }
+   /* MLE, Container and Tree */
+   else if(strncmp(tmpbuf, "#10", 4)==0 || strncmp(tmpbuf, "#37", 4)==0)
+   {
+      thiswidth = 500;
+      thisheight = 200;
+   }
    /* Button */
    else if(strncmp(tmpbuf, "#3", 3)==0)
    {
--- a/win/dw.c	Thu Jan 12 17:21:31 2012 +0000
+++ b/win/dw.c	Thu Jan 12 18:21:54 2012 +0000
@@ -4396,7 +4396,8 @@
 /* Internal function to calculate the widget's required size..
  * These are the general rules for widget sizes:
  * 
- * Scrolled(Container,Tree,MLE)/Render/Unspecified: 1x1
+ * Render/Unspecified: 1x1
+ * Scrolled(Container,Tree,MLE): 500x200
  * Entryfield/Combobox/Spinbutton: 150x(maxfontheight)
  * Spinbutton: 50x(maxfontheight)
  * Text/Status: (textwidth)x(textheight)
@@ -4473,14 +4474,31 @@
       thiswidth = 50;
       extraheight = 6;
    }
-   /* Entryfields */
-   else if(strnicmp(tmpbuf, EDITCLASSNAME, strlen(EDITCLASSNAME)+1) == 0 &&
-           !(GetWindowLong(handle, GWL_STYLE) & ES_MULTILINE))
-   {
-      dw_font_text_extents_get(handle, NULL, testtext, NULL, &thisheight);
-      thiswidth = 150;
-      extraheight = 6;
-   }
+   /* Entryfields and MLE */
+   else if(strnicmp(tmpbuf, EDITCLASSNAME, strlen(EDITCLASSNAME)+1) == 0)
+   {
+      if((GetWindowLong(handle, GWL_STYLE) & ES_MULTILINE))
+      {
+         /* MLE */
+         thiswidth = 500;
+         thisheight = 200;
+      }
+      else
+      {
+         /* Entryfield */
+         dw_font_text_extents_get(handle, NULL, testtext, NULL, &thisheight);
+         thiswidth = 150;
+         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)
+   {
+      thiswidth = 500;
+      thisheight = 200;
+   }
+   /* Buttons */
    else if(strnicmp(tmpbuf, BUTTONCLASSNAME, strlen(BUTTONCLASSNAME)+1) == 0)
    {
       ULONG style = GetWindowLong(handle, GWL_STYLE);