Implement #displayOn: instead of #displayString
authorStefan Vogel <sv@exept.de>
Fri, 03 Aug 2012 17:53:28 +0200
changeset 2896 b94f53848481
parent 2895 fe7143fbfdbe
child 2897 b97e8a922cd2
Implement #displayOn: instead of #displayString
SelfNode.st
--- a/SelfNode.st	Fri Aug 03 17:52:49 2012 +0200
+++ b/SelfNode.st	Fri Aug 03 17:53:28 2012 +0200
@@ -109,12 +109,22 @@
 
 !SelfNode methodsFor:'printing & storing'!
 
-displayString
-    "return a string for display in inspectors etc."
+displayOn:aGCOrStream
+    "Compatibility
+     append a printed desription on some stream (Dolphin,  Squeak)
+     OR:
+     display the receiver in a graphicsContext at 0@0 (ST80).
+     This method allows for any object to be displayed in some view
+     (although the fallBack is to display its printString ...)"
 
-    ^ 'InterpreterVariable(self)'
+    "/ what a kludge - Dolphin and Squeak mean: printOn: a stream;
+    "/ ST/X (and some old ST80's) mean: draw-yourself on a GC.
+    aGCOrStream isStream ifFalse:[
+        ^ super displayOn:aGCOrStream.
+    ].
 
-    "Modified: 20.9.1997 / 11:41:41 / cg"
+    aGCOrStream 
+        nextPutAll:'InterpreterVariable(self)'.
 !
 
 printOn:aStream indent:i
@@ -145,9 +155,9 @@
 !SelfNode class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/SelfNode.st,v 1.21 2011-07-25 22:36:02 vrany Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/SelfNode.st,v 1.22 2012-08-03 15:53:28 stefan Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libcomp/SelfNode.st,v 1.21 2011-07-25 22:36:02 vrany Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/SelfNode.st,v 1.22 2012-08-03 15:53:28 stefan Exp $'
 ! !