SimpleView.st
changeset 3616 0ddaf2ce9b06
parent 3614 86de926ad2d1
child 3617 bc12e3fd061c
--- a/SimpleView.st	Tue Apr 09 16:45:09 2002 +0200
+++ b/SimpleView.st	Wed Apr 10 12:46:07 2002 +0200
@@ -2994,11 +2994,13 @@
 subViews:aListOfViews
     "set the collection of subviews"
 
+    self obsoleteMethodWarning.
+
     subViews := aListOfViews.
     subViews notNil ifTrue:[
-	subViews do:[:view |
-	    view container:self
-	]
+        subViews do:[:view |
+            view container:self
+        ]
     ]
 
     "Modified: 9.5.1996 / 00:42:28 / cg"
@@ -3854,13 +3856,13 @@
     "add a view to the collection of subviews"
 
     subViews isNil ifTrue:[
-	subViews := OrderedCollection with:newView
+        subViews := OrderedCollection with:newView
     ] ifFalse:[
-	(subViews includesIdentical:newView) ifTrue:[
-	    self error:'trying to add a view twice' mayProceed:true.
-	    ^ self.
-	].
-	subViews add:newView.
+        (subViews includesIdentical:newView) ifTrue:[
+            self error:'trying to add a view twice' mayProceed:true.
+            ^ self.
+        ].
+        subViews add:newView.
     ].
     self setContainerIn:newView.
 
@@ -3873,17 +3875,17 @@
      element at some defined place."
 
     subViews isNil ifTrue:[
-	subViews := OrderedCollection with:newView
+        subViews := OrderedCollection with:newView
     ] ifFalse:[
-	(subViews includesIdentical:newView) ifTrue:[
-	    self error:'trying to add a view twice' mayProceed:true.
-	    ^ self.
-	].
-	aView isNil ifTrue:[
-	    subViews add:newView
-	] ifFalse:[
-	    subViews add:newView after:aView.
-	]
+        (subViews includesIdentical:newView) ifTrue:[
+            self error:'trying to add a view twice' mayProceed:true.
+            ^ self.
+        ].
+        aView isNil ifTrue:[
+            subViews add:newView
+        ] ifFalse:[
+            subViews add:newView after:aView.
+        ]
     ].
     self setContainerIn:newView.
 
@@ -3896,17 +3898,17 @@
      element at some defined place."
 
     subViews isNil ifTrue:[
-	subViews := OrderedCollection with:newView
+        subViews := OrderedCollection with:newView
     ] ifFalse:[
-	(subViews includesIdentical:newView) ifTrue:[
-	    self error:'trying to add a view twice' mayProceed:true.
-	    ^ self.
-	].
-	aView isNil ifTrue:[
-	    subViews addFirst:newView
-	] ifFalse:[
-	    subViews add:newView before:aView.
-	]
+        (subViews includesIdentical:newView) ifTrue:[
+            self error:'trying to add a view twice' mayProceed:true.
+            ^ self.
+        ].
+        aView isNil ifTrue:[
+            subViews addFirst:newView
+        ] ifFalse:[
+            subViews add:newView before:aView.
+        ]
     ].
     self setContainerIn:newView.
 
@@ -3924,13 +3926,13 @@
     "add a view to the front of the collection of subviews"
 
     subViews isNil ifTrue:[
-	subViews := OrderedCollection with:newView
+        subViews := OrderedCollection with:newView
     ] ifFalse:[
-	(subViews includesIdentical:newView) ifTrue:[
-	    self error:'trying to add a view twice' mayProceed:true.
-	    ^ self.
-	].
-	subViews addFirst:newView.
+        (subViews includesIdentical:newView) ifTrue:[
+            self error:'trying to add a view twice' mayProceed:true.
+            ^ self.
+        ].
+        subViews addFirst:newView.
     ].
     self setContainerIn:newView.
 
@@ -3993,10 +3995,12 @@
     "remove a view from the collection of subviews"
 
     subViews notNil ifTrue:[
-	subViews remove:aView ifAbsent:[nil].
-	(subViews size == 0) ifTrue:[
-	    subViews := nil
-	]
+        subViews remove:aView ifAbsent:[nil].
+        aView setContainer:nil.
+
+        (subViews size == 0) ifTrue:[
+            subViews := nil
+        ]
     ]
 !
 
@@ -4011,11 +4015,11 @@
 
     aView container:self.
     (aView graphicsDevice ~~ device) ifTrue:[
-	'SimpleView [warning]: subview (' errorPrint. aView class name errorPrint.
-	') has different device than me (' errorPrint.
-	self class name errorPrint. ').' errorPrintCR.
-	aView device:device
-    ]
+        'SimpleView [warning]: subview (' errorPrint. aView class name errorPrint.
+        ') has different device than me (' errorPrint.
+        self class name errorPrint. ').' errorPrintCR.
+        aView device:device
+    ].
 
     "Created: 9.5.1996 / 00:46:59 / cg"
     "Modified: 10.1.1997 / 18:06:49 / cg"
@@ -4584,9 +4588,9 @@
     "evaluate aBlock for all subviews (recursively)"
 
     subViews notNil ifTrue:[
-	subViews do:[:aSubview |
-	    aSubview withAllSubViewsDo:aBlock
-	]
+        subViews do:[:aSubview |
+            aSubview withAllSubViewsDo:aBlock
+        ]
     ]
 
     "Modified: 12.2.1997 / 12:23:38 / cg"
@@ -7065,8 +7069,8 @@
 
     sview := self.
 
-    [ (sview := sview superView) notNil ] whileTrue:[
-	sview == aViewOrComponent ifTrue:[^ true].
+    [ (sview := sview container) notNil ] whileTrue:[
+        sview == aViewOrComponent ifTrue:[^ true].
     ].
     ^ false
 !
@@ -9277,6 +9281,6 @@
 !SimpleView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.435 2002-04-08 09:48:47 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.436 2002-04-10 10:46:07 cg Exp $'
 ! !
 SimpleView initialize!