changeset 1549:ca6be9c48fff

Implemented auto-sizing containers on Mac.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 13 Jan 2012 17:40:22 +0000
parents ef7959aae8da
children 78a2e6a51285
files mac/dw.m
diffstat 1 files changed, 20 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mac/dw.m	Fri Jan 13 17:07:52 2012 +0000
+++ b/mac/dw.m	Fri Jan 13 17:40:22 2012 +0000
@@ -3532,9 +3532,25 @@
             thisheight = size.height;
         }
     }
-    /* MLE, Container and Tree */
+    /* Container */
+    else if([ object isMemberOfClass:[DWContainer class] ])
+    {
+        NSRect rect = [object frame];
+        
+        thiswidth = rect.size.width;
+        thisheight = rect.size.height;
+        
+        if(thiswidth < _DW_SCROLLED_MIN_WIDTH)
+            thiswidth = _DW_SCROLLED_MIN_WIDTH;
+        if(thiswidth > _DW_SCROLLED_MAX_WIDTH)
+            thiswidth = _DW_SCROLLED_MAX_WIDTH;
+        if(thisheight < _DW_SCROLLED_MIN_HEIGHT)
+            thisheight = _DW_SCROLLED_MIN_HEIGHT;
+        if(thisheight > _DW_SCROLLED_MAX_HEIGHT)
+            thisheight = _DW_SCROLLED_MAX_HEIGHT;
+    }
+    /* MLE and Tree */
     else if([ object isMemberOfClass:[DWMLE class] ] ||
-            [ object isMemberOfClass:[DWContainer class] ] ||
             [ object isMemberOfClass:[DWTree class] ])
     {
         thiswidth = _DW_SCROLLED_MAX_WIDTH;
@@ -8166,7 +8182,8 @@
         /* Some controls are embedded in scrollviews...
          * so get the parent of the scrollview in that case.
          */
-        if([object isKindOfClass:[NSTableView class]] && [parent isMemberOfClass:[NSClipView class]])
+        if(([object isKindOfClass:[NSTableView class]] || [object isMemberOfClass:[DWMLE class]])
+            && [parent isMemberOfClass:[NSClipView class]])
         {
             object = [parent superview];
             parent = (DWBox *)[object superview];