UIPainter can now resize subviews of PanelViews
authorStefan Vogel <sv@exept.de>
Wed, 25 Mar 2009 12:58:07 +0100
changeset 2480 6effcbfba4e3
parent 2479 fda2e68c7cad
child 2481 b8999543e2b4
UIPainter can now resize subviews of PanelViews
UIPainterView.st
--- a/UIPainterView.st	Wed Mar 25 12:57:51 2009 +0100
+++ b/UIPainterView.st	Wed Mar 25 12:58:07 2009 +0100
@@ -2590,22 +2590,17 @@
         "/ self breakPoint:#cg.
         ^ true
     ].
-    parent contents spec class isLayoutContainer ifTrue:[
-        "/ self breakPoint:#cg.
-        ^ false
-    ].
-    ^ true
+    ^ parent contents spec class isLayoutContainer not
 !
 
 canExchangeSelectionLayouts
     "returns true if the selection size is exactly 2
      and all elements in the selection can be moved or aligned
     "
-    selection size == 2 ifFalse:[
-	^ false
+    selection size ~~ 2 ifTrue:[
+        ^ false
     ].
     ^ self canMoveOrAlignSelection
-
 !
 
 canGroup
@@ -2657,6 +2652,47 @@
     ^ self canMove:(self selection)
 !
 
+canResize:something
+    "checks whether something is not nil and if all widgets derived from
+     something can be resized."
+
+    something notNil ifTrue:[
+        self forEach:something do:[:aView|
+            (self canResizeView:aView) ifFalse:[^ false]
+        ].
+        ^ true
+    ].
+    ^ false
+!
+
+canResizeSelection
+    "returns true if a selection exists and all elements in the selection
+     can be resized"
+
+    ^ self canResize:(self selection)
+!
+
+canResizeView:aView
+    "returns true if the view can be resized.
+     This is dependent on its parent view."
+
+    |item parent|
+
+    item := treeView itemOfView:aView.
+    item isNil ifTrue:[
+        "/ I dont know anything about that view (cg: how can this happen ?)
+        "/ self breakPoint:#cg.
+        ^ false
+    ].
+    parent := item parent.
+    parent isNil ifTrue:[
+        "/ that view has no parent (cg: does this mean its the canvas itself ?)
+        "/ self breakPoint:#cg.
+        ^ false
+    ].
+    ^ parent contents spec class canResizeSubComponents
+!
+
 canUngroup
     "test whether the selected element can be ungrouped; only one
      element is selected and has children"
@@ -2795,8 +2831,9 @@
     |view|
 
     (view := self findViewWithId:(args at:1)) notNil ifTrue:[
-	view perform:(args at:2) with:(args at:3).
-	self layoutChanged.
+        view perform:(args at:2) with:(args at:3).
+        self elementChangedSize:view.
+        self layoutChanged.
     ]
 !